diff --git a/iopsys-econet/base-files/etc/system_layout/mtd.json b/iopsys-econet/base-files/etc/system_layout/mtd.json new file mode 100644 index 0000000000000000000000000000000000000000..405ee64bb8d7ae2ebff1d2edb033b45fe6ae07c9 --- /dev/null +++ b/iopsys-econet/base-files/etc/system_layout/mtd.json @@ -0,0 +1,27 @@ +{ + "banks": [ + { + "id": 1, + "name": "A", + "rootfs": "/dev/mtdblock3", + "overlay": "ubi:overlay1" + }, + { + "id": 2, + "name": "B", + "rootfs": "/dev/mtdblock4", + "overlay": "ubi:overlay2" + } + ], + "overlay_scope": [ + "/" + ], + "mounts": [ + { + "mountpoint": "/data", + "device": "ubi:data", + "type": "ubifs", + "options": [] + } + ] +} diff --git a/iopsys-econet/base-files/lib/preinit/05_mount_tmpfs_overlay b/iopsys-econet/base-files/lib/preinit/05_mount_tmpfs_overlay index bf4f5cf6d3def3179b146043e05c0ceb2ee9005c..81e72b4e20a0535f4af2d4e422c842f91f4e964b 100644 --- a/iopsys-econet/base-files/lib/preinit/05_mount_tmpfs_overlay +++ b/iopsys-econet/base-files/lib/preinit/05_mount_tmpfs_overlay @@ -3,8 +3,12 @@ mount_tmpfs_overlay() { case "$rootfs_type" in squashfs*) - ramoverlay - echo "ramoverlay activated" + if ! ubiattach -p /dev/mtd8; then + echo "ubi attach failed activate ramoverlay" + ramoverlay + else + echo "ubi attached" + fi ;; esac } diff --git a/iopsys-econet/image/upgrade-bundle/upgrade b/iopsys-econet/image/upgrade-bundle/upgrade index 0c22cc761dc7667f6b0252f2bb68004dfa54b6b9..148eb98df2f0f2f66b19eaac94de59fdb63e22de 100755 --- a/iopsys-econet/image/upgrade-bundle/upgrade +++ b/iopsys-econet/image/upgrade-bundle/upgrade @@ -1,5 +1,7 @@ #!/bin/sh +. /lib/functions.sh + invocation=$1 image=$2 log_tag="$0 $1" @@ -45,13 +47,14 @@ do_exit_reboot() { do_squashfs_update() { local image=$1 - local next_bank_boot_mtd="mtd2" - local next_bank_rootfs_mtd="mtd4" + local next_bank_boot_mtd=mtd"$( find_mtd_index "boot2" )" + local next_bank_rootfs_mtd=mtd"$( find_mtd_index "rootfs2" )" local next_bank_id="2" + local ubicontainer_mtd=mtd"$( find_mtd_index "ubi_container" )" if [[ "1" != "$(fw_printenv -n active_image)" ]]; then - next_bank_boot_mtd="mtd1" - next_bank_rootfs_mtd="mtd3" + next_bank_boot_mtd=mtd"$( find_mtd_index "boot1" )" + next_bank_rootfs_mtd=mtd"$( find_mtd_index "rootfs1" )" next_bank_id="1" fi @@ -82,6 +85,15 @@ do_squashfs_update() { rm /tmp/squashfs.bin do_post_upgrade $image + log "- Install overlay partition if not present -" + if [[ "1" != "$(fw_printenv -n overlay_installed)" ]]; then + flash_erase /dev/$ubicontainer_mtd 0 0 + ubiformat /dev/$ubicontainer_mtd + ubiattach -p /dev/$ubicontainer_mtd + ubimkvol /dev/ubi0 -n 6 -N overlay1 -s 10MiB + ubimkvol /dev/ubi0 -n 7 -N overlay2 -s 10MiB + fw_setenv overlay_installed "1" + fi log "- Set boot bank $next_bank_id and reboot-" fw_setenv active_image $next_bank_id do_exit_reboot