[coreboot] [PATCH] libpayload: Add multiboot support

Robert Millan rmh at aybabtu.com
Thu Sep 25 22:02:41 CEST 2008

On Thu, Sep 25, 2008 at 12:51:47PM -0600, Jordan Crouse wrote:
> This is a simple patch to parse and read the multiboot table
> in libpayload.  It doesn't do much more then read the memory
> map for now, but the important thing is that we are storing off
> %eax and %ebx in the init code and using it when we need it.


> The next step is probably an API where upon a multiboot aware
> payload could insert new things into the table (say, the drive
> structure, or the cmdline or other interesting information), and then
> pass it to a child payload.

If you want to preserve the table for future use, I recommend that you
copy it early in the code.  Per spec the loader doesn't make any promises
on its location (other than not overwriting your code with it, of course).

> I'm not sure what else we would need to do to libpayload so that
> grub will load the payloads, but I'm sure Robert will enlighten us.

You also need a Multiboot header in the resulting image.  It has to be
32bit-aligned and in the first 8k.  For what your patch does, the
following should suffice:

0x1BADB002  (magic)
0x00000002  (flag for memory info)
(-0x1BADB002 -0x00000002)  (checksum)

For details see http://www.gnu.org/software/grub/manual/multiboot/html_node/Header-layout.html#Header-layout

Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."

More information about the coreboot mailing list