Make-initrd development discussion
 help / color / mirror / Atom feed
From: "Leonid Krivoshein" <>
Subject: [make-initrd] [PATCH v6 07/22] bootchain-waitdev: added optional prefix CDROM: to device spec
Date: Sun, 24 Oct 2021 17:20:57 -0000
Message-ID: <20211024172057.Bd5NQlzFqkj5mrrpe5U0JKxQkiYm_2pEB5BJV-V3sic@z> (raw)

At now, if a device is specified with a "CDROM:" prefix, only ISO-9660
file systems or those labeled "CD-ROM" are expected. If only the prefix
is specified in the specification, the first available CD-ROM is expected.

Signed-off-by: Leonid Krivoshein <>
 features/bootchain-core/             |  9 ++++++++-
 features/bootchain-waitdev/          |  9 +++++----
 .../data/lib/uevent/filters/bootchain-waitdev | 19 ++++++++++++++++++-
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/features/bootchain-core/ b/features/bootchain-core/
index 7f12f1d..8d341e0 100644
--- a/features/bootchain-core/
+++ b/features/bootchain-core/
@@ -84,7 +84,14 @@ configurations with `root=pipeline`.
   on from the parameter.
 - run() - run an external command.
-## Example
+## Examples
+Cmdline: root=bootchain bootchain=waitdev,mountfs,mountfs,overlayfs,rootfs waitdev=CDROM:LABEL=ALT_regular-rescue/x86_64 mountfs=DEVNANE mountfs=rescue
+Following these parameters, the daemon waits for a local device with the
+ISO-9660 file system and the volume label "ALT_regular-rescue/x86_64", mounts
+this media, mounts the "rescue" file from it as squashfs of the root system,
+makes it writable using overlayfs and tries to boot from it.
 Cmdline: root=pipeline pipeline=getimage,mountfs,overlayfs,rootfs getimage= mountfs=rescue
diff --git a/features/bootchain-waitdev/ b/features/bootchain-waitdev/
index bdf736e..126a904 100644
--- a/features/bootchain-waitdev/
+++ b/features/bootchain-waitdev/
@@ -10,13 +10,14 @@ feature. It allows to wait a specified block or character special devices.
 ## Boot parameters
 - `waitdev` describes the local device to wait. The format of this parameter is
-   the same as `root=`. This parameter can be specified more than once depending
-   on how many times a corresponding element is mentioned in the `bootchain`.
+   the same as `root=`, but with optional `CDROM:` prefix. This parameter can be
+   specified more than once depending on how many times a corresponding element
+   is mentioned in the `bootchain`.
 ## Example
-Cmdline: root=bootchain bootchain=waitdev,mountfs,mountfs,overlayfs,rootfs waitdev=LABEL=ALT_regular-rescue/x86_64 mountfs=dev mountfs=rescue
+Cmdline: root=bootchain bootchain=waitdev,mountfs,mountfs,overlayfs,rootfs waitdev=CDROM:LABEL=ALT_regular-rescue/x86_64 mountfs=dev mountfs=rescue
-Following these parameters, the bootchain wait local disk drive labeled as
+Following these parameters, the bootchain wait local CDROM drive labeled as
 "ALT_regular-rescue/x86_64", mount it, mount squash file "rescue" as a loop
 from it, make final rootfs writable using overlayfs and will try to boot from it.
diff --git a/features/bootchain-waitdev/data/lib/uevent/filters/bootchain-waitdev b/features/bootchain-waitdev/data/lib/uevent/filters/bootchain-waitdev
index 272aee7..8df8985 100755
--- a/features/bootchain-waitdev/data/lib/uevent/filters/bootchain-waitdev
+++ b/features/bootchain-waitdev/data/lib/uevent/filters/bootchain-waitdev
@@ -3,6 +3,23 @@
 . /.initrd/initenv
 . initrd-sh-functions
+	local retval="$1" name="$2"
+	case "$name" in
+	CDROM:*)
+		[ "${ID_CDROM-}" = 1 ] ||
+		[ "${ID_FS_TYPE-}" = iso9660 ] ||
+			return 1
+		name="${name#CDROM:}"
+		name="${name:-/dev/sr0}"
+		;;
+	esac
+	get_dev "$retval" "$name"
 mkdir -p -- /.initrd/bootchain/waitdev
 cd /.initrd/bootchain/waitdev/
@@ -10,7 +27,7 @@ i=0
 while [ "$i" -lt "${WAITDEV:-0}" ]; do
 	eval "spec=\"\${WAITDEV$i-}\""
-	if [ -n "$spec" ] && get_dev dev "$spec"; then
+	if [ -n "$spec" ] && get_dev_prefixed dev "$spec"; then
 		printf '%s\n' "$dev" > "$i"

                 reply	other threads:[~2021-10-24 17:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211024172057.Bd5NQlzFqkj5mrrpe5U0JKxQkiYm_2pEB5BJV-V3sic@z \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Make-initrd development discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror make-initrd/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 make-initrd make-initrd/ \
	public-inbox-index make-initrd

Example config snippet for mirrors.
Newsgroup available over NNTP:

AGPL code for this site: git clone