Hi, Attached patch makes the init script attempt to find an writable image to use with Overlay/AUFS, and probably does so poorly.
The idea is to eventually allow users to do a "RESET" option in case they mess up the system. The underlying image can be something read-only like cramfs or squashfs. Any comments or suggestions?
diff --git a/meta/recipes-core/initrdscripts/files/init-live.sh b/meta/recipes-core/initrdscripts/files/init-live.sh index 441b41c..35047c8 100644 --- a/meta/recipes-core/initrdscripts/files/init-live.sh +++ b/meta/recipes-core/initrdscripts/files/init-live.sh @@ -152,6 +152,25 @@ do sleep 1 done +try_rw_image() { + for i in /run/media/$ROOT_DISK/$ISOLINUX/${ROOT_IMAGE}.rw; do + if [ -w $i ]; then + mount -o rw,loop,noatime,sync $i /rootfs.rw + if [ "$?" -ne 0 ]; then + break + fi + touch /rootfs.rw/.rwtest 2>/dev/null + if [ "$?" -ne 0 ]; then + break + fi + rm /rootfs.rw/.rwtest + return + fi + done + umount /rootfs.rw + mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw +} + # Try to mount the root image read-write and then boot it up. # This function distinguishes between a read-only image and a read-write image. # In the former case (typically an iso), it tries to make a union mount if possible. @@ -159,6 +178,7 @@ done mount_and_boot() { mkdir $ROOT_MOUNT mknod /dev/loop0 b 7 0 2>/dev/null + mknod /dev/loop1 b 7 1 2>/dev/null if ! mount -o rw,loop,noatime,nodiratime /run/media/$ROOT_DISK/$ISOLINUX/$ROOT_IMAGE $ROOT_MOUNT ; then fatal "Could not mount rootfs image" @@ -187,7 +207,7 @@ mount_and_boot() { rm -rf /rootfs.ro /rootfs.rw fatal "Could not move rootfs mount point" else - mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw + try_rw_image mkdir -p /rootfs.rw/upperdir /rootfs.rw/work mount -t overlay overlay -o "lowerdir=/rootfs.ro,upperdir=/rootfs.rw/upperdir,workdir=/rootfs.rw/work" $ROOT_MOUNT mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw @@ -201,7 +221,7 @@ mount_and_boot() { rm -rf /rootfs.ro /rootfs.rw fatal "Could not move rootfs mount point" else - mount -t tmpfs -o rw,noatime,mode=755 tmpfs /rootfs.rw + try_rw_image mount -t aufs -o "dirs=/rootfs.rw=rw:/rootfs.ro=ro" aufs $ROOT_MOUNT mkdir -p $ROOT_MOUNT/rootfs.ro $ROOT_MOUNT/rootfs.rw mount --move /rootfs.ro $ROOT_MOUNT/rootfs.ro
-- _______________________________________________ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core