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”
solar said
This url provides a script which makes an even smaller bootable system. I mainly use it to test a kernels before rebooting my desktop. But is a fine example of just how small you can really make things. Requires busybox/genext2fs
solar said
http://dev.gentoo.org/~solar/busybox/bbemu
themoonseeker said
Hi I follow this tutorial but I’ve got an error that I can’t resolve…
The system boot and hang at this point :
VFS : Cannot open root device “hda” or unknown-block(0,0)
Please append a correct “root=” boot option
Kernel panic – not syncing : VFS : Unable to mount root fs on unkown-block(0,0)
Any solution?
When making the kernel, I choose ext3, ext2 in kernel (not in module)
Thanks
And good tutorial!
sleepworm said
I got the same problem with themoonseeker, any solutions???
opensas said
hi
could you please provide us a guide on how to configure the kernel for this particular emulated hardware…
(I’ve posted a question at http://forums.gentoo.org/viewtopic-p-3938392.html#3938392)
thanks is advance
Browsem said
Hello.
Just wanted to mention in “4.4”
the “#echo “sys-apps/baselayout-lite -*” >> /etc/portage/package.keywords”
should be
#echo “sys-apps/baselayout-lite **” >> /etc/portage/package.keywords
thx for great howto