|<><><><><> Original message from Ronald G Minnich <><><><><> |On Thu, 1 Jun 2000, Jeff Garzik wrote: | |> Can you steal code from LILO to patch the in-core kernel image with |> values it needs? |> |> Right now the Linux kernel depends on a memory map read from BIOS. One |> solution -- which I think should belong in the official kernel -- might |> be to create our own memory map, and then pass the physical address of |> that map into the kernel image. | |Some values come into the kernel now from page zero. Page zero is made |inaccessible early in the boot process. Since its not used, it seems like |a good place to put the PARAM variables. What I was wondering was whether |we could have the initial boot code put a PARAM struct at page 0 and let |linux bcopy it in to its own empty_zero_page, which is where the regular |BIOS stuff is put by the code in arch/i386/boot (if my memory is correct). | |It's also long past time that PARAM was made a struct :-) | |On a different not: Now that I've seen how you init a keyboard, I've got |no problem with leaving that code in :-)
Ron, Given that your running C code prior to branching to the Linux kernel entry point, there is really no reason that you can't have a nice C environment already setup before calling the Linux kernel. With C code calling C code you can then use C calling conventions for passing information to the kernel. My recommendation is to use something along the lines of
int linux_kernel_entrypoint(int argc, char **argv, char **envp) { .... }
You then don't need to hard code any locations. Linux when it is ready to take over and has enough info can then discard what ever remains of the linuxbios environment. To pass information about the system to the kernel use envp. This actually works pretty cleanly and you won't have a struct that is out of sync between the kernel and linuxbios. C calling conventions don't change very quickly so it is a pretty safe bet.
Here is an example of how things might be called. In addition you might want to look at some of the NetBSD and OpenBSD ports that do similar things.
char *envp[MAX_ENVP];
envp[0] = "BIOS=linuxbios"; /* this must be the first parameter */ envp[1] = "bios_rev=xx.xx"; envp[2] = "manufacture=Joe's computers"; envp[3] = "motherboard=JC2000"; envp[4] = "chipset=SiS630" envp[5] = memsize; sprintf(memsize, "memsize=%d", available_memory); envp[6] = ...
/* call the kernel entry point */ (*loadfile->entrypoint)(argc, argv, envp);
If the kernel needs to deal with being booted from different environments, it can relatively easily probe for the 'BIOS=linuxbios' string at the begining of envp. If it ain't there then it ain't linuxbios and it will have to deal. If it is linuxbios then a whole assortment of assumptions can then be made.
If you do opt to go this route then I would like to give you some recommendations on what envp variables you should define and what there names should be for compatability with other BIOSes.
TJ Merritt tjm@codegen.com 1-415-834-9111 - To unsubscribe: send mail to majordomo@freiburg.linux.de with 'unsubscribe openbios' in the body of the message