Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/target/linux/mvebu/mamba/base-files/lib/preinit/81_mount_ubifs_overlay b/target/linux/mvebu/mamba/base-files/lib/preinit/81_mount_ubifs_overlay
- index 14e1a52..4df654d 100644
- --- a/target/linux/mvebu/mamba/base-files/lib/preinit/81_mount_ubifs_overlay
- +++ b/target/linux/mvebu/mamba/base-files/lib/preinit/81_mount_ubifs_overlay
- @@ -2,24 +2,10 @@
- SYSCFG_UBIFS_MNT=/tmp/syscfg
- get_current_rootfs_label() {
- - boot_part=`/usr/sbin/fw_printenv -n boot_part`
- - rootfs_label=""
- - if [ "$boot_part" -eq 1 ]
- - then
- - # primary boot image
- - rootfs_label="rootfs"
- - elif [ "$boot_part" -eq 2 ]
- - then
- - # alternative boot image
- - rootfs_label="alt_rootfs"
- - else
- - # try to guess from bootarg, should not come here
- - grep -q "mtdblock5" /proc/cmdline && boot_part=1 \
- - && rootfs_label="rootfs"
- - grep -q "mtdblock7" /proc/cmdline && boot_part=2 \
- - && rootfs_label="alt_rootfs"
- - fw_setenv boot_part $boot_part
- - fi
- + grep -q "mtdblock5" /proc/cmdline && boot_part=1 \
- + && rootfs_label="rootfs"
- + grep -q "mtdblock7" /proc/cmdline && boot_part=2 \
- + && rootfs_label="alt_rootfs"
- echo "$rootfs_label"
- }
- @@ -65,22 +51,28 @@ try_ubifs_syscfg_mount() {
- fi
- if [ $recover_ubifs -eq 1 ]
- then
- - echo "ubifs syscfg partition is damaged"
- - echo "try to recover by formatting $mtdpart..."
- - [ -e /dev/ubi0 ] && ubidetach -m $mtdpart_idx
- - ubiformat -y -q /dev/mtd$mtdpart_idx
- - ubiattach -m $mtdpart_idx /dev/ubi_ctrl
- - ubi0_nod_id=`cat /sys/class/ubi/ubi0/dev | tr -s ":" " "`
- - [ ! -e /dev/ubi0 ] && mknod /dev/ubi0 c ${ubi0_nod_id}
- - ubimkvol /dev/ubi0 -n 0 -N syscfg -t dynamic --maxavsize
- + ubifs_recover
- fi
- # finally mount the ubifs
- - mount -t ubifs -o noatime ubi0:syscfg $SYSCFG_UBIFS_MNT || return 1
- + mount -t ubifs -o noatime ubi0:syscfg $SYSCFG_UBIFS_MNT || \
- + ubifs_recover || \
- + mount -t ubifs -o noatime ubi0:syscfg $SYSCFG_UBIFS_MNT || return 1
- [ ! -d $SYSCFG_UBIFS_MNT/openwrt_overlay ] && mkdir -p $SYSCFG_UBIFS_MNT/openwrt_overlay
- mount -o bind $SYSCFG_UBIFS_MNT/openwrt_overlay $overlay_mountpoint
- return 0
- }
- +ubifs_recover() {
- + echo "ubifs syscfg partition is damaged"
- + echo "try to recover by formatting $mtdpart..."
- + [ -e /dev/ubi0 ] && ubidetach -m $mtdpart_idx
- + ubiformat -y -q /dev/mtd$mtdpart_idx
- + ubiattach -m $mtdpart_idx /dev/ubi_ctrl
- + ubi0_nod_id=`cat /sys/class/ubi/ubi0/dev | tr -s ":" " "`
- + [ ! -e /dev/ubi0 ] && mknod /dev/ubi0 c ${ubi0_nod_id}
- + ubimkvol /dev/ubi0 -n 0 -N syscfg -t dynamic --maxavsize
- +}
- +
- ubifs_syscfg_rootfs_pivot() {
- echo "switching to ubifs sysfs overlay"
- fopivot /overlay /rom
Advertisement
Add Comment
Please, Sign In to add comment