diff --git a/Makefile.common b/Makefile.common deleted file mode 100644 index d094a6e..0000000 --- a/Makefile.common +++ /dev/null @@ -1,59 +0,0 @@ - # -*- makefile -*- - #****************************************************************************** - # - # Guillaume Cottenceau (gc@mandrakesoft.com) - # - # Copyright 2000 MandrakeSoft - # - # This software may be freely redistributed under the terms of the GNU - # public license. - # - # 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., 675 Mass Ave, Cambridge, MA 02139, USA. - # - #***************************************************************************** - -#include /usr/lib/dietlibc/Makefile.rules - -#DIET_LIBDIR = /usr/lib/dietlibc/lib-$(ARCH) - - #- default lib is dietlibc (honoured by main Makefile whenever possible) -#L = DIETLIBC -L = GLIBC - - #- default frontend is newt (honoured by main Makefile whenever possible) -F = NEWT -# F = STDIO - - #- override in some situations -ifeq (ia64, $(ARCH)) -L = GLIBC -endif -ifeq (ppc, $(ARCH)) -L = GLIBC -endif - - #- flags used by all stuff -ifeq (ppc, $(ARCH)) -CFLAGS += -Os -pipe -Wall -fomit-frame-pointer -else -CFLAGS += -pipe -Wall -O2 -D_GNU_SOURCE -endif - -GLIBC_INCLUDES = -INCLUDES = -I. $($(L)_INCLUDES) - -GCC_LIBDIR=$(shell dirname `gcc -print-libgcc-file-name`) -LIBGCC_A=$(shell gcc -print-libgcc-file-name) - -GLIBC_LDFLAGS_STAGE1 = -static -DIETLIBC_LDFLAGS_STAGE1 = -nostdlib -# $(LIBGCC_A) -LDFLAGS_STAGE1 = $($(L)_LDFLAGS_STAGE1) - -GLIBC_LIBC = -DIETLIBC_LIBC = $(DIET_LIBDIR)/libc.a $(DIET_LIBDIR)/libcompat.a -STAGE1_LIBC = $($(L)_LIBC) - -STRIPCMD = strip -R .note -R .comment diff --git a/doc/WHY-DIETLIBC b/doc/WHY-DIETLIBC deleted file mode 100644 index e7c526b..0000000 --- a/doc/WHY-DIETLIBC +++ /dev/null @@ -1,50 +0,0 @@ -(the dietlibc is a replacement for the glibc, which aim is to produce -smaller statically linked binaries) - - -The use for dietlibc in the stage1 was clear because currently used -install process on x86 is from a 1.44 Mbytes floppy. On this floppy we -need to fit the kernel, modules (scsi and network access), and the code to -do the basic things to load the stage2. The only part on which we could -progress was the code. - -As always, figures demonstrate evidences. Here are the size of the -binaries used for the cdrom, disk, network and full floppy installs, using -newt as the UI library: - - - with glibc - --rwxr-xr-x 1 gc gc 569448 May 15 15:29 stage1-cdrom --rwxr-xr-x 1 gc gc 572264 May 15 15:29 stage1-disk --rwxr-xr-x 1 gc gc 624712 May 15 15:30 stage1-network --rwxr-xr-x 1 gc gc 720360 May 15 15:29 stage1-full - - - with dietlibc - --rwxr-xr-x 1 gc gc 169332 May 15 14:26 stage1-cdrom --rwxr-xr-x 1 gc gc 172180 May 15 14:26 stage1-disk --rwxr-xr-x 1 gc gc 198612 May 15 14:26 stage1-network --rwxr-xr-x 1 gc gc 251764 May 15 14:26 stage1-full - - -The `stage1-full' binary has code for many things, most notably: data -decrunching (bzlib), archive extraction (in-house format), module loading -(insmod from busybox), PCI detection, ide and scsi handling, -cdrom/disk/loopback mounting, DHCP client negociation (redhat+grub), NFS -mounting (util-linux), FTP and HTTP transmission (redhat), pcmcia -initializing (pcmcia-cs), UI interaction (slang/newt); with use of the -dietlibc, the binary is only 250 kbytes! - - -Due to the modular coding, it is also possible to choose to not use -slang/newt as the UI, but a stdio-only UI. In that case, the binaries get -even smaller: - --rwxr-xr-x 1 gc gc 104500 May 15 15:46 stage1-cdrom* --rwxr-xr-x 1 gc gc 107348 May 15 15:46 stage1-disk* --rwxr-xr-x 1 gc gc 133972 May 15 15:47 stage1-network* --rwxr-xr-x 1 gc gc 187348 May 15 15:46 stage1-full* - - - -gc [Tue May 15 15:58:34 2001] \ No newline at end of file diff --git a/minilibc.c b/minilibc.c deleted file mode 100644 index 77b65ac..0000000 --- a/minilibc.c +++ /dev/null @@ -1,251 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * Portions from Erik Troan (ewt@redhat.com) - * - * Copyright 1996 Red Hat Software - * - */ - - -#define MINILIBC_INTERNAL - -#include "minilibc.h" - -int atexit (void (*__func) (void)) -{ - return 0; -} - -void exit() -{ - _do_exit(0); - for (;;); /* Shut up gcc */ -} - - -char ** _environ = NULL; -int errno = 0; - -void _init (int __status) -{ -} - -void __libc_init_first (int __status) -{ -} - -int __libc_start_main (int (*main) (int, char **, char **), int argc, - char **argv, void (*init) (void), void (*fini) (void), - void (*rtld_fini) (void), void *stack_end) -{ - exit ((*main) (argc, argv, NULL)); - /* never get here */ - return 0; -} - -void _fini (int __status) -{ -} - -inline int socket(int a, int b, int c) -{ - unsigned long args[] = { a, b, c }; - - return socketcall(SYS_SOCKET, args); -} - -inline int bind(int a, void * b, int c) -{ - unsigned long args[] = { a, (long) b, c }; - - return socketcall(SYS_BIND, args); -} - -inline int listen(int a, int b) -{ - unsigned long args[] = { a, b, 0 }; - - return socketcall(SYS_LISTEN, args); -} - -inline int accept(int a, void * addr, void * addr2) -{ - unsigned long args[] = { a, (long) addr, (long) addr2 }; - - return socketcall(SYS_ACCEPT, args); -} - - -void sleep(int secs) -{ - struct timeval tv; - - tv.tv_sec = secs; - tv.tv_usec = 0; - - select(0, NULL, NULL, NULL, &tv); -} - - -int strlen(const char * string) -{ - int i = 0; - - while (*string++) i++; - - return i; -} - -char * strncpy(char * dst, const char * src, int len) -{ - char * chptr = dst; - int i = 0; - - while (*src && i < len) *dst++ = *src++, i++; - if (i < len) *dst = '\0'; - - return chptr; -} - -char * strcpy(char * dst, const char * src) -{ - char * chptr = dst; - - while (*src) *dst++ = *src++; - *dst = '\0'; - - return chptr; -} - -void * memcpy(void * dst, const void * src, size_t count) -{ - char * a = dst; - const char * b = src; - - while (count--) - *a++ = *b++; - - return dst; -} - - -int strcmp(const char * a, const char * b) -{ - int i, j; - - i = strlen(a); j = strlen(b); - if (i < j) - return -1; - else if (j < i) - return 1; - - while (*a && (*a == *b)) a++, b++; - - if (!*a) return 0; - - if (*a < *b) - return -1; - else - return 1; -} - -int strncmp(const char * a, const char * b, int len) -{ - char buf1[1000], buf2[1000]; - - strncpy(buf1, a, len); - strncpy(buf2, b, len); - buf1[len] = '\0'; - buf2[len] = '\0'; - - return strcmp(buf1, buf2); -} - -char * strchr(char * str, int ch) -{ - char * chptr; - - chptr = str; - while (*chptr) - { - if (*chptr == ch) return chptr; - chptr++; - } - - return NULL; -} - - -char * strstr(char *haystack, char *needle) -{ - char * tmp = haystack; - while ((tmp = strchr(tmp, needle[0])) != NULL) { - int i = 1; - while (i < strlen(tmp) && i < strlen(needle) && tmp[i] == needle[i]) - i++; - if (needle[i] == '\0') - return tmp; - tmp++; - } - return NULL; -} - - -/* Minimum printf which handles only characters, %d's and %s's */ -void printf(char * fmt, ...) -{ - char buf[2048]; - char * start = buf; - char * chptr = buf; - va_list args; - char * strarg; - int numarg; - - strncpy(buf, fmt, sizeof(buf)); - va_start(args, fmt); - - while (start) - { - while (*chptr != '%' && *chptr) chptr++; - - if (*chptr == '%') - { - *chptr++ = '\0'; - print_str_init(1, start); - - switch (*chptr++) - { - case 's': - strarg = va_arg(args, char *); - print_str_init(1, strarg); - break; - - case 'd': - numarg = va_arg(args, int); - print_int_init(1, numarg); - break; - } - - start = chptr; - } - else - { - print_str_init(1, start); - start = NULL; - } - } -} - diff --git a/minilibc.h b/minilibc.h deleted file mode 100644 index e0775e3..0000000 --- a/minilibc.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Guillaume Cottenceau (gc@mandrakesoft.com) - * - * Copyright 2000 MandrakeSoft - * - * This software may be freely redistributed under the terms of the GNU - * public license. - * - * 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., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - -/* - * Portions from Erik Troan (ewt@redhat.com) - * - * Copyright 1996 Red Hat Software - * - */ - - -#include - -#define _LOOSE_KERNEL_NAMES 1 - -#define NULL ((void *) 0) - -#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) - -#define MS_MGC_VAL 0xc0ed0000 - -#define isspace(a) (a == ' ' || a == '\t') - -extern char ** _environ; - -extern int errno; - -/* Aieee, gcc 2.95+ creates a stub for posix_types.h on i386 which brings - glibc headers in and thus makes __FD_SET etc. not defined with 2.3+ kernels. */ -#define _FEATURES_H 1 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#ifndef MINILIBC_INTERNAL -static inline _syscall5(int,mount,const char *,spec,const char *,dir,const char *,type,unsigned long,rwflag,const void *,data); -static inline _syscall5(int,_newselect,int,n,fd_set *,rd,fd_set *,wr,fd_set *,ex,struct timeval *,timeval); -static inline _syscall4(int,wait4,pid_t,pid,int *,status,int,opts,void *,rusage) -static inline _syscall3(int,write,int,fd,const char *,buf,unsigned long,count) -static inline _syscall3(int,reboot,int,magic,int,magic_too,int,flag) -static inline _syscall3(int,execve,const char *,fn,void *,argv,void *,envp) -static inline _syscall3(int,read,int,fd,const char *,buf,unsigned long,count) -static inline _syscall3(int,open,const char *,fn,int,flags,mode_t,mode) -static inline _syscall3(int,ioctl,int,fd,int,request,void *,argp) -static inline _syscall2(int,dup2,int,one,int,two) -static inline _syscall2(int,kill,pid_t,pid,int,sig) -static inline _syscall2(int,symlink,const char *,a,const char *,b) -static inline _syscall2(int,chmod,const char * ,path,mode_t,mode) -static inline _syscall2(int,sethostname,const char *,name,int,len) -static inline _syscall2(int,setdomainname,const char *,name,int,len) -static inline _syscall2(int,setpgid,int,name,int,len) -static inline _syscall2(int,signal,int,num,void *,len) -static inline _syscall1(int,umount,const char *,dir) -static inline _syscall1(int,unlink,const char *,fn) -static inline _syscall1(int,close,int,fd) -static inline _syscall1(int,swapoff,const char *,fn) -static inline _syscall0(int,getpid) -static inline _syscall0(int,sync) -#ifdef __sparc__ -/* Nonstandard fork calling convention :( */ -static inline int fork(void) { - int __res; - __asm__ __volatile__ ( - "mov %0, %%g1\n\t" - "t 0x10\n\t" - "bcc 1f\n\t" - "dec %%o1\n\t" - "sethi %%hi(%2), %%g1\n\t" - "st %%o0, [%%g1 + %%lo(%2)]\n\t" - "b 2f\n\t" - "mov -1, %0\n\t" - "1:\n\t" - "and %%o0, %%o1, %0\n\t" - "2:\n\t" - : "=r" (__res) - : "0" (__NR_fork), "i" (&errno) - : "g1", "o0", "cc"); - return __res; -} -#else -static inline _syscall0(int,fork) -#endif -static inline _syscall0(pid_t,setsid) -static inline _syscall3(int,syslog,int, type, char *, buf, int, len); -#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) -static inline _syscall2(int,socketcall,int,code,unsigned long *, args) -#define __NR__do_exit __NR_exit -extern inline _syscall1(int,_do_exit,int,exitcode) -#endif - -#define select _newselect - -extern int errno; - -inline int socket(int a, int b, int c); -inline int bind(int a, void * b, int c); -inline int listen(int a, int b); -inline int accept(int a, void * addr, void * addr2); - -void sleep(int secs); - -int strlen(const char * string); -char * strcpy(char * dst, const char * src); -void * memcpy(void * dst, const void * src, size_t count); -int strcmp(const char * a, const char * b); -int strncmp(const char * a, const char * b, int len); -char * strchr(char * str, int ch); -char * strstr(char *haystack, char *needle); -char * strncpy(char * dst, const char * src, int len); - -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, ...) __attribute__ ((format (printf, 1, 2))); - diff --git a/modules.h b/modules.h index d095a58..d0c1b85 100644 --- a/modules.h +++ b/modules.h @@ -26,9 +26,4 @@ enum return_type ask_insmod(); enum insmod_return my_insmod(const char * mod_name, char * options); void update_modules(void); -struct module_deps_elem { - char * name; - char ** deps; -}; - #endif