From 3605eff88190af9cc2905ba750252c1643a1bc7d Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Wed, 19 Aug 2020 12:13:26 +0200 Subject: layerscape: add dtb to sysupgrade At this moment sysupgrade replaces only kernel and rootfs. This patch add dtb part to sysupgrade images to avoid situation when old dtb make system broken. Is possible to sysupgrade older images for NOR devices: 1. Firmware partition in bootargs need to be updated to: "49m@0xf00000(firmware)". Env should be saved after changes. 2. After step one, "sysupgrade -F" will work. Run tested: LS1046A-RDB Reviewed-by: Yangbo Lu Signed-off-by: Pawel Dembicki [bump PKG_RELEASE for uboot-layerscape] Signed-off-by: Adrian Schmutzler --- .../base-files/etc/uci-defaults/05_fix-compat-version | 19 +++++++++++++++++++ .../layerscape/base-files/lib/upgrade/platform.sh | 5 ++++- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version (limited to 'target/linux/layerscape/base-files') diff --git a/target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version new file mode 100644 index 0000000000..923f4ac273 --- /dev/null +++ b/target/linux/layerscape/base-files/etc/uci-defaults/05_fix-compat-version @@ -0,0 +1,19 @@ +# +# Copyright (C) 2020 OpenWrt.org +# + +. /lib/functions.sh + +case "$(board_name)" in + fsl,ls1012a-rdb | \ + fsl,ls1021a-twr | \ + fsl,ls1043a-rdb | \ + fsl,ls1046a-rdb | \ + fsl,ls1088a-rdb | \ + fsl,ls2088a-rdb) + uci set system.@system[0].compat_version="2.0" + uci commit system + ;; +esac + +exit 0 diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh index fa0f21a6c5..633cbaf953 100644 --- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh +++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh @@ -61,7 +61,7 @@ platform_do_upgrade_sdboot() { if [ -n "$diff" ]; then dd if="$1" of="/dev/$diskdev" bs=1024 count=4 > /dev/null 2>&1 echo "Writing image to /dev/$diskdev..." - dd if="$1" of="/dev/$diskdev" bs=1024 skip=16384 seek=16384 > /dev/null 2>&1 + dd if="$1" of="/dev/$diskdev" bs=1024 skip=15360 seek=15360 > /dev/null 2>&1 sync # Separate removal and addtion is necessary; otherwise, partition 1 @@ -72,6 +72,9 @@ platform_do_upgrade_sdboot() { return 0 fi + # write dtb + echo "Writing dtb to /dev/$diskdev..." + dd if="$1" of="/dev/$diskdev" bs=1024 skip=15360 seek=15360 count=1024 > /dev/null 2>&1 # write kernel image echo "Writing kernel to /dev/$diskdev..." dd if="$1" of="/dev/$diskdev" bs=1024 skip=16384 seek=16384 count=16384 > /dev/null 2>&1 -- cgit v1.2.3