summaryrefslogtreecommitdiffstats
path: root/loader2
diff options
context:
space:
mode:
Diffstat (limited to 'loader2')
-rw-r--r--loader2/Makefile13
-rw-r--r--loader2/cdinstall.c7
-rw-r--r--loader2/hardware.c95
-rw-r--r--loader2/hardware.h5
-rw-r--r--loader2/init.c3
-rw-r--r--loader2/linuxrc.s390424
-rw-r--r--loader2/loader.c50
-rw-r--r--loader2/modules.c19
-rw-r--r--loader2/modules.h4
-rw-r--r--loader2/net.c53
10 files changed, 604 insertions, 69 deletions
diff --git a/loader2/Makefile b/loader2/Makefile
index 45fa2f51e..778db6adf 100644
--- a/loader2/Makefile
+++ b/loader2/Makefile
@@ -30,14 +30,14 @@ SOURCES = $(subst .o,.c,$(OBJS)) loader.c
HWLIBS = -lkudzu_loader -lpci
DEBUG = -ggdb
-COPTS = $(DEBUG) -Os -Wall -DVERSION='"$(VERSION)"'
+COPTS = $(DEBUG) -Os -Wall -DUSE_LOGDEV -DVERSION='"$(VERSION)"'
CFLAGS = $(COPTS) -ffunction-sections -D_GNU_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBIO_H
STATIC = -static
+REALCC=gcc
ifeq (1, $(USEDIET))
CFLAGS += -DGZLIB=1
DIET=diet
-REALCC=gcc
CC=$(DIET) $(REALCC)
BTERMLIB = -lbtermdiet -lbogldiet
WLITELIB = -lwlitediet
@@ -51,8 +51,8 @@ else
OBJS += wcstubs.o
endif
-ifeq (i386, $(ARCH))
-COPTS += -DUSE_LOGDEV
+ifneq (,$(filter s390 s390x,$(ARCH)))
+BINS += linuxrc.s390
endif
# translation stuff
@@ -80,6 +80,9 @@ loader.po: $(wildcard *.c)
xgettext --default-domain=loader --add-comments \
--keyword=_ --keyword=N_ *.c
+linuxrc.s390:
+ @echo "Nothing to do for $@"
+
init: init.o
$(CC) $(STATIC) $(COPTS) $(LDFLAGS) -o $@ init.o
@@ -118,7 +121,7 @@ install: all
mkdir -p $(DESTDIR)/$(RUNTIMEDIR)/loader
for n in $(BINS); do \
install -m 755 $$n $(DESTDIR)/$(RUNTIMEDIR)/loader; \
- strip $(DESTDIR)/$(RUNTIMEDIR)/loader/$$n; \
+ strip $(DESTDIR)/$(RUNTIMEDIR)/loader/$$n || :; \
done
install -m 644 loader.tr $(DESTDIR)/$(RUNTIMEDIR)/loader
install -m 644 module-info $(DESTDIR)/$(RUNTIMEDIR)/loader
diff --git a/loader2/cdinstall.c b/loader2/cdinstall.c
index f9366f660..1db6c2700 100644
--- a/loader2/cdinstall.c
+++ b/loader2/cdinstall.c
@@ -26,10 +26,7 @@
#include <sys/mount.h>
#include <sys/ioctl.h>
#include <unistd.h>
-
-#if !defined(__s390__) && !defined(__s390x__)
#include <linux/cdrom.h>
-#endif
#include "kickstart.h"
#include "loader.h"
@@ -49,9 +46,6 @@ static int getISOStatusFromFD(int isofd, char *mediasum);
/* ejects the CD device the device node /tmp/cdrom points at */
void ejectCdrom(void) {
-#if defined(__s390__) || defined(__s390x__)
- return;
-#else
int ejectfd;
logMessage("ejecting /tmp/cdrom...");
@@ -62,7 +56,6 @@ void ejectCdrom(void) {
} else {
logMessage("eject failed %d ", errno);
}
-#endif
}
/*
diff --git a/loader2/hardware.c b/loader2/hardware.c
index 569d7dade..bc92e61da 100644
--- a/loader2/hardware.c
+++ b/loader2/hardware.c
@@ -6,7 +6,7 @@
* Michael Fulbright <msf@redhat.com>
* Jeremy Katz <katzj@redhat.com>
*
- * Copyright 1997 - 2002 Red Hat, Inc.
+ * Copyright 1997 - 2003 Red Hat, Inc.
*
* This software may be freely redistributed under the terms of the GNU
* General Public License.
@@ -21,6 +21,7 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <ctype.h>
#include "loader.h"
#include "hardware.h"
@@ -30,6 +31,21 @@
/* JKFIXME: this is the same hack as in loader.c for second stage modules */
extern struct moduleBallLocation * secondStageModuleLocation;
+/* returns whether or not we can probe devices automatically or have to
+ * ask for them manually. */
+int canProbeDevices(void) {
+#if defined(__s390__) || defined(__s390x__)
+ return 1;
+#endif
+
+ if ((access("/proc/bus/pci/devices", R_OK) &&
+ access("/proc/openprom", R_OK) &&
+ access("/proc/iSeries", R_OK)))
+ return 0;
+
+ return 1;
+}
+
static int detectHardware(moduleInfoSet modInfo,
char *** modules, int flags) {
struct device ** devices, ** device;
@@ -166,7 +182,7 @@ int scsiTapeInitialize(moduleList modLoaded, moduleDeps modDeps,
kudzu can autodetect and setup printers in post install*/
void initializeParallelPort(moduleList modLoaded, moduleDeps modDeps,
moduleInfoSet modInfo, int flags) {
- /* JKFIXME: this can be used on other arches too... */
+ /* JKFIXME: this could be useful on other arches too... */
#if !defined (__i386__)
return;
#endif
@@ -184,6 +200,7 @@ void initializeParallelPort(moduleList modLoaded, moduleDeps modDeps,
void updateKnownDevices(struct knownDevices * kd) {
kdFindIdeList(kd, 0);
kdFindScsiList(kd, 0);
+ kdFindDasdList(kd, 0);
kdFindNetList(kd, 0);
}
@@ -199,8 +216,7 @@ int busProbe(moduleInfoSet modInfo, moduleList modLoaded, moduleDeps modDeps,
if (FL_NOPROBE(flags)) return 0;
- if (!access("/proc/bus/pci/devices", R_OK) ||
- !access("/proc/openprom", R_OK)) {
+ if (canProbeDevices()) {
/* autodetect whatever we can */
if (detectHardware(modInfo, &modList, flags)) {
logMessage("failed to scan pci bus!");
@@ -240,3 +256,74 @@ void ideSetup(moduleList modLoaded, moduleDeps modDeps,
struct knownDevices * kd) {
mlLoadModuleSet("ide-cd", modLoaded, modDeps, modInfo, flags);
}
+
+
+/* check if the system has been booted with dasd parameters */
+/* These parameters define the order in which the DASDs */
+/* are visible to Linux. Otherwise load dasd modules probeonly, */
+/* then parse proc to find active DASDs */
+/* Reload dasd_mod with correct range of DASD ports */
+void dasdSetup(moduleList modLoaded, moduleDeps modDeps,
+ moduleInfoSet modInfo, int flags,
+ struct knownDevices * kd) {
+#if !defined(__s390__) && !defined(__s390x__)
+ return;
+#else
+ char **dasd_parms;
+ char *line, *ports = NULL;
+ char *parms = NULL, *parms_end;
+ FILE *fd;
+
+ dasd_parms = malloc(sizeof(*dasd_parms) * 2);
+ dasd_parms[0] = NULL;
+ dasd_parms[1] = NULL;
+
+ fd = fopen ("/proc/cmdline", "r");
+ if(fd) {
+ line = (char *)malloc(sizeof(char) * 200);
+ while (fgets (line, 199, fd) != NULL) {
+ if((parms = strstr(line, " dasd=")) ||
+ (parms = strstr(line, " DASD="))) {
+ parms++;
+ strncpy(parms, "dasd", 4);
+ parms_end = parms;
+ while(*parms_end && !(isspace(*parms_end))) parms_end++;
+ *parms_end = '\0';
+ break;
+ }
+ }
+ fclose(fd);
+ free(line);
+ }
+ if(!parms || (strlen(parms) == 5)) {
+ parms = NULL;
+ } else {
+ dasd_parms[0] = strdup(parms);
+ mlLoadModule("dasd_mod", modLoaded, modDeps, modInfo,
+ dasd_parms, flags);
+
+ mlLoadModuleSet("dasd_diag_mod:dasd_fba_mod:dasd_eckd_mod",
+ modLoaded, modDeps, modInfo, flags);
+ return;
+ }
+ if(!parms) {
+ mlLoadModuleSet("dasd_mod:dasd_diag_mod:dasd_fba_mod:dasd_eckd_mod",
+ modLoaded, modDeps, modInfo, flags);
+ if((ports = getDasdPorts())) {
+ parms = (char *)malloc(strlen("dasd=") + strlen(ports) + 1);
+ strcpy(parms,"dasd=");
+ strcat(parms, ports);
+ dasd_parms[0] = parms;
+ simpleRemoveLoadedModule("dasd_eckd_mod", modLoaded, flags);
+ simpleRemoveLoadedModule("dasd_fba_mod", modLoaded, flags);
+ simpleRemoveLoadedModule("dasd_diag_mod", modLoaded, flags);
+ simpleRemoveLoadedModule("dasd_mod", modLoaded, flags);
+ reloadUnloadedModule("dasd_mod", modLoaded, dasd_parms, flags);
+ reloadUnloadedModule("dasd_eckd_mod", modLoaded, NULL, flags);
+ free(dasd_parms);
+ free(ports);
+ }
+ }
+#endif
+}
+
diff --git a/loader2/hardware.h b/loader2/hardware.h
index 54dccff3b..4d7ec319e 100644
--- a/loader2/hardware.h
+++ b/loader2/hardware.h
@@ -4,6 +4,8 @@
#include "modules.h"
#include "../isys/probe.h"
+int canProbeDevices(void);
+
int agpgartInitialize(moduleList modLoaded, moduleDeps modDeps,
moduleInfoSet modInfo, int flags);
int scsiTapeInitialize(moduleList modLoaded, moduleDeps modDeps,
@@ -21,5 +23,8 @@ void scsiSetup(moduleList modLoaded, moduleDeps modDeps,
void ideSetup(moduleList modLoaded, moduleDeps modDeps,
moduleInfoSet modInfo, int flags,
struct knownDevices * kd);
+void dasdSetup(moduleList modLoaded, moduleDeps modDeps,
+ moduleInfoSet modInfo, int flags,
+ struct knownDevices * kd);
#endif
diff --git a/loader2/init.c b/loader2/init.c
index aa6f522b0..9a33cd326 100644
--- a/loader2/init.c
+++ b/loader2/init.c
@@ -744,6 +744,9 @@ int main(int argc, char **argv) {
dup2(fd, 1);
dup2(fd, 2);
close(fd);
+#else
+ dup2(0, 1);
+ dup2(0, 2);
#endif
setsid();
diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390
new file mode 100644
index 000000000..99ce5fd26
--- /dev/null
+++ b/loader2/linuxrc.s390
@@ -0,0 +1,424 @@
+#! /bin/sh
+#
+# Copyright (C) 2000,2001,2002 by
+# Bernhard Rosenkraenzer <bero@redhat.com>
+# Oliver Paukstadt <opaukstadt@millenux.com>
+# Karsten Hopp <karsten@redhat.de>
+# Florian La Roche <laroche@redhat.com>
+# Nils Philippsen <nils@redhat.de>
+# Helge Deller <hdeller@redhat.de>
+# David Sainty <dsainty@redhat.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; either version 2 of the License, or
+# (at your option) any later version.
+#
+# 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
+#
+VERSION=1.01
+
+export TEXTDOMAIN=s390installer
+export TEXTDOMAINDIR=/usr/lib/locale
+
+debugshell()
+{
+ echo $"You have defined DEBUG, so here is a shell. You can use 'exit'"
+ echo $"to go on with the normal installation process."
+ /bin/sh
+}
+
+startinetd()
+{
+ echo
+ echo $"Starting telnetd and sshd to allow login over the network."
+ echo $"Welcome to the Red Hat Linux install environment $VERSION for $S390ARCH" > /etc/issue.net
+ echo $"Welcome to the Red Hat Linux install environment $VERSION for $S390ARCH" > /etc/motd
+ echo >> /etc/motd
+ echo $"Now run 'loader' to install Red Hat Linux." >> /etc/motd
+ echo >> /etc/motd
+
+ /sbin/xinetd -stayalive -reuse -pidfile /tmp/xinetd.pid
+ /sbin/sshd
+ while : ; do
+ echo
+ echo $"Please connect now to $IPADDR and start 'loader' from this shell."
+ ls -l /bin/sh | grep -q bash && /bin/sh --login || /bin/sh -l
+ done
+}
+
+S390ARCH=`uname -m`
+if [ "$S390ARCH" = "s390" ]; then
+ export S390ARCH="S/390"
+else
+ export S390ARCH="zSeries"
+fi
+
+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
+
+# limit output on x3270 console
+mount -t proc none /proc
+mount -t devpts /dev/pts /dev/pts
+echo "1 4 1 1" > /proc/sys/kernel/printk
+
+mkdir /OCO
+mount -t ext2 /dev/ram /OCO >/dev/null 2>&1
+# if there is no second initrd, remove mountpoint because
+# anaconda checks for its existance:
+if [ "$?" != "0" ]; then
+ rm -rf /OCO 2>/dev/null
+fi
+
+ifconfig lo 127.0.0.1 netmask 255.0.0.0
+route add -host 127.0.0.1 dev lo 2>/dev/null
+
+[ -n "$DEBUG" ] && debugshell
+
+LO=""
+
+[ -L /sbin/insmod ] && LO=".o"
+
+# read in configuration as set by the parm file
+if [ -n "$HOST" ]; then
+ set -- `echo $HOST |sed 's/:/ /g'`
+ HOSTNAME=$1
+ DEVICE=$2
+ NETTYPE=`echo $DEVICE |sed -e 's/[0-9].*//'`
+ IPADDR=$3
+ if [ ":$NETTYPE" = ":iucv" ]; then
+ IUCV="iucv=$4"
+ GATEWAY=$5
+ MTU=$6
+ elif [ ":$NETTYPE" = ":ctc" -o ":$NETTYPE" = ":escon" ]; then
+ GATEWAY=$4
+ MTU=$5
+ else
+ echo $4 | grep -q "\." && MTU=$4 || echo "Invalid MTU $4, skipping"
+ fi
+fi
+if [ -n "$MTU" ]; then
+ MMTU="mtu $MTU"
+else
+ if [ "$NETTYPE" = "ctc" ]; then
+ MMTU="mtu 4096"
+ MTU="4096"
+ IMTU="1"
+ fi
+fi
+if [ -n "$NETWORK" ]; then
+ set -- `echo $NETWORK | sed 's/:/ /g'`
+ NETWORKIP=$1
+ NETMASK=$2
+ BROADCAST=$3
+ if [ ":$NETTYPE" != ":ctc" -a ":$NETTYPE" != ":iucv" -a ":$NETTYPE" != ":escon" ]; then
+ GATEWAY=$4
+ fi
+fi
+
+
+# Parse configuration
+# Check for missing parameters, prompt for them if necessary
+while [ -z "$HOSTNAME" ]; do
+ echo $"Please enter the FQDN of your new Linux guest (e.g. s390.redhat.com):"
+ read HOSTNAME
+done
+while [ -z "$NETTYPE" ]; do
+ echo $"Please enter which kind of network device do you intend to use"
+ echo " (e.g. ctc, escon, iucv, eth, hsi, tr):"
+ read NETTYPE
+done
+DEVICE=${NETTYPE}0
+if [ ":$NETTYPE" != ":iucv" ]; then # iucv is the only interface without chandev config
+ while [ -z "$CHANDEV" ]; do
+ echo $"Please enter parameters you need to pass to the channel device layer."
+ echo $"This includes the I/O ports of your ctc, escon, qeth, hsi and lcs devices."
+ echo $"Additional parameters for QETH devices such as the portname"
+ echo $"should be entered at the next prompt, not here !"
+ echo $"(e.g. \"ctc0,0x600,0x601\" will activate the ctc0 interface at I/O"
+ echo $"ports 0x600,0x601):"
+ read CHANDEV
+ done
+ echo "$CHANDEV" |grep -q "qeth"
+ if [ "$?" = "0" ]; then
+ if [ -z "$QETHPARM" ]; then
+ echo $"Each OSA-Express feature in QDIO mode must be associated with a port name"
+ echo $"Please enter additional parameters for your QETH device"
+ echo $"(e.g. \"add_parms,0x10,{lo_devno,hi_devno},portname:port_name\")"
+ echo $"Press enter if you don't want to enter additional parameters"
+ read QETHPARM
+ if [ -z "$QETHPARM" ]; then
+ echo $"You have been warned, but this will not work without an associated portname"
+ fi
+ fi
+ fi
+ echo "$CHANDEV" |grep -q "hsi"
+ if [ "$?" = "0" ]; then
+ if [ -z "$QETHPARM" ]; then
+ echo $"Please enter additional parameters for your HSI device"
+ echo $"(e.g. \"add_parms,0x10,{lo_devno,hi_devno},portname:port_name\")"
+ echo $"Press enter if you don't want to enter additional parameters"
+ read QETHPARM
+ fi
+ fi
+ [ -n "$CHANDEV" ] && echo "$CHANDEV" >/proc/chandev
+ [ -n "$QETHPARM" ] && echo "$QETHPARM" >/proc/chandev
+ [ -n "$CHANDEV" ] && echo "reprobe" >/proc/chandev
+fi
+if [ ":$NETTYPE" = ":eth" ] || [ ":$NETTYPE" = ":tr" ] || [ ":$NETTYPE" = ":hsi" ]; then
+ while [ -z "$IPADDR" ]; do
+ echo $"Please enter the IP address of your new Linux guest:"
+ read IPADDR
+ done
+ while [ -z "$NETWORK" ]; do
+ echo $"Enter the network address of the new Linux guest:"
+ read NETWORK
+ done
+ while [ -z "$NETMASK" ]; do
+ echo $"Enter the netmask for the new Linux guest (e.g. 255.255.255.0):"
+ read NETMASK
+ done
+ while [ -z "$BROADCAST" ]; do
+ echo $"Enter the broadcast address for the new Linux guest:"
+ read BROADCAST
+ done
+fi
+
+if [ ":$NETTYPE" = ":eth" ] || [ ":$NETTYPE" = ":tr" ] || [ ":$NETTYPE" = ":hsi" ]; then
+ while [ -z "$GATEWAY" ]; do
+ echo $"Please enter your default gateway:"
+ read GATEWAY
+ done
+ if echo "$CHANDEV" |grep -q "lcs"; then
+ LCS="on"
+ fi
+ # qeth and nettype!= eth is hipersockets !
+ if echo "$CHANDEV" |grep -q "qeth"; then
+ if echo "$NETTYPE" |grep -q "eth"; then
+ QETH="on"
+ elif echo "$NETTYPE" |grep -q "hsi"; then
+ HSI="on"
+ elif echo "$NETTYPE" |grep -q "tr"; then
+ TR="on"
+ fi
+ fi
+else # ctc0, escon0, iucv0
+ while [ -z "$GATEWAY" ]; do
+ echo $"Enter the IP of your ctc/escon/iucv point-to-point partner:"
+ read GATEWAY
+ done
+ if [ "$NETTYPE" = "ctc" ]; then
+ MMTU="mtu 4096"
+ MTU="4096"
+ IMTU="1"
+ else
+ echo $"Enter the maximal transfer unit (MTU) for this connection or leave empty:"
+ read MTU
+ if [ -n "$MTU" ]; then
+ MMTU="mtu 4096"
+ fi
+ fi
+
+ if [ ":$NETTYPE" = ":iucv" ]; then
+ while [ -z "$IUCV" ]; do
+ echo $"Enter iucv kernel module options (usually iucv=HOST,"
+ echo $"where HOST is TCPIP for VM, \$TCPIP for VIF):"
+ read IUCV
+ done
+ fi
+fi
+
+# configure network-interface
+KERNELVERSION=`cat /proc/version | awk '{ print $3 }'`
+if [ ":$NETTYPE" = ":ctc" -o ":$NETTYPE" = ":escon" ]; then
+ insmod ctc$LO $CTC
+ ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY
+ route add -host $IPADDR dev $DEVICE 2>/dev/null
+elif [ ":$NETTYPE" = ":iucv" ]; then
+ insmod netiucv$LO $IUCV
+ ifconfig $DEVICE $IPADDR $MMTU pointopoint $GATEWAY
+ route add -host $IPADDR dev $DEVICE 2>/dev/null
+else # lcs, tr, qeth, hsi or older kernel without opensource-lcs
+ if [ "$DEVICE" = "eth0" -a "$HSI" = "on" ]; then
+ DEVICE="hsi0"
+ fi
+ insmod ipv6$LO
+ if [ -n "$LCS" ]; then
+ insmod -f lcs$LO
+ if [ "$?" = "1" ]; then
+ echo $"warning: no lcs module found in the first initrd, "
+ echo $" looking for second initrd"
+ else
+ ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST
+ route add -net $NETWORK netmask $NETMASK dev $DEVICE 2>/dev/null
+ fi
+ fi
+ if [ -d "/OCO" ]; then
+ if [ -n "$LCS" ]; then
+ if [ -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/lcs.o ]; then
+ insmod -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/lcs$LO
+ else
+ echo $"error: no lcs module found"
+ fi
+ else # qeth or hsi
+ if [ -f /OCO/$KERNELVERSION/kernel/drivers/s390/qdio.o -a -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/qeth.o ]; then
+ insmod -f /OCO/$KERNELVERSION/kernel/drivers/s390/qdio$LO
+ insmod -f /OCO/$KERNELVERSION/kernel/drivers/s390/net/qeth$LO
+ else
+ echo $"error: The qdio and the qeth modules are needed for this"
+ echo $"They cannot be found in /OCO/$KERNELVERSION/kernel/drivers/s390/, skipping..."
+ fi
+ fi
+ ifconfig $DEVICE $IPADDR $MMTU netmask $NETMASK broadcast $BROADCAST
+ route add -net $NETWORK netmask $NETMASK dev $DEVICE 2>/dev/null
+ fi
+fi
+route add default gw $GATEWAY dev $DEVICE 2>/dev/null
+
+if [ -z "$DNS" ]; then
+ echo $"Please enter your DNS server(s), separated by colons (:):"
+ read DNS
+fi
+if [ -z "$DNS" ]; then
+ echo $"You might encounter problems without a nameserver, especially"
+ echo $"with FTP installs"
+fi
+
+if [ -n "$DNS" -a -z "$SEARCHDNS" ]; then
+ echo $"Please enter your DNS search domain(s) (if any), separated by colons (:):"
+ read SEARCHDNS
+fi
+
+[ -n "$HOSTNAME" ] && hostname $HOSTNAME
+
+# show interfaces and routing table
+ifconfig -a
+route -n
+
+[ -n "$DEBUG" ] && debugshell
+
+echo $"Starting portmap."
+portmap
+
+# convert to space-separated lists
+if [ -n "$SEARCHDNS" ]; then
+ SEARCHDNS=`echo $SEARCHDNS |sed -e 's/:/ /g'`
+ for i in "$SEARCHDNS"; do echo "search $i"; done >> /etc/resolv.conf
+fi
+if [ -n "$DNS" ]; then
+ DNS=`echo $DNS |sed -e 's/:/ /g'`
+ for i in "$DNS"; do echo "nameserver $i"; done >> /etc/resolv.conf
+fi
+
+grep -q ext3 /proc/filesystems
+if [ "$?" != "0" ]; then
+ insmod jbd$LO
+ insmod ext3$LO
+fi
+
+
+# Don't add MTU to the installed system's config. It was
+# set to 4096 for the installer only
+if [ "$IMTU" = "1" ]; then
+ MTU=
+fi
+
+# transfer options into install environment
+cat > /tmp/install.cfg << EOF
+LANG="$LANG"
+S390ARCH="$S390ARCH"
+TEXTDOMAIN="$TEXTDOMAIN"
+TEXTDOMAINDIR="$TEXTDOMAINDIR"
+CHANDEV="$CHANDEV"
+QETHPARM="$QETHPARM"
+HOSTNAME="$HOSTNAME"
+DEVICE="$DEVICE"
+NETTYPE="$NETTYPE"
+IPADDR="$IPADDR"
+GATEWAY="$GATEWAY"
+MTU="$MTU"
+NETWORK="$NETWORK"
+NETMASK="$NETMASK"
+BROADCAST="$BROADCAST"
+INTERACTIVE="$INTERACTIVE"
+DNS="$DNS"
+SEARCHDNS="$SEARCHDNS"
+FORCEDASDFORMAT="$FORCEDASDFORMAT"
+LCS="$LCS"
+QETH="$QETH"
+HSI="$HSI"
+TR="$TR"
+IUCV="$IUCV"
+CTC="$CTC"
+ROOTPW="$ROOTPW"
+CROOTPW="$CROOTPW"
+ONBOOT="yes"
+export LANG CHANDEV QETHPARM S390ARCH TEXTDOMAIN TEXTDOMAINDIR HSI
+export HOSTNAME DEVICE NETTYPE IPADDR GATEWAY MTU
+export NETWORK NETMASK BROADCAST DNS SEARCHDNS
+export LCS QETH IUCV ROOTPW CROOTPW ONBOOT
+export TR
+EOF
+# immediately read it in again to export these into the shell below
+. /tmp/install.cfg
+cat /tmp/install.cfg >> /etc/profile
+cat > /tmp/netinfo << EOF
+DEVICE=$DEVICE
+ONBOOT=yes
+BOOTPROTO=static
+IPADDR=$IPADDR
+NETMASK=$NETMASK
+GATEWAY=$GATEWAY
+BROADCAST=$BROADCAST
+HOSTNAME=$HOSTNAME
+DOMAIN=
+MTU=$MTU
+EOF
+
+# so that the vars get propagated into the sshd shells
+cat >> /etc/profile <<EOF
+LD_LIBRARY_PATH=$LD_LIBRARY_PATH
+PATH=$PATH
+HOME=$HOME
+PYTHONPATH=$PYTHONPATH
+export LD_LIBRARY_PATH PATH HOME PYTHONPATH
+EOF
+
+echo $DEVICE | grep ctc && echo "REMIP=$GATEWAY" >> /tmp/netinfo
+echo $DEVICE | grep ctc && echo "export REMIP=$GATEWAY" >> /etc/profile
+
+[ -n "$DEBUG" ] && debugshell
+
+startinetd
+
+umount -a
+umount /proc
+
+exit 0
+# ;;; Local Variables: ***
+# ;;; mode: sh ***
+# ;;; tab-width:3 ***
+# ;;; end: ***
+# vim:ts=3:sw=3
diff --git a/loader2/loader.c b/loader2/loader.c
index a68e7d301..f640560c1 100644
--- a/loader2/loader.c
+++ b/loader2/loader.c
@@ -839,6 +839,29 @@ static int manualDeviceCheck(moduleInfoSet modInfo, moduleList modLoaded,
return 0;
}
+/* JKFIXME: I don't really like this, but at least it isolates the ifdefs */
+/* Either move dirname to %s_old or unlink depending on arch (unlink on all
+ * !s390{,x} arches). symlink to /mnt/runtime/dirname. dirname *MUST* start
+ * with a '/' */
+static void migrate_runtime_directory(char * dirname) {
+ char * runtimedir;
+
+ runtimedir = sdupprintf("/mnt/runtime%s", dirname);
+ if (!access(runtimedir, X_OK)) {
+#if !defined(__s390__) && !defined(__s390x__)
+ unlink(dirname);
+#else
+ char * olddir;
+
+ olddir = sdupprintf("%s_old", dirname);
+ rename(dirname, olddir);
+ free(olddir);
+#endif
+ symlink(runtimedir, dirname);
+ }
+ free(runtimedir);
+}
+
int main(int argc, char ** argv) {
int flags = 0;
@@ -954,6 +977,7 @@ int main(int argc, char ** argv) {
/* now let's do some initial hardware-type setup */
ideSetup(modLoaded, modDeps, modInfo, flags, &kd);
scsiSetup(modLoaded, modDeps, modInfo, flags, &kd);
+ dasdSetup(modLoaded, modDeps, modInfo, flags, &kd);
/* Note we *always* do this. If you could avoid this you could get
a system w/o USB keyboard support, which would be bad. */
@@ -962,17 +986,13 @@ int main(int argc, char ** argv) {
/* now let's initialize any possible firewire. fun */
firewireInitialize(modLoaded, modDeps, modInfo, flags);
- kdFindIdeList(&kd, 0);
- kdFindScsiList(&kd, 0);
- kdFindNetList(&kd, 0);
+ updateKnownDevices(&kd);
/* explicitly read this to let libkudzu know we want to merge
* in future tables rather than replace the initial one */
pciReadDrivers("/modules/pcitable");
- if ((access("/proc/bus/pci/devices", R_OK) &&
- access("/proc/openprom", R_OK) &&
- access("/proc/iSeries", R_OK)) || FL_MODDISK(flags)) {
+ if (!canProbeDevices() || FL_MODDISK(flags)) {
startNewt(flags);
loadDriverDisks(CLASS_UNSPEC, modLoaded, &modDeps,
@@ -1011,14 +1031,10 @@ int main(int argc, char ** argv) {
url = doLoaderMain("/mnt/source", &loaderData, &kd, modInfo, modLoaded, &modDeps, flags);
if (!FL_TESTING(flags)) {
- unlink("/usr");
- symlink("/mnt/runtime/usr", "/usr");
- unlink("/lib");
- symlink("/mnt/runtime/lib", "/lib");
- if (!access("/mnt/runtime/lib64", X_OK)) {
- unlink("/lib64");
- symlink("/mnt/runtime/lib64", "/lib64");
- }
+ /* unlink dirs and link to the ones in /mnt/runtime */
+ migrate_runtime_directory("/usr");
+ migrate_runtime_directory("/lib");
+ migrate_runtime_directory("/lib64");
}
logMessage("getting ready to spawn shell now");
@@ -1045,10 +1061,8 @@ int main(int argc, char ** argv) {
checkForHardDrives(&kd, &flags);
- if (((access("/proc/bus/pci/devices", R_OK) &&
- access("/proc/openprom", R_OK) &&
- access("/proc/iSeries", R_OK)) ||
- FL_ISA(flags) || FL_NOPROBE(flags)) && !loaderData.ksFile) {
+ if ((!canProbeDevices() || FL_ISA(flags) || FL_NOPROBE(flags))
+ && !loaderData.ksFile) {
startNewt(flags);
manualDeviceCheck(modInfo, modLoaded, &modDeps, &kd, flags);
}
diff --git a/loader2/modules.c b/loader2/modules.c
index 2163dd702..0cc7c1b50 100644
--- a/loader2/modules.c
+++ b/loader2/modules.c
@@ -44,13 +44,6 @@ static struct extractedModule * extractModules (char * const * modNames,
struct extractedModule * oldPaths,
struct moduleBallLocation * location);
-
-static int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded,
- int flags);
-static int reloadUnloadedModule(char * modName, moduleList modLoaded,
- int flags);
-
-
/* pass in the type of device (eth or tr) that you're looking for */
static int ethCount(const char * type) {
int fd;
@@ -517,7 +510,7 @@ static int doLoadModules(const char * origModNames, moduleList modLoaded,
}
if (reloadUsbStorage) {
- reloadUnloadedModule("usb-storage", modLoaded, flags);
+ reloadUnloadedModule("usb-storage", modLoaded, NULL, flags);
/* JKFIXME: here's the rest of the hacks. basically do the reverse
* of what we did before.
*/
@@ -804,7 +797,7 @@ static struct extractedModule * extractModules (char * const * modNames,
* but we do update the loadedModuleInfo to reflect the fact that its using
* no devices anymore.
*/
-static int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded,
+int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded,
int flags) {
int status, rc = 0;
pid_t child;
@@ -851,8 +844,8 @@ static int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded,
* if we think it was already loaded. we also update firstDevNum and
* lastDevNum to be current
*/
-static int reloadUnloadedModule(char * modName, moduleList modLoaded,
- int flags) {
+int reloadUnloadedModule(char * modName, moduleList modLoaded,
+ char ** args, int flags) {
char fileName[200];
int rc, status;
pid_t child;
@@ -890,7 +883,7 @@ static int reloadUnloadedModule(char * modName, moduleList modLoaded,
dup2(fd, 2);
close(fd);
- rc = insmod(fileName, NULL, NULL);
+ rc = insmod(fileName, NULL, args);
_exit(rc);
}
@@ -913,7 +906,7 @@ void loadKickstartModule(struct loaderData_s * loaderData, int argc,
char * opts = NULL;
char * module = NULL;
char * type = NULL;
- char ** args;
+ char ** args = NULL;
poptContext optCon;
int rc;
int flags = *flagsPtr;
diff --git a/loader2/modules.h b/loader2/modules.h
index 3c4c6872e..7f43457c8 100644
--- a/loader2/modules.h
+++ b/loader2/modules.h
@@ -44,5 +44,9 @@ int mlLoadModuleSetLocation(const char * modNames,
int mlModuleInList(const char * modName, moduleList list);
void writeScsiDisks(moduleList list);
+int simpleRemoveLoadedModule(const char * modName, moduleList modLoaded,
+ int flags);
+int reloadUnloadedModule(char * modName, moduleList modLoaded,
+ char **, int flags);
#endif
diff --git a/loader2/net.c b/loader2/net.c
index c331fa8c2..432da26d5 100644
--- a/loader2/net.c
+++ b/loader2/net.c
@@ -237,12 +237,13 @@ void setupNetworkDeviceConfig(struct networkDeviceConfig * cfg,
}
cfg->isDynamic = 1;
+ cfg->preset = 1;
} else if (inet_aton(loaderData->ip, &addr)) {
cfg->dev.ip = addr;
cfg->dev.set |= PUMP_INTFINFO_HAS_IP;
cfg->isDynamic = 0;
+ cfg->preset = 1;
}
- cfg->preset = 1;
}
if (loaderData->netmask && (inet_aton(loaderData->netmask, &addr))) {
@@ -292,6 +293,8 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
char dhcpChoice;
char * chptr;
+ memset(&c, 0, sizeof(c));
+
/* JKFIXME: we really need a way to override this and be able to change
* our network config */
if (!FL_TESTING(flags) && cfg->preset) {
@@ -445,8 +448,12 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
#else /* s390 now */
char * env;
- /* quick and dirty hack by opaukstadt@millenux.com for s390 */
- /* ctc stores remoteip in broadcast-field until pump.h is changed */
+
+ /* JKFIXME: this is something of a hack... will go away better once
+ * we start just reading this into the ip info in loaderdata */
+ winStatus(50, 3, _("Setting up networking"),
+ _("Setting up networking for %s..."), device, 0);
+
memset(&newCfg, 0, sizeof(newCfg));
strcpy(newCfg.dev.device, device);
newCfg.isDynamic = 0;
@@ -477,18 +484,23 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
if(inet_aton((t? t : s), &newCfg.dev.dnsServers[0]))
newCfg.dev.set |= PUMP_NETINFO_HAS_DNS;
}
- if (!strncmp(newCfg.dev.device, "ctc", 3)) {
- env = getenv("REMIP");
- if (env && *env) {
- if(inet_aton(env, &newCfg.dev.gateway))
- newCfg.dev.set |= PUMP_NETINFO_HAS_GATEWAY;
- }
- }
env = getenv("BROADCAST");
if (env && *env) {
if(inet_aton(env, &newCfg.dev.broadcast))
newCfg.dev.set |= PUMP_INTFINFO_HAS_BROADCAST;
}
+ env = getenv("MTU");
+ if (env && *env) {
+ newCfg.dev.mtu = atoi(env);
+ newCfg.dev.set |= PUMP_INTFINFO_HAS_MTU;
+ }
+ env = getenv("REMIP");
+ if (env && *env) {
+ if (inet_aton(env, &newCfg.dev.ptpaddr))
+ newCfg.dev.set |= PUMP_INTFINFO_HAS_PTPADDR;
+ }
+
+ sleep(1);
#endif /* s390 */
/* preserve extra dns servers for the sake of being nice */
@@ -504,23 +516,22 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
fillInIpInfo(cfg);
-#if !defined(__s390__) && !defined(__s390x__)
if (!(cfg->dev.set & PUMP_NETINFO_HAS_GATEWAY)) {
- if (*c.gw && inet_aton(c.gw, &addr)) {
+ if (c.gw && *c.gw && inet_aton(c.gw, &addr)) {
cfg->dev.gateway = addr;
cfg->dev.set |= PUMP_NETINFO_HAS_GATEWAY;
}
}
if (!(cfg->dev.numDns)) {
- if (*c.ns && inet_aton(c.ns, &addr)) {
+ if (c.ns && *c.ns && inet_aton(c.ns, &addr)) {
cfg->dev.dnsServers[0] = addr;
cfg->dev.numDns = 1;
}
}
newtPopWindow();
-#endif
+
if (!FL_TESTING(flags)) {
configureNetwork(cfg);
findHostAndDomain(cfg, flags);
@@ -531,7 +542,6 @@ int readNetConfig(char * device, struct networkDeviceConfig * cfg, int flags) {
}
int configureNetwork(struct networkDeviceConfig * dev) {
-#if !defined(__s390__) && !defined(__s390x__)
char *rc;
rc = pumpSetupInterface(&dev->dev);
@@ -541,7 +551,6 @@ int configureNetwork(struct networkDeviceConfig * dev) {
if (dev->dev.set & PUMP_NETINFO_HAS_GATEWAY)
pumpSetupDefaultGateway(&dev->dev.gateway);
-#endif
return 0;
}
@@ -566,12 +575,8 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev,
fprintf(f, "BOOTPROTO=static\n");
fprintf(f, "IPADDR=%s\n", inet_ntoa(dev->dev.ip));
fprintf(f, "NETMASK=%s\n", inet_ntoa(dev->dev.netmask));
- if (dev->dev.set & PUMP_NETINFO_HAS_GATEWAY) {
- fprintf(f, "GATEWAY=%s\n", inet_ntoa(dev->dev.gateway));
- if (!strncmp(dev->dev.device, "ctc", 3) || \
- !strncmp(dev->dev.device, "iucv", 4))
- fprintf(f, "REMIP=%s\n", inet_ntoa(dev->dev.gateway));
- }
+ if (dev->dev.set & PUMP_NETINFO_HAS_GATEWAY)
+ fprintf(f, "GATEWAY=%s\n", inet_ntoa(dev->dev.gateway));
if (dev->dev.set & PUMP_INTFINFO_HAS_BROADCAST)
fprintf(f, "BROADCAST=%s\n", inet_ntoa(dev->dev.broadcast));
}
@@ -580,6 +585,10 @@ int writeNetInfo(const char * fn, struct networkDeviceConfig * dev,
fprintf(f, "HOSTNAME=%s\n", dev->dev.hostname);
if (dev->dev.set & PUMP_NETINFO_HAS_DOMAIN)
fprintf(f, "DOMAIN=%s\n", dev->dev.domain);
+ if (dev->dev.set & PUMP_INTFINFO_HAS_MTU)
+ fprintf(f, "MTU=%d\n", dev->dev.mtu);
+ if (dev->dev.set & PUMP_INTFINFO_HAS_PTPADDR)
+ fprintf(f, "REMIP=%s\n", inet_ntoa(dev->dev.ptpaddr));
fclose(f);