From bddbeeb8874bd22b8b60e27dd366bc5f3a8d1cee Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 13 Oct 2012 22:52:42 +0000 Subject: [PATCH] Bug #351873: More livecd control, and initramfs livecd argument documentation. Signed-off-by: Robin H. Johnson --- ChangeLog | 5 +++++ defaults/initrd.defaults | 7 +++++-- defaults/initrd.scripts | 2 +- defaults/linuxrc | 6 +++++- doc/genkernel.8.txt | 14 ++++++++++++-- 5 files changed, 28 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6204a06..05484d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ # Distributed under the GPL v2 # $Id$ + 13 Oct 2012; Robin H. Johnson defaults/initrd.defaults, + defaults/initrd.scripts, defaults/linuxrc, doc/genkernel.8.txt: + Bug #351873: More livecd control, and initramfs livecd argument + documentation. + 13 Oct 2012; Robin H. Johnson arch/alpha/kernel-config, arch/ppc/kernel-config, arch/x86/kernel-config, arch/x86_64/kernel-config, defaults/kernel-config: diff --git a/defaults/initrd.defaults b/defaults/initrd.defaults index 73fe4c9..90f73f4 100755 --- a/defaults/initrd.defaults +++ b/defaults/initrd.defaults @@ -67,12 +67,15 @@ else fi REAL_ROOT='' +CONSOLE='/dev/console' +NEW_ROOT='/newroot' CDROOT='0' CDROOT_DEV='' CDROOT_TYPE='auto' -NEW_ROOT='/newroot' CDROOT_PATH='/mnt/cdrom' -CONSOLE='/dev/console' +# This is the file that the cdroot will be checked for as a +# marker. It must exist RELATIVE to the cdroot. +CDROOT_MARKER='/livecd' LOOPS='/livecd.loop /zisofs /livecd.squashfs /image.squashfs /livecd.gcloop' diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 03e61e0..227fc99 100755 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -159,7 +159,7 @@ bootstrapCD() { # a bunch of extra devices [ -n "${CDROOT_DEV}" ] && DEVICES="${CDROOT_DEV}" - findmediamount "cdrom" "${SUBDIR}/livecd" "REAL_ROOT" "${CDROOT_PATH}" ${DEVICES} + findmediamount "cdrom" "${SUBDIR}/${CDROOT_MARKER}" "REAL_ROOT" "${CDROOT_PATH}" ${DEVICES} } bootstrapKey() { diff --git a/defaults/linuxrc b/defaults/linuxrc index 011505c..54a57c6 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -39,6 +39,7 @@ FAKE_ROOT='' REAL_ROOTFLAGS='' ROOTFSTYPE='auto' CRYPT_SILENT=0 + mkdir -p /etc/cmdline /etc/modprobe.d for x in ${CMDLINE} do @@ -69,6 +70,9 @@ do cdroot_type=*) CDROOT_TYPE=${x#*=} ;; + cdroot_marker=*) + CDROOT_MARKER=${x#*=} + ;; # Start livecd loop, looptype options loop=*) LOOP=${x#*=} @@ -657,7 +661,7 @@ then # If encrypted, find key and mount, otherwise mount as usual if [ -n "${CRYPT_ROOT}" ] then - CRYPT_ROOT_KEY="$(head -n 1 "${CDROOT_PATH}"/livecd)" + CRYPT_ROOT_KEY="$(head -n 1 "${CDROOT_PATH}"/${CDROOT_MARKER})" CRYPT_ROOT='/dev/loop0' good_msg 'You booted an encrypted livecd' "${CRYPT_SILENT}" diff --git a/doc/genkernel.8.txt b/doc/genkernel.8.txt index 912f899..6376e28 100644 --- a/doc/genkernel.8.txt +++ b/doc/genkernel.8.txt @@ -551,11 +551,21 @@ which the ramdisk scripts would recognize. *cdroot*[=<...>]:: *cdroot_type*=<...>:: - TO BE DOCUMENTED +*cdroot_marker*=<...>:: + Used for LiveCDs. *cdroot* without arguments will cause the initramfs to + scan all devices for a LiveCD. An argument to *cdroot* will cause it to + scan only that device. A LiveCD is any device containing a file with the + name & Path of *cdroot_marker* (default of "/livecd"). *cdroot_type* + (default of "auto") is the filesystem type to use while mounting devices + to check. On success, the LiveCD will be mounted at $CDROOT_PATH. *loop*=<...>:: *looptype*=<...>:: - TO BE DOCUMENTED + Used for LiveCDs. After mounting the LiveCD or ISO, look for a file at + *loop*=path to use as a loopback image for the main type. Mount it with + filesystem type *looptype*. Possible values for *looptype*: normal, + squashfs, gcloop, zisofs, noloop, sgimips. If *looptype* is not specified, + a guess is made, based on the name or extension of *loop*. *isoboot*=<...>:: Loop-mount an ISO file from the boot device to get the filesystem image. -- 2.26.2