imx: make sdcard/eMMC sysupgrade more resilient
[openwrt/staging/dedeckeh.git] / target / linux / imx / base-files / lib / imx.sh
index a451de3779ee0c1fadec48a19982c30adff298ec..9c692357588ec45445627d9a80878471f53731f0 100644 (file)
@@ -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
 }