[coreboot] questions about "QEMU Build Tutorial"
mylesgw at gmail.com
Fri May 2 17:12:46 CEST 2008
> My test versions:
> coreboot v2- revision 3275
> filo - v0.5- revision 45
> qemu- v0.9.1
> I followed steps described in that wiki page, and I got:
> 1 init_drive: Probing for hda
> 2 init_drive: LBA mode, sectors=409600
> 3 init_drive: LBA48 mode, sectors=409600
> 4 init_drive: Init device params... ok
> 5 hda: LBA48 209MB: QEMU HARDDISK
> 6 init_controller: MASTER CHECK: master yes
> 7 init_controller: /*slave */ -- drive is 0
> 8 open_pc_partition: pc partition magic number not found
> Have I missed anything? Seems 'qemu-create img' not produce the correct
> here is my xxd result:
> $ head disk.img | xxd | vi -
> 1 0000000: 0000 0000 0000 0000 0000 0000 0000 0000 ................
> 2 0000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
I don't know how this tutorial is supposed to work. Disk.img is supposed to
be the whole hard drive, and you're treating it like a partition with
mkfs.ext2. Here is something that should work:
1. Create the raw image like it says in the tutorial
2. Boot QEMU with a rescue disk from your favorite OS
3. Run fdisk and create a single partition on the drive that takes up the
4. Quit and write the partition to disk
5. Run mkfs.ext2fs on that partition
6. Exit QEMU
You now have a partitioned disk with an ext2 fs. You could have put in a
second partition for swap while you were there, but lets keep this simple.
Now you have a hard drive image with a partition and you need to mount that
partition to copy the files you want.
mount -o loop,skip=32256 disk.img /mnt/rootfs
(Thanks to http://wiki.archlinux.org/index.php/Qemu)
and continue the tutorial.
To restate: The problem is that when you run mkfs.ext2 on the disk.img,
you're formatting it as if it were a partition, not a drive, and you don't
have a valid partition table.
There are many other ways to get this done, I think this is the easiest. If
you can't get it to work you might also try:
1. Stealing the first 32256 bytes (63 * 512B sectors) from a known good
image of the same size and concatenating it to the front of a partition like
you made in the tutorial (- 63 sectors)
Hope that helps,
PS The page I referenced above has other advanced tips too.
More information about the coreboot