This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: compile glibc without most features
Geoff Keating <geoffk@cygnus.com> writes:
| > is it possible to compile the GNU libc without most features, which
| > are nice for a workstation but unimportant for an embedded system?
Sorry I misused the notation "embedded system" for a small system.
What I really want to create is a boot disk for Linux.
| It sounds like what you really want is newlib, which is designed for
| such embedded systems. Look at http://sourceware.cygnus.com.
I have problems to link against newlib. I am not sure, if I
understand the problem right, but newlib-1.8.2 has no crt*.o file and
when I try to link with -nostartfiles, I get the following error:
gcc -L. -static -nostartfiles hello.o -lc -lnosys -o hello
/usr/local/i686-pc-linux-gnu/bin/ld: warning: cannot find entry symbol _start; defaulting to 08048080
And when I try to link without -nostartfiles, ld tries to use my
system files and that does not work either:
gcc -L. -static hello.o -lc -lnosys -o hello
/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0xe): undefined reference to `__libc_init_first'
/usr/lib/crt1.o(.text+0x18): undefined reference to `_environ'
./libc.a(exit.o): In function `exit':
/home/olivia/szi/software/smbproxy/1.1.1/bootdisk/newlib-1.8.2/newlib.build/libc/stdlib/../../../newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
collect2: ld returned 1 exit status
make: *** [hello] Error 1
And by the way: I think it is un economically to maintain a second
clib only to get a precisely defined set of function from the glibc.
So I think glibc is the only lib, that can be used for a Linux boot
disk. But the single so file is bigger than 2 MB. Each static link
produces binaries which are about 200 - 400 KB. In order to select
during boot between CD and NFS the floppy must contain drivers for
NICs, NFS, IDE, ISO9660, EXT2. I have put them into the kernel, to
remove insmod, but with all the drivers the bzImage is 600k and with
this 5 programs the boot disk is completely full:
1216950 161 -rwxr-xr-x 1 szi ego 164724 Apr 25 12:55 ./rc
1216904 392 -rwxr-xr-x 1 szi ego 401292 Apr 25 17:46 ./busybox
1216946 282 -rwxr-xr-x 1 szi ego 288140 Apr 27 09:35 ./mount
1216951 252 -rwxr-xr-x 1 szi ego 257132 Apr 27 09:35 ./umount
1216955 251 -rwxr-xr-x 1 szi ego 256212 Apr 25 14:43 ./ip
The extra mount tool is necessary, because the nfsmount in bussybox
does not work with the 2.3.99-pre5 kernel.
So you see: It is a *pain* to get glibc on a floppy.
I think glibc would be more flexible, when it's configure has some
kind of compatibility option. I would help much, when one can say
configure --features=unix98 or --features=posix or
--features=my-own-set-of-features
Sascha