diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2001-02-22 13:06:07 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2001-02-22 13:06:07 +0000 |
commit | a0d4ac60dc373d2f18d9861087e0054d4e8f865d (patch) | |
tree | 92718cc3604293f2f1cbe63945bc49eb134427bf | |
parent | d256d73891a4806211f9de9007ea0b465cead03b (diff) | |
download | drakx-backup-do-not-use-a0d4ac60dc373d2f18d9861087e0054d4e8f865d.tar drakx-backup-do-not-use-a0d4ac60dc373d2f18d9861087e0054d4e8f865d.tar.gz drakx-backup-do-not-use-a0d4ac60dc373d2f18d9861087e0054d4e8f865d.tar.bz2 drakx-backup-do-not-use-a0d4ac60dc373d2f18d9861087e0054d4e8f865d.tar.xz drakx-backup-do-not-use-a0d4ac60dc373d2f18d9861087e0054d4e8f865d.zip |
have "init" compiled against dietlibc (rather than glibc) on non-Intel arch's
-rw-r--r-- | mdk-stage1/Makefile | 9 | ||||
-rw-r--r-- | mdk-stage1/dietlibc/include/signal.h | 1 | ||||
-rw-r--r-- | mdk-stage1/dietlibc/include/stdlib.h | 7 | ||||
-rw-r--r-- | mdk-stage1/dietlibc/include/sys/select.h | 6 | ||||
-rw-r--r-- | mdk-stage1/dietlibc/include/sys/socket.h | 1 | ||||
-rw-r--r-- | mdk-stage1/dietlibc/include/unistd.h | 6 | ||||
-rw-r--r-- | mdk-stage1/init-libc-headers.h | 10 | ||||
-rw-r--r-- | mdk-stage1/init.c | 24 | ||||
-rw-r--r-- | mdk-stage1/minilibc.c | 8 | ||||
-rw-r--r-- | mdk-stage1/minilibc.h | 6 |
10 files changed, 51 insertions, 27 deletions
diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile index 5c3a0e98a..c230d4b39 100644 --- a/mdk-stage1/Makefile +++ b/mdk-stage1/Makefile @@ -111,7 +111,8 @@ NETWORK_DEFS = -DDISABLE_CDROM -DDISABLE_DISK ifeq (i386, $(ARCH)) LDFLAGS_INIT = -static -nostdlib /usr/lib/crt1.o else -LDFLAGS_INIT = $(GLIBC_LDFLAGS_STAGE1) +LDFLAGS_INIT = $(DIETLIBC_LDFLAGS_STAGE1) +INIT_LIBC = $(DIETLIBC_LIBC) endif @@ -137,8 +138,8 @@ dirs: [ "$$n" = "." ] || make -C $$n ;\ done -init: $(INITOBJS) - $(CC) $(LDFLAGS_INIT) -o $@ $(INITOBJS) +init: $(INITOBJS) $(INIT_LIBC) + $(CC) $(LDFLAGS_INIT) -o $@ $^ $(STRIPCMD) $@ stage1-cdrom: $(STAGE1OBJS-CDROM) $(STAGE1_OWN_LIBS) $(STAGE1_OWN_LIBS) $(MEDIAS_FRONTEND_LINK) $(STAGE1_LIBC) @@ -168,7 +169,7 @@ $(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c .depend $(COMPILE) $(GLIBC_INCLUDES) $(NETWORK_DEFS) -c $< -o $@ $(INITOBJS): %.o: %.c - $(COMPILE) $(INIT_DEFS) $(GLIBC_INCLUDES) -c $< + $(COMPILE) $(INIT_DEFS) $(DIETLIBC_INCLUDES) -c $< .c.o: .depend $(COMPILE) $(GLIBC_INCLUDES) $(PCMCIA_DEFS) -c $< diff --git a/mdk-stage1/dietlibc/include/signal.h b/mdk-stage1/dietlibc/include/signal.h index d4d2b0f44..9214d176d 100644 --- a/mdk-stage1/dietlibc/include/signal.h +++ b/mdk-stage1/dietlibc/include/signal.h @@ -10,5 +10,6 @@ int sigemptyset(sigset_t *set) __THROW; int sigaddset(sigset_t *set, int signum) __THROW; int sigprocmask(int how, const sigset_t *set, sigset_t *oldset) __THROW; int raise (int sig) __THROW; +void (*signal(int signum, void (*sighandler)(int)))(int) __THROW; #endif diff --git a/mdk-stage1/dietlibc/include/stdlib.h b/mdk-stage1/dietlibc/include/stdlib.h index 90f2fbbb7..c5fea2608 100644 --- a/mdk-stage1/dietlibc/include/stdlib.h +++ b/mdk-stage1/dietlibc/include/stdlib.h @@ -33,5 +33,12 @@ void exit(int); extern char **environ; +#define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) +#define WIFSIGNALED(status) (!WIFSTOPPED(status) && !WIFEXITED(status)) +#define WEXITSTATUS(status) (((status) & 0xff00) >> 8) +#define WTERMSIG(status) ((status) & 0x7f) +#define WSTOPSIG(status) WEXITSTATUS(status) +#define WIFEXITED(status) (WTERMSIG(status) == 0) + #endif diff --git a/mdk-stage1/dietlibc/include/sys/select.h b/mdk-stage1/dietlibc/include/sys/select.h index e69de29bb..fa166a530 100644 --- a/mdk-stage1/dietlibc/include/sys/select.h +++ b/mdk-stage1/dietlibc/include/sys/select.h @@ -0,0 +1,6 @@ +#ifndef _SYS_SELECT_H +#define _SYS_SELECT_H 1 + +int select(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); + +#endif diff --git a/mdk-stage1/dietlibc/include/sys/socket.h b/mdk-stage1/dietlibc/include/sys/socket.h index 659c88e99..f590c35c4 100644 --- a/mdk-stage1/dietlibc/include/sys/socket.h +++ b/mdk-stage1/dietlibc/include/sys/socket.h @@ -5,6 +5,7 @@ #include <linux/socket.h> int socket(int domain, int type, int protocol); +int listen (int fd, int n); int accept(int s, struct sockaddr *addr, socklen_t *addrlen); int connect(int sockfd, const struct sockaddr *serv_addr, socklen_t addrlen); int bind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); diff --git a/mdk-stage1/dietlibc/include/unistd.h b/mdk-stage1/dietlibc/include/unistd.h index a3c863586..5165ba286 100644 --- a/mdk-stage1/dietlibc/include/unistd.h +++ b/mdk-stage1/dietlibc/include/unistd.h @@ -59,6 +59,11 @@ int brk(void *end_data_segment) __THROW; void *sbrk(ptrdiff_t increment) __THROW; int gethostname(char *name, size_t len) __THROW; +int sethostname(const char *name, size_t len) __THROW; + +int setdomainname(const char *name, size_t len) __THROW; + +void sync(void) __THROW; /* Values for the second argument to access. These may be OR'd together. */ @@ -73,5 +78,6 @@ int dup2 (int __fd, int __fd2) __THROW; pid_t setsid (void) __THROW; +unsigned int sleep (unsigned int __seconds) __THROW; #endif diff --git a/mdk-stage1/init-libc-headers.h b/mdk-stage1/init-libc-headers.h index d9394d851..f5f6aa2e6 100644 --- a/mdk-stage1/init-libc-headers.h +++ b/mdk-stage1/init-libc-headers.h @@ -33,8 +33,12 @@ #include <signal.h> #include <sys/resource.h> #include <sys/wait.h> -#include <linux/reboot.h> -#include <sys/reboot.h> #include <linux/unistd.h> -_syscall3(int, syslog, int, type, char *, bufp, int, len); +#include <sys/select.h> + +#ifndef SOCK_STREAM +#define SOCK_STREAM 1 +#endif +_syscall3(int, syslog, int, type, char *, bufp, int, len); +_syscall3(int, reboot, int, magic, int, magic2, int, flag); diff --git a/mdk-stage1/init.c b/mdk-stage1/init.c index edcce8508..6d81c7e47 100644 --- a/mdk-stage1/init.c +++ b/mdk-stage1/init.c @@ -68,7 +68,7 @@ void print_warning(char *msg) printf("W: %s\n", msg); } -void print_int(int fd, int i) +void print_int_init(int fd, int i) { char buf[10]; char * chptr = buf + 9; @@ -90,7 +90,7 @@ void print_int(int fd, int i) write(fd, chptr + 1, j); } -void print_str(int fd, char * string) +void print_str_init(int fd, char * string) { write(fd, string, strlen(string)); } @@ -147,27 +147,27 @@ void doklog() sleep(5); } - print_str(log, "] got socket\n"); + print_str_init(log, "] got socket\n"); if (bind(sock, (struct sockaddr *) &sockaddr, sizeof(sockaddr.sun_family) + strlen(sockaddr.sun_path))) { - print_str(log, "] bind error: "); - print_int(log, errno); - print_str(log, "\n"); + print_str_init(log, "] bind error: "); + print_int_init(log, errno); + print_str_init(log, "\n"); sleep(5); } - print_str(log, "] bound socket\n"); + print_str_init(log, "] bound socket\n"); chmod("/dev/log", 0666); if (listen(sock, 5)) { - print_str(log, "] listen error: "); - print_int(log, errno); - print_str(log, "\n"); + print_str_init(log, "] listen error: "); + print_int_init(log, errno); + print_str_init(log, "\n"); sleep(5); } /* disable on-console syslog output */ syslog(8, NULL, 1); - print_str(log, "] kernel/system logger ok\n"); + print_str_init(log, "] kernel/system logger ok\n"); FD_ZERO(&unixs); while (1) { memcpy(&readset, &unixs, sizeof(unixs)); @@ -450,7 +450,7 @@ int main(int argc, char **argv) if (!abnormal_termination) { printf("rebooting system\n"); sleep(2); - reboot(LINUX_REBOOT_CMD_RESTART); + reboot(0xfee1dead, 672274793, 0x01234567); } else { printf("you may safely reboot your system\n"); while (1); diff --git a/mdk-stage1/minilibc.c b/mdk-stage1/minilibc.c index d8ff88852..77b65accc 100644 --- a/mdk-stage1/minilibc.c +++ b/mdk-stage1/minilibc.c @@ -224,18 +224,18 @@ void printf(char * fmt, ...) if (*chptr == '%') { *chptr++ = '\0'; - print_str(1, start); + print_str_init(1, start); switch (*chptr++) { case 's': strarg = va_arg(args, char *); - print_str(1, strarg); + print_str_init(1, strarg); break; case 'd': numarg = va_arg(args, int); - print_int(1, numarg); + print_int_init(1, numarg); break; } @@ -243,7 +243,7 @@ void printf(char * fmt, ...) } else { - print_str(1, start); + print_str_init(1, start); start = NULL; } } diff --git a/mdk-stage1/minilibc.h b/mdk-stage1/minilibc.h index f3ff9c758..e717d4255 100644 --- a/mdk-stage1/minilibc.h +++ b/mdk-stage1/minilibc.h @@ -109,8 +109,6 @@ static inline _syscall0(int,fork) #endif static inline _syscall0(pid_t,setsid) static inline _syscall3(int,syslog,int, type, char *, buf, int, len); -#define LINUX_REBOOT_CMD_RESTART 0x01234567 -#define reboot(x) reboot(0xfee1dead, 672274793, x) #else static inline _syscall5(int,_newselect,int,n,fd_set *,rd,fd_set *,wr,fd_set *,ex,struct timeval *,timeval); static inline _syscall3(int,write,int,fd,const char *,buf,unsigned long,count) @@ -139,8 +137,8 @@ char * strchr(char * str, int ch); char * strstr(char *haystack, char *needle); char * strncpy(char * dst, const char * src, int len); -void print_str(int fd, char * string); -void print_int(int fd, int i); +void print_str_init(int fd, char * string); +void print_int_init(int fd, int i); /* Minimum printf which handles only characters, %d's and %s's */ void printf(char * fmt, ...); |