1. Create a directory
(1) mkdir busybox-rootfs
CD busybox-rootfs
Mkdir bin Dev etc home lib MNT opt proc root sbin sys tmp usr VaR
(2) Compile commands and library files compiled from busybox into the corresponding folder.
(3) configure the inittab file under the etc directory
: Sysinit:/etc/init. d/rc. s
: Once:/usr/sbin/telnetd
: Respawn:/sbin/Getty-l ttys0 115200 VT100
(4) configure the/etc/init. d/rc. s file
#! /Bin/sh
#
/Bin/Mount-T sysfssysfs/sys
#
/Bin/Mount-T proc/proc
#
/Bin/Mount-T tmpfstmpfs/tmp
#
/Bin/Mount-T tmpfstmpfs/root
#
/Bin/Mount-T tmpfstmpfs/var
CD/var
/Bin/mkdir-P cache liblocal lock log mail opt run spool TMP
#
/Bin/Mount-T tmpfstmpfs/dev
/Bin/mkdir-P/dev/PTS
/Bin/Mount-T devptsdevpts/dev/PTS
Echo/sbin/mdev>/proc/sys/kernel/hotplug
/Sbin/mdev-S
#
/Sbin/modprobe bondingmiimon = 200
/Sbin/modprobe dm9000
#
Echo active-Backup>/sys/class/NET/bond0/Bonding/Mode
/Sbin/ifconfig bond0168.3.0.47 netmask running 255.255.0 up
Echo + eth0>/sys/class/NET/bond0/Bonding/slaves
Echo + eth1>/sys/class/NET/bond0/Bonding/slaves
#
/Bin/hostname hepxa270
#
/Bin/IP link set can0 uptype can bitrate 125000 restart-MS 100
/Bin/IP link set can1 uptype can bitrate 125000 restart-MS 100
2. Compile
Execute sh busybox-rootfs.sh to compile and generate file rootfs. img
Busybox-rootfs.sh File Content
#! /Bin/sh
Mkfs. ubifs-rbusybox-rootfs-M 1-e 262016-C 112-O ubifs. img
Ubinize-O rootfs. IMG-M1-P 256kib busybox-rootfs.cfg
Rmubifs. img
Note:
-R specifies the folder
-M specifies the minimum I/O operation size, which is the size of a page in nandflash.
-E specifies the size of the logical erased block.
-C specifies the maximum logical block number 262016, that is, kb.
Busybox-rootfs.cfg File Content
[Rootfs-volume]
Mode = ubi
Image = ubifs. img
Vol_id = 0
Vol_size = 25mib
Vol_type = dynamic
Vol_name = rootfs
Vol_alignment = 1
Vol_flags = autoresize