Still possible to directly boot without loader?

Ruslan Ermilov ru at FreeBSD.org
Wed Nov 1 15:43:52 UTC 2006


On Thu, Nov 02, 2006 at 12:44:56AM +1100, Bruce Evans wrote:
> The masking hack is probably only needed for aout.  For elf,
> objdump -h /kernel says:
> 
> % Sections:
> % Idx Name          Size      VMA       LMA       File off  Algn
> % ...
> %                   CONTENTS, ALLOC, LOAD, READONLY, DATA
> %   4 .text         002853e0  c043b510  c043b510  0003b510  2**4
> 
> so KERNBASE = LMA - <File off> for at least this kernel.  boot2 now
> loads the text section from file offset <File off> to address LMA(masked).
> I think it just needs to load at an address that is the same mod
> PAGE_SIZE as LMA or VMA (these must agree mod PAGE_SIZE), provided it
> adjusts the entry address to match.
> 
It isn't generally:

: LINT/kernel:     file format elf32-i386-freebsd
: 
: Sections:
: Idx Name          Size      VMA       LMA       File off  Algn
: [...]
:   4 .text         009c589c  bf490e60  bf490e60  00090e60  2**4
:                   CONTENTS, ALLOC, LOAD, READONLY, CODE

But:

: $ nm LINT/kernel | grep kernbase
: bf000000 A kernbase

The "paddr" of the first loadable segment is KERNBASE + KERNLOAD,
and KERNLOAD is always 2M for PAE and 4M for non-PAE.  (Please
see my other private email I just sent that goes into more detail
about this, and provides one possible formulae to compute the
KERNBASE from "paddr".)


Cheers,
-- 
Ruslan Ermilov
ru at FreeBSD.org
FreeBSD committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20061101/c741bd9f/attachment.pgp


More information about the freebsd-stable mailing list