summaryrefslogtreecommitdiffstats
path: root/target/linux/imx
diff options
context:
space:
mode:
authorLech Perczak <lech.perczak@gmail.com>2022-04-28 23:32:12 +0200
committerPiotr Dymacz <pepe2k@gmail.com>2022-07-11 14:18:40 +0200
commit4436d7bae8c38eda1cb159e3b1ffd2fd1a553bed (patch)
tree92b13d8262e3438be3f4447fa96ffb2d69dca49f /target/linux/imx
parent70a9c75ef3ff3866b0cf9b80323ba756a3850b59 (diff)
downloadopenwrt-4436d7bae8c38eda1cb159e3b1ffd2fd1a553bed.tar.gz
openwrt-4436d7bae8c38eda1cb159e3b1ffd2fd1a553bed.tar.bz2
openwrt-4436d7bae8c38eda1cb159e3b1ffd2fd1a553bed.zip
imx: make sdcard/eMMC sysupgrade more resilient
Ensure, that kernel update is performed atomically on filesystem, to reduce likelihood of failure if power-cut occurs during sysupgrade. If kernel update fails for whatever reason, skip updating rootfs as well. Signed-off-by: Lech Perczak <lech.perczak@gmail.com>
Diffstat (limited to 'target/linux/imx')
-rw-r--r--target/linux/imx/base-files/lib/imx.sh9
1 files changed, 6 insertions, 3 deletions
diff --git a/target/linux/imx/base-files/lib/imx.sh b/target/linux/imx/base-files/lib/imx.sh
index a451de3779..9c69235758 100644
--- a/target/linux/imx/base-files/lib/imx.sh
+++ b/target/linux/imx/base-files/lib/imx.sh
@@ -41,9 +41,12 @@ imx_sdcard_do_upgrade() {
board_dir="${board_dir%/}"
imx_sdcard_mount_boot
- get_image "$1" | tar Oxf - ${board_dir}/kernel > /boot/uImage
- get_image "$1" | tar Oxf - ${board_dir}/root > $(rootpart_from_uuid)
- sync
+ get_image "$1" | tar Oxf - ${board_dir}/kernel > /boot/uImage-new && \
+ mv /boot/uImage-new /boot/uImage && \
+ sync && \
+ get_image "$1" | tar Oxf - ${board_dir}/root > $(rootpart_from_uuid) && \
+ sync
+
umount /boot
}