#!/bin/sh echo "------Create rootfs directons start...--------" mkdir rootfs cd rootfs echo "--------Create root,dev....----------" mkdir root dev etc boot tmp var sys proc lib mnt home usr mkdir etc/init.d etc/rc.d etc/sysconfig mkdir usr/sbin usr/bin usr/lib usr/modules echo "make node in dev/console dev/null" sudo mknod -m 600 dev/console c 5 1 sudo mknod -m 600 dev/null c 1 3 mkdir mnt/etc mnt/jffs2 mnt/yaffs mnt/data mnt/temp mkdir var/lib var/lock var/run var/tmp chmod 1777 tmp chmod 1777 var/tmp echo "-------make direction done---------"将其保存成脚本,加上可执行权限。就会在工作目录建立根文件系统基本目录
ARCH=arm CROSS_COMPILE=arm-linux-(4)然后make CONFIG_PREFIX=/home/sun/study/rootfs install
-------------------------------------------------- You will probably need to make your busybox binary setuid root to ensure all configured applets will work properly. --------------------------------------------------代表编译成功,成功之后就会在/home/sun/study/rootfs/bin 中出现很多可执行文件,在/home/sun/study/rootfs出现Linuxrc可执行文件
::sysinit:/etc/init.d/rcS console::askfirst:-/bin/sh ::restart:/sbin/init ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount -a -r ::shutdown:/sbin/swapoff -a加上可执行权限 chmod +x inittab
echo "----------mount all.........." mount -a echo "----------Starting mdev......" echo /sbin/mdev > /proc/sys/kernel/hotplug mdev -s /bin/hostname -F /etc/sysconfig/HOSTNAME echo "***********************************************" echo "************booting to mini2440 *****************" echo "Kernel version:linux-2.6.32.2" echo "zhenguoyao-uestc-chengdu" echo "Date:2011.5.30" echo "***********************************************"加上可执行权限 chmod +x rcS
#evice mount-point type option dump fsck order proc /proc proc defaults 0 0 none /tmp ramfs defaults 0 0 mdev /dev ramfs defaults 0 0 sysfs /sys sysfs defaults 0 0(4)etc/profile用户环境配置文件
PATH=/bin:/sbin:/usr/bin:/usr/sbin export PATH #set hostname HOSTNAME='/bin/hostname' export HOSTNAME # Set PS1 PS1='[\u@\h \W]\
export PS1(5)/etc/passwd shadow 用户文件以及密码
cat >>./etc/sysconfig/HOSTNAME 然后键入 mini2440 回车 然后按下 ctrl+c 结束录入
注意:以上操作应该在建立的rootfs目录中
五. NFS文件系统测试
设置uboot启动参数为
bootargs noinitrd root=/dev/nfs rw nfsroot=192.168.1.111:/home/sun/study/rootfs ip=192.168.1.230:192.168.1.1::255.255.255.0 console=ttySAC0,115200 init=linuxrc mem=64M
用uboot引导内核,如果可以进入终端,说明启动成功!noinitrd root=/dev/mtdblock3 rootfstype=jffs2 rw console=ttySAC0,115200 init=/linuxrc mem=64M
在u-boot终端输入:
tftp rootfs.jffs2