2.19.2.busybox的移植实战

/**************************一. busybox制作成功*********************************************/
实验目的:ls /root/rootfs/oceanstar_rootfs/my_busybox/ (可以看到4个文件夹表示制作busybox成功,这个实验已经做过了)

(1). windows电脑下的F:\winshare\rootfs\busybox-1.24.1.tar.bz2

(2). 将busybox复制到ubuntu中并解压:

* cd /root/rootfs/oceanstar_rootfs/
* cp /mnt/hgfs/Winshare/rootfs/busybox-1.24.1.tar.bz2 /root/rootfs/oceanstar_rootfs/
* ls
* tar -jxvf busybox-1.24.1.tar.bz2

(3) 改makefile里的arch和cross_com

* cd /root/rootfs/oceanstar_rootfs/busybox-1.24.1
* vi Makefile:添加

             ARCH = arm
             CROSS_COMPILE = /usr/local/arm/arm-2009q3/bin//arm-none-linux-gnueabi-

(4). make menuconfig进行配置

* Busybox Settings--->


            Build Options--->
                [*]Build BusyBox as a static binary(no shared libs)
            Busybox Library Tuning--->
                [*]vi-style line editing commands
                [*]Fancy shell prompts

* Linux Module Utilities--->


    [ ]Simplified modutils
       [*]insmod
       [*]rmmod
       [*]lsmod
       [*]modprobe
       [*]depmod


* Linux System Utilities--->[*]mdev


       [*]Support /etc/mdev.conf
       [*]Support subdirs/symlinks
       [*]Support regular expressions substitutions when renaming dev
       [*]Support command execution at device addition/removal
       [*]Support loading of firmwares


* Coreutils  --->


     [ ] sync  

(5). make -j2(Final link with:: m)
ls(出现一个黄色的busybox就表示表示完成了)

(6). 安装busybox

* make menuconfig


            Busybox Settings  --->Installation Options ("make install" behavior)  --->(./_install) BusyBox installation prefix,然后

复制 /root/rootfs/oceanstar_rootfs/my_busybox

* make install

实验目的:ls /root/rootfs/oceanstar_rootfs/my_busybox/ (可以看到4个文件夹表示制作busybox成功)

/**********开发板设置bootargs挂载添加了busybox移植的rootfs(已经解决)**************************************/
(1). SecurtCRT连接运行linux系统的开发板

* 打断3s启动进入uboot:
* 设置bootargs:setenv bootargs root=/dev/nfs nfsroot=192.168.1.141:/root/rootfs/oceanstar_rootfs/my_busybox ip=192.168.1.10:192.168.1.141:192.168.1.1:255.255.255.0::eth0:off  init=/linuxrc console=ttySAC2,115200   
* save

(2). zImage下载

* 前提条件:tftp搭建好,插好网线
* ls /tftpboot/      (看有没有zImage,如果没有,参考:zImage:2.15.3.内核配置和编译体验(1.24实验手册))
* ping 192.168.1.141
* tftp 30008000 zImage
* 结果不断重启, VFS: Cannot open root device "nfs" or unknown-block(0,255),实验现象与老师的不同,老师的是VFS:Mounted root (nfs filesystem) on device 0:12

总结:nfs挂载失败,
分析:这堂课有两个实验:制作busybox和下载添加了busybox的rootfs,这两个实验连接起来的地方是开发板uboot中设置bootargs:/root/rootfs/oceanstar_rootfs/my_busybox。

2018.3.14更新:开发板设置bootargs挂载添加了busybox移植的rootfs失败原因是内核不支持nfs方式启动,可参考rootfs:2.18.4.nfs方式启动自制简易文件夹形式的rootfs.zhu:配置内核支持nfs方式启动

解决方法:set bootcmd 'tftp 30008000 zImage; bootm 30008000'(一定要设置)

/***************************跟新版本**********************************************************/

(1). windows电脑下的F:\winshare\rootfs\busybox-1.24.1.tar.bz2

(2). 将busybox复制到ubuntu中并解压:

* cd /root/porting_x210/rootfs/aston_rootfs
* cp /mnt/hgfs/Winshare/rootfs/busybox-1.24.1.tar.bz2 ./
* ls
* tar -jxvf busybox-1.24.1.tar.bz2

(3) 改makefile里的arch和cross_com
* cd busybox-1.24.1
* make distclean
* vi Makefile:添加

             ARCH = arm
             CROSS_COMPILE = /usr/local/arm/arm-2009q3/bin//arm-none-linux-gnueabi-

(4). make menuconfig进行配置
* Busybox Settings--->

            Build Options--->
                [*]Build BusyBox as a static binary(no shared libs)
            Busybox Library Tuning--->
                [*]vi-style line editing commands
                [*]Fancy shell prompts



* Coreutils  --->     


              [ ] sync  

* Linux Module Utilities--->


    [ ]Simplified modutils
       [*]insmod
       [*]rmmod
       [*]lsmod
        [* ]     Pretty output (NEW)
       [*]modprobe
         [* ]     Blacklist support (NEW)
       [*]depmod

* Linux System Utilities--->[*]mdev


       [*]Support /etc/mdev.conf
       [*]Support subdirs/symlinks
       [*]Support regular expressions substitutions when renaming dev
       [*]Support command execution at device addition/removal
       [*]Support loading of firmwares



* Busybox Settings  --->Installation Options ("make install" behavior)  --->(./_install) BusyBox installation prefix,然后复制 /root/porting_x210/rootfs/rootfs

(5). make -j2(Final link with:: m)
ls(出现一个黄色的busybox就表示表示完成了)

(6). 安装busybox

* make install

ls /root/porting_x210/rootfs/rootfs(可以看到4个文件夹表示制作busybox成功)/**********开发板设置bootargs挂载添加了busybox移植的rootfs**************************************/(1). SecurtCRT连接运行linux系统的开发板
* 打断3s启动进入uboot:
* 设置bootargs:setenv bootargs root=/dev/nfs nfsroot=192.168.1.141:/root/porting_x210/rootfs/rootfs ip=192.168.1.10:192.168.1.141:192.168.1.1:255.255.255.0::eth0:off init=/linuxrc console=ttySAC2,115200
* set bootcmd 'tftp 30008000 zImage; bootm 30008000'(一定要设置)
* save
* reset

结果:
[ 9.423975] VFS: Mounted root (nfs filesystem) on device 0:12.
[ 9.428489] Freeing init memory: 172K
can't run '/etc/init.d/rcS': No such file or directory
can't open /dev/tty2: No such file or directory
can't open /dev/tty3: No such file or directory
can't open /dev/tty4: No such file or directory
/#

得到了命令行,挂载成功,/linuxrc(就是busybus)执行:但是找不到rcS等文件

猜你喜欢

转载自www.cnblogs.com/Ocean-Star/p/9235778.html
今日推荐