]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
network: add iBFT interface configuration
authorHarald Hoyer <harald@redhat.com>
Mon, 7 Mar 2011 12:19:44 +0000 (13:19 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 7 Mar 2011 12:37:20 +0000 (13:37 +0100)
[forward port of 0828d4c3574693ae80c217229e1bba6948dc9509]

dracut.kernel.7.xml
modules.d/40network/ifup
modules.d/40network/module-setup.sh
modules.d/40network/parse-ip-opts.sh

index aad27e2a42fa448707abf89475d7e76e8e900529..32e73cf040a55288a600143fc04a248feec97d56 100644 (file)
@@ -386,7 +386,7 @@ This parameter can be specified multiple times.</para>
       <variablelist>
         <varlistentry>
           <term>
-            <envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6}</replaceable>
+            <envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6|ibft}</replaceable>
           </term>
           <listitem>
             <para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp, 
@@ -394,6 +394,7 @@ loop sequentially through all interfaces (eth0, eth1, ...) and use the first
 with a valid DHCP root-path.</para>
             <para><constant>auto6</constant>: IPv6 autoconfiguration</para>
             <para><constant>dhcp6</constant>: IPv6 DHCP</para>
+            <para><constant>ibft</constant>: iBFT autoconfiguration</para>
           </listitem>
         </varlistentry>
         <varlistentry>
index c548eceec0617156ba213bc6b7ac0fd1f2cacaaf..dc711090e2964d8e4975da74bca05d04e7afd95d 100755 (executable)
@@ -207,7 +207,9 @@ fi
 # looking for ip= lines
 for p in $(getargs ip=); do
     ip_to_var $p
-    
+    # skip ibft
+    [ "$autoconf" = "ibft" ] && continue
+       
     # If this option isn't directed at our interface, skip it
     [ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
 
index cb8c5df8dda0d99d667dbb3ee342ae36d9099183..6dd5fab0eb11a3463e35bfbdc8c130f07380f8bd 100755 (executable)
@@ -55,9 +55,9 @@ install() {
     inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
     inst_hook pre-udev 60 "$moddir/net-genrules.sh"
     inst_hook cmdline 91 "$moddir/dhcp-root.sh"
-    inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
-    inst_hook cmdline 97 "$moddir/parse-bond.sh"
-    inst_hook cmdline 98 "$moddir/parse-bridge.sh"
+    inst_hook cmdline 96 "$moddir/parse-bond.sh"
+    inst_hook cmdline 97 "$moddir/parse-bridge.sh"
+    inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
     inst_hook cmdline 99 "$moddir/parse-ifname.sh"
     inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
 
index b4954a26f248b2f9311406c05bdbc90542dc99b2..d4e501890e532d2cf437b5dca4b124e5add31b63 100755 (executable)
@@ -51,11 +51,43 @@ if [ -n "$NEEDBOOTDEV" ] ; then
     [ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
 fi
 
+if [ "ibft" = "$(getarg ip=)" ]; then
+    modprobe ibft
+    num=0
+    (   
+       for iface in /sys/firmware/ibft/ethernet*; do
+           [ -e ${iface}/mac ] || continue
+            ifname_mac=$(read a < ${iface}/mac; echo $a)
+           [ -z "$ifname_mac" ] || continue
+            ifname_if=ibft$num
+           num=$(( $num + 1 ))
+           echo "ifname=$ifname_if:$ifname_mac"
+           dev=$ifname_if
+
+           dhcp=$(read a < ${iface}/dhcp; echo $a)
+           if [ -n "$dhcp" ]; then
+               echo "ip=$dev:dhcp"
+           else
+               ip=$(read a < ${iface}/ip-addr; echo $a)
+               gw=$(read a < ${iface}/gateway; echo $a)
+               mask=$(read a < ${iface}/subnet-mask; echo $a)
+               hostname=$(read a < ${iface}/hostname; echo $a)
+               echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
+           fi
+       done
+    ) >> /etc/cmdline
+    # reread cmdline
+    unset CMDLINE
+fi
+
 # Check ip= lines
 # XXX Would be nice if we could errorcheck ip addresses here as well
 for p in $(getargs ip=); do
     ip_to_var $p
 
+    # skip ibft
+    [ "$autoconf" = "ibft" ] && continue
+
     # We need to have an ip= line for the specified bootdev
     [ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1