4) Choose at least these options :
- Toolchain --> Enable WCHAR Support (The WCHAR
data type contains a 16-bit Unicode character.)
- Toolchain --> Enable locale ... Support (Locale
support refers to an application respecting cultural preferences
regarding alphabets, sorting, number formatting, etc.)
- Toolchain --> Build/install c++ compiler and libstdc++
(Supports gcc-c++ compiler for Qt and XOrg)
- Package Selection --> Graphic libraries and applications
--> qtopia4 (A graphical environment for Linux on a handheld PC or
small device.)
- Package Selection --> Graphic libraries and applications
--> Compatibility with Qt3 (using older version, supports
application developed in Qt3 Designer)
- Package Selection --> Graphic libraries and applications
--> X Windows System Server --> modular xorg ( The X.Org
project provides an open source implementation of the X Window)
- Package Selection --> Graphic libraries and applications
--> X.org X Window System, X11R7, release 7.3
- Package Selection --> Graphic libraries and applications
--> X.org X Window System, X11R7, release 7.3 --> X11R7 Servers
--> xorg-server (X server component)
- Package Selection --> Graphic libraries and applications
-->
X.org X Window System, X11R7, release 7.3 --> X11R7 Drivers -->
xf86-input-keyboard (very common interface :-)
- Package Selection --> Graphic libraries and applications
-->
X.org X Window System, X11R7, release 7.3 --> X11R7 Drivers -->
xf86-input-mouse
- Package Selection --> Graphic libraries and applications
-->
X.org X Window System, X11R7, release 7.3 --> X11R7 Drivers -->
xf86-video-cirrus (Cirrus VGA is emulated in QEMU)
- Package Selection --> Graphic libraries and applications
-->
X.org X Window System, X11R7, release 7.3 --> X11R7 Drivers -->
xf86-video-fbdev (or you can use framebuffer)
- Package Selection --> Graphic libraries and applications
-->
X.org X Window System, X11R7, release 7.3 --> X11R7 Application
--> you can add some useful applications
- Package Selection --> Graphic libraries and applications
-->
X.org X Window System, X11R7, release 7.3 --> MatchBow Window
Manager (The Matchbox window manager is responsible for
managing X11 client window geometry and stacking order, as
well as providing decorations and controls)
- Package Selection --> Graphic libraries and applications
-->
X.org X Window System, X11R7, release 7.3 --> rxtv (Terminal
emulation program in X
- Target Filesystem Options --> grub (Multiboot boot loader
derived from GRUB, GRand Unified Bootloader)
- Save configuration
5) make uclibc-menuconfig
- Check Wide Character Support and Locale Support (might be missing)
6) run make (it will download approximatelly 340 MB)
make will fail with the following line :
/build_i686/staging_dir/usr/include/xorg/miscstruct.h:54:20: error:
pixman.h: No such file or directory
workaround:
cd ./build_i686/staging_dir/usr/include
ln -sf pixman-1/* .
cd -
Final build should finish like this :
-rw-rw-r-- 1 michal michal 58580992 2009-04-05 23:03
/mnt/build/binaries/uclibc/rootfs.i686.ext2
rm -f /mnt/build/project_build_i686/uclibc/.fakeroot*
Creating a disk image for QEMU
1) Create an empty file for disk image,
dd if=/dev/zero of=myimage bs=512
count=$((64*1024*1024/512))
Block size will be 512B, we need 64MB = 64*1024*1024, the number of
512B blocks will be 64MB/512.
2) Make a block device from the image file using losetup.
losetup is used to associate loop
devices with regular files or block devices, to detach loop devices and
to query the status of a loop device. In Unix like operating systems, a
loop device is a pseudo-device that makes a
file accessible as a block device. Lets create a loop device from the
image.
losetup /dev/loop0
myimage
3) Create a partition layout using fdisk. fdisk is a commonly used name
for a command-line
utility that provides
disk partitioning functions in an OS.
fdisk
/dev/loop0
Create a primary partition with maximum size.
- Press n - new partition
- Press p - primary
- Press 1 -
partition number 1, First cylinder 1, Last cylinder 8
- Press w - write
setup
4) Mount primary partition to filesystem, this way you can copy files
created by buildroot to your image.
First created a loop device representating the partition. Partition is
beginning on the first cylinder (check
fdisk
-ul /dev/loop0, and find begining block). Calculate the offset
of the partition from the beginning of the device (starting block *
block size, 63 * 512 = 32256B). Now you can create second loop device
pointing on the partition (
losetup -o
32256 /dev/loop1 /dev/loop0 ).
For more information concerning harddisk and its geometry have a look at
http://en.wikipedia.org/wiki/Hard_disk_drive
http://en.wikipedia.org/wiki/Cylinder-head-sector
5) Create an EXT2 (or EXT3) filesystem on the partition.
mkfs (make a filesystem) is the
standard Unix command for formatting a disk partition. Using
mkfs.ext2 -m0 /dev/loop1 will create
an EXT2 filesystem with 0% reserved space for root (by default 5% is
reserved, but this was overriden by the -m parameter).
6) Mount your newly created filesystem to your system directory
structer
mount -a /dev/loop1
/mnt/somewhere. Now you should be able to write data on your
64M filesystem. Check
df for
free space.
e.g.
/dev/loop1
63429 45750 17679
73% /mnt/somewhere
7) Copy files from /buildroot-2009.02/project_build_i686/uclibc/root to
your mount point (be sure to keep file rights and owner root)
8) Get working kernel from somewhere (you can try to compile from
source (www.kernel.org, make menuconfig, make, resulting in bzImage) or
use Buildroot (it supports building kernel image and placing release
file into root structure) or the easiest way - use kernel from some
Live distro, such as FedoraLive, you will need vmlinuz0 and initrd0))
9) Prepare boot loader, we will use GNU GRUB ("GRUB" for short) is a
boot loader package from the GNU Project. GRUB is the reference
implementation of the Multiboot Specification, which allows a user to
have several different operating systems on their computer at once, and
to choose which one to run when the computer starts.
- run grub --device-map=/dev/null
(we don't want GRUB to detect real drives, do we ? :-)
- set the device hd0 as our file - device
(hd0) img
- set the root, where GRUB files are stored - root (hd0,0)
- setup the disk - setup (hd0)
10) Create GRUB configuration file in your filesystem (
/mnt/somewhere/boot/grub/grub.conf ). Add following lines (these are
referring to kernel taken from Fedora Live)
title=GNU/Linux
root (hd0,0)
kernel /boot/vmlinuz0 rw root=/dev/sda1
initrd /boot/initrd0.img