summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2010-02-11 10:08:15 -1000
committerDavid Cantrell <dcantrell@redhat.com>2010-02-11 11:13:31 -1000
commitce6276243f69e7854dfe978554645af1bab2faf4 (patch)
treef60dc6c427bf58a74e1e238598878af8eaa73a32
parent38dd6b93704a739624a2669e24e613a74c5aaca0 (diff)
downloadanaconda-ce6276243f69e7854dfe978554645af1bab2faf4.tar.gz
anaconda-ce6276243f69e7854dfe978554645af1bab2faf4.tar.xz
anaconda-ce6276243f69e7854dfe978554645af1bab2faf4.zip
Use lsznet.raw from s390utils package (#563548).
The lsznet.raw and controlunits.sh files are now part of the s390-tools project, which is in the s390utils package. Remove our copies and make sure we use the ones from the s390utils package.
-rw-r--r--loader/Makefile.am2
-rw-r--r--loader/controlunits.sh104
-rw-r--r--loader/linuxrc.s39010
-rw-r--r--loader/lsznet.raw286
-rwxr-xr-xscripts/mk-images9
-rwxr-xr-xscripts/upd-instroot2
6 files changed, 13 insertions, 400 deletions
diff --git a/loader/Makefile.am b/loader/Makefile.am
index cfb7c7b3f..4d063bb29 100644
--- a/loader/Makefile.am
+++ b/loader/Makefile.am
@@ -27,7 +27,7 @@ noinst_HEADERS = *.h
if IS_S390
boot_PROGRAMS += shutdown
-dist_boot_SCRIPTS = linuxrc.s390 lsznet.raw controlunits.sh
+dist_boot_SCRIPTS = linuxrc.s390
else
boot_PROGRAMS += init
endif
diff --git a/loader/controlunits.sh b/loader/controlunits.sh
deleted file mode 100644
index 5364d76d6..000000000
--- a/loader/controlunits.sh
+++ /dev/null
@@ -1,104 +0,0 @@
-# controlunits.sh: define some common control unit mappings
-# Copyright (C) IBM Corp. 2009
-# Author: Steffen Maier <maier@de.ibm.com>
-#
-# 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.
-
-# 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.)
-readonly -a CU=(
- 1731/01
- 1731/05
- 3088/08
- 3088/1f
- 3088/1e
- 3088/01
- 3088/60
- 3088/61
-)
-
-# $CU_CARDTYPE array is the only one which may contain entries with spaces
-readonly -a CU_CARDTYPE=(
- "OSA (QDIO)"
- "HiperSocket"
- "CTC adapter"
- "escon channel"
- "ficon channel"
- "LCS p390"
- "LCS OSA"
- "LCS CLAW"
-)
-
-readonly -a CU_DEVDRV=(
- qeth
- qeth
- ctcm
- ctcm
- ctcm
- lcs
- lcs
- lcs
-)
-
-readonly -a CU_DEVNAME=(
- eth
- hsi
- ctc
- ctc
- ctc
- eth
- eth
- eth
-)
-
-readonly -a CU_GROUPCHANNELS=(
- 3
- 3
- 2
- 2
- 2
- 2
- 2
- 2
-)
-
-readonly -a CHPIDTYPES=(
- [0x10]=OSE
- [0x11]=OSD
- [0x24]=IQD
-)
-
-# 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 485002117..7b20286d4 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -31,7 +31,7 @@
# - 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
+# - lsznet.raw and znetcontrolunits from s390utils-base in /lib/s390-tools
# - pack kernel modules and module-init-tools (no longer use busybox for that)
# - "multi on" in /etc/host.conf [RH bugs 486457,486461,483244]
@@ -351,18 +351,14 @@ function udev_setup() {
declare -a nettable
function read_lsznet_output() {
- #local lsznet_output=/tmp/lsznet.raw
- #lsznet.raw > $lsznet_output
count=0
local line
while read line; do
nettable[$count]="$line"
count=$((count + 1))
- #done < $lsznet_output
- #rm -f $lsznet_output
# using the more sophisticated process substitution instead of temp file
# requires the symlink /dev/fd -> /proc/self/fd => createDevices
- done < <(lsznet)
+ done < <(/lib/s390-tools/lsznet.raw)
}
function print_nettable() {
@@ -515,7 +511,7 @@ declare -r BUSIDFORMAT=[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]
declare -r IDFORMAT=$PREFIXFORMAT.$SSIDFORMAT.$BUSIDFORMAT
declare -r SUBCHANNEL_TYPE_IO=0
-. /sbin/controlunits
+. /lib/s390-tools/znetcontrolunits
function cardtype2cleartext() {
local cardtype=$1
diff --git a/loader/lsznet.raw b/loader/lsznet.raw
deleted file mode 100644
index a95415377..000000000
--- a/loader/lsznet.raw
+++ /dev/null
@@ -1,286 +0,0 @@
-#! /bin/bash
-
-# lsznet.raw: list sensible network device hardware setups for Linux on s390(x)
-# Copyright (C) IBM Corp. 2008,2009
-# Author: Steffen Maier <maier@de.ibm.com>
-#
-# 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
-
-readonly SYSFS=/sys
-# DEBUG=0 turns off debugging. >=1 means increasing debugging.
-readonly DEBUG=0
-
-# nothing to be changed below here
-
-export TEXTDOMAIN=lsznet.raw
-
-readonly CMD=${0##*/}
-
-function error() {
- echo $"$CMD: ERROR: $*" 1>&2
- exit 1;
-}
-
-# currently requires bash version 3.0 or later
-# (this seems reasonable since bash-3.0 has been shipped with
-# RHEL 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7;
-# bash-3.1 with RHEL 5.0, 5.1; and bash-3.2 with RHEL 5.2)
-if [ ${BASH_VERSINFO[0]} -lt 3 -o \
- ${BASH_VERSINFO[1]} -lt 0 ]; then
- error $"only works with BASH version 3.0 or later (current version used is ${BASH_VERSION})"
-fi
-
-# the script was designed for Linux kernel 2.6 and might work with newer ones
-kernel_version=$(uname -r)
-IFS=.
-read krn_ver krn_patch krn_foo <<< "$kernel_version"
-unset IFS
-if [ $krn_ver -lt 2 -o $krn_patch -lt 6 ]; then
- error $"only works for kernel versions 2.6 or probably later"
-fi
-
-. /sbin/controlunits
-
-readonly PREFIXFORMAT=[[:xdigit:]]*
-readonly SSIDFORMAT=[0-3]
-readonly BUSIDFORMAT=[[:xdigit:]][[:xdigit:]][[:xdigit:]][[:xdigit:]]
-readonly IDFORMAT=$PREFIXFORMAT.$SSIDFORMAT.$BUSIDFORMAT
-readonly SUBCHANNEL_TYPE_IO=0
-
-function debug() {
- level=$1
- shift
- [ $DEBUG -ge $level ] && echo "$*" 1>&2
-}
-
-# Returns symbolic name of CHPID type in $chpidtype_symbolic,
-# if an entry in the array $CHPIDTYPES has been found at index of argument 1.
-# Returns "?" otherwise.
-# Always succeeds and returns 0.
-function search_chpt() {
- local chpidtype_number=$1
- chpidtype_symbolic=${CHPIDTYPES[$((0x$chpidtype_number))]}
- if [ "$chpidtype_symbolic" == "" ]; then
- chpidtype_symbolic="?"
- fi
- return 0
-}
-
-# build_list:
-#
-# Prints list on standard output consisting of all subchannels and
-# ccwdevices whose control unit type/model match supported network
-# device types on s390. Each matching entry is accompanied with
-# (almost all) corresponding attributes.
-#
-function build_list() {
- # use /sys/devices/css*/ for startpath
- readonly STARTPATH=$SYSFS/devices
- # change to base directory so path globbing length with find is minimal
- cd $STARTPATH
- # fail out gracefully, if there is not expected sysfs environment
- # (could even fail out near the top, if $(uname -m) != s390x)
- csses=css$PREFIXFORMAT
- for d in $csses; do
- [ -d $d ] || exit
- done
- find $csses -name "$IDFORMAT" |
- while read dir; do
- debug 6 " examining sysfs directory $dir"
- # must not use $...FORMAT (file globs) here since this is a regex:
- [[ "$dir" =~ ^css([[:xdigit:]]+)/([[:xdigit:]]+\.[0-3]\.[[:xdigit:]]{4})/([[:xdigit:]]+\.[0-3]\.[[:xdigit:]]{4})$ ]]
- case $? in
- 0)
- # string matched the pattern
- debug 6 " ${BASH_REMATCH[@]}"
- prefix=${BASH_REMATCH[1]}
- subch=${BASH_REMATCH[2]}
- devbusid=${BASH_REMATCH[3]}
- subch_p=css$prefix/$subch
- dev_p=$subch_p/$devbusid
- debug 6 " $subch_p $dev_p"
- ;;
- 1)
- # string did not match the pattern
- continue
- ;;
- 2)
- error $"syntax error in regex of match operator =~, code needs to be fixed"
- ;;
- *)
- error $"unexpected return code of regex match operator =~, code needs to be fixed"
- ;;
- esac
- debug 5 " sysfs directory matched regex $dir"
- # skip non-I/O-subchannels, i.e. chsc and message subchannels
- if [ -f $subch_p/type ]; then
- read type < $subch_p/type
- if [ $type != $SUBCHANNEL_TYPE_IO ]; then
- debug 3 " skip non-I/O subchannel"
- continue
- fi
- fi
- # get subchannel information...
- # ATTENTION: hex values from sysfs are WITHOUT leading 0x prefix!
- read chpid_list < $subch_p/chpids
- read -a chpids <<< "$chpid_list"
- if [ ${#chpids[@]} -ne 8 ]; then
- error $"sysfs reported ${#chpids[@]} CHPIDs instead of expected 8"
- fi
- read pim pam pom foo < $subch_p/pimpampom
- pimchpidZ=""
- local chp
- for ((chp=0; chp < 8; chp++)); do
- mask=$((0x80 >> chp))
- if (( 0x$pim & $mask )); then
- pimchpidZ=${pimchpidZ}${chpids[chp]}
- else
- pimchpidZ=${pimchpidZ}"ZZ"
- fi
- done
- # get device information...
- read cutype < $dev_p/cutype
- read active < $dev_p/online
- # skip already active subchannels and those that are already in a
- # ccwgroup and thus not available any more:
- [ $active == "1" ] && continue
- [ -h $dev_p/group_device ] && continue
- # get chpid information...
- pimchpids=${pimchpidZ//ZZ/}
- [ $pimchpids == "" ] && continue
- # Taking the first 2 hex digits as CHPID relies somewhat on the fact
- # that network adaptors don't use multipathing and only have one CHP.
- # Anyway it's OK since we're only interested in CHPID type and I guess
- # this should be equal for all possible multipaths to the same device.
- chpid=${pimchpids:0:2}
- chpid_p=css$prefix/chp$prefix.$chpid
- read chptype < $chpid_p/type
- # filter and output...
- if search_cu $cutype; then
- if [ "${CU_DEVDRV[$cu_idx]}" == "ctc" ]; then
- # assume CTC are mostly virtual and ignore chpid from sysfs
- chpidtype_symbolic="-"
- else
- search_chpt $chptype
- fi
- echo $pimchpids $devbusid $STARTPATH/$dev_p $cutype $chpidtype_symbolic $chptype ${CU_DEVDRV[$cu_idx]} ${CU_DEVNAME[$cu_idx]} ${CU_GROUPCHANNELS[$cu_idx]} $cu_idx ${CU_CARDTYPE[$cu_idx]}
- else
- debug 5 " skip non-network device $devbusid CU $cutype"
- fi
- done
-}
-
-# search_groups:
-#
-# Prints enumeration list on standard output consisting of possible
-# hardware configurations (ccwgroups) for network devices on s390.
-# Each configuration suggestion includes corresponding attributes
-# that are of potential interest for the user and fit in a fixed column
-# table on an 80 column screen.
-#
-# PRECONDITION: Standard input has to be stably sorted by device bus IDs and
-# then by CHPIDs, i.e. grouped by CHPIDs.
-#
-function search_groups() {
- local w_prefix w_ssid w_devno
- local d_prefix d_ssid d_devno
- local prefix ssid devno x
- local chp devbusid dev_p cutype chpidtypename chptype devdrv devname groupchs cu_idx cardtype
- # remembered last state variables for possible ccwgroup:
- local r_prefix="Z"
- local r_ssid="Z"
- local r_devno="ZZZZ"
- local r_chp="ZZ"
- local r_cutype="ZZZZ/ZZ"
- local count=0
- local item=1
- local skipped=0
- # currently unused are: dev_p,chptype, cu_idx.
- while read chp devbusid dev_p cutype chpidtypename chptype devdrv devname groupchs cu_idx cardtype; do
- debug 1 " # $chp $devbusid $dev_p $cutype $chpidtypename $chptype $devdrv $devname $groupchs $cu_idx $cardtype"
- IFS=.
- read prefix ssid devno x <<< "$devbusid"
- unset IFS
- if [ $r_chp != $chp \
- -o $r_prefix != $prefix \
- -o $r_ssid != $ssid \
- -o $r_cutype != $cutype ]; then
- # restart with new read channel info and remember it
- r_prefix=$prefix
- r_ssid=$ssid
- r_devno=$devno
- r_chp=$chp
- r_cutype=$cutype
- count=1
- debug 2 " INFO: restart on different CHPID or prefix or CUtype/model"
- continue
- fi
- count=$((count + 1))
- if [ $count -eq 2 ]; then
- # about to check if write channel is one above read channel
- if [ $((0x$devno)) -ne $((0x$r_devno + 1)) ]; then
- # start with new read channel info
- r_prefix=$prefix
- r_ssid=$ssid
- r_devno=$devno
- r_chp=$chp
- r_cutype=$cutype
- count=1
- skipped=$((skipped + 1))
- # unimplemented possible packed channel usage option:
- # remember unused channels for later use as data channel
- debug 2 " INFO: restart on unmatching read channel"
- continue
- fi
- w_prefix=$prefix
- w_ssid=$ssid
- w_devno=$devno
- elif [ $count -eq 3 ]; then
- # remember data channel info
- d_prefix=$prefix
- d_ssid=$ssid
- d_devno=$devno
- fi
- debug 2 " INFO: groupchs=$groupchs count=$count"
- if [ $count -ne $groupchs ]; then
- debug 2 " INFO: skip"
- continue
- fi
- # found possible ccwgroup
- case $count in
- 2)
- chlist=$r_prefix.$r_ssid.$r_devno,$w_prefix.$w_ssid.$w_devno
- ;;
- 3)
- chlist=$r_prefix.$r_ssid.$r_devno,$w_prefix.$w_ssid.$w_devno,$d_prefix.$d_ssid.$d_devno
- ;;
- *)
- error $"unknown number of channels for group, code needs to be fixed"
- ;;
- esac
- echo $item $cutype $chp $chpidtypename $devdrv $devname $chlist "$cardtype"
- item=$((item + 1))
- # restart after successful detection
- r_prefix="Z"
- count=0
- done
- debug 1 " STATISTIC: skipped $skipped devnos because of unmatching read channel"
-}
-
-build_list |
-# stable sort by device bus IDs and then by CHPIDs => grouped by CHPIDs
-# (sorting only works since keys are fixed no. of digits with leading zeros!)
-sort -s -k 1,1 -k 2,2 |
-#cat ; exit # move at desired line and uncomment to see intermediate output
-search_groups
diff --git a/scripts/mk-images b/scripts/mk-images
index eaf62705e..92121b9ea 100755
--- a/scripts/mk-images
+++ b/scripts/mk-images
@@ -605,6 +605,13 @@ makeinitrd() {
instbin $IMGPATH /usr/sbin/$cmd $MBD_DIR /sbin/$cmd
done
+ # lsznet requirements
+ mkdir -p $MBD_DIR/lib/s390-tools
+ for lsznetbin in lsznet.raw znetcontrolunits ; do
+ target="/lib/s390-tools/$lsznetbin"
+ instbin $IMGPATH $target $MBD_DIR $target
+ done
+
# required for lsznet
instbin $IMGPATH /usr/bin/sort $MBD_DIR /sbin/sort
@@ -648,8 +655,6 @@ makeinitrd() {
else
instbin $IMGPATH ${LOADERBINDIR##$IMGPATH}/shutdown $MBD_DIR /sbin/shutdown
instbin $IMGPATH /usr/lib/anaconda-runtime/loader/linuxrc.s390 $MBD_DIR /sbin/init
- instbin $IMGPATH /usr/lib/anaconda-runtime/loader/lsznet.raw $MBD_DIR /sbin/lsznet
- instbin $IMGPATH /usr/lib/anaconda-runtime/loader/controlunits.sh $MBD_DIR /sbin/controlunits
instbin $IMGPATH /usr/sbin/dasdfmt $MBD_DIR /sbin/dasdfmt
fi
diff --git a/scripts/upd-instroot b/scripts/upd-instroot
index a6c65eea9..ec57f316f 100755
--- a/scripts/upd-instroot
+++ b/scripts/upd-instroot
@@ -711,6 +711,8 @@ bin/tar
bin/uname
bin/vi
lib/modules/ibm
+lib/s390-tools/lsznet.raw
+lib/s390-tools/znetcontrolunits
lib/security
sbin/arp
sbin/cmsfscat