Author: pierre
Date: Sat Sep 7 06:43:10 2019
New Revision: 22107
Log:
Add the possibility for resuming from disk in initramfs. This allows kernel
command lines like this:
linux /boot/vmlinuz-5.2.11-lfs-SVN-20190902
root=UUID=47a81d89-8788-4ec4-99dd-0f3a0943e96b resume=LABEL=MYSWAP ro
initrd /boot/initrd.img-5.2.11-lfs-1
Modified:
trunk/BOOK/postlfs/filesystems/initramfs.xml
Modified: trunk/BOOK/postlfs/filesystems/initramfs.xml
==============================================================================
--- trunk/BOOK/postlfs/filesystems/initramfs.xml Sat Sep 7 06:37:59
2019 (r22106)
+++ trunk/BOOK/postlfs/filesystems/initramfs.xml Sat Sep 7 06:43:10
2019 (r22107)
@@ -222,6 +222,9 @@
if [ -d /lib/systemd ]; then
cp -a /lib/systemd $WDIR/lib
fi
+if [ -d /lib/elogind ]; then
+ cp -a /lib/elogind $WDIR/lib
+fi
# Install the kernel modules if requested
if [ -n "$KERNEL_VERSION" ]; then
@@ -305,6 +308,19 @@
fi
}
+do_try_resume()
+{
+ case "$resume" in
+ UUID=* ) eval $resume; resume="/dev/disk/by-uuid/$UUID" ;;
+ LABEL=*) eval $resume; resume="/dev/disk/by-label/$LABEL" ;;
+ esac
+
+ if $noresume || ! [ -b "$resume" ]; then return; fi
+
+ ls -lH "$resume" | ( read x x x x maj min x
+ echo -n ${maj%,}:$min > /sys/power/resume )
+}
+
init=/sbin/init
root=
rootdelay=
@@ -312,6 +328,8 @@
ro="ro"
rootflags=
device=
+resume=
+noresume=false
mount -n -t devtmpfs devtmpfs /dev
mount -n -t proc proc /proc
@@ -327,6 +345,8 @@
rootdelay=* ) rootdelay=${param#rootdelay=} ;;
rootfstype=*) rootfstype=${param#rootfstype=} ;;
rootflags=* ) rootflags=${param#rootflags=} ;;
+ resume=* ) resume=${param#resume=} ;;
+ noresume ) noresume=true ;;
ro ) ro="ro" ;;
rw ) ro="rw" ;;
esac
@@ -352,6 +372,7 @@
if [ -x /sbin/vgchange ] ; then /sbin/vgchange -a y > /dev/null ; fi
if [ -n "$rootdelay" ] ; then sleep "$rootdelay" ; fi
+do_try_resume # This function will not return if resuming from disk
do_mount_root
killall -w ${UDEVD##*/}
--
http://lists.linuxfromscratch.org/listinfo/blfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page