[master 1/1] dracut: accept inst.dd=[file:]/dd.iso (#1268792)

wgwoods installerbot-noreply at redhat.com
Tue Oct 6 20:06:58 UTC 2015


From: Will Woods <wwoods at redhat.com>

Like with inst.ks=/ks.cfg, some users want to be able to inject the
driver disk into the initramfs and load it from there.

The mechanisms for doing this are already basically present, we just
need to handle it the same way we do when the kickstart is already
inside the initramfs: check to see if the requested file exists, and if
it's already present, use it as-is.

The canonical form of this argument is:

    inst.dd=file:/path/to/dd.iso

`dd.iso` can be an ISO or a driver RPM, which must be injected into the
initramfs.
`file:` may be omitted, although that practice is discouraged.
`path:` can be used instead of `file:`, but that's also discouraged.

Resolves: rhbz#1268792
---
 dracut/driver-updates-genrules.sh | 14 +++++++++++---
 dracut/driver_updates.py          |  5 ++++-
 dracut/parse-anaconda-dd.sh       |  6 ++++--
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/dracut/driver-updates-genrules.sh b/dracut/driver-updates-genrules.sh
index 9aa6421..d911b94 100644
--- a/dracut/driver-updates-genrules.sh
+++ b/dracut/driver-updates-genrules.sh
@@ -21,10 +21,18 @@ else
     debug_msg "/tmp/dd_disk file was not created"
 fi
 
-# Run driver-updates for LABEL=OEMDRV and any other requested disk
+# Run driver-updates for LABEL=OEMDRV and any other requested disk/image
 for dd in $DD_OEMDRV $DD_DISK; do
-    when_diskdev_appears "$(disk_to_dev_path $dd)" \
-        driver-updates --disk $dd \$devnode
+    # ..is this actually a disk image that already exists inside initramfs?
+    if [ -f $dd ]; then
+        # if so, no need to wait for udev - add it to initqueue now
+        initqueue --onetime --unique --name dd_initrd \
+            driver-updates --disk $dd $dd
+    else
+        # otherwise, tell udev to do driver-updates when the device appears
+        when_diskdev_appears "$(disk_to_dev_path $dd)" \
+            driver-updates --disk $dd \$devnode
+    fi
 done
 
 # force us to wait at least until we've settled at least once
diff --git a/dracut/driver_updates.py b/dracut/driver_updates.py
index f3f2075..1da201d 100755
--- a/dracut/driver_updates.py
+++ b/dracut/driver_updates.py
@@ -30,7 +30,10 @@
     driver-updates --disk DISKSTR DEVNODE
 
         DISKSTR is the string passed by the user ('/dev/sda3', 'LABEL=DD', etc.)
-        DEVNODE is the actual device node (/dev/sda3, /dev/sr0, etc.)
+        DEVNODE is the actual device node or image (/dev/sda3, /dev/sr0, etc.)
+
+        DEVNODE must be mountable, but need not actually be a block device
+        (e.g. /dd.iso is valid if the user has inserted /dd.iso into initrd)
 
     driver-updates --net URL LOCALFILE
 
diff --git a/dracut/parse-anaconda-dd.sh b/dracut/parse-anaconda-dd.sh
index f94fbaf..081b401 100755
--- a/dracut/parse-anaconda-dd.sh
+++ b/dracut/parse-anaconda-dd.sh
@@ -19,8 +19,10 @@ for dd in $(getargs dd= inst.dd=); do
         http:*|https:*|ftp:*|nfs:*|nfs4:*) echo $dd >> /tmp/dd_net ;;
         # disks: strip "cdrom:" or "hd:" and add to dd_disk
         cdrom:*|hd:*) echo ${dd#*:} >> /tmp/dd_disk ;;
-        # anything else is assumed to be a disk
-        *) echo $dd >> /tmp/dd_disk
+        # images crammed into initrd: strip "file:" or "path:"
+        file:*|path:*) echo ${dd#*:} >> /tmp/dd_disk ;;
+        # anything else is assumed to be a disk (or disk image)
+        *) echo $dd >> /tmp/dd_disk ;;
     esac
 done
 


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/c696b376bae4a51e423da21df052511ff1969275


More information about the anaconda-patches mailing list