韦东山笔记之用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 ...
随机推荐
- Windchill 配置LOG文件,使开发中的代码能显示打印的信息
如开发代码的类HomeLogic.java, 包路径在pnt.report.home 需求:需监控此类的打印数据 方法:配置D:\ptc\Windchill_10.1\Windchill\codeba ...
- R-安装、卸载、查看及卸除加载包
1. 安装包 install.packages("BiocInstaller") 2. 卸载已安装包 remove.packages("BiocInstaller&quo ...
- 我的笔记文档版本控制系统-MediaWiki-回到顶部/链接放大/升级
为了练习自己的JS.CSS基本功,这些天和MediaWiki干上了!^_^ 下面是我的MediaWiki新添加的功能: 回到顶部 链接放大 MediaWiki升级 回到顶部 回到顶部是很多网站的基本功 ...
- hdu1052
#include <iostream>#include<algorithm>#include<queue>#include<stack>#include ...
- Spark Streaming 官网上提到的几点调优
总的来说,需要考虑以下两点: 1. 有效地运用集群资源去减少每个批次处理的时间 2. 正确的设置batch size,以使得处理速度能跟上接收速度 一. 为了减少处理时间,主要有以下几个优化点: 1 ...
- 洛谷P3145 [USACO16OPEN]分割田地Splitting the Field
P3145 [USACO16OPEN]分割田地Splitting the Field 题目描述 Farmer John's NN cows (3 \leq N \leq 50,0003≤N≤50,00 ...
- 让你的IDEA倍爽
使用IDEA开发有 一段时间了,从陌生到熟悉的过程算是很平稳的度过,感谢IntelliJ IDEA交流群(群号244908708)里面的群友对我提供的帮助,感谢群主的github上面提供的资料. 这篇 ...
- AT2161 シャッフル / Shuffling
传送门 其实有一个显然的性质嘛:对于每个数,其实只要考虑它最右能被换到的位置就好了 然后设\(f[i][j]\)表示已经处理完了前\(i-1\)位,当前还有\(j\)个\(1\)可以自由支配(注意这里 ...
- element-ui国际化探索(大型项目适用)
配置好了,自己感觉是比较简单的,就是有一点点繁琐,加油吧. 由于保密,无法拿出项目,故写了一个小demo,记录一下,适用于大型项目: 项目中需要自定义切换中/英文(国际化),基于vue.js,结合vu ...
- Scrapy框架中的Pipeline组件
简介 在下图中可以看到items.py与pipeline.py,其中items是用来定义抓取内容的实体:pipeline则是用来处理抓取的item的管道 Item管道的主要责任是负责处理有蜘蛛从网页中 ...