summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorMark Hamzy <hamzy@us.ibm.com>2009-02-16 14:19:35 -0600
committerDavid Cantrell <dcantrell@redhat.com>2009-03-02 15:20:53 -1000
commitd00ef216099104c03c400f56fb21e19089df4a7d (patch)
tree7c413e8735cbd86e7fd1a4204778500c3e347f89 /loader
parent86eee97f1915c1743d7a2cd91c1b072ccd9bd1e7 (diff)
downloadanaconda-d00ef216099104c03c400f56fb21e19089df4a7d.tar.gz
anaconda-d00ef216099104c03c400f56fb21e19089df4a7d.tar.xz
anaconda-d00ef216099104c03c400f56fb21e19089df4a7d.zip
reIPL support for s390
Signed-off-by: David Cantrell <dcantrell@redhat.com>
Diffstat (limited to 'loader')
-rw-r--r--loader/linuxrc.s39032
-rw-r--r--loader/loader.c55
2 files changed, 33 insertions, 54 deletions
diff --git a/loader/linuxrc.s390 b/loader/linuxrc.s390
index 9acab9b97..af2d43956 100644
--- a/loader/linuxrc.s390
+++ b/loader/linuxrc.s390
@@ -61,35 +61,13 @@ checkipv4()
doshutdown()
{
- exec /sbin/shutdown
- exit 0
+ echo $"about to exec shutdown"
+ exec /sbin/shutdown
+ exit 0
}
doreboot()
{
- # find out the location of /boot and use it to re-ipl
- boot="$(cat /proc/mounts | grep " /mnt/sysimage/boot " | awk -F" " '{print $1}')"
- if [ -z $boot ]; then
- # use root if /boot not used
- boot="$(cat /proc/mounts | grep " /mnt/sysimage " | awk -F" " '{print $1}')"
- fi
-
- # lookup dasd disk
- echo $boot | grep "dasd" > /dev/null
- if [ $? -eq 0 ]; then
- type="ccw"
- boot="$(basename $boot)"
- # strip partition number from dasd device
- boot="$(echo ${boot%[0-9]})"
- id="$(basename $(readlink /sys/block/$boot/device))"
- echo $type > /sys/firmware/reipl/reipl_type
- echo $id > /sys/firmware/reipl/$type/device
- else
- # scsi re-ipl only supported on newer machines
- doshutdown
- exit 0
- fi
-
echo $"about to exec shutdown -r"
exec /sbin/shutdown -r
exit 0
@@ -670,7 +648,9 @@ if [ -n "$RUNKS" ]; then
/sbin/loader
fi
-doreboot
+# A shutdown needs to be performed here to avoid a loop booting back into the installer
+echo $"Finishing up with doshutdown"
+doshutdown
# ;;; Local Variables: ***
# ;;; mode: sh ***
diff --git a/loader/loader.c b/loader/loader.c
index 10ac30756..98ea24cba 100644
--- a/loader/loader.c
+++ b/loader/loader.c
@@ -121,6 +121,8 @@ uint64_t flags = LOADER_FLAGS_SELINUX;
int num_link_checks = 5;
int post_link_sleep = 0;
+static pid_t init_pid = 1;
+
static struct installMethod installMethods[] = {
{ N_("Local CD/DVD"), 0, DEVICE_CDROM, mountCdromImage },
{ N_("Hard drive"), 0, DEVICE_DISK, mountHardDrive },
@@ -1716,6 +1718,11 @@ void loaderSegvHandler(int signum) {
exit(1);
}
+void loaderUsrXHandler(int signum) {
+ logMessage(INFO, "Sending signal %d to process %d\n", signum, init_pid);
+ kill(init_pid, signum);
+}
+
static int anaconda_trace_init(void) {
#ifdef USE_MTRACE
setenv("MALLOC_TRACE","/malloc",1);
@@ -1798,6 +1805,26 @@ int main(int argc, char ** argv) {
{ 0, 0, 0, 0, 0, 0, 0 }
};
+ /* get init PID if we have it */
+ if ((f = fopen("/var/run/init.pid", "r")) != NULL) {
+ char linebuf[256];
+ memset(linebuf, '\0', sizeof(linebuf));
+
+ while (fgets(linebuf, sizeof(linebuf) - 1, f) != NULL) {
+ errno = 0;
+ init_pid = strtol((const char *) &linebuf, NULL, 10);
+ if (errno == EINVAL || errno == ERANGE) {
+ logMessage(ERROR, "%s (%d): %m", __func__, __LINE__);
+ init_pid = 1;
+ }
+ }
+
+ fclose(f);
+ }
+
+ signal(SIGUSR1, loaderUsrXHandler);
+ signal(SIGUSR2, loaderUsrXHandler);
+
/* Make sure sort order is right. */
setenv ("LC_COLLATE", "C", 1);
@@ -2228,34 +2255,6 @@ int main(int argc, char ** argv) {
waitpid(pid, &status, 0);
}
-#if defined(__s390__) || defined(__s390x__)
- /* FIXME: we have to send a signal to linuxrc on s390 so that shutdown
- * can happen. this is ugly */
- FILE * f;
- f = fopen("/var/run/init.pid", "r");
- if (!f) {
- logMessage(WARNING, "can't find init.pid, guessing that init is pid 1");
- pid = 1;
- } else {
- char * buf = malloc(256);
- char *ret;
-
- ret = fgets(buf, 256, f);
- errno = 0;
- pid = strtol(buf, NULL, 10);
-
- if ((errno == ERANGE && (pid == LONG_MIN || pid == LONG_MAX)) ||
- (errno != 0 && pid == 0)) {
- logMessage(ERROR, "%s: %d: %m", __func__, __LINE__);
- abort();
- }
-
- free(buf);
- fclose(f);
- }
-
- kill(pid, SIGUSR2);
-#endif
stop_fw_loader(&loaderData);
return rc;
}