Hi,

I build by gentoo kernel without genkernel, and I want to create the
initramfs by hand. Following is the steps I did:

Build the kernel with initramfs support;
mkdir -p /usr/src/initramfs{dev,bin,sbin,etc,root,proc,sys}
cp -aL /bin/bb /usr/src/initramfs/bin # copy the busybox
cp -a /sbin/lvm /usr/src/initramfs/sbin # i created my root on lvm
cp -a /dev/{hda,hda1,hda2,ram0} /usr/src/initramfs/dev # i am not sure
if i am correct here
vim /usr/src/initramfs/init # create the init script, it based on
http://en.gentoo-wiki.com/wiki/Initramfs
#!/bin/busybox sh

# Mount the /proc and /sys filesystems.
mount -t proc none /proc
mount -t sysfs none /sys

# Do your stuff here.
echo "This script mounts rootfs and boots it up, nothing more!"

# active lvm
lvm vgscan
lvm vgchange -ay

# Mount the root filesystem.
mount -o ro /dev/vgsys/root /mnt/root

# Clean up.
umount /proc
umount /sys

# Boot the real thing.
exec switch_root /mnt/root /sbin/init


#####################################################
chmod +x /usr/src/initramfs/init

then I use find /usr/src/initramfs/init | cipo -oHnewc | gzip -9 >
/boot/initramfs.gz

But when I try to boot my system, I got kernel panic, and it says it
cannot find the init script. If I remove the 'initrd' instruction from
the grub.conf file, the error message does different, which means the
system WAS trying to process the initramfs. But I do not know why it
cannot find the init script.

I modified the initramfs that the genkernel generated before, and the
system works fine after that. But I never created a initramfs from
scratch before

-- 
Best Regards,
David Shen

http://twitter.com/davidshen84

Reply via email to