[coreboot] questions about "QEMU Build Tutorial"
Jun Ma
sync.jma at gmail.com
Sat May 3 17:54:40 CEST 2008
On Sat, May 3, 2008 at 12:29 AM, Myles Watson <mylesgw at gmail.com> wrote:
>
> Your contributions are welcome!
>
"You must have cookies enabled to log in to coreboot. If you don't
have an account and wish to contribute contact Stefan Reinauer or
Ronald Minnich. NOTE: You don't need an account to read the
information on this site. So don't ask for an account unless you have
something to contribute."
Here is a instruction with ugly format, hope I have not miss important things.
==START==
My test env: debian etch with kernel 2.6.25.
src prepare:
coreboot v2 - svn://coreboot.org/repos/trunk/coreboot-v2
qemu-0.9.1.tar.gz/kqemu - http://fabrice.bellard.free.fr/qemu/
filo-0.5 - svn co svn://coreboot.org/filo/trunk/filo-0.5
linux src - http://www.kernel.org
linux rescue cd. - for partitions.
build tools:
qemu:
New linux distributions use gcc4.x as default, but qemu needs
gcc-3.x, so maybe you need to install gcc3.4 (for debian users, 'sudo
apt-get install gcc-3.4')
$ cd qemu-0.9.1
$ ./configure --cc=gcc-3.4 --target-list=i386-softmmu && make
$ sudo make install
Ok, qemu is done. you can use "qemu -h" for more helps. Let us
create a qemu hard disk image first. BTW, kqemu will bring you better
performance, please google for installing.
$ qemu-img create -f raw test.img 200M
Use your favourite rescue CD to do partion issues.(I choose
rhel here because both Debian etch/lenny CDs could not enter the
rescue mode in qemu-0.9.1.:<. anyone who knows the reason please tell
me, thanks. )
$ qemu -cdrom ~/iso/rhel5_rescue.iso -boot d -hda test.img -L
~/work/qemu-0.9.1/pc-bios/ -m 512
Run fdisk and create a single partition on the drive that
takes up the whole drive
Quit and write the partition to disk
Run mkfs.ext2fs on that partition
Exit QEMU
Allright, we start to build rootfs for qemu image.
$ sudo mount -o loop,offset=32256 test.img /mnt/rootfs
Create a boot directory and copy your Linux kernel (vmlinuz)
and initramfs (initrd) to it:
$ sudo mkdir /mnt/rootfs/boot
$ sudo mkdir /mnt/rootfs/boot/filo
$ sudo cp vmlinuz /mnt/rootfs/boot/vmlinuz
$ sudo cp initrd /mnt/rootfs/boot/initrd
$ sudo vi /mnt/rootfs/boot/filo/menu.lst
# For booting GNU/Linux
title GNU/Linux
root (hd0,0)
kernel /boot/vmlinuz root=/dev/hda1
initrd /boot/initrd
# Add other files as you wish.
$ sudo cp -R /* /mnt/rootfs
Alternatively, with Debian you can use the debootstrap command
to create a basic root filesystem:
$ sudo debootstrap --arch i386 etch /mnt/rootfs
http://ftp.debian.org/debian/
If you are using a debootstrap filesystem, open the file
/mnt/rootfs/etc/inittab and change runlevel to level 1:
id:1:initdefault:
cd out of /mnt/rootfs and umount it:
$ sudo umount /mnt/rootfs
filo:
$ cd filo-0.5
First invocation of make creates the default Config file.
$ make
Edit this file as you like.
vi Config
change MENULST_FILE to "hda1:/boot/filo/menu.lst", since we
only have one single partition.
change AUTOBOOT_FILE to "hda1:/boot/vmlinuz root=/dev/hda1
console=ttyS0,115200"
Run make again to create filo.elf, the ELF FILO image.
$ make
coreboot:
change payload to path/to/filo.elf
$ vi coreboot-v2/targets/emulation/qemu-x86/Config.lb
$ cd coreboot-v2/targets
$ ./buildtarget emulation/qemu-x86
$ cd emulation/qemu-x86/qemu-x86/
$ sudo make
Here we got coreboot.rom which use filo as bootloader.
$ cp coreboot.rom ~/bios.bin
$ cp $path/to/qemu-0.9.1/pc-bios/vgabios-cirrus.bin ~/
Here we go!
Boot test.img using coreboot.
$ qemu -L ~ -hda test.img
==END==
--
FIXME if it is wrong.
More information about the coreboot
mailing list