Booting questions ....

John Baldwin jhb at FreeBSD.org
Thu Nov 11 08:13:32 PST 2004


On Monday 08 November 2004 03:27 pm, Willem Jan Withagen wrote:
> John Baldwin wrote:
>
> [All about getting a flat memoryspace]
>
> >>>>Next is then which ranges are valid to test, and then things really
> >>>> start to get complicated and arch dependant. Which is why I ended up
> >>>> in machdep.c right after the setting up of the memory ranges.
> >>>
> >>>Heh, the above memory mapping is also i386 specific.  Alpha only has a
> >>>small bit of memory mapped in the loader, same with sparc64, etc.
> >>
> >>Ehhhh, again more reasons to put this in the kernel, or something that
> >>closely resembles a kernel.
> >
> > Well, part of the problem there is that the early kernel code is all MD
> > anyway.  I think your best bet really is to write your own mini-kernel
> > that the loader can load to do this, but it will require MD stubs for
> > early bootstrapping as well as some kind of API for mapping a page so you
> > can test it and then unmap it, which is required for x86 machines with >
> > 4GB of RAM for example.
>
> I would start simple, and forget about PAE, since I do not have a PAE
> machine... Simple 1386, and amd64-smp is all I got. Then I'd rather look at
> other architectures, then look at PAE. If ever I get this far.

Note that amd64 uses PAE, so if you want an amd64 version that can do more 
than 4 GB you will have to handle PAE.

> Can you give me some hints from the current modules/source-files on i386 I
> would at least need to get somewhere. Because that would be the way I'd go:
> See if I can rip enough from the regular kernel to be able to build the
> mini-kernel.

It might be easier to start with a sys tree and start turning off stuff you 
don't need.  If you want to use the FreeBSD kernel as the basis for your 
mini-kernel instead of writing it from scratch, you are basically going to 
need to sit down and read a lot of code and section 9 manpages to understand 
the APIs for mapping memory, etc.

> Did anybody write a routine that "dumps" the module list before mi_startup
> start to work on it??? Or would that be my first assignment :)
>
> I'll start by copying my own sys-tree so work does not get overwritten by
> daily cvsup.

I would strongly recommend using some type of source code control for this 
project such as p4 or svn with the stock FreeBSD sys sources in a vendor tree 
so that you can update to later FreeBSD versions and let the source code 
control software help manage the process of merging any relevant changes into 
your code.  Also, having your own work under source code control will save 
you a lot of headaches.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-arch mailing list