bump version and fix CPP token
[buildroot.git] / docs / README.diskimage
blob67a0aad4f09feb9ec1655b51c26c4555e126b4b0
1 # Sample for i386 to create a 6MB disk-image
3 # create an image file
4 dd if=/dev/zero bs=512 count=$((6*1024*1024/512)) of=img
5 # create a partition (optional)
6 echo -e "n\np\n1\n\nw\n" | \
7   ~/src/busybox/busybox fdisk -C 16065 -H 255 -S 63 ./img
8 # as root, associate the image with a look-device:
9 # The offset of 512 comes from the the layout of the image. See
10 # ~/src/busybox/busybox fdisk -C 16065 -H 255 -S 63 -l ./img for the start
11 # block and multiply this with the block size (==512).
12 ~/src/busybox/busybox losetup -o 512 /dev/loop/0 /path/to/the/img
13 # create some filesystem on it, for example ext2
14 mkfs.ext2 -m0 -Lslash /dev/loop/0
15 # mount it and copy your stuff to it
16 ~/src/busybox/busybox mount -oloop,rw /dev/loop/0 /media/l0
17 ~/src/busybox/busybox mkdir -p /media/l0/boot/grub
18 ~/src/busybox/busybox cp -a project_build_i386/root/boot/grub/stage? /media/l0/boot/grub/
19 ~/src/busybox/busybox cp -a project_build_i386/root/boot/bzImage /media/l0/boot/
20 ~/src/busybox/busybox cat > /media/l0/boot/grub/menu.lst <<EOF
21 title=GNU/Linux
22 root (hd0,0)
23 kernel /boot/bzImage
24 EOF
25 # finally unmount the dist and disassociate the loopdev
26 ~/src/busybox/busybox umount /media/l0
27 ~/src/busybox/busybox losetup -d /dev/loop/0
28 # now install grub from the chroot
29 ~/src/busybox/busybox losetup /dev/loop/0 /path/to/the/img
30 project_build_i386/root/usr/sbin/grub --device-map=/dev/null
31 device (hd0) img
32 geometry (hd0) 16065 255 63
33 root (hd0,0)
34 setup (hd0)
35 quit
36 # finally boot the thing
37 /opt/qemu-trunk_ggi-2.2.2/bin/qemu -snapshot -hda img -boot c