我的系统信息如下:
guoyanzhang@bogon:~/bub$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.7 (stretch)
Release: 9.7
Codename: stretch
guoyanzhang@bogon:~/bub$ uname -r
4.19.0-0.bpo.1-amd64
1,下载
我下载的是:busybox-1.30.1.tar.bz2.
2,解压
guoyanzhang@bogon:~/bub$ tar -xvf busybox-1.30.1.tar.bz2
3,安装交叉编译器
这里不详细写了,我的博文(debian9.6使用安装包安装交叉编译器)里面有写。
4,安装libncurses5-dev
guoyanzhang@bogon:~/bub$ sudo apt-get install libncurses5-dev
5,配置menu
guoyanzhang@bogon:~/bub/busybox-1.30.1$ make menuconfig
需要修改下面的几项:
a,settings里面
------build options
------installation options
b,coreutils里面
c,linux system utilities里面
按照上面图片设置好,保存退出。
特别提示:上面的选项是根据我编译的时候报错提示,然后设置的,只有按照如上的设置,下面编译才没有错。
6,编译
guoyanzhang@bogon:~/bub/busybox-1.30.1$ make
没有报错的话,就继续进行。
7,安装
guoyanzhang@bogon:~/bub/busybox-1.30.1$ make install
之后,如下:
guoyanzhang@bogon:~/bub$ ls
busybox-1.30.1 busybox-1.30.1.tar.bz2 system
guoyanzhang@bogon:~/bub$ cd system/
guoyanzhang@bogon:~/bub/system$ ls
bin linuxrc sbin usr
多了一个system。
8,补全system
guoyanzhang@bogon:~/bub/system$ mkdir dev etc lib mnt proc sys tmp var
guoyanzhang@bogon:~/bub/system$ ls
bin dev etc lib linuxrc mnt proc sbin sys tmp usr var
guoyanzhang@bogon:~/bub/system$ cd etc/
guoyanzhang@bogon:~/bub/system/etc$ cat eth0-setting
IP=192.168.1.230
Mask=255.255.255.0
Gateway=192.168.1.1
DNS=192.168.1.1
MAC=08:90:90:90:90:90
guoyanzhang@bogon:~/bub/system/etc$ chmod 755 eth0-setting
guoyanzhang@bogon:~/bub/system/etc$ mkdir init.d
guoyanzhang@bogon:~/bub/system/etc$ cd init.d/
guoyanzhang@bogon:~/bub/system/etc/init.d$ cat ifconfig-eth0
#!/bin/bash
echo -n Try to bring eth0 interface up ......>/dev/ttySAC2
if [ -f /etc/eth0-setting ]
then
source /etc/eth0-setting
if grep -q "^/dev/root/ nfs" /etc/mtab
then
echo -n NFS root ... > /dev/ttySAC2
else
ifconfig eth0 down
ifconfig eth0 hw ether $MAC
ifconfig eth0 $IP netmask $Mask up
route add default gw $Gateway
fi
echo nameserver $DNS > /etc/resolv.conf
else
if grep -q "^/dev/root/ nfs" /etc/mtab
then
echo -n NFS root ... > /dev/ttySAC2
else
/sbin/ifconfig-eth0 192.168.1.106 netmask 255.255.255.0 up
fi
fi
echo Done > /dev/ttySAC2
guoyanzhang@bogon:~/bub/system/etc/init.d$ chmod 755 ifconfig-eth0
guoyanzhang@bogon:~/bub/system/etc/init.d$ cat rcs
#!/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin:
runlevel=S
prevlevel=N
umask 022
export PATH runlevel prevlevel
#
# Trap CTRL-C &c only in this shell so we can interrupt subprocesses.
#
trap ":" INT QUIT TSTP
/bin/hostname iTOP-4412
#/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
[ -e /proc/1 ] || /bin/mount -n -t proc none /proc
[ -e /sys/class ] || /bin/mount -n -t sysfs none /sys
[ -e /dev/tty ] || /bin/mount -t ramfs none /dev
echo /sbin/mdev > /proc/sys/kernel/hostplug
/sbin/mdev -s
#/bin/hostplug
#mounting file system specified in /etc/fstab
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/log/boa
mkdir -p /var/lock
mkdir -p /var/run
mkdir -p /var/tmp
ln -sf /dev/ttyS2 /dev/tty2
ln -sf /dev/ttyS2 /dev/tty3
ln -sf /dev/ttyS2 /dev/tty4
syslogd
/etc/rc.d/init.d/netd start
echo " " > /dev/tty1
echo " starting networking ..." /dev/tty1
#sleep 1
#/etc/rc.d/init.d/httpd start
#echo " " > /dev/tty1
#echo "starting web server ..." > /dev/tty1
#sleep 1
#/etc/rc.d/init.d/leds start
#echo " " > /dev/tty1
#echo "starting leds service ..." > /dev/tty1
#echo " "
#sleep 1
#echo "******************" > /dev/ttySAC2
#echo " http://www.topeet.com.cn " > /dev/ttySAC2
#echo "******************" > /dev/ttySAC2
#echo "******************"
#echo " http://www.topeet.com.cn "
#echo "******************"
mkdir /mnt/disk
sleep 1
/sbin/ifconfig lo 127.0.0.1
/etc/init.d/ifconfig-eth0
guoyanzhang@bogon:~/bub/system/etc/init.d$ chmod 755 rcs
guoyanzhang@bogon:~/bub/system/etc/init.d$ mkdir rc.d
guoyanzhang@bogon:~/bub/system/etc/init.d$ cd rc.d/
uoyanzhang@bogon:~/bub/system/etc/init.d/rc.d$ cat netd
#!/bin/sh
base=inetd
# see how we were called.
case "$1" in
start)
/usr/sbin/$base
;;
stop)
pid=`/bin/pidof $base`
if [ -n "$pid" ]; then
kill -9 $pid
fi
;;
esac
exit 0
guoyanzhang@bogon:~/bub/system/etc/init.d/rc.d$ chmod 755 netd
guoyanzhang@bogon:~/bub/system$ cd lib/
guoyanzhang@bogon:~/bub/system/lib$ sudo cp /home/guoyanzhang/cross/opt/FriendlyARM/toolschain/4.4.3/lib/* . -r
guoyanzhang@bogon:~/bub/system$ cd var
guoyanzhang@bogon:~/bub/system/var$ mkdir lib lock log run tmp
9,制作成img文件
这个需要make_ext4fs工具,我网上没有找到,我这个板子是迅为4412的,资料里面带。
make_ext4fs -s -l 314572800 -a root -L linux system.img system
参考1:https://blog.csdn.net/tanjialiang_/article/details/79490653
参考2:https://blog.csdn.net/sinat_23071467/article/details/52702525
参考3:https://blog.csdn.net/hejinjing_tom_com/article/details/53489905
参考4:https://www.cnblogs.com/softhal/p/5769121.html
参考5:https://www.cnblogs.com/god-of-death/p/10283871.html
参考6:https://blog.csdn.net/hejinjing_tom_com/article/details/53489905
参考7:https://blog.csdn.net/leon1741/article/details/54838924/
参考8:https://blog.csdn.net/coolwriter/article/details/77801649