From 841067b45e61bb8d5a1394d8bba25db1d2a23ea0 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Wed, 21 Feb 2001 23:01:11 +0000 Subject: - fix "init" on ppc (do not use minilibc on non-i386 arch's) - fix segfault of dietlibc-linked apps (broken va_stuff in dietlibc) - cleanup of "init" --- mdk-stage1/init.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) (limited to 'mdk-stage1/init.c') diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index 502bb3b21..edcce8508 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -19,19 +19,14 @@ * */ -#include "minilibc.h" -#include "config-stage1.h" - -#define KICK_FLOPPY 1 -#define KICK_BOOTP 2 +#ifndef INIT_HEADERS +#include "init-libc-headers.h" +#else +#include INIT_HEADERS +#endif -#define MS_REMOUNT 32 +#include "config-stage1.h" -#define ENV_PATH 0 -#define ENV_LD_LIBRARY_PATH 1 -#define ENV_HOME 2 -#define ENV_TERM 3 -#define ENV_DEBUG 4 char * env[] = { "PATH=/usr/bin:/bin:/sbin:/usr/sbin:/mnt/sbin:/mnt/usr/sbin:/mnt/bin:/mnt/usr/bin", @@ -73,6 +68,33 @@ void print_warning(char *msg) printf("W: %s\n", msg); } +void print_int(int fd, int i) +{ + char buf[10]; + char * chptr = buf + 9; + int j = 0; + + if (i < 0) + { + write(1, "-", 1); + i = -1 * i; + } + + while (i) + { + *chptr-- = '0' + (i % 10); + j++; + i = i / 10; + } + + write(fd, chptr + 1, j); +} + +void print_str(int fd, char * string) +{ + write(fd, string, strlen(string)); +} + /* fork to: * (1) watch /proc/kmsg and copy the stuff to /dev/tty4 @@ -203,6 +225,8 @@ void doklog() } +#define LOOP_CLR_FD 0x4C01 + void del_loop(char *device) { int fd; @@ -426,7 +450,7 @@ int main(int argc, char **argv) if (!abnormal_termination) { printf("rebooting system\n"); sleep(2); - reboot(0xfee1dead, 672274793, 0x1234567); + reboot(LINUX_REBOOT_CMD_RESTART); } else { printf("you may safely reboot your system\n"); while (1); -- cgit v1.2.1