[PATCH anaconda-dracut] Fix ksdevice=<MAC> - instead of renaming the device to ksdev0 just use it

Radek Vykydal rvykydal at redhat.com
Thu Feb 21 12:57:27 UTC 2013


ksdevice option doesn't work in f17 and f18.

It used to specify which network device to activate in early stage of
installation, eg. to fetch kickstart or installation image.

In F17 and F18 the device should be specified by dracut option ip=

Mapping of ksdevice options from loader to dracut options used in
F17 and F18:

- ksdevice missing (and network is required)
loader: user was asked in UI in case of more devices present
dracut: activates all devices if not specified

- ksdevice=eth0
loader: eth0 is activated
dracut: specify device in ip=, eg
        ip=eth0:dhcp
        ip=10.34.39.44::10.34.39.254:255.255.255.0::eth0:none

- ksdevice=00:12:34:56:78:9a
loader: device with MAC address is activated
dracut: We translate it to ifname=ksdev0:00:12:34:56:78:9a which renames
        the device.
        It is possible to use BOOTIF=00-12-34-56-78-9a, which this patch
        does.

- ksdevice=link
loader: first device with link found is activated
dracut: no way to achive this (activate single unspecified device)?

- ksdevice=ibft
loader: activate devcie configrued in iBFT
dracut: use ip=ibft option
---
 dracut/parse-anaconda-net.sh | 24 +++++++++++++++++++-----
 1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/dracut/parse-anaconda-net.sh b/dracut/parse-anaconda-net.sh
index 411b1f5..4b5f9a5 100755
--- a/dracut/parse-anaconda-net.sh
+++ b/dracut/parse-anaconda-net.sh
@@ -5,26 +5,40 @@ net_conf=/etc/cmdline.d/75-anaconda-network-options.conf
 
 check_depr_arg "dns" "nameserver=%s"
 
+mac_to_bootif() {
+    local bootif=${1}
+    local IFS=':'
+    bootif=$(for i in ${bootif} ; do echo -n $i-; done)
+    bootif=${bootif%-}
+    bootif="01-$bootif"
+    echo $bootif
+}
+
 # handle ksdevice (tell us which device to use for ip= stuff later)
 export ksdevice=""
 ksdev_val=$(getarg ksdevice=)
 if [ -n "$ksdev_val" ]; then
     case "$ksdev_val" in
         link)
-            warn "'ksdevice=link' does nothing (it's the default behavior)"
+            warn "'ksdevice=link' is not supported."
         ;;
         ibft)
             warn "'ksdevice=ibft' is deprecated. Using 'ip=ibft' instead."
             echo "ip=ibft" > $net_conf
-            ksdevice="ibft0"
         ;;
         bootif)
             warn "'ksdevice=bootif' does nothing (BOOTIF is used by default if present)"
         ;;
         ??:??:??:??:??:??)
-            warn "'ksdevice=<MAC>' is deprecated. Using 'ifname=ksdev0:<MAC>' instead."
-            ksdevice="ksdev0"
-            echo "ifname=$ksdevice:$ksdev_val" > $net_conf
+
+            BOOTIF=$(getarg 'BOOTIF=')
+            if [ -n "$BOOTIF" ] ; then
+                warn "'ksdevice=<MAC>' is deprecated. Supplied BOOTIF takes precedence."
+            else
+                bootif=$(mac_to_bootif "$ksdev_val")
+                warn "'ksdevice=<MAC>' is deprecated. Using BOOTIF=$bootif instead."
+                echo "BOOTIF=$bootif" > $net_conf
+            fi
         ;;
         *) ksdevice="$ksdev_val" ;;
     esac
-- 
1.7.11.7



More information about the anaconda-patches mailing list