|
|
18971c |
From 70b7ec9492f950bcfb6f390c58ad6e3e2b8fda9c Mon Sep 17 00:00:00 2001
|
|
|
18971c |
From: Fabian Deutsch <fabiand@fedoraproject.org>
|
|
|
18971c |
Date: Thu, 19 Feb 2015 10:09:14 +0100
|
|
|
18971c |
Subject: [PATCH] dmsquash: Add squashfs support to rd.live.fsimg
|
|
|
18971c |
|
|
|
18971c |
Previously rd.live.fsimg only supported filesystems residing in
|
|
|
18971c |
(compressed) archives.
|
|
|
18971c |
Now rd.live.fsimg can also be used when a squashfs image is used.
|
|
|
18971c |
This is achieved by extracting the rootfs image from the squashfs and
|
|
|
18971c |
then continue with the default routines for rd.live.fsimg.
|
|
|
18971c |
In addition some code duplication got removed and some documentation
|
|
|
18971c |
got added.
|
|
|
18971c |
|
|
|
18971c |
Signed-off-by: Fabian Deutsch <fabiand@fedoraproject.org>
|
|
|
18971c |
(cherry picked from commit b0472eac111268e2cae783097d0eccc1986e1762)
|
|
|
18971c |
---
|
|
|
18971c |
dracut.cmdline.7.asc | 9 +++
|
|
|
18971c |
.../90dmsquash-live/dmsquash-live-root.sh | 64 ++++++++++---------
|
|
|
18971c |
2 files changed, 42 insertions(+), 31 deletions(-)
|
|
|
18971c |
|
|
|
18971c |
diff --git a/dracut.cmdline.7.asc b/dracut.cmdline.7.asc
|
|
|
18971c |
index 0c3bc295..1e89bd50 100644
|
|
|
18971c |
--- a/dracut.cmdline.7.asc
|
|
|
18971c |
+++ b/dracut.cmdline.7.asc
|
|
|
18971c |
@@ -802,6 +802,10 @@ Enables debug output from the live boot process.
|
|
|
18971c |
Specifies the directory within the squashfs where the ext3fs.img or rootfs.img
|
|
|
18971c |
can be found. By default, this is __LiveOS__.
|
|
|
18971c |
|
|
|
18971c |
+**rd.live.ram=**1::
|
|
|
18971c |
+Copy the complete image to RAM and use this for booting. This is useful
|
|
|
18971c |
+when the image resides on i.e. a DVD which needs to be ejected later on.
|
|
|
18971c |
+
|
|
|
18971c |
**rd.live.overlay.thin=**1::
|
|
|
18971c |
Enables the usage of thin snapshots instead of classic dm snapshots.
|
|
|
18971c |
The advantage of thin snapshots is, that they support discards, and will free
|
|
|
18971c |
@@ -814,6 +818,11 @@ Enables writable filesystem support. The system will boot with a fully
|
|
|
18971c |
writable filesystem without snapshots __(see notes above about available live boot options)__.
|
|
|
18971c |
You can use the **rootflags** option to set mount options for the live
|
|
|
18971c |
filesystem as well __(see documentation about rootflags in the **Standard** section above)__.
|
|
|
18971c |
+This implies that the whole image is copied to RAM before the boot continues.
|
|
|
18971c |
++
|
|
|
18971c |
+NOTE: There must be enough free RAM available to hold the complete image.
|
|
|
18971c |
++
|
|
|
18971c |
+This method is very suitable for diskless boots.
|
|
|
18971c |
|
|
|
18971c |
|
|
|
18971c |
Plymouth Boot Splash
|
|
|
18971c |
diff --git a/modules.d/90dmsquash-live/dmsquash-live-root.sh b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
|
18971c |
index 12354f42..64abc0be 100755
|
|
|
18971c |
--- a/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
|
18971c |
+++ b/modules.d/90dmsquash-live/dmsquash-live-root.sh
|
|
|
18971c |
@@ -148,6 +148,7 @@ do_live_overlay() {
|
|
|
18971c |
base=$BASE_LOOPDEV
|
|
|
18971c |
over=$OVERLAY_LOOPDEV
|
|
|
18971c |
fi
|
|
|
18971c |
+
|
|
|
18971c |
if [ -n "$thin_snapshot" ]; then
|
|
|
18971c |
modprobe dm_thin_pool
|
|
|
18971c |
mkdir /run/initramfs/thin-overlay
|
|
|
18971c |
@@ -199,29 +200,6 @@ if [ -n "$OSMINSQFS" ]; then
|
|
|
18971c |
umount -l /run/initramfs/squashfs.osmin
|
|
|
18971c |
fi
|
|
|
18971c |
|
|
|
18971c |
-# we might have an embedded fs image to use as rootfs (uncompressed live)
|
|
|
18971c |
-if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
|
|
|
18971c |
- FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
|
|
|
18971c |
-elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
|
|
|
18971c |
- FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
|
|
|
18971c |
-fi
|
|
|
18971c |
-
|
|
|
18971c |
-if [ -n "$FSIMG" ] ; then
|
|
|
18971c |
- BASE_LOOPDEV=$( losetup -f )
|
|
|
18971c |
-
|
|
|
18971c |
- if [ -n "$writable_fsimg" ] ; then
|
|
|
18971c |
- # mount the provided fileysstem read/write
|
|
|
18971c |
- echo "Unpacking live filesystem (may take some time)"
|
|
|
18971c |
- unpack_archive $FSIMG /run/initramfs/fsimg/
|
|
|
18971c |
- losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
|
|
|
18971c |
- echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
|
|
|
18971c |
- else
|
|
|
18971c |
- # mount the filesystem read-only and add a dm snapshot for writes
|
|
|
18971c |
- losetup -r $BASE_LOOPDEV $FSIMG
|
|
|
18971c |
- do_live_from_base_loop
|
|
|
18971c |
- fi
|
|
|
18971c |
-fi
|
|
|
18971c |
-
|
|
|
18971c |
# we might have an embedded fs image on squashfs (compressed live)
|
|
|
18971c |
if [ -e /run/initramfs/live/${live_dir}/${squash_image} ]; then
|
|
|
18971c |
SQUASHED="/run/initramfs/live/${live_dir}/${squash_image}"
|
|
|
18971c |
@@ -242,18 +220,42 @@ if [ -e "$SQUASHED" ] ; then
|
|
|
18971c |
mkdir -m 0755 -p /run/initramfs/squashfs
|
|
|
18971c |
mount -n -t squashfs -o ro $SQUASHED_LOOPDEV /run/initramfs/squashfs
|
|
|
18971c |
|
|
|
18971c |
- BASE_LOOPDEV=$( losetup -f )
|
|
|
18971c |
- if [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
|
|
18971c |
- losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/ext3fs.img
|
|
|
18971c |
- elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
|
|
18971c |
- losetup -r $BASE_LOOPDEV /run/initramfs/squashfs/LiveOS/rootfs.img
|
|
|
18971c |
- fi
|
|
|
18971c |
+fi
|
|
|
18971c |
+
|
|
|
18971c |
+# we might have an embedded fs image to use as rootfs (uncompressed live)
|
|
|
18971c |
+if [ -e /run/initramfs/live/${live_dir}/ext3fs.img ]; then
|
|
|
18971c |
+ FSIMG="/run/initramfs/live/${live_dir}/ext3fs.img"
|
|
|
18971c |
+elif [ -e /run/initramfs/live/${live_dir}/rootfs.img ]; then
|
|
|
18971c |
+ FSIMG="/run/initramfs/live/${live_dir}/rootfs.img"
|
|
|
18971c |
+elif [ -f /run/initramfs/squashfs/LiveOS/ext3fs.img ]; then
|
|
|
18971c |
+ FSIMG="/run/initramfs/squashfs/LiveOS/ext3fs.img"
|
|
|
18971c |
+elif [ -f /run/initramfs/squashfs/LiveOS/rootfs.img ]; then
|
|
|
18971c |
+ FSIMG="/run/initramfs/squashfs/LiveOS/rootfs.img"
|
|
|
18971c |
+fi
|
|
|
18971c |
|
|
|
18971c |
- umount -l /run/initramfs/squashfs
|
|
|
18971c |
+if [ -n "$FSIMG" ] ; then
|
|
|
18971c |
+ BASE_LOOPDEV=$( losetup -f )
|
|
|
18971c |
|
|
|
18971c |
- do_live_from_base_loop
|
|
|
18971c |
+ if [ -n "$writable_fsimg" ] ; then
|
|
|
18971c |
+ # mount the provided fileysstem read/write
|
|
|
18971c |
+ echo "Unpacking live filesystem (may take some time)"
|
|
|
18971c |
+ mkdir /run/initramfs/fsimg/
|
|
|
18971c |
+ if [ -n "$SQUASHED" ]; then
|
|
|
18971c |
+ cp -v $FSIMG /run/initramfs/fsimg/rootfs.img
|
|
|
18971c |
+ else
|
|
|
18971c |
+ unpack_archive $FSIMG /run/initramfs/fsimg/
|
|
|
18971c |
+ fi
|
|
|
18971c |
+ losetup $BASE_LOOPDEV /run/initramfs/fsimg/rootfs.img
|
|
|
18971c |
+ echo "0 $( blockdev --getsize $BASE_LOOPDEV ) linear $BASE_LOOPDEV 0" | dmsetup create live-rw
|
|
|
18971c |
+ else
|
|
|
18971c |
+ # mount the filesystem read-only and add a dm snapshot for writes
|
|
|
18971c |
+ losetup -r $BASE_LOOPDEV $FSIMG
|
|
|
18971c |
+ do_live_from_base_loop
|
|
|
18971c |
+ fi
|
|
|
18971c |
fi
|
|
|
18971c |
|
|
|
18971c |
+[ -e "$SQUASHED" ] && umount -l /run/initramfs/squashfs
|
|
|
18971c |
+
|
|
|
18971c |
if [ -b "$OSMIN_LOOPDEV" ]; then
|
|
|
18971c |
# set up the devicemapper snapshot device, which will merge
|
|
|
18971c |
# the normal live fs image, and the delta, into a minimzied fs image
|