jump to navigation

everything’s bootable but me…(2) August 23, 2006

Posted by TSAI HONG-BIN in Linux.
trackback

Cofession, I then threw the usbinitrd.img away and created a root file system to work it out. So, then, it seems like to start over.

Instead of using an initrd.img, I let it boot from a root file system. First we create a ramdisk file.

#dd if=/dev/zero of=/tmp/rootfs-file bs=1k count=4096

#mkfs.ext2 /tmp/rootfs-file 4096

#mount /tmp/rootfs-file /mnt/rootfs -o loop

I created root file system via buildroot-20060817.tar.gz. Unexpectedly, nodes under /dev in the target root file system it created are all normal files. I didn’t aware of this situation at the begining and therefore suffered from the result of system hang during booting process. Anyway, the fixup is quite simple, just copy the /dev of the system currently running like

#cp -dfR /dev/ /path/to/rootfs/

Besides, make sure that you selected all desired packages in busybox and re-compiled. the target root file system is located in ~buildroot/build_i386/root/ (presume that your target system is still in i386 architecture)

#cp -dfR /path/to/buildroot/build_i386/root/* /mnt/rootfs/

#umount /mnt/rootfs

#dd if=/tmp/rootfs-file bs=1k count=4096 | gzip -9 > rootfs.gz

#cp rootfs.gz /media/disk/

#umount /media/disk

Unnecessary kernel modules are removed, others are set build-in. In the end of recompiling, I got a kernel image in 1MB. Then copy all stuff to the usb drive. Set syslinux.cfg as follows:

############################################

DEFAULT vmlinuz

APPEND root=/dev/ram0 ramdisk_size=100000 init=/etc/init initrd=rootfs.gz

############################################

Now you got it.

Advertisements

Comments»

No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: