Browse Source

Add fcoe booting support

Supported cmdline formats:
fcoe=<networkdevice>:<dcb|nodcb>
fcoe=<macaddress>:<dcb|nodcb>

Note currently only nodcb is supported, the dcb option is reserved for
future use.

Note letters in the macaddress must be lowercase!

Examples:
fcoe=eth0:nodcb
fcoe=4A:3F:4C:04:F8:D7:nodcb
master
Hans de Goede 16 years ago committed by Harald Hoyer
parent
commit
3508cc816e
  1. 11
      modules.d/95fcoe/check
  2. 14
      modules.d/95fcoe/fcoe-genrules.sh
  3. 16
      modules.d/95fcoe/fcoe-up
  4. 7
      modules.d/95fcoe/install
  5. 2
      modules.d/95fcoe/installkernel
  6. 48
      modules.d/95fcoe/parse-fcoe.sh

11
modules.d/95fcoe/check

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
#!/bin/sh

# We depend on network modules being loaded
[ "$1" = "-d" ] && echo network

# FIXME
# If hostonly was requested, fail the check if we are not actually
# booting from root.
#[ "$1" = "-h" ] && ! egrep -q '/ /dev/nbd[0-9]*' /proc/mounts && exit 1

exit 0

14
modules.d/95fcoe/fcoe-genrules.sh

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
#!/bin/sh

# We use (fcoe_interface or fcoe_mac) and fcoe_dcb as set by parse-fcoe.sh
# If neither mac nor interface are set we don't continue
[ -z "$fcoe_interface" -a -z "$fcoe_mac" ] && return

# Write udev rules
{
if [ -n "$fcoe_mac" ] ; then
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_mac" "$fcoe_dcb"
else
printf 'ACTION=="add", SUBSYSTEM=="net", KERNEL=="%s", RUN+="/sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb"
fi
} > /etc/udev/rules.d/60-fcoe.rules

16
modules.d/95fcoe/fcoe-up

@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
#!/bin/sh
#
# We get called like this:
# /sbin/fcoe-up <network-device> <dcb|nodcb>
#
# Note currently only nodcb is supported, the dcb option is reserved for
# future use.

# Huh? Missing arguments ??
[ -z "$1" -o -z "$2" ] && exit 1

netif=$1
dcb=$2

/sbin/ip link set "$netif" up
echo -n "$netif" > /sys/module/fcoe/parameters/create

7
modules.d/95fcoe/install

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
#!/bin/bash

dracut_install ip

inst "$moddir/fcoe-up" "/sbin/fcoe-up"
inst_hook pre-udev 60 "$moddir/fcoe-genrules.sh"
inst_hook cmdline 99 "$moddir/parse-fcoe.sh"

2
modules.d/95fcoe/installkernel

@ -0,0 +1,2 @@ @@ -0,0 +1,2 @@
#!/bin/bash
instmods fcoe

48
modules.d/95fcoe/parse-fcoe.sh

@ -0,0 +1,48 @@ @@ -0,0 +1,48 @@
#!/bin/sh
#
# Supported formats:
# fcoe=<networkdevice>:<dcb|nodcb>
# fcoe=<macaddress>:<dcb|nodcb>
#
# Note currently only nodcb is supported, the dcb option is reserved for
# future use.
#
# Note letters in the macaddress must be lowercase!
#
# Examples:
# fcoe=eth0:nodcb
# fcoe=4A:3F:4C:04:F8:D7:nodcb

[ -z "$fcoe" ] && fcoe=$(getarg fcoe=)

# If it's not set we don't continue
[ -z "$fcoe" ] && return

parse_fcoe_opts() {
local IFS=:
set $fcoe

case $# in
2)
fcoe_interface=$1
fcoe_dcb=$2
;;
7)
fcoe_mac=$1:$2:$3:$4:$5:$6
fcoe_dcb=$7
;;
*)
die "Invalid arguments for fcoe="
;;
esac
}

parse_fcoe_opts

# currently only nodcb is supported
if [ "$fcoe_dcb" != "nodcb" ] ; then
die "Invalid FCoE DCB option: $fcoe_dcb"
fi

# FCoE actually supported?
[ -e /sys/module/fcoe/parameters/create ] || modprobe fcoe || die "FCoE requested but kernel/initrd does not support FCoE"
Loading…
Cancel
Save