[SeaBIOS] [PATCHv2 0/6] Improved multi-platform support

Ian Campbell ijc at hellion.org.uk
Tue Feb 12 11:34:58 CET 2013


On Mon, 2013-02-11 at 17:28 +0000, David Woodhouse wrote:
> On Mon, 2013-02-11 at 12:43 +0000, Ian Campbell wrote:
> > I don't know if distros prefer to have fewer images or not, once you
> > have 2 I guess having N is not such a big deal for something the size
> > and build time of SeaBIOS.
> 
> Probably not. It's not as if supporting Xen is an otherwise trivial
> exercise for the distros anyway; the effort of having an extra SeaBIOS
> binary is probably lost in the noise.
> 
> > I don't have any objections to either approach from the Xen PoV.
> > 
> > > 
> > > Thoroughly untested patch on top of your series at
> > > git://github.com/KevinOConnor/seabios.git test-20130209
> > > 
> > > How would I go about testing this myself?
> > 
> > You would need to install and configure Xen. It's not as complex as it
> > once was but it isn't a 5 minute hack either. I'm happy to give details
> > if you like though.
> 
> Yes please.
> 
> I take it the first step is running 'yum install xen' on my Fedora
> workstation, and rebooting into Xen with the Fedora kernel as Dom0?

I was going to say no, you need to build from source if you want to
experiment with different SeaBIOS versions, but actually that isn't
quite true -- you can install from packages and then use the packaged
source to rebuild hvmloader against the newer SeaBIOS. This is a path
less trodden but I guess might be simpler for you? You'll need a version
of Fedora which includes Xen 4.2, since that is where seabios became an
option, I expect this means Fedora 18+ is required.

I've CC'd Dario who is the Fedora user on our team, since I'm a Debian
type myself and generally build Xen from source anyhow I'm not 100%
confident in some of the bits below which may be tweaked by distros.

For docs you can find a few bits about Xen on Fedora at
http://wiki.xen.org/wiki/Category:Fedora especially
http://wiki.xen.org/wiki/Fedora_Host_Installation but basic install is
as you suggest "yum install xen" and reboot (but see the wiki for stuff
on how to tame network manager etc, if you haven't already for other
reasons).

At this point you'll want to create a guest, I don't think you actually
need a fully functioning one to test SeaBIOS. I suppose the Fedora way
to do this would be to use virt-install or virt-manager or something
(perhaps Dario can advise), but I'd be tempted to just use the xen
command line tools.

There are two toolstacks in Xen today but only the new "xl" toolstack
supports using SeaBIOS, the deprecated xend toolstack doesn't have this
option. I'm afraid I've no idea which Fedora 18 defaults to (I hope this
is something Dario can clarify), if it is xend then you will need to
chkconfig xend off and perhaps reboot. If xend is running then xl will
complain. 

First create a guest configuration file (seabios.cfg) with the
following:
        builder = "hvm"
        name = "seabios"
        device_model_version_override = "qemu-xen"
        memory = 512
        serial = 'pty'

This doesn't include any disks or nics, but should boot enough to test
basic seabios up until the "no bootable device" message. A nic is easy
to add:
        vif = ['']
will create one with a random mac, add mac=xx:xx:xx:xx:xx inside the ''
if you want something specific.

To add a disk using a physical backing device (e.g. LVM volume):
        disk = ['phy:/dev/VOl00/VM,hda,w']
Or to use e.g. a qcow image:
        disk = ['qcow:/images/seabios.qcow,hda,w']
A raw file would be file:/....

You can also add
        vnc = 1
to enable that. xl.cfg(5) explains most of the interesting options

Then to start the guest:
        xl create -c seabios.cfg
this will start the guest and connect to the serial console (-c), Ctrl=]
to disconnect. "xl console seabios" to connect manually.

To kill the guest:
        xl dest seabios

I often use "create -e" to stop xl from automatically restarting a
crashed domain, which is handy if hvmloader/seabios is crashing early
on.

Once you have a guest running you'll want to rebuild hvmloader (lets try
without a custom seabios first). To do that grab and unpack the .src.rpm
(I expect you know better than I how to do this, rpm -bp perhaps?).

Once you have the tree you can:
	./configure
	make -C tools/firmware
to rebuild just seabios + hvmloader. The result is in
tools/firmware/hvmloader/hvmloader which you can copy
to /usr/lib/xen/boot/hvmloader or override by adding 
        firmware_override = "/path/to/hvmloader"
to your cfg.

Lastly to change the seabios bits, just change to
tools/firmware/seabios-dir (assuming Fedora's packaging hasn't moved it)
and git fetch/git reset/vim/emacs, the build system won't clobber this
unless you ask it to. Then to rebuild:
        rm  tools/firmware/hvmloader/seabios.o \ 
                tools/firmware/seabios-dir/out/bios.bin \
                tools/firmware/hvmloader/roms.inc
        make -C tools/firmware

(the rm is just a bit of paranoia to make sure it gets rebuilt)

The other thing which might be useful is to build a debug hypervisor,
since this allows guest debug (e.g. from seabios magic i/o writes) to go
the xen console (visible in "xl dmesg"), to do this just
        make debug=y dist-xen
Then you will find a new Xen in dist/install/boot/ which you can copy
to /boot and add to your bootloader etc.

I can explain the full build from source dance too if that would be
useful. Looking at all the Fedora-isms above which I'm not sure about,
maybe that would have been easier...

Obviously I'm also happy to test proposed changes.

Ian.

-- 
Ian Campbell
Current Noise: Cathedral - Tree Of Life & Death

 If I start writing essays about Free Software for slashdot,
           please shoot me.




More information about the SeaBIOS mailing list