[coreboot] cbfstool, Linux trampoline and SeaBIOS

Curt Brune curt at cumulusnetworks.com
Fri Aug 29 01:08:55 CEST 2014


Hello -

First time poster, so take it easy on me :)

This is a great project -- I was able to get a kvm+coreboot+SeaBIOS
environment going pretty easily.  I started with the master branch of
coreboot and went from there.

I am having a problem trying to load a Linux kernel+initramfs cbfs
payload from SeaBIOS.  I can successfully boot the same
kernel+initramfs straight from coreboot (without SeaBIOS) as a
payload.

I started this topic on the SeaBIOS list -- there's a lot of good
background in the replies there:

  http://www.seabios.org/pipermail/seabios/2014-August/008215.html

I now think my problem lies in the cbfstool and the Linux trampoline.

Summarizing the analysis from those posts: the Linux trampoline code
does not set up the segment descriptors for __BOOT_CS and __BOOT_DS as
described in the Linux kernel documentation:

  ... a GDT must be loaded with the descriptors for selectors
  __BOOT_CS(0x10) and __BOOT_DS(0x18); both descriptors must be 4G
  flat segment; __BOOT_CS must have execute/read permission, and
  __BOOT_DS must have read/write permission;

Now in the working coreboot case it turns out the segment descriptors
at selectors 0x10 and 0x18, setup in the coreboot ramstage, match what
the Linux kernel expects (see coreboot/src/arch/x86/lib/c_start.S).

In the non-working SeaBIOS case the segment descriptors are configured
differently and the cbfs Linux payload does not work.

If the cbfs Linux payload is to be used in multiple environments
should the trampoline take care of descriptors that Linux requires?

Attached is a patch to util/cbfstool/linux_trampoline.c that does just
that.  Basically I borrowed the descriptor configs from
coreboot/src/arch/x86/lib/c_start.S for selectors 0x10 and 0x18.

Apologies for my poor x86 assembly coding -- first time.

Cheers,
Curt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: linux_trampoline.patch
Type: text/x-diff
Size: 4194 bytes
Desc: not available
URL: <http://www.coreboot.org/pipermail/coreboot/attachments/20140828/950c0868/attachment-0001.bin>


More information about the coreboot mailing list