mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2025-02-20 08:34:42 +02:00
[package] extroot: block-mount block-extroot: Added ability to do a whole disk extroot instead of only an overlay-based extroot.
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26109 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
d011a32a8b
commit
d4627d82f4
@ -37,10 +37,17 @@ determine_external_root() {
|
|||||||
}
|
}
|
||||||
config_load fstab
|
config_load fstab
|
||||||
config_foreach config_mount_by_section mount 1
|
config_foreach config_mount_by_section mount 1
|
||||||
|
ER_OVERLAY_ROM="/no-extroot"
|
||||||
|
|
||||||
[ "$rootfs_found" = "1" ] && grep -q ' /overlay ' /proc/mounts && {
|
[ "$rootfs_found" = "1" ] && grep -q ' /overlay ' /proc/mounts && {
|
||||||
pi_extroot_mount_success=true
|
pi_extroot_mount_success=true
|
||||||
pi_mount_skip_next=false
|
pi_mount_skip_next=false
|
||||||
|
ER_OVERLAY_ROM="/overlay"
|
||||||
|
}
|
||||||
|
[ "$rootfs_found" = "1" ] && grep -q ' /rom ' /proc/mounts && {
|
||||||
|
pi_extroot_mount_success=true
|
||||||
|
pi_mount_skip_next=false
|
||||||
|
ER_OVERLAY_ROM="/rom"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UCI_CONFIG_DIR="$OLD_UCI_CONFIG_DIR"
|
UCI_CONFIG_DIR="$OLD_UCI_CONFIG_DIR"
|
||||||
|
@ -13,7 +13,7 @@ check_set_md5sum() {
|
|||||||
er_extroot_md5sum="$(cat $er_md5sum_file)"
|
er_extroot_md5sum="$(cat $er_md5sum_file)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local er_overlay_file="/overlay/etc/extroot.md5sum"
|
local er_overlay_file="${ER_OVERLAY_ROM}/etc/extroot.md5sum"
|
||||||
|
|
||||||
local er_extroot_overlay_md5sum
|
local er_extroot_overlay_md5sum
|
||||||
if [ -f "$er_overlay_file" ]; then
|
if [ -f "$er_overlay_file" ]; then
|
||||||
@ -24,8 +24,8 @@ check_set_md5sum() {
|
|||||||
cat $er_md5sum_file >$er_overlay_file
|
cat $er_md5sum_file >$er_overlay_file
|
||||||
elif [ "$er_extroot_overlay_md5sum" != "$er_extroot_md5sum" ]; then
|
elif [ "$er_extroot_overlay_md5sum" != "$er_extroot_md5sum" ]; then
|
||||||
pi_extroot_mount_success="false"
|
pi_extroot_mount_success="false"
|
||||||
mkdir -p /tmp/overlay-disabled
|
mkdir -p /tmp${ER_OVERLAY_ROM}-disabled
|
||||||
mount --move /overlay /tmp/overlay-disabled
|
mount --move ${ER_OVERLAY_ROM} /tmp${ER_OVERLAY_ROM}-disabled
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,10 +9,17 @@
|
|||||||
external_root_pivot() {
|
external_root_pivot() {
|
||||||
check_skip || [ "$pi_extroot_mount_success" != "true" ] || {
|
check_skip || [ "$pi_extroot_mount_success" != "true" ] || {
|
||||||
echo "switching to external rootfs"
|
echo "switching to external rootfs"
|
||||||
|
if [ "$ER_OVERLAY_ROM" = "/overlay" ]; then
|
||||||
if [ "$ER_IS_SQUASHFS" = "true" ]; then
|
if [ "$ER_IS_SQUASHFS" = "true" ]; then
|
||||||
umount /tmp/overlay
|
umount /tmp/overlay
|
||||||
fi
|
fi
|
||||||
mount -o remount,ro / && fopivot /overlay /rom && pi_mount_skip_next=true
|
mount -o remount,ro / && fopivot /overlay /rom && pi_mount_skip_next=true
|
||||||
|
elif [ "$ER_OVERLAY_ROM" = "/rom" ]; then
|
||||||
|
if [ "$ER_IS_SQUASHFS" = "true" ]; then
|
||||||
|
umount /tmp/overlay
|
||||||
|
fi
|
||||||
|
mount -o remount,ro / && pivot_rom /rom /rom && pi_mount_skip_next=true
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,3 +24,13 @@ er_load_modules() {
|
|||||||
rm -rf /tmp/extroot_modules
|
rm -rf /tmp/extroot_modules
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pivot_rom() { # <new_root> <old_root>
|
||||||
|
mount -o move /proc $1/proc && \
|
||||||
|
pivot_root $1 $1$2 && {
|
||||||
|
mount -o move $2/dev /dev
|
||||||
|
mount -o move $2/tmp /tmp
|
||||||
|
mount -o move $2/sys /sys 2>&-
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -41,10 +41,14 @@ config_mount_by_section() {
|
|||||||
if [ "$find_rootfs" = "1" ]; then
|
if [ "$find_rootfs" = "1" ]; then
|
||||||
if [ "$is_rootfs" -eq 1 ]; then
|
if [ "$is_rootfs" -eq 1 ]; then
|
||||||
target=/overlay
|
target=/overlay
|
||||||
|
elif [ "$target" = "/" ]; then
|
||||||
|
target=/rom
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ "$is_rootfs" -eq 1 ] || [ "$target" = "/overlay" ]; then
|
if [ "$is_rootfs" -eq 1 ] || [ "$target" = "/overlay" ]; then
|
||||||
target=/tmp/overlay-disabled
|
target=/tmp/overlay-disabled
|
||||||
|
elif [ "$target" = "/" ] || [ "$target" = "/rom" ]; then
|
||||||
|
target="/tmp/rom-disabled"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -59,6 +63,9 @@ config_mount_by_section() {
|
|||||||
[ "$target" = "/overlay" ] && {
|
[ "$target" = "/overlay" ] && {
|
||||||
rootfs_found=1
|
rootfs_found=1
|
||||||
}
|
}
|
||||||
|
[ "$target" = "/rom" ] && {
|
||||||
|
rootfs_found=1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user