http://gentoo-wiki.com/TinyGentoo
http://www.wplug.org/top/wplug-top018.txt
1. prepare
#mkdir tiny-gentoo
#cd tiny-gentoo
#wget http://gentoo.osuosl.org/experimental/x86/embedded/stages/
stage3-x86-uclibc-2005.0.tar.bz2
#wget http://gentoo.osuosl.org/snapshots/portage-20060102.tar.bz2
#tar xjpf stage*.tar.bz2
#cp -L /etc/resolv.conf etc/resolv.conf
#mkdir -p usr/portage
#tar xjf portage-20060102.tar.bz2 -C usr2. chroot to tiny-gentoo#chroot . /bin/bash
#env-update && source /etc/profile
3. Make a minimal gentoo
#ln -snf /usr/portage/profiles/uclibc/x86/2005.1/ /etc/make.profile
#nano /etc/make.conf
FEATURES=”ccache”
USE=”minimal”
#emerge ccache
#emerge -auDN world
#etc-update
(#emerge vanilla-sources)
#cp /etc/skel/.bash_profile /etc/skel/.bashrc /root/
4. Make the real tiny rootfs
#mkdir /rootfs
#mkdir -p /etc/portage
#echo “sys-apps/baselayout-lite -*” >> /etc/portage/package.keywords
#nano /etc/make.conf
#ROOT=/rootfs emerge -av baselayout-lite uclibc busybox
5. Chroot to the new /rootfs
#chroot /rootfs /bin/ash
#passwd
#addgroup -g 100 users foo
#adduser -h /home/foo -s /bin/ash -G users foo
#exit (–this exit to the last chroot box tiny-gentoo)
6. Modify the fstab file.
#echo “TinyGentoo” > /rootfs/etc/hostname
# echo “/dev/hda / ext3 defaults” >> rootfs/etc/fstab
#chmod 555 /rootfs/proc
7. Emerge the wanted packages into /rootfs
#ROOT=/rootfs emerge -av net-tools udhcp lynx scrollz dropbear screen
8. Now the /rootfs directory now contains your complete system. Clean it and make a tar ball.
# cd /rootfs
# tar -zcf ../rootfs.tgz .
# exit ( — exit to your host linux)
9. Build the disk img file. (write the rootfs to an img file.)
# qemu-img create gentoo.img 64M
# mkfs.ext3 -q gentoo.img
# mount -o loop gentoo.img /mnt/floppy
# tar -zxf rootfs.tgz -C /mnt/floppy
# umount /mnt/floppy
10. Build kernel for Qemu
The Qemu has following devices:
- i440FX host PCI bridge and PIIX3 PCI to ISA bridge
- Cirrus CLGD 5446 PCI VGA card or dummy VGA card with Bochs VESA extensions
- PS/2 mouse and keyboard
- 2 PCI IDE interfaces with hard disk and CD-ROM support
- Floppy disk
- NE2000 PCI network adapters
- Serial ports
- Soundblaster 16 card
Just remember to add all the device drivers into kernel, not as modules. And also add ext3 support into the kernel.
Finally we’ll get kernel/arch/i386/boot/bzImage.
11. Boot from Qemu!
# qemu -hda gentoo.img -kernel bzImage -append “root=/dev/hda”