treewide: adjust sysupgrade script

This commit is contained in:
AmadeusGhost 2020-05-01 16:29:04 +08:00
parent 920cf867f4
commit 7d17073c14
7 changed files with 27 additions and 16 deletions

View File

@ -7,7 +7,7 @@ mbl_do_platform_check() {
[ "$#" -gt 1 ] && return 1
export_bootdevice && export_partdevice diskdev 0 || {
export_bootdevice && export_partdevice diskdev -2 || {
echo "Unable to determine upgrade device"
return 1
}
@ -36,7 +36,7 @@ mbl_do_platform_check() {
mbl_do_upgrade() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev 0 || {
export_bootdevice && export_partdevice diskdev -2 || {
echo "Unable to determine upgrade device"
return 1
}
@ -70,6 +70,10 @@ mbl_do_upgrade() {
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
# root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem
# one of which is this offset, I'm not sure what's the best fix, so
# here's a WA.
let part=$((part - 2))
if export_partdevice partdev $part; then
echo "Writing image to /dev/$partdev..."
get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
@ -86,7 +90,8 @@ mbl_do_upgrade() {
mbl_copy_config() {
local partdev
if export_partdevice partdev 1; then
# Same as above /dev/sd[a|b]2 is root, so /boot is -1
if export_partdevice partdev -1; then
mount -t ext4 -o rw,noatime "/dev/$partdev" /mnt
cp -af "$CONF_TAR" /mnt/
umount /mnt

View File

@ -9,7 +9,7 @@ platform_check_image() {
[ "$#" -gt 1 ] && return 1
export_bootdevice && export_partdevice diskdev 0 || {
export_bootdevice && export_partdevice diskdev -2 || {
echo "Unable to determine upgrade device"
return 1
}
@ -38,7 +38,7 @@ platform_check_image() {
platform_do_upgrade() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev 0 || {
export_bootdevice && export_partdevice diskdev -2 || {
echo "Unable to determine upgrade device"
return 1
}
@ -72,6 +72,10 @@ platform_do_upgrade() {
#iterate over each partition from the image and write it to the boot disk
while read part start size; do
# root is /dev/sd[a|b]2 and not /dev/sd[a|b] this causes some problem
# one of which is this offset, I'm not sure what's the best fix, so
# here's a WA.
let part=$((part - 2))
if export_partdevice partdev $part; then
echo "Writing image to /dev/$partdev..."
get_image "$@" | dd of="/dev/$partdev" ibs="512" obs=1M skip="$start" count="$size" conv=fsync
@ -88,7 +92,8 @@ platform_do_upgrade() {
platform_copy_config() {
local partdev
if export_partdevice partdev 1; then
# Same as above /dev/sd[a|b]2 is root, so /boot is -1
if export_partdevice partdev -1; then
mkdir -p /boot
[ -f /boot/kernel.img ] || mount -t vfat -o rw,noatime "/dev/$partdev" /boot
cp -af "$CONF_TAR" /boot/

View File

@ -75,7 +75,7 @@ define Device/iom_ix2-200
UBINIZE_OPTS := -E 5
IMAGE_SIZE := 31744k
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
check-size
check-size $$$$(IMAGE_SIZE)
endef
TARGET_DEVICES += iom_ix2-200

View File

@ -52,7 +52,7 @@ define Build/fullimage
rm $@.tmp
endef
DEVICE_VARS += SIGNATURE MAGIC CRC32_POLY
DEVICE_VARS += IMAGE_SIZE SIGNATURE MAGIC CRC32_POLY
DTS_DIR := $(DTS_DIR)/lantiq
# Shared device definition: applies to every defined device
@ -63,11 +63,12 @@ define Device/Default
KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | uImage lzma
FILESYSTEMS := squashfs
IMAGE_SIZE :=
SOC := $(DEFAULT_SOC)
DEVICE_DTS = $$(SOC)_$(1)
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
define Device/NAND/xway
@ -92,7 +93,7 @@ endef
define Device/lantiqBrnImage
KERNEL := kernel-bin | append-dtb | mkbrncmdline | lzma-no-dict
IMAGES := factory.bin
IMAGE/factory.bin := mkbrnimg | check-size
IMAGE/factory.bin := mkbrnimg | check-size $$$$(IMAGE_SIZE)
endef
define Device/lantiqFullImage
@ -106,7 +107,7 @@ define Device/AVM
KERNEL := kernel-bin | append-dtb | lzma | eva-image
KERNEL_INITRAMFS := $$(KERNEL)
IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-avm-fakeroot | \
append-rootfs | pad-rootfs | append-metadata | check-size
append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
endef
ifeq ($(SUBTARGET),ase)

View File

@ -89,10 +89,10 @@ define Device/netgear_dgn3500
factory-na.img factory.img
IMAGE/sysupgrade-na.bin := \
append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "NA" | \
pad-rootfs | append-metadata | check-size
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/sysupgrade.bin := \
append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "WW" | \
pad-rootfs | append-metadata | check-size
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory-na.img := \
pad-extra $(DGN3500_KERNEL_OFFSET_DEC) | append-kernel | append-rootfs | \
dgn3500-sercom-footer $(DGN3500_KERNEL_OFFSET_HEX) "NA" | pad-rootfs | \
@ -119,7 +119,7 @@ define Device/netgear_dgn3500b
IMAGES += factory.img
IMAGE/sysupgrade.bin := \
append-kernel | append-rootfs | dgn3500-sercom-footer 0x0 "DE" | \
pad-rootfs | append-metadata | check-size
pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
IMAGE/factory.img := \
pad-extra $(DGN3500_KERNEL_OFFSET_DEC) | append-kernel | append-rootfs | \
dgn3500-sercom-footer $(DGN3500_KERNEL_OFFSET_HEX) "DE" | pad-rootfs | \

View File

@ -9,7 +9,7 @@ define Device/lantiqTpLink
tplink-v2-header -s -V "ver. 1.0"
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin := tplink-v2-image -s -V "ver. 1.0" | \
append-metadata | check-size
append-metadata | check-size $$$$(IMAGE_SIZE)
endef
define Device/tplink_tdw8970

View File

@ -11,7 +11,7 @@ I2C_LANTIQ_MODULES:= \
define KernelPackage/i2c-lantiq
TITLE:=Lantiq I2C controller
$(call i2c_defaults,$(I2C_LANTIQ_MODULES),52)
DEPENDS:=kmod-i2c-core @TARGET_lantiq_falcon
DEPENDS:=+kmod-i2c-core @TARGET_lantiq_falcon
endef
define KernelPackage/i2c-lantiq/description