韦东山笔记之用busybox构建根文件系统
1 百度搜索busybox进入busybox官网(https://busybox.net/)作者:恒久力行 QQ:624668529
tar xjf busybox-1.24.2.tar.bz2

make menuconfig
vi Makefile
CROSS_COMPILE ?=arm-linux-
make
miscutils/i2c_tools.c:1046: error: `I2C_FUNC_SMBUS_PEC‘ undeclared here (not in a function)
miscutils/i2c_tools.c:1046: error: initializer element is not constant
miscutils/i2c_tools.c:1046: error: (near initialization for `i2c_funcs_tab[12].value‘)
miscutils/i2c_tools.c:1047: error: initializer element is not constant
miscutils/i2c_tools.c:1047: error: (near initialization for `i2c_funcs_tab[12]‘)
miscutils/i2c_tools.c:1049: error: initializer element is not constant
miscutils/i2c_tools.c:1049: error: (near initialization for `i2c_funcs_tab[13]‘)
miscutils/i2c_tools.c:1051: error: initializer element is not constant
miscutils/i2c_tools.c:1051: error: (near initialization for `i2c_funcs_tab[14]‘)
miscutils/i2c_tools.c:1052: error: initializer element is not constant
miscutils/i2c_tools.c:1052: error: (near initialization for `i2c_funcs_tab[15]‘)
make[1]: *** [miscutils/i2c_tools.o] Error 1
make: *** [miscutils] Error 2
miscutils/ionice.c:23: error: `SYS_ioprio_set‘ undeclared (first use in this function)
miscutils/ionice.c:23: error: (Each undeclared identifier is reported only once
miscutils/ionice.c:23: error: for each function it appears in.)
miscutils/ionice.c: In function `ioprio_get‘:
miscutils/ionice.c:28: error: `SYS_ioprio_get‘ undeclared (first use in this function)
make[1]: *** [miscutils/ionice.o] Error 1
make: *** [miscutils] Error
vi util-linux/umount.c
// MNT_FORCE and MNT_DETACH (from linux/fs.h) must match// OPT_FORCE and OPT_LAZY.{typedefchar bug[(OPT_FORCE != MNT_FORCE || OPT_LAZY != MNT_DETACH)?-1:1];
// MNT_FORCE and MNT_DETACH (from linux/fs.h) must match// OPT_FORCE and OPT_LAZY.{typedefchar bug[(OPT_FORCE != MNT_FORCE || OPT_LAZY !=2)?-1:1];}
vi ./coreutils/sync.c
/*
* syncfs is documented to only fail with EBADF,
* which can‘t happen here. So, no error checks.
*/
86行 syncfs(fd);
18 行 //config: bool "Enable -d and -f flags (requres syncfs(2) in libc)"
找了一个 arm-libc 中并没有这个函数
下载了 busybox-1.23.0.tar.bz2 找到同名文件,发现这个内容明显要简单很多。用 1.23 的版本替换 1.24 的。
#include "libbb.h"
/* This is a NOFORK applet. Be very careful! */
int sync_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int sync_main(int argc UNUSED_PARAM, char **argv IF_NOT_DESKTOP(UNUSED_PARAM))
{
/* coreutils-6.9 compat */
bb_warn_ignoring_args(argv[1]);
sync();
return EXIT_SUCCESS;
}
再次编译就通过了
Your linker does not support --sort-section,alignment
Trying libraries: crypt m
Library crypt is not needed, excluding it
Library m is needed, can't exclude it (yet)
Final link with: m
DOC busybox.pod
DOC BusyBox.txt
DOC busybox.1
DOC BusyBox.html
make CONFIG_PREFIX=/work/nfs_root/first_fs install
②init本身,即busybox
③/etc/inittab
④配置文件里指定的应用程序
⑤c库
book@book-desktop:/work/nfs_root/first_fs$ ls
bin dev linuxrc sbin usr
book@book-desktop:/work/nfs_root/first_fs$ mkdir etc
book@book-desktop:/work/nfs_root/first_fs$ vi etc/inittab
里面加一句:console::askfirst:-/bin/sh
问题解决:主要原因是编译器的问题,我用的是高版本的编译器,但是库加载的是低版本的编译器。换成低版本的编译器后,改一下环境变量如下
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/work/tools/gcc-3.4.5-glibc-2.3.6/bin"
book@book-desktop:/work/nfs_root/first_fs$ vi etc/inittabconsole::askfirst:-/bin/sh::sysinit:/etc/init.d/rcS
chmod +x etc/init.d/rcS
book@book-desktop:/work/nfs_root/first_fs$ vi etc/init.d/rcS#mount -t proc none /procmount -amkdir /dev/ptsmount -t devpts devpts /dev/ptsecho /sbin/mdev >/proc/sys/kernel/hotplugmdev -s
book@book-desktop:/work/nfs_root/first_fs$ vi etc/fstab#device mount-point type options dump fsck orderproc /proc proc defaults 00sysfs /sys sysfs defaults 00tmpfs /dev tmpfs defaults 00
重启可以看到启动参数:
bootargs=noinitrd root=/dev/mtdblock3 rootfstype=jffs2 init=/linuxrc console=ttySAC0
修改启动参数:在linux-2.6.22.6\Documentation的nfsroot.txt里面有参数的说明
nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
bootargs noinitrd root=/dev/nfs
nfsroot=192.168.1.51:/work/nfs_root/first_fs
ip=192.168.1.11:192.168.1.51:192.168.1.1:255.255.255.0::eth0:off
init=/linuxrc console=ttySAC0
OpenJTAG> set bootargs noinitrd root=/dev/nfs
nfsroot=192.168.1.51:/work/nfs_root/first_fs
ip=192.168.1.11:192.168.1.51:192.168.1.1:255.255.255.0::eth0:off
init=/linuxrc console=ttySAC0
OpenJTAG> save
OpenJTAG> boot
到这里网络文件系统已经搭建好了,这样你可以在服务器上面编辑代码,编译,然后在单板上面运行了。
韦东山笔记之用busybox构建根文件系统的更多相关文章
- 使用busybox构建根文件系统
当我们在Qemu上运行起来自己编译的内核之后,需要使用busybox构建一个文件系统,将此文件系统挂载上去就可以使用busybox提供的各种命令了. 1.编译安装busybox 源码下载地址:http ...
- Busybox构建根文件系统和制作Ramdisk
定制根文件系统的方法很多,最常用的是使用BusyBox来构建定制根文件系统.它集成压缩了Linux的许多工具和命令,可以使用户迅速方便地建立一套相对完整.功能丰富的文件系统,其中包括大量常用的应用 ...
- linux2.6.30.4内核移植(5)——构建根文件系统(yaffs文件系统格式的镜像)
一.首先编译并安装BusyBox 这里使用的交叉编译器还是3.4.5. 注意:编译内核.编译BusyBox以及编译文件系统中的所有应用程序的交叉编译器要使用同一个版本. 1.获取BusyBox源码 下 ...
- 通过busybox制作根文件系统
通过busybox制作根文件系统可以自定义选项,在制作的根文件系统中添加需要的命令,指定生成的根文件系统到相应的目录下. 一. 根文件系统的获取方式--->官网: https://busybox ...
- 通过busybox制作根文件系统详细过程
我在之前的uboot通过NFS挂载ubuntu根文件系统中也有实现过根文件系统的制作,那只是在ubuntu官网已经做好的根文件基础上安装一些自己所需的软解而已.而使用busybox制作根文件系统可以自 ...
- 移植最新u-boot(裁剪和修改默认参数)之韦东山笔记
1.下载.建立source insight工程.编译.烧写.如果无运行分析原因 tar xjf u-boot-2012.04.01.tar.bz2 cd u-boot-2012.04.01 make ...
- 使用BusyBox制作根文件系统【转】
本文转载自:http://www.cnblogs.com/lidabo/p/5300180.html 1.BusyBox简介 BusyBox 是很多标准 Linux 工具的一个单个可执行实现.Busy ...
- 使用BusyBox制作根文件系统
1.BusyBox简介 BusyBox 是很多标准 Linux 工具的一个单个可执行实现.BusyBox 包含了一些简单的工具,例如 cat 和 echo,还包含了一些更大.更复杂的工具,例如 gre ...
- zju(4)使用busybox制作根文件系统
1.实验目的 1.学习和掌握busybox相关知识及应用: 2.学会使用交叉编译器定制一个busybox: 3.利用该busybox制作一个文件系统: 4.熟悉根文件系统组织结构: 5.定制.编译ra ...
随机推荐
- 第五篇 elasticsearch express插入数据
1.后端 在elasticsearch.js文件夹下添加: function addDocument(document) { return elasticClient.index({ index: i ...
- Flask15 远程开发环境搭建、安装虚拟机、导入镜像文件、创建开发环境、pycharm和远程开发环境协同工作
1 安装VM虚拟机 待更新... 2 导入镜像文件 待更新... 3 启动虚拟机 4 远程连接虚拟机 4.1 安装xShell软件 待更新... 4.2 创建一个新的连接 4.2.1 在虚拟机中获取虚 ...
- GIT 图形化操作指南
Git操作指南(2) -- Git Gui for Windows的建库.克隆(clone).上传(push).下载(pull).合并 关于linux上建库等操作请看文章: http://hi.bai ...
- Qt Console Application
代码编译完生成的.o文件(又称对象文件,是可执行文件)和链接.o文件形成的.exe可执行文件都保存在“build-Project-Desktop_Qt_5_8_0_GCC_64bit-Debug”中. ...
- java的大小端和转换
一直以为大小端针对的bit的顺序,今天才知道:大小端的分度值是 byte,即每一个byte都是按照正常顺序,但是byte组装成一个int 或者是 long等时每个byte的摆放位置不同. 测试代码: ...
- 图解Laravel的生命周期
先来张图大致理解下laravel的生命周期. 下面对应相应的代码,解释上图. //文件路径:laravel/public/index.php /** * laravel的启动时间 */ define( ...
- Boost Python官方样例(三)
导出C++类(纯虚函数和虚函数) 大致做法就是为class写一个warp,通过get_override方法检测虚函数是否被重载了,如果被重载了调用重载函数,否则调用自身实现,最后导出的时候直接导出wa ...
- PHP框架学习思路
希望可以帮助到正在学习的PHPer
- iOS拼图
#import "ViewController.h" @interface ViewController () @end @implementation ViewContro ...
- thinkphp5实现文章上一篇,下一篇
写在控制器 //列表是按照根据id降序排列的,所以上一篇 $prv=Db::table('qy_article')->where('at_id','>',$at_id)->where ...