精简rootfs:
1.找一个可用的rootfs,删除一些可有可无的东西,如:opt/Qtopia/
lib/下删掉与jpeg和png有关的so文件
bin/、sbin/、usr/bin/和usr/sbin下删掉一些无用的东西
2.对可执行文件(主要是库文件)进行“瘦身”:
$ du –sh lib/
12M
$ mipsel-linux-strip lib/* //注意:瘦身后无法恢复
$ du –sh lib/3.0M
$ ls
bin dev etc home lib linuxrc mnt opt proc sbin sys tmp usr$ du -sh
7.8M注意,瘦身后的rootfs越小越好!
制作:
$ find . | cpio -H newc -o | gzip -9 > /tmp/tmproot.cpio.gz
15235 blocks
$ ls -hl /tmp/tmproot.cpio.gz
-rw-r--r-- 1 qilu qilu 2.9M 2012-04-18 09:30 /tmp/tmproot.cpio.gz
配置kernel:
1.CONFIG_BLK_DEV_INITRD & CONFIG_INITRAMFS_SOURCE:
General setup
-> Initial RAM filesystem and RAM disk (initramfs/initrd) support
-> Initramfs source file(s) => /tmp/tmproot.cpio.gz
2.CONFIG_BLK_DEV_RAM & ~_COUNT & ~_SIZE (enlarge /dev/ram0)
Device Drivers
-> Block devices
-> RAM block device support
-> Default number of RAM disks => 4
-> Default RAM disk size (kbytes) => 16384
然后,重新编译内核(make uImage)!
配置uboot启动参数(bootargs):
setenv bootargs mem=255M@0x0 256M@0x30000000 console=ttyS2,57600n8 ip=off root=/dev/ram0 rw rdinit=/linuxrc