Skip to content
Snippets Groups Projects
Commit 332f6f8f authored by Bartlomiej Grzeskowiak's avatar Bartlomiej Grzeskowiak
Browse files

iopsys-econet: Add overlay support for mtd_squashfs layout


Mtd_squashfs layout is used to workaround nand flash issues on some flash
chips. Overlay in Ubi support is added also to this configuration.

Signed-off-by: default avatarBartlomiej Grzeskowiak <bartlomiej.grzeskowiak@iopsys.eu>
parent 0ea7160c
Branches
No related tags found
1 merge request!315iopsys-econt: Add overlay support for mtd_squashfs layout
{
"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": []
}
]
}
...@@ -3,8 +3,12 @@ mount_tmpfs_overlay() { ...@@ -3,8 +3,12 @@ mount_tmpfs_overlay() {
case "$rootfs_type" in case "$rootfs_type" in
squashfs*) squashfs*)
ramoverlay if ! ubiattach -p /dev/mtd8; then
echo "ramoverlay activated" echo "ubi attach failed activate ramoverlay"
ramoverlay
else
echo "ubi attached"
fi
;; ;;
esac esac
} }
......
#!/bin/sh #!/bin/sh
. /lib/functions.sh
invocation=$1 invocation=$1
image=$2 image=$2
log_tag="$0 $1" log_tag="$0 $1"
...@@ -45,13 +47,14 @@ do_exit_reboot() { ...@@ -45,13 +47,14 @@ do_exit_reboot() {
do_squashfs_update() { do_squashfs_update() {
local image=$1 local image=$1
local next_bank_boot_mtd="mtd2" local next_bank_boot_mtd=mtd"$( find_mtd_index "boot2" )"
local next_bank_rootfs_mtd="mtd4" local next_bank_rootfs_mtd=mtd"$( find_mtd_index "rootfs2" )"
local next_bank_id="2" local next_bank_id="2"
local ubicontainer_mtd=mtd"$( find_mtd_index "ubi_container" )"
if [[ "1" != "$(fw_printenv -n active_image)" ]]; then if [[ "1" != "$(fw_printenv -n active_image)" ]]; then
next_bank_boot_mtd="mtd1" next_bank_boot_mtd=mtd"$( find_mtd_index "boot1" )"
next_bank_rootfs_mtd="mtd3" next_bank_rootfs_mtd=mtd"$( find_mtd_index "rootfs1" )"
next_bank_id="1" next_bank_id="1"
fi fi
...@@ -82,6 +85,15 @@ do_squashfs_update() { ...@@ -82,6 +85,15 @@ do_squashfs_update() {
rm /tmp/squashfs.bin rm /tmp/squashfs.bin
do_post_upgrade $image 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-" log "- Set boot bank $next_bank_id and reboot-"
fw_setenv active_image $next_bank_id fw_setenv active_image $next_bank_id
do_exit_reboot do_exit_reboot
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment