Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Apr 1998 17:59:28 +0800
From:      Peter Wemm <peter@netplex.com.au>
To:        John-Mark Gurney <gurney_j@resnet.uoregon.edu>
Cc:        Terry Lambert <tlambert@primenet.com>, current@FreeBSD.ORG
Subject:   Re: ELF kernels: When? 
Message-ID:  <199804220959.RAA05222@spinner.netplex.com.au>
In-Reply-To: Your message of "Wed, 22 Apr 1998 00:45:18 MST." <19980422004518.25051@hydrogen.nike.efn.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
John-Mark Gurney wrote:
> Terry Lambert scribbled this message on Apr 22:
> > I would like to run an ELF kernel.
> > 
> > Specifically, I would like to experiment with abstracting libkern
> > as a seperate ELF segment in the running kernel that I could map
> > into a program's address space via a section aware dlopen() (sort
> > of a poor man's "libelf").  I would hack the loader to not load
> > the (shared object) section type I'd use for this.
> > 
> > This would tend to fix the !@#$%! "ps: proc size mismatch ..."
> > messages, once and for all.
> > 
> > So, per the subject: "ELF kernels: When?".
> 
> well, one of the requirements to elf kernel is going to be link_elf.c
> being writen...  otherwide, elf kernels will NEVER happen (either elf
> kernels or improved bus/device design)...  so when will that happen?
> 
> as far as elf kernels, I thought a few people were running the kernels
> using jdp's elfkit...

What, you mean like this?

[..]
cc -c -O -pipe -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit  -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes  -Wpointer-arith -Winline -Wuninitialized  -nostdinc -I- -I. -I../.. -I../../../include  -DKERNEL -include opt_global.h -elf  ../../i386/i386/setdef0.c
cc -c -O -pipe -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit  -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes  -Wpointer-arith -Winline -Wuninitialized  -nostdinc -I- -I. -I../.. -I../../../include  -DKERNEL -include opt_global.h -elf  ../../i386/i386/setdef1.c
sh ../../conf/newvers.sh BEAST 
cc -O -pipe -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit  -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes  -Wpointer-arith -Winline -Wuninitialized  -nostdinc -I- -I. -I../.. -I../../../include  -DKERNEL -include opt_global.h -elf -c vers.c
loading kernel
text    data    bss     dec     hex     filename
952005  65132   120004  1137141 1159f5  kernel
peter@beast[4:39pm]~src/sys/compile/BEAST-128> file kernel
kernel: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically linked, not stripped

[also:]
peter@beast[4:40pm]~src/sys/compile/BEAST-129> file /kernel
/kernel:    ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically linked, not stripped

The real problems are:
- The bootblocks do not load the ELF symbol table, so DDB can't see it.
- DDB doesn't understand the ELF symbol tables yet anyway.
- the bootblocks have *zero* bytes free at present.  There is ELF load code
available, but you have to disable BAD144 to get it to fit. Restructuring 
the code so that the #ifdefs are not too messy tips the bootblocks over 
the limit by a few bytes.
- The loader is quite simple, it pulls in the text and data LOAD sections, 
without any of the section headers etc.  Those section headers and string 
tables are needed to do proper runtime linking via link_elf.c.

> -- 
>   John-Mark Gurney                      Modem Rev/FAX: +1 541 346 9237
>   Cu Networking					  P.O. Box 5693, 97405
> 
>   Live in Peace, destroy Micro$oft, support free software, run FreeBSD
> 	    Don't trust anyone you don't have the source for
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-current" in the body of the message
> 

Cheers,
-Peter
--
Peter Wemm <peter@netplex.com.au>   Netplex Consulting



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199804220959.RAA05222>