Creating BrazilFW hd image to use in qemu, VirtualBox etc.

Several tutorials

Creating BrazilFW hd image to use in qemu, VirtualBox etc.

Mensagempor wodz » Qui Jan 24, 2008 5:43 am

Create hd (or floppy) image with BrazilFW to be used in virtual machine like qemu, VirtualBox or other without use of real hardware drive.

1. recent syslinux (the binary provided with BFW is ancient one and fails to boot on many systems including qemu)
2. dd
3. fdisk
4. mkfs.vfat
5. ms-sys
5. loopback support in kernel
6. BrazillFW install CD iso image

1.Create image file (16MB in this example - adjust to Your needs)
# dd if=/dev/zero of=/tmp/brazil.img bs=1k count=16384

2.Create of partition(s) in image file
# fdisk -C 128 -u brazil.img
there You have to:
- create new primary partition at least 3MB (command n)
- change type of partition to FAT16 (command t type 6)
- mark partition as bootable (command a)
- exit writing changes

3.Create filesystem in image file
You have to calculate offset of partition in image file.
OFFSET = BS*SBoP (the one shown by fdisk)
In my example BS=512 SBoP=63 => OFFSET=32256

# losetup -o OFFSETT /dev/loop0 brazil.img
# mkfs.vfat /dev/loop0

4. Loopmount BrazilFW install CD and create brazil files
# mkdir /tmp/brazilCD
# mount brazilfw-cd.iso /tmp/brazilCD -o loop
# cd /tmp/brazilCD/BrazilFW
# ./ -hd

Answer configuration questions (just like in normal installation of bfw)
The installer will create dir /brazilfw-tmp-disk with (almost)all needed files

5. Mount FAT partition from image file
# mkdir /tmp/brazilIMG
# mount /dev/loop0 /tmp/brazilIMG

6. Copy all files from /brazilfw-tmp-disk into Your image
# cp -a /brazilfw-tmp-diski/* /tmp/brazilIMG

7. Copy kernel with IDE support
# cp /tmp/brazilCD/install/linux /tmp/brazilIMG

8. Edit syslinux.cfg
# chmod 644 /tmp/brazilIMG/syslinux.cfg
# vi /tmp/brazilIMG/syslinux.cfg
- remove '=' after append
- change boot=/dev/xxxx,vfat to boot=/dev/hda1,vfat
- save and exit

Content of the file after modification should look like this:

display syslinux.dpy
timeout 0
default linux
append load_ramdisk=1 initrd=root.tgz initrd_dyn=minix ramdisk_size=4096 root=/dev/ram0 boot=/dev/hda1,vfat

9. umount BrazilCD
# umount /tmp/brazilCD
# rm -r /tmp/brazilCD

10. umount brazil image
# umount /tmp/brazilIMG
# rm -r /tmp/brazilIMG
11. Remove /brazilfw-tmp-disk
# rm -r /brazilfw-tmp-disk

12. install syslinux in image
# syslinux /dev/loop0

13. Remove association between image and loop device
# losetup -d /dev/loop0

14. Write mbr to the image
# ms-sys -df /tmp/brazil.img

15. Test Your image :-)
# qemu -hda /tmp/brazil.img

Hopefully You will see standard boot process of BFW (maybe with some errors from loading ethernet drivers).

Final notes:
You can also create more sophisticated image with two partitions (the second one should be of type Linux and filesystem should be minix). This second partition is used by some of BFW additions (like squid for example).
With some small adjustments this procedure can be used to build custom floppy image also.

Voltar para Several tutorials

Quem está online

Usuários navegando neste fórum: Nenhum usuário registrado e 0 visitantes