[guowenxue@localhost rootfs]$ sudo dd if=/dev/zero of=ramdisk bs=1M count=16
[guowenxue@localhost rootfs]$ sudo losetup /dev/loop0 ./ramdisk
[guowenxue@localhost rootfs]$ sudo mke2fs /dev/loop0
mke2fs 1.35 (28-Feb-2004)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
4096 inodes, 16384 blocks
819 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=16777216
2 block groups
8192 blocks per group, 8192 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[guowenxue@localhost rootfs]$ sudo mount -t ext2 /dev/loop0 mnt/
[guowenxue@localhost rootfs]$ ls mnt/
lost+found
[guowenxue@localhost rootfs]$ sudo cp -arf rootfs_tree/* mnt/
[guowenxue@localhost rootfs]$ ls mnt/
apps bin drivers home linuxrc lost+found proc sbin tmp var
audio dev etc lib logs mnt root sys usr
[guowenxue@localhost rootfs]$ sudo umount mnt
[guowenxue@localhost rootfs]$ sudo losetup -d /dev/loop0
[guowenxue@localhost rootfs]$ gzip -9 ramdisk
同时需要修改Linux内核中对ramdisk支持的大小,方法如下:
在内核目录下执行make menuconfig,选择
Device Drivers --->
Block devices --->
<*> RAM disk support (16) Default number of RAM disks (16384) Default RAM disk size (kbytes)
[guowenxue@localhost rootfs]$ gzip -d ramdisk.gz
[guowenxue@localhost rootfs]$ sudo mount ramdisk -o loop mnt/
RAMDISK烧录过程:
内核烧录
========================
tftp 20000000 uImage.gz
nand erase a0000 500000
nand write 20000000 a0000 500000
文件系统烧录
========================
tftp 20000000 nrfs.ext2.gz
nand erase 5a0000 500000
nand write 20000000 5a0000 500000
===========================
默认内核参数传递和u-boot启动命令如下,如要调试请自行更改
U-Boot> pri
bootargs=loglevel=0 initrd=0x21100000,3145728 root=/dev/ram0 rw
bootcmd=nand read 20000000 a0000 500000;nand read 21100000 5a0000 500000;bootm 20000000
重启
==========================
reset
阅读(2039) | 评论(1) | 转发(0) |