diff --git a/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh b/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh index c191271149..2287e0619d 100644 --- a/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh +++ b/target/linux/apm821xx/base-files/lib/upgrade/wdbook.sh @@ -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 diff --git a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh index 37e479272b..62eede53d3 100644 --- a/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh +++ b/target/linux/bcm27xx/base-files/lib/upgrade/platform.sh @@ -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/ diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index 4ba9f9a1b2..30c27e3e8c 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -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 diff --git a/target/linux/lantiq/image/Makefile b/target/linux/lantiq/image/Makefile index b169d93859..d0fef7c115 100644 --- a/target/linux/lantiq/image/Makefile +++ b/target/linux/lantiq/image/Makefile @@ -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) diff --git a/target/linux/lantiq/image/ar9.mk b/target/linux/lantiq/image/ar9.mk index 7a8f05ea58..73e2ab89b2 100644 --- a/target/linux/lantiq/image/ar9.mk +++ b/target/linux/lantiq/image/ar9.mk @@ -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 | \ diff --git a/target/linux/lantiq/image/tp-link.mk b/target/linux/lantiq/image/tp-link.mk index 2f9fa7b97f..acbc32b46a 100644 --- a/target/linux/lantiq/image/tp-link.mk +++ b/target/linux/lantiq/image/tp-link.mk @@ -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 diff --git a/target/linux/lantiq/modules.mk b/target/linux/lantiq/modules.mk index e7fbad3a29..8cd720093c 100644 --- a/target/linux/lantiq/modules.mk +++ b/target/linux/lantiq/modules.mk @@ -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