exit 1
}
-boot="$(find_mtd_part 'RouterBoard NAND Boot')"
+boot="$(find_mtd_part 'Routerboard NAND Boot')"
main="$(find_mtd_part 'rootfs')"
[ -z "$boot" -o -z "$main" ] && {
echo "Cannot find NAND Flash partitions"
sync
ls /tmp/wget2nand-boot/
ls /tmp/wget2nand/
+# use kexec if present
+[ -x /usr/bin/kexec ] && {
+ kexec -l /tmp/wget2nand-boot/kernel --command-line="$(cat /proc/cmdline) root=$main rootfstype=yaffs2"
+ kexec -e
+}
+
# unmount the partitions and remove the directories into which they were mounted
umount /tmp/wget2nand-boot
umount /tmp/wget2nand