mkdir /usr/src/initramfs cd /usr/src/initramfs mkdir -p bin lib dev etc mnt/root proc root sbin sys
USE="static" emerge --root=/usr/src/initramfs/ -v busybox
cp -a /dev/{null,console,tty,sd??} /usr/src/initramfs/dev/
#!/bin/busybox sh # Mount the /proc and /sys filesystems. mount -t proc none /proc mount -t sysfs none /sys #setup mdev echo /sbin/mdev > /proc/sys/kernel/hotplug /sbin/mdev -s # Do your stuff here. echo "This script mounts rootfs and boots it up, nothing more!" rescue_shell() { echo "Something went wrong. Dropping you to a shell." busybox --install -s exec /bin/sh } uuidlabel_root() { for cmd in $(cat /proc/cmdline) ; do case $cmd in root=*) dev=${cmd#root=} type=${dev%%=*} if [ $type = "LABEL" ] || [ $type = "UUID" ] ; then mount -o ro $(findfs "$dev") /mnt/root else mount -o ro ${dev} /mnt/root fi ;; esac done } # Mount the root filesystem. uuidlabel_root || rescue_shell # Clean up. umount /proc umount /sys # Boot the real thing. exec switch_root /mnt/root /sbin/init
chmod +x /usr/src/initramfs/init
cd /usr/src/linux make menuconfig General setup ---> [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support (/usr/src/initramfs) Initramfs source file(s) make -j4 && make modules_install
cd /usr/src/initramfs/ find . -print0 | cpio –null -ov –format=newc | gzip -9 > /boot/initramfs.cpio.gz
edit grub < 1.0(add the initrd line):
title Gentoo root (hd0,0) kernel /kernel64 initrd /initramfs.cpio.gz
edit grub > 2
menuentry 'Gentoo 64 Linux (UUID)' { root=hd0,1 linux /boot/kernel64 root=UUID=d2e3c17f-75db-4c95-87ce-760c8e41e2ca initrd /boot/initramfs.cpio.gz }