This brings linuxrc.s390 and friends to the latest version as posted here https://www.redhat.com/archives/anaconda-devel-list/2009-February/msg00392.html plus some updates after that. Changes: - update usage of udev to rawhide - no more telnetd for network login during install - adapt readcmsfile to automatic loading of device driver modules - refactor main part into function init_main - consider renaming of network device driver module from ctc to ctcm - refactor control unit lookup tables into separate file - no more rely on kernel versions to detect device driver features - upstream qeth driver supports IPv6 on HiperSockets in layer3 mode - no more manual (un)loading of device driver modules - correctly handle default MAC address for layer2 qeth devices - no more kill udevd at end of linuxrc.s390 - write network device configuration to correct new place (ifcfg) Splitting up into single patches is impossible without merge conflicts. --- loader/controlunits.sh | 56 +++++ loader/linuxrc.s390 | 575 +++++++++++++++++++----------------------------- 2 files changed, 288 insertions(+), 343 deletions(-) create mode 100644 loader/controlunits.sh diff --git a/loader/controlunits.sh b/loader/controlunits.sh new file mode 100644 index 0000000..e99db36 --- /dev/null +++ b/loader/controlunits.sh @@ -0,0 +1,56 @@ +# controlunits.sh: define some common control unit mappings +# Copyright (C) IBM Corp. 2009 +# Author: Steffen Maier <maier@xxxxxxxxxx> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License only. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +# The arrays (among other things) should be adapted, if any of those device +# drivers start supporting different CU types/models. + +readonly -a CU=( + 1731/01 + 1731/05 + 3088/08 + 3088/1f + 3088/1e + 3088/01 + 3088/60 + 3088/61 +) + +readonly -a CU_DEVDRV=( + qeth + qeth + ctcm + ctcm + ctcm + lcs + lcs + lcs +) + +# Searches for a match of argument 1 on the array $CU and sets $cu_idx +# to the matched array index on success. +# Returns 0 on success, 1 on failure. +function search_cu() { + local scu=$1 + local i + for ((i=0; i < ${#CU[@]}; i++)); do + if [ "$scu" == "${CU[i]}" ]; then + cu_idx=$i + return 0 + fi + done + return 1 +} diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390 index 5dec01d..260e393 100644 --- a/loader/linuxrc.s390 +++ b/loader/linuxrc.s390 @@ -27,10 +27,18 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# prerequisites of this script to run inside the RHEL5.3 installer initrd: -# - copy udevsettle and udevd to initrd -# - copy lsznet.raw to initrd as /sbin/lsznet -# - create /etc/udev/udev.conf with at least one comment line as content +# prerequisites of this script to run inside the installer initrd: +# - udevadm and udevd need to be there +# - have /etc/udev/udev.conf with at least one comment line as content +# - if necessary, have udev rules +# - copy lsznet.raw and controlunits.sh to initrd +# - pack kernel modules and module-init-tools (no longer use busybox for that) +# - "multi on" in /etc/host.conf [RH bugs 486457,486461,483244] + +# TODOs: +# - make sure driver modules get loaded automatically +# - udev rule for lcs/ctcm vs. cu3088 +# - make sure netiucv gets loaded even without udev events since on no bus VERSION=1.2 @@ -131,14 +139,13 @@ function sysecho () { function startinetd() { echo - echo $"Starting telnetd and sshd to allow login over the network." + echo $"Starting sshd to allow login over the network." if [ -z "$testing" ]; then echo $"Welcome to the anaconda install environment $VERSION for $S390ARCH" > /etc/issue.net echo $"Welcome to the anaconda install environment $VERSION for $S390ARCH" > /etc/motd echo >> /etc/motd fi # testing - /sbin/xinetd -stayalive -reuse -pidfile /tmp/xinetd.pid /sbin/sshd if [ -z "$RUNKS" ]; then echo @@ -157,33 +164,42 @@ function readcmsfile() # $1=dasdport $2=filename { local dev if [ $# -ne 2 ]; then return; fi - mknod /dev/dasda b 94 0 + # precondition: udevd created dasda block device node if ! sysecho /proc/cio_ignore "free $1"; then echo $"DASD $1 could not be cleared from device blacklist" return 1 fi # /proc/cio_ignore won't block on freeing devices until resensing # has been completed, so wait until the udev event queue depletes - # (without udevsettle we could wait 2 seconds unconditionally) + # (without udevadm settle we could wait 2 seconds unconditionally) #debug ls -laF /dev/.udev - udevsettle + udevadm settle + # even though the device might now be online, some of its + # sysfs attributes might not yet be available sleep 1 - insmod dasd_mod$LO dasd=$1 - insmod dasd_eckd_mod$LO - if ! cmsfscat -d /dev/dasda -a $2 > /tmp/$2; then - echo $"Could not read conf file $2 on CMS DASD $1." - fi - # maybe replace with a more robust: dev=$(printf "0.0.%04x" $((0x${1}))) + # precondition: dasd_eckd_mod driver incl. dependencies loaded, + # dasd_mod must be loaded without setting any DASD online if [ ${#1} == 3 ]; then dev="0.0.0${1}" elif [ ${#1} == 4 ]; then dev="0.0.${1}" fi - sysecho /sys/bus/ccw/drivers/dasd-eckd/$dev/online 0 - rmmod dasd_eckd_mod - rmmod dasd_mod + if ! sysecho /sys/bus/ccw/devices/$dev/online 1; then + echo $"DASD $dev could not be set online" + return 1 + fi + if ! cmsfscat -d /dev/dasda -a $2 > /tmp/$2; then + echo $"Could not read conf file $2 on CMS DASD $1." + fi + if ! sysecho /sys/bus/ccw/devices/$dev/online 0; then + echo $"DASD $dev could not be set offline again" + return 1 + fi + # consequences of no more module unload: loader/anaconda can no longer + # use DASD option to online DASDs and set other DASD parameters! } +# adaption of the same function in init.c (udevd gets started later) function createDevices() { awk '{ printf("mknod /dev/%s %s %s %s\n", $1, $2, $3, $4); @@ -202,6 +218,7 @@ random c 1 8 644 root:root urandom c 1 9 644 root:root rtc c 10 135 644 root:root EOF + # tty handling is different from init.c since s390 does not have all for i in 2 3 4 5 6 7 8 9 ; do ln -s console /dev/tty$i done @@ -209,6 +226,70 @@ EOF ln -s /proc/self/fd /dev/fd } +# approximately the main() function of init.c +function init_main() { + S390ARCH=$(uname -m) + if [ "$S390ARCH" = "s390" ]; then + export S390ARCH="S/390" + else + export S390ARCH="zSeries" + fi + + echo + echo $"Starting the $S390ARCH initrd to configure networking. Version is $VERSION" + + # set up env vars as we do in init.c + if [ $(uname -m) = "s390x" ]; then + LD_LIBRARY_PATH=/lib64:/usr/lib64:/usr/X11R6/lib64:/usr/kerberos/lib64:/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/lib + else + LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/lib + fi + export LD_LIBRARY_PATH + + PATH="$PATH:/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/X11R6/bin" + export PATH + HOME=/ + export HOME + PYTHONPATH=/tmp/updates + export PYTHONPATH + + if [ -z "$testing" ]; then + + mount -t proc none /proc + + mount -t tmpfs none /dev + createDevices + # udevd req'd by udevadm settle (/dev/.udev/queue) + # in readcmsfile, dialog_network_table, semantic_check_subchannels. + # (important: start udevd at the right time, e.g. after setup of /dev) + echo $"starting udev..." + udevd --daemon + + mount -t devpts /dev/pts /dev/pts + mount -t sysfs none /sys + # remount root fs rw + mount /dev/root / -o remount,rw + + # limit output on 3270 console + # (console_loglevel of 4 is just right to not get driver info, + # e.g. from qeth, since that would mix up with the user dialog) + echo "4 4 1 7" > /proc/sys/kernel/printk + + # make /tmp/ramfs + mount -t ramfs none /tmp + + ifconfig lo 127.0.0.1 netmask 255.0.0.0 + route add -host 127.0.0.1 dev lo + + echo -e "127.0.0.1\tlocalhost.localdomain localhost localhost4 localhost4.localdomain4" > /etc/hosts + echo -e "::1\t\tlocalhost.localdomain localhost localhost6 localhost6.localdomain6" >> /etc/hosts + + # init.c would also fork /sbin/dbus-uuidgen --ensure + # and /sbin/dbus-daemon --system + + fi # testing +} + # from here on accesses to sysfs try to follow # linux/Documentation/sysfs-rules.txt @@ -346,14 +427,12 @@ function dialog_network_table() { #( while true; do echo -n "."; sleep 3; done ) & #local childpid=$! #debug ls -laF /dev/.udev - udevsettle + udevadm settle # (virtual) CTC/A takes some more time to appear in sysfs # FIXME: how long to wait? 3 seconds seems to be enough. sleep 3 #kill $childpid #echo - # udevsettle only works if udevd is running (/dev/.udev/queue)! - # (without udevsettle we could wait 5-10 seconds uncond.) continue else echo $"Device blacklist could not be cleared" @@ -366,7 +445,11 @@ function dialog_network_table() { local item cutype chp chpidtype devdrv devname chlist cardtype read item cutype chp chpidtype devdrv devname chlist cardtype <<< ${nettable[$choice]} # $NETTYPE happens to be exactly the network driver name - NETTYPE=$devdrv + if [ "$devdrv" = "ctcm" ]; then + NETTYPE="ctc" + else + NETTYPE=$devdrv + fi SUBCHANNELS=$chlist break done @@ -379,49 +462,7 @@ declare -r BUSIDFORMAT=[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]] declare -r IDFORMAT=$PREFIXFORMAT.$SSIDFORMAT.$BUSIDFORMAT declare -r SUBCHANNEL_TYPE_IO=0 -# The following combinations of control unit type and model were taken from the -# Linux network device drivers for s390 on 2008-06-09 from Linux 2.6.25.4. -# The list (among other things) should be adapted, if any of those device -# drivers start supporting different CU types/models. -# (Alternatively, the list could be generated by reading the modaliases -# directly out of the device driver modules: -# modinfo qeth/cu3088 | fgrep 'alias:' -# However, this would still require a list of device driver modules.) - -declare -r -a CU=( - 1731/01 - 1731/05 - 3088/08 - 3088/1f - 3088/1e - 3088/01 - 3088/60 -) - -declare -r -a CU_DEVDRV=( - qeth - qeth - ctc - ctc - ctc - lcs - lcs -) - -# Searches for a match of argument 1 on the array $CU and sets $cu_idx -# to the matched array index on success. -# Returns 0 on success, 1 on failure. -function search_cu() { - local scu=$1 - local i - for ((i=0; i < ${#CU[@]}; i++)); do - if [ "$scu" == "${CU[i]}" ]; then - cu_idx=$i - return 0 - fi - done - return 1 -} +. /sbin/controlunits.sh function cardtype2cleartext() { local cardtype=$1 @@ -436,9 +477,9 @@ function cardtype2cleartext() { OSD_Express) echo "OSA card in OSD mode, unknown link type" ;; HSTR) echo "OSA card in OSD mode, High Speed Token Ring" ;; OSN) echo "OSA for NCP, ESCON/CDLC bridge" ;; - HiperSockets) echo "HiperSocket with CHPID type IQD" ;; + HiperSockets) echo "HiperSockets with CHPID type IQD" ;; "GuestLAN QDIO") echo "GuestLAN based on OSA (QDIO)" ;; - "GuestLAN Hiper") echo "GuestLAN based on HiperSocket" ;; + "GuestLAN Hiper") echo "GuestLAN based on HiperSockets" ;; unknown) echo "other" ;; *) echo "unknown" echo "l.$LINENO: found unknown card_type, code needs to be fixed" 1>&2 @@ -456,29 +497,6 @@ function isVM() { fi } -# echos one comparable integer built from 3 arguments in kernel version style -function kernel_version() { - [ $# -eq 3 ] || return 1 - local krn_ver=$1 krn_patch=$2 krn_sub=$3 - local version=$(( (krn_ver << 16) + (krn_patch << 8) + krn_sub )) - # <<EOF convince syntax highlighter that above shifts are no here documents - echo $version - return 0 -} - -# echos one comparable integer built from actual running kernel version -function linux_version() { - local krn_ver krn_patch krn_sub - local krn_foo krn_extra - IFS=. - read krn_ver krn_patch krn_foo < <(uname -r) - unset IFS - IFS=- - read krn_sub krn_extra <<< "$krn_foo" - unset IFS - kernel_version $krn_ver $krn_patch $krn_sub -} - # watch out: potential error message as side effect function isLayer2Default() { # Read default from sysfs because according to device @@ -514,22 +532,14 @@ function isLayer2() { esac } -# returns true iff qeth device $SCH_R_DEVBUSID and kernel version +# returns true iff qeth device $SCH_R_DEVBUSID # is capable of supporting IPv6 # watch out: potential error message as side effect function ipv6_capable() { [ "$NETTYPE" = "qeth" ] || return 1 case $cardtype in - OSD_10GIG|OSD_1000|OSD_100|OSD_Express|"GuestLAN QDIO") return 0 ;; - HiperSockets) - if isLayer2; then - return 0 - elif [ $(linux_version) -ge $(kernel_version 2 6 26) ]; then - return 0 - else - return 1 - fi - ;; + OSD_10GIG|OSD_1000|OSD_100|OSD_Express|HiperSockets|"GuestLAN QDIO") + return 0 ;; OSD_GbE_LANE|OSD_FE_LANE|OSD_TR_LANE|OSD_ATM_LANE) return 1 ;; HSTR|OSN|unknown) return 1 ;; "GuestLAN Hiper") return 1 ;; @@ -538,75 +548,6 @@ function ipv6_capable() { esac } -function insert_module() { - local module=${1} - if grep "^${module%.ko} .*$" /proc/modules &> /dev/null ; then - # module has already been loaded => do not try to load again - return 0 - fi - if ! insmod $module; then - echo $"Could not load kernel module $module" - fi -} - -function load_kernel_modules() { - if [ ":$NETTYPE" = ":ctc" ]; then - insert_module ccwgroup$LO - insert_module cu3088$LO - insert_module fsm$LO - insert_module ctc$LO - elif [ ":$NETTYPE" = ":iucv" ]; then - insert_module fsm$LO - insert_module iucv$LO - insert_module netiucv$LO - elif [ "$NETTYPE" = "lcs" ]; then - insert_module ccwgroup$LO - insert_module cu3088$LO - insert_module lcs$LO - elif [ "$NETTYPE" = "qeth" ]; then - insert_module crypto_api$LO - insert_module xfrm_nalgo$LO - insert_module ipv6$LO - insert_module ccwgroup$LO - insert_module qdio$LO - insert_module qeth$LO - fi -} - -function remove_module() { - if ! rmmod $1; then - #echo $"Could not remove kernel module $1" - : - fi -} - -function remove_kernel_modules() { - if [ ":$NETTYPE" = ":ctc" ]; then - remove_module ctc - remove_module fsm - remove_module cu3088 - remove_module ccwgroup - elif [ ":$NETTYPE" = ":iucv" ]; then - remove_module netiucv - remove_module iucv - remove_module fsm - elif [ "$NETTYPE" = "lcs" ]; then - remove_module lcs - remove_module cu3088 - remove_module ccwgroup - elif [ "$NETTYPE" = "qeth" ]; then - remove_module qeth - remove_module qdio - remove_module ccwgroup - # The remaining 3 modules can hardly be unloaded - # since e.g. loopback holds an inet6 address and thus a reference. - # But that's no problem as long as the device drivers are removed. - remove_module ipv6 - remove_module xfrm_nalgo - remove_module crypto_api - fi -} - # sets device online _and_ retrieves DEVICE at the same time # iucv cannot be set online since it's not based on ccw(group) function set_device_online() { @@ -638,7 +579,7 @@ function set_device_online() { done if [ "$NETTYPE" = "lcs" -o "$NETTYPE" = "ctc" ]; then # KH FIXME: Workaround for missing sysfs interface - # DEVICE=`cat /sys/devices/lcs/${SUBCHANNELS//,*/}/if_name` + # DEVICE=$(cat /sys/devices/lcs/${SUBCHANNELS//,*/}/if_name) # replaced with flexible solution: # https://bugzilla.redhat.com/show_bug.cgi?id=204803#c9 # "sys/bus/ccwgroup/devices/${SUBCHANNEL}/net\:* @@ -684,7 +625,7 @@ function set_device_up() { fi # Device does not come up fast enough to use "ip" to configure, so block. # While OSA come up themselves after setting online, - # e.g. HiperSocket won't, so set them up explicitly for the following check + # e.g. HiperSockets won't => set them up explicitly for the following check debug ip link set up $DEVICE local i=1 while : ; do @@ -727,6 +668,8 @@ function syntax_check_domainname() { function modprobe_alias() { if [ ":$NETTYPE" = ":iucv" ]; then echo "alias $DEVICE netiucv" >> /tmp/modprobe.conf + elif [ ":$NETTYPE" = ":ctc" ]; then + echo "alias $DEVICE ctcm" >> /tmp/modprobe.conf else echo "alias $DEVICE $NETTYPE" >> /tmp/modprobe.conf fi @@ -829,9 +772,6 @@ function rollback_config() { [ -z "$mtu_was_set" ] && unset MTU [ -z "$mmtu_was_set" ] && unset MMTU [ -z "$vswitch_was_set" ] && unset VSWITCH - # Try to silently unload modules. We ignore failures since - # load_kernel_modules only tries to load missing modules. - tv remove_kernel_modules # prevent possible reuse of an old DEVICE on restarting dialog unset DEVICE } @@ -960,7 +900,7 @@ function ask() { c) handle=$OPTARG ;; f) finish=$OPTARG ;; "?") ;; # ignore invalid option - :) echo $"l.$LINENO: Missing parameter to option -$OPTARG" 1>&2 ;; + :) echo "l.$LINENO: Missing parameter to option -$OPTARG" 1>&2 ;; esac done while : ; do @@ -1018,7 +958,7 @@ function ask() { # few parameters need special handling done by their own function: $finish else - echo "Unsupported calling of ask function, please fix calling code" + echo $"Unsupported calling of ask function, please fix calling code" fi done # PARMNAME # disable potential temporary redoing-mode during reenter-mode @@ -1068,7 +1008,7 @@ function question_choices_nettype() { function helptext_nettype() { echo $" Help text for network type:" echo $" qeth: OSA-Express Fast Ethernet, Gigabit Ethernet (including 1000Base-T)," - echo $" High Speed Token Ring, Hipersockets, and ATM (running Ethernet LAN emulation)" + echo $" High Speed Token Ring, and ATM (running Ethernet LAN emulation)" echo $" features in QDIO mode." echo $" [default]" echo $" lcs: OSA-2 Ethernet/Token Ring, OSA-Express Fast Ethernet in non-QDIO mode," @@ -1114,7 +1054,7 @@ function do_chandev() { ### SUBCHANNELS function syntax_check_subchannels() { - SUBCHANNELS=`echo $SUBCHANNELS | tr ABCDEF abcdef` + SUBCHANNELS=$(echo $SUBCHANNELS | tr ABCDEF abcdef) # - make subchannel question dependent on NETTYPE (2 vs. 3 subchannels) if [ "$NETTYPE" = "qeth" ]; then # - match against regex, depending on qeth @@ -1173,10 +1113,10 @@ function semantic_check_subchannels() { if sysecho /proc/cio_ignore "free $devbusid"; then # /proc/cio_ignore won't block on freeing devices # until resensing has been completed, so wait until - # the udev event queue depletes (without udevsettle we + # the udev event queue depletes (without udevadm settle we # could wait 2 seconds unconditionally) #debug ls -laF /dev/.udev - udevsettle + udevadm settle # even though the device might now be online, some of its # sysfs attributes (e.g. cutype) might not yet be available sleep 1 @@ -1214,7 +1154,13 @@ function semantic_check_subchannels() { local cutype read cutype < $dev_p/cutype if search_cu $cutype; then - if [ "${CU_DEVDRV[$cu_idx]}" != "$NETTYPE" ]; then + local driver + if [ "$NETTYPE" = "ctc" ]; then + driver="ctcm" + else + driver=$NETTYPE + fi + if [ "${CU_DEVDRV[$cu_idx]}" != "$driver" ]; then echo $"Device $devbusid has control unit type $cutype," echo $" which does not match your selected network type $NETTYPE" all_subch_good=1 @@ -1291,6 +1237,7 @@ function semantic_check_subchannels() { if [ "$i" -eq 2 ]; then local sch_w_devbusid=$devbusid local sch_w_devno=$devno + # TODO: not true for CTCM => relax # - write_devbusid == read_devbusid+1 if [ $((0x$devno)) -ne $((0x$sch_r_devno + 1)) ]; then echo $"Device bus ID of write channel (dev $devbusid) must be one larger than" @@ -1353,11 +1300,17 @@ function semantic_check_subchannels() { function handle_subchannels() { # - try to establish ccwgroup right here and fail out on error - if sysecho /sys/bus/ccwgroup/drivers/${NETTYPE}/group "$SUBCHANNELS"; then + local driver + if [ "$NETTYPE" = "ctc" ]; then + driver="ctcm" + else + driver=$NETTYPE + fi + if sysecho /sys/bus/ccwgroup/drivers/${driver}/group "$SUBCHANNELS"; then case "$NETTYPE" in qeth) # Just preliminary card_type info until device goes online! - # In fact it seems enough to separate OSA from HiperSocket. + # In fact it seems enough to separate OSA from HiperSockets. if [ -f /sys/devices/qeth/$SCH_R_DEVBUSID/card_type ]; then read cardtype < /sys/devices/qeth/$SCH_R_DEVBUSID/card_type else @@ -1366,9 +1319,11 @@ function handle_subchannels() { ;; ctc|lcs) if [ -f /sys/devices/cu3088/$SCH_R_DEVBUSID/type ]; then - local type=$(cat /sys/devices/cu3088/$SCH_R_DEVBUSID/type) - [ "$type" = "CTC/A" ] && type="channel-to-channel adapter" - echo "Detected: $type" + local type + read type < /sys/devices/cu3088/$SCH_R_DEVBUSID/type + [ "$type" = "CTC/A" ] && \ + type="channel-to-channel adapter (CTC/A)" + echo $"Detected: $type" else echo $"Could not read ctc network card type from sysfs." fi @@ -1436,7 +1391,7 @@ function do_subchannels() { function syntax_check_portname() { # - 1-8 characters, we convert it to upper case - PORTNAME=`echo $PORTNAME | tr '[:lower:]' '[:upper:]'` + PORTNAME=$(echo $PORTNAME | tr '[:lower:]' '[:upper:]') local portname_len=${#PORTNAME} if [ "$portname_len" -ge 1 -a "$portname_len" -le 8 ]; then return 0 @@ -1542,7 +1497,7 @@ function helptext_portno() { } function exception_portno() { - # Writing portno of e.g. hipersocket device fails. + # Writing portno of e.g. hipersockets device fails. # Therefore, do not configure on empty default value. [ -z "$PORTNO" ] && break } @@ -1604,7 +1559,11 @@ function helptext_layer2() { } function exception_layer2() { - [ -z "$LAYER2" ] && break + if [ -z "$LAYER2" ]; then + isLayer2Default && LAYER2=1 || LAYER2=0 + # do not break, always apply, default may differ from online layer mode + #break + fi } function do_layer2() { @@ -1655,37 +1614,36 @@ function question_prefix_macaddr() { } function question_choices_macaddr() { - echo -n $" (e.g. 02:00:00:00:00:00, ? for help)." - # for virtual OSAs macaddr is optional and defaults to not specifying one - if [ -z "${cardtype//OSD_*/}" ]; then - echo - else - echo $" Default is automatic:" - fi + macaddr_default=$(ifconfig $DEVICE | grep 'HWaddr' | sed 's/.*HWaddr \([[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]:[[:xdigit:]][[:xdigit:]]\).*/\1/') + echo $" (e.g. 02:00:00:00:00:00, ? for help). Default is $macaddr_default:" } function helptext_macaddr() { echo $" Help text for MAC address:" - echo $" This is required for real OSA in layer 2 mode." - echo $" If connecting to a layer 2 VSWITCH, a MAC address is automatically assigned." - echo -n $" You may accept the automatic MAC address with an empty input." if [ -z "${cardtype//OSD_*/}" ]; then - echo + echo $" For real OSA in layer 2 mode, a random MAC address is automatically assigned." else - echo $" [default]" + echo $" If connecting to a layer 2 VSWITCH, a MAC address is automatically assigned." fi + echo $" You may accept the automatic MAC address with an empty input. [default]" + echo $" If the automatic address is not unique, please provide a MAC address." + [ -z "${cardtype//OSD_*/}" ] && \ + echo $" For real OSA, the provided address must be different from that of the OSA." echo $" You may override the automatic MAC address with non-empty input." echo $" An example MAC address would be: 02:00:00:00:00:00" } function exception_macaddr() { - # for real OSAs macaddr is required - if [ -n "${cardtype//OSD_*/}" ]; then - # for virtual OSAs macaddr is optional - if [ -z "$MACADDR" ]; then + if [ -z "$MACADDR" ]; then + if [ -z "${cardtype//OSD_*/}" ]; then + # keep random default MAC address of real OSA, + # so the OSA comes up with the same MAC each time in the future + MACADDR=$macaddr_default + else + # virtual OSA in layer2 is GuestLAN or VSWITCH VSWITCH=1 - break fi + break fi } @@ -1813,7 +1771,7 @@ function syntax_check_peerid() { echo $"Incorrect string length [0..8] for IUCV connection to peer (PEERID): $PEERID" return 1 fi - PEERID=`echo $PEERID | tr '[:lower:]' '[:upper:]'` + PEERID=$(echo $PEERID | tr '[:lower:]' '[:upper:]') [[ "$PEERID" =~ ^[[:alnum:]$]{0,8}$ ]] case $? in 0) @@ -1894,7 +1852,7 @@ function do_peerid() { ### HOSTNAME function syntax_check_hostname() { - syntax_check_domainname "$HOSTNAME" $"Incorrect format for hostname (HOSTNAME): $HOSTNAME" + syntax_check_domainname "$HOSTNAME" "Incorrect format for hostname (HOSTNAME): $HOSTNAME" } function handle_hostname() { @@ -1914,8 +1872,8 @@ function question_choices_hostname() { } function helptext_hostname() { - echo $" Help text for hostname:" - echo $" Enter the full qualified domain name of your host." + echo $" Help text for hostname:" + echo $" Enter the full qualified domain name of your host." } function do_hostname() { @@ -1958,11 +1916,9 @@ function helptext_ipaddr() { echo $" or alternatively a valid IPv6 address without CIDR prefix (e.g. 2001:0DB8::)" echo $" IPv6 is supported on:" echo $" - Ethernet interfaces of the OSA-Express adapter running in QDIO mode." - echo $" - HiperSockets layer 2 interfaces" - [ $(linux_version) -ge $(kernel_version 2 6 26) ] && \ - echo $" - HiperSockets layer 3 interfaces" + echo $" - HiperSockets interfaces" echo $" - z/VM guest LAN interfaces running in QDIO mode." - echo $" IPv6 is not supported on HiperSocket guest LAN, OSA-Express Token Ring, ATM." + echo $" IPv6 is not supported on HiperSockets guest LAN, OSA-Express Token Ring, ATM." fi } @@ -2007,13 +1963,13 @@ function hint_netmask_v4() { # <<EOF convince syntax highlighter that above shifts are no here documents if [ $(( ip & 0x80000000 )) -eq $(( 0x00000000 )) ]; then # class a - echo $"255.0.0.0" + echo "255.0.0.0" elif [ $(( ip & 0xC0000000 )) -eq $(( 0x80000000 )) ]; then # class b - echo $"255.255.0.0" + echo "255.255.0.0" elif [ $(( ip & 0xE0000000 )) -eq $(( 0xC0000000 )) ]; then # class c - echo $"255.255.255.0" + echo "255.255.255.0" else # some other class that should not be used as host address return 1 @@ -2523,7 +2479,9 @@ function parse_dasd() { esac done < <(echo $DASD | sed 's/,/\n/g') if [ "$handle" = "yes" ]; then - udevsettle + udevadm settle + # even though the device might now be online, some of its + # sysfs attributes might not yet be available sleep 1 fi if [ "$allgood" = "yes" ]; then @@ -2727,101 +2685,43 @@ function final_check() { ### MAIN ### -S390ARCH=`uname -m` -if [ "$S390ARCH" = "s390" ]; then - export S390ARCH="S/390" -else - export S390ARCH="zSeries" -fi +init_main -echo -echo $"Starting the $S390ARCH initrd to configure networking. Version is $VERSION" - -# set up env vars as we do in init.c -if [ `uname -m` = "s390x" ]; then - LD_LIBRARY_PATH=/lib64:/usr/lib64:/usr/X11R6/lib64:/usr/kerberos/lib64:/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/lib -else - LD_LIBRARY_PATH=/lib:/usr/lib:/usr/X11R6/lib:/usr/kerberos/lib +# Parse configuration +if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then + readcmsfile $CMSDASD $CMSCONFFILE + source /tmp/$CMSCONFFILE #2>/dev/null fi -export LD_LIBRARY_PATH - -PATH="$PATH:/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sysimage/bin:/mnt/sysimage/usr/bin:/mnt/sysimage/usr/sbin:/mnt/sysimage/sbin:/mnt/sysimage/usr/X11R6/bin" -export PATH -HOME=/ -export HOME -PYTHONPATH=/tmp/updates -export PYTHONPATH - -if [ -z "$testing" ]; then - - mount -t proc none /proc - mount -t tmpfs none /dev - createDevices - mount -t devpts /dev/pts /dev/pts - mount -t sysfs none /sys - # remount root fs rw - mount /dev/root / -o remount,rw - - # limit output on x3270 console - # (console_loglevel of 4 is just right to not get driver info, e.g. from qeth, - # since that would mix up with the user dialog) - echo "4 4 1 7" > /proc/sys/kernel/printk - - # make /tmp/ramfs - mount -t ramfs none /tmp - - ifconfig lo 127.0.0.1 netmask 255.0.0.0 - route add -host 127.0.0.1 dev lo - - echo -e "127.0.0.1\tlocalhost.localdomain localhost" > /etc/hosts - echo -e "::1\t\tlocalhost6.localdomain6 localhost6" >> /etc/hosts - - LO="" - - [ -L /sbin/insmod ] && LO=".ko" - - # udevd req'd by udevsettle in readcmsfile, dialog_network_table, and - # semantic_check_subchannels. - # (important to start udevd at the right time, e.g. after setup of /dev) - udevd --daemon - - # Parse configuration - if [ -n "$CMSDASD" -a -n "$CMSCONFFILE" ]; then - readcmsfile $CMSDASD $CMSCONFFILE - source /tmp/$CMSCONFFILE #2>/dev/null - fi - -fi # testing - -### MAIN (continuation) ### if [ -r /sys/firmware/ipl/ipl_type ]; then - if [ "`cat /sys/firmware/ipl/ipl_type`" = "fcp" ]; then - while [ 1 ]; do + #local ipl_type + read ipl_type < /sys/firmware/ipl/ipl_type + if [ "$ipl_type" = "fcp" ]; then + while : ; do echo $"Your IPL device is set to FCP." echo $"Would you like to perform a CD-ROM/DVD-ROM installation? (y/n)" + #local do_cd_install read do_cd_install case $do_cd_install in y|Y|[Yy][Ee][Ss]) - insert_module qdio$LO - insert_module scsi_mod$LO - insert_module scsi_transport_fc$LO - insert_module zfcp$LO - CD_DEVICE="`cat /sys/firmware/ipl/device`" - WWPN="`cat /sys/firmware/ipl/wwpn`" - LUN="`cat /sys/firmware/ipl/lun`" + # precondition: zfcp driver incl. dependencies loaded + #local CD_DEVICE WWPN LUN + read CD_DEVICE < /sys/firmware/ipl/device + read WWPN < /sys/firmware/ipl/wwpn + read LUN < /sys/firmware/ipl/lun if sysecho /proc/cio_ignore "free $CD_DEVICE"; then - udevsettle + udevadm settle + # even though device might now be online, some of its + # sysfs attributes might not yet be available sleep 1 else echo $"Device $CD_DEVICE could not be cleared from device blacklist" fi - echo 1 > /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/online - [ $? == 0 ] || echo $"Could not set FCP device $CD_DEVICE online" - echo $WWPN > /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/port_add - [ $? == 0 ] || echo $"Could not add WWPN $WWPN on FCP device $CD_DEVICE" - echo $LUN > /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/$WWPN/unit_add - [ $? == 0 ] || echo $"Could not add LUN $LUN at WWPN $WWPN on FCP device $CD_DEVICE" + sysecho /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/online 1 \ + || echo $"Could not set FCP device $CD_DEVICE online" + # port (WWPN) appears automatically + sysecho /sys/bus/ccw/drivers/zfcp/$CD_DEVICE/$WWPN/unit_add $LUN \ + || echo $"Could not add LUN $LUN at WWPN $WWPN on FCP device $CD_DEVICE" break ;; n|N|[Nn][Oo]) @@ -2846,7 +2746,6 @@ fi # [ -z "${cardtype//OSD_*/}" ] can be used to check for real OSA -# Parse configuration # Check for missing parameters, prompt for them if necessary while : ; do @@ -2862,7 +2761,7 @@ while : ; do echo $"* NOTE: To enter default or empty values press enter twice. *" fi do_nettype - tv load_kernel_modules + # precondition: driver (qeth/lcs/ctcm/netiucv) loaded incl. dependencies # only works, if ipv6 kernel module has been loaded before: [ "$NETTYPE" = "qeth" ] && tv disable_ipv6_autoconf if [ "$NETTYPE" != "iucv" ]; then @@ -2886,7 +2785,7 @@ while : ; do fi do_layer2 # set device online to know the device name - # and to know if it's OSD/HiperSocket/GuestLAN BUT do not + # and to know if it's OSD/HiperSockets/GuestLAN BUT do not # try to ifconfig the device up since that requires # setting the mac address before (if applicable). set_device_online || workflow_item_menu noredo @@ -2970,9 +2869,6 @@ while : ; do done # outer dialog loop -#echo $"Starting portmap." -#portmap - if [ -z "$testing" ]; then # convert to space-separated lists @@ -2989,18 +2885,13 @@ if [ -z "$testing" ]; then for i in $RESOLVDNS; do echo "nameserver $i"; done >> /etc/resolv.conf fi - # make sure we have an /etc/hosts file (required for telnetd) + # make sure we have an /etc/hosts file (originally required for telnetd) if [ ! -z "$HOSTNAME" -a ! -z "$IPADDR" ]; then - echo -e "$IPADDR\t$HOSTNAME `echo $HOSTNAME | cut -d '.' -f 1`" >> /etc/hosts + echo -e "$IPADDR\t$HOSTNAME $(echo $HOSTNAME | cut -d '.' -f 1)" >> /etc/hosts fi fi # testing -if [ -z "$testing" ]; then - # undo startup of udevd, only needed it for possible calls of udevsettle - killall udevd -fi # testing - if [ -n "$DASD" ]; then echo "DASD=$DASD" > /tmp/dasd_ports fi @@ -3015,16 +2906,6 @@ done # cio_ignore handling for FCP should happen when the content of /tmp/fcpconfig # will actually be processed which is in anaconda's zfcp.py ZFCP::readConfig() -if [ -z "$testing" ]; then - - grep -q ext3 /proc/filesystems - if [ "$?" != "0" ]; then - insmod jbd$LO - insmod ext3$LO - fi - -fi # testing - # TODO/FIXME: also need to pass IPv6 decision to loader/anaconda # [ "$ipv6" ] && echo "IPV6=yes" @@ -3051,9 +2932,9 @@ ONBOOT="yes" CTCPROT="$CTCPROT" EOF if [ "$ipv6" ]; then - echo DNS=\"`echo $DNS | cut -d ',' -f 1`\" >> /tmp/install.cfg + echo DNS=\"$(echo $DNS | cut -d ',' -f 1)\" >> /tmp/install.cfg else - echo DNS=\"`echo $DNS | cut -d ':' -f 1`\" >> /tmp/install.cfg + echo DNS=\"$(echo $DNS | cut -d ':' -f 1)\" >> /tmp/install.cfg fi cat >> /tmp/install.cfg << EOF export LANG PORTNAME S390ARCH TEXTDOMAIN TEXTDOMAINDIR @@ -3066,7 +2947,14 @@ EOF if [ -z "$testing" ]; then cat /tmp/install.cfg >> /etc/profile fi # testing -cat > /tmp/netinfo << EOF + +NETSCRIPTS="/etc/sysconfig/network-scripts" +IFCFGFILE="$NETSCRIPTS/ifcfg-$DEVICE" +if [ ! -d "$NETSCRIPTS" ]; then + mkdir -p $NETSCRIPTS +fi + +cat > $IFCFGFILE << EOF DEVICE=$DEVICE ONBOOT=yes BOOTPROTO=static @@ -3077,34 +2965,35 @@ MTU=$MTU SUBCHANNELS=$SUBCHANNELS EOF if [ "$ipv6" ]; then - [ "$DNS" != "" ] && echo "DNS=`echo $DNS | cut -d ',' -f 1`" >> /tmp/netinfo -else - [ "$DNS" != "" ] && echo "DNS=`echo $DNS | cut -d ':' -f 1`" >> /tmp/netinfo -fi -[ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> /tmp/netinfo -[ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> /tmp/netinfo -[ "$PORTNAME" != "" ] && echo "PORTNAME=$PORTNAME" >> /tmp/netinfo -[ "$CTCPROT" != "" ] && echo "CTCPROT=$CTCPROT" >> /tmp/netinfo -[ "$LAYER2" != "" ] && echo "LAYER2=$LAYER2" >> /tmp/netinfo -[ "$MACADDR" != "" ] && echo "MACADDR=$MACADDR" >> /tmp/netinfo -[ "$PORTNO" != "" ] && echo "PORTNO=$PORTNO" >> /tmp/netinfo -# also needs support in stage2 to make PORTNO persistent, -# i.e. OPTION="portno=1" in /etc/sysconfig/network-scripts/ifcfg-<netdevname> -# this is done by the loader starting with RHEL 5.3 -if [ "$ipv6" ]; then - cat >> /tmp/netinfo << EOF + cat >> $IFCFGFILE << EOF IPV6INIT=yes IPV6_AUTOCONF=no IPV6ADDR=$IPADDR/$NETMASK +IPV6_DEFAULTGW=$GATEWAY EOF # FIXME: /etc/sysconfig/network:IPV6_DEFAULTGW=$GATEWAY # /etc/sysconfig/network:NETWORKING_IPV6=yes else - cat >> /tmp/netinfo << EOF + cat >> $IFCFGFILE << EOF IPADDR=$IPADDR NETMASK=$NETMASK EOF fi +if [ "$ipv6" ]; then + [ "$DNS" != "" ] && echo "DNS=$(echo $DNS | cut -d ',' -f 1)" >> $IFCFGFILE +else + [ "$DNS" != "" ] && echo "DNS=$(echo $DNS | cut -d ':' -f 1)" >> $IFCFGFILE +fi +[ "$NETTYPE" != "" ] && echo "NETTYPE=$NETTYPE" >> $IFCFGFILE +[ "$PEERID" != "" ] && echo "PEERID=$PEERID" >> $IFCFGFILE +[ "$PORTNAME" != "" ] && echo "PORTNAME=$PORTNAME" >> $IFCFGFILE +[ "$CTCPROT" != "" ] && echo "CTCPROT=$CTCPROT" >> $IFCFGFILE +[ "$LAYER2" != "" ] && echo "LAYER2=$LAYER2" >> $IFCFGFILE +[ "$MACADDR" != "" ] && echo "MACADDR=$MACADDR" >> $IFCFGFILE +[ "$PORTNO" != "" ] && echo "PORTNO=$PORTNO" >> $IFCFGFILE +# also needs support in stage2 (loader.c,(net.c)) to make PORTNO persistent, +# i.e. OPTION="portno=1" in /etc/sysconfig/network-scripts/ifcfg-<netdevname> +# (see loader of RHEL 5.3) if [ -z "$testing" ]; then -- 1.6.3.1 _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list