工具:busybox1.17,mkyaffs2image
主机:ubuntu 10.4
交叉编译器:arm-linux-gcc 4.3.2
1.下载源码,下载后解压,然后配置:
make menuconfig
2.配置比较多,不多说,完后编译make
3.安装 make install
4.修改。安装后的文件系统在_install目录下,可以看到还少很多目录,手动添加:
mkdir dev etc lib root usr var proc mnt tmp sys
添加inittab文件:
gedit etc/inittab
内容如下:
::sysinit:/etc/init.d/rcS
::askfirst:-/bin/sh
::ctrlaltdel:/sbin/reboot
::shutdown:/sbin/swapoff -a
::shutdown:/bin/umount -a -r
::restart:/sbin/init
添加rcS脚本:
mkdir etc/init.d
gedit etc/init.d/rcS
内容如下:
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
export PATH
#make the shell ignore these signal.
trap ":" INT QUIT TSTP
/bin/hostname Fl2440ARM
/bin/mount -n -t proc none /proc
/bin/mount -n -t sysfs none /sys
/bin/mount -n -t usbfs none /proc/bus/usb
/bin/mount -t ramfs none /dev
echo /sbin/mdev > /proc/sys/kernel/hotplug
/sbin/mdev -s
#/bin/hotplug
# mounting file system
mkdir -p /dev/pts
mkdir -p /dev/shm
/bin/mount -n -t devpts none /dev/pts -o mode=0622
/bin/mount -n -t tmpfs tmpfs /dev/shm
/bin/mount -n -t ramfs none /tmp
/bin/mount -n -t ramfs none /var
mkdir -p /var/empty
mkdir -p /var/log
mkdir -p /var/lock
mkdir -p /var/run
mkdir -p /var/tmp
#set the system clock
/sbin/hwclock -s
#start log system
syslogd
echo " Welcome to my system!" > /dev/tty1
echo " "> /dev/tty1
echo " 2010-12-21 by crazyman" > /dev/tty1
echo "________________________________________" > /dev/tty1
# up the net card.
/sbin/ifconfig lo 127.0.0.1
/sbin/ifconfig eth0 192.168.1.15 up
使rcS脚本可执行:
chmod +x etc/init.d/rcS
5.添加lib库:
复制/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/目录下的全部文件到_install/lib中。
6.使用工具生成文件系统映像
mkyaffs2image _install myfilesystem.img