AVATT: Difference between revisions

From coreboot
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
This page is about the "[http://code.google.com/soc/2008/coresystems/appinfo.html?csaid=ED0729A9DB64B39B All Virtual All The Time]" GSoC 2008 project.
This page is about the "[http://code.google.com/soc/2008/coresystems/appinfo.html?csaid=ED0729A9DB64B39B All Virtual All The Time]" GSoC 2008 project.
This project aims to create a modified Linux-As-Bootloader coreboot payload that contains a Linux kernel modified to include [http://kvm.qumranet.com KVM] support, uClibc, a custom busybox image, and whatever is needed to get KVM-qemu up and running in the ROM image.
This project aims to create a modified Linux-As-Bootloader coreboot payload that contains a Linux kernel modified to include [http://kvm.qumranet.com KVM] support, uClibc, a custom busybox image, and whatever is needed to get KVM-qemu up and running in the ROM image. Use this [http://panzer.utcluj.ro/~alien/coreboot/AVATT/screenshot.png screenshot] if you want to see it in action.


== Needed tools ==
== Prebuilt ROM image ==


In order to build this, you need a modified version of [[buildrom]], that can be cloned from my git repo like this:
I have prepared a pre-built image that you can use in qemu to see what's this all about without having to spend considerable time to compile it.
git clone git://repo.or.cz/kvm-coreboot.git buildrom


In order for it to work, you need to have installed the [http://www.coreboot.org/Buildrom#Prerequisites prerequisites] of buildrom. The slackware folks ;] may prefer to skip this and then fix by hand any encountered build failures by installing the missing programs.
These are some copy/paste instructions that will fetch it and run it in qemu:


You need a x86 Linux distribution with gcc > 4.2, since currently the build fails under x86-64 and gcc-3.x doesn't support some compiler flags we are using. Eventually this will get fixed in the future.
wget http://panzer.utcluj.ro/~alien/coreboot/AVATT/BIOS/bios.bin -O /tmp/bios.bin
wget http://panzer.utcluj.ro/~alien/coreboot/AVATT/BIOS/vgabios-cirrus.bin -O /tmp/vgabios-cirrus.bin
qemu-system-x86_64 -L /tmp -hda /dev/null -m 768 -serial stdio


== How to build ==
If your bandwidth allows, you can also get a [http://panzer.utcluj.ro/~alien/coreboot/AVATT/diskimage.img.bz2 disk image], extract it and pass it as the -hda parameter of qemu instead the /dev/null file so that you can mount it and try to run VMs of the CD ISO images present inside it. This won't work for now, see the "Current Status" section to find out why.
Just type  
 
make
== Building from scratch ==
from within the buildrom directory and everything should get built.
=== Needed tools ===
 
First of all, you need a x86 Linux distribution with gcc > 4.2, since currently the build fails under x86-64 and gcc-3.x doesn't support some compiler flags we are using. Eventually this will get fixed in the future.
 
In order to build this stuff you need a modified version of [[buildrom]] that can be cloned from my git repo using this command:
git clone http://repo.or.cz/r/kvm-coreboot.git
 
You also need to have installed some of the [http://www.coreboot.org/Buildrom#Prerequisites prerequisites of buildrom]. The slackware folks ;] may prefer to skip this and then fix by hand any encountered build failures by installing only the missing programs.
 
=== How to build ===
Just type ''make'' from within the buildrom directory and everything should get built.


(Optional step) If you wish to make some adjustments you may do it by running one of these commands, but normally you shouldn't need to do this:
(Optional step) If you wish to make some adjustments you may do it by running one of these commands, but normally you shouldn't need to do this:
Line 22: Line 33:
  make busybox-config  
  make busybox-config  


== How to run ==
=== How to run the ROM image you just built ===


You should read the [[QEMU Build Tutorial]] and the [[QEMU]] pages to see how to run a BIOS image with qemu, but since this howto aims to be as short as possible, here you have all you need to get it running ASAP:
You should read the [[QEMU Build Tutorial]] and the [[QEMU]] pages to see how to run a BIOS image with qemu, but since this howto aims to be as short as possible, here you have all you need to get it running ASAP:
Line 51: Line 62:
**Debian Lenny  
**Debian Lenny  
**Gentoo
**Gentoo
* kvm crashes due to Thread Local Store(TLS) issues in uClibc.
* kvm crashes due to Thread Local Store(TLS) implementation issues in uClibc.


Notes:
Notes:

Revision as of 23:02, 29 August 2008

This page is about the "All Virtual All The Time" GSoC 2008 project. This project aims to create a modified Linux-As-Bootloader coreboot payload that contains a Linux kernel modified to include KVM support, uClibc, a custom busybox image, and whatever is needed to get KVM-qemu up and running in the ROM image. Use this screenshot if you want to see it in action.

Prebuilt ROM image

I have prepared a pre-built image that you can use in qemu to see what's this all about without having to spend considerable time to compile it.

These are some copy/paste instructions that will fetch it and run it in qemu:

wget http://panzer.utcluj.ro/~alien/coreboot/AVATT/BIOS/bios.bin -O /tmp/bios.bin
wget http://panzer.utcluj.ro/~alien/coreboot/AVATT/BIOS/vgabios-cirrus.bin -O /tmp/vgabios-cirrus.bin
qemu-system-x86_64 -L /tmp -hda /dev/null -m 768 -serial stdio

If your bandwidth allows, you can also get a disk image, extract it and pass it as the -hda parameter of qemu instead the /dev/null file so that you can mount it and try to run VMs of the CD ISO images present inside it. This won't work for now, see the "Current Status" section to find out why.

Building from scratch

Needed tools

First of all, you need a x86 Linux distribution with gcc > 4.2, since currently the build fails under x86-64 and gcc-3.x doesn't support some compiler flags we are using. Eventually this will get fixed in the future.

In order to build this stuff you need a modified version of buildrom that can be cloned from my git repo using this command:

git clone http://repo.or.cz/r/kvm-coreboot.git

You also need to have installed some of the prerequisites of buildrom. The slackware folks ;] may prefer to skip this and then fix by hand any encountered build failures by installing only the missing programs.

How to build

Just type make from within the buildrom directory and everything should get built.

(Optional step) If you wish to make some adjustments you may do it by running one of these commands, but normally you shouldn't need to do this:

make menuconfig (for buildrom)
make kernel-config
make uclibc-config
make busybox-config 

How to run the ROM image you just built

You should read the QEMU Build Tutorial and the QEMU pages to see how to run a BIOS image with qemu, but since this howto aims to be as short as possible, here you have all you need to get it running ASAP:

It's quite handy to have a symlink to "deploy/emulation-qemu-x86.rom" in your $HOME with the name bios.bin, and in the same directory you should have the Cirrus VGA BIOS ROM image. Here you have cut/paste commands for this scenario:

ln -s deploy/emulation-qemu-x86.rom ~/bios.bin
wget http://panzer.utcluj.ro/~alien/coreboot/AVATT/BIOS/vgabios-cirrus.bin -O ~/vgabios-cirrus.bin

Then you must run qemu in 64bit mode so that we can get support for the SVM instructions:

qemu-system-x86_64 -L ~ -hda /dev/null -m 768 -serial stdio

Notes:

  • The -m 768 parameter is mandatory, since otherwise the kernel will panic because I hardcoded the RAM size to 768M in coreboot. It was 128M before, and that proved to be too small. Sorry for those who have few MBs of RAM.
  • The -serial parameter is good for those who have keyboard issues with the default SDL output of qemu, like arrow keys not working, etc. This way you can also use the terminal you used to launch qemu as a second console and here all the keys should work fine.

What's inside the 2MB BIOS ROM image?

  • Linux kernel version 2.6.22.2 with tiny patches and a custom config
  • uClibc 0.9.28.3 with some patches applied (aio, fenv, long double math) and a custom config - only the .so files are included
  • zlib 1.2.3 - only the .so file is included
  • ncurses 5.6 - the .so file and some other small necessary files are included
  • kvm-72 with some small patches - the extra BIOSes, the nbd tool and the docs are missing
  • busybox 1.1.3 with a custom config - NEEDS UPDATE

Current status

  • everything compiles fine on x86 but fails on x86-64. It was tested and should compile on the following Linux distributions:
    • Ubuntu 8.04 & 8.10 alpha
    • Debian Lenny
    • Gentoo
  • kvm crashes due to Thread Local Store(TLS) implementation issues in uClibc.

Notes:

  • gcc versions older than 4.2 are unsupported due to missing support for some CFLAGS
  • You may use older gcc versions, even 3.x but they may not support all the CFLAGS we have. Anyway, after dropping the conflicting CFLAGS it should compile but YMMV.
  • Gentoo hardened failed because of a strange error, even after dropping the CFLAGS unsupported by gcc-3 and after adding some stuff in uClibc's security section. I have no idea what could cause this:
Internal error convert_magic 00006000 != a5a5a5a5

The convert_magic error indicates that the assembler/linker didn't initialize struct image_params at the right place.

TODO

  • make the kvm userspace tool not to crash anymore. A possible solution would be to fix the TLS issues from the version of uClibc we currently use (daily snapshots from their SVN tree). This could even mean porting the uClibc-nptl branch to x86 if both of the x86 linuxthreads branches prove to be too hard to fix.
  • user-friendly tool that can create and run virtual machines.
  • automatically starting the virtual machines at boot.
  • get the network to work in qemu since it fails with both coreboot v2 and v3.
  • integrate the virt-manager daemon inside the ROM image, if it and its dependencies fit the remaining free space. This needs network support to be really useful.
  • fix compilation on x86_64 boxes by compiling everything in 64bit mode. We need a 64bit hardware anyway since the SVM instructions are available only on recent 64 bit boxes so this shouldn't matter too much, except for the some extra wasted ROM space caused by 64bit code.
  • keep the versions as up-to-date as possible but also compatible with each other

Contact

If you find anything incomplete or wrong about this page please don't hesitate to fix it. If you can't, please drop me an email at cristi.magherusan NO@SPAM net.utcluj.ro and I'll do it myself.

You can also find me on IRC most of the time. My nick is "alien".


Thanks for passing by,

Cristi

Public domain I, the copyright holder of this work, hereby release it into the public domain. This applies worldwide.

In case this is not legally possible:
I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.