韦东山笔记之用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 ...
随机推荐
- [51nod1043]幸运号码
题意:1个长度为2N的数,如果左边N个数的和 = 右边N个数的和,那么就是一个幸运号码. 例如:99.1230.123312是幸运号码. 给出一个N,求长度为2N的幸运号码的数量.由于数量很大,输出数 ...
- solr搜索应用
非票商品搜索,为了不模糊查询影响数据库的性能,搭建了solr搜索应用,php从solr读取数据
- 会话临时表 ORA-14452
需要使用Oracle的临时表,向其中插入记录,用完后再删除.但是后来发现临时表的删除总是失败,返回错误: ORA-14452: attempt to create, alter or drop an ...
- Protocol Buffers官方文档(proto3语言指南)
本文是对官方文档的翻译,大部分内容都是引用其他一些作者的优质翻译使文章内容更加通俗易懂(自己是直译,读起来有点绕口难理解,本人英文水平有限),参考的文章链接在文章末尾 这篇指南描述如何使用protoc ...
- C++的STL总结(1)
没有很系统的学过算法,c++也只是学些基础,虽然经常会用一些STL里面的函数,但是并没有对STL模板库有一个清晰的了解,趁着寒假有时间就自己在网上百度浏览别人的总结的内容,自己汇集并总结了一下,希望对 ...
- Educational Codeforces Round 57D(DP,思维)
#include<bits/stdc++.h>using namespace std;char s[100007];long long a[100007];long long dp[100 ...
- 洛谷P2474 [SCOI2008]天平
P2474 [SCOI2008]天平 题目背景 2008四川NOI省选 题目描述 你有n个砝码,均为1克,2克或者3克.你并不清楚每个砝码的重量,但你知道其中一些砝码重量的大小关系.你把其中两个砝码A ...
- 清北刷题冲刺 10-30 p.m
少女 #include<iostream> #include<cstdio> #include<queue> #include<cstdlib> #de ...
- 为什么要把系统拆分成分布式的,为啥要用Dubbo?
阅读本文大概需要 6 分钟. 作者:yanglbme 1.面试题 为什么要进行系统拆分?如何进行系统拆分?拆分后不用 dubbo 可以吗? 2.面试官心里分析 从这个问题开始就进行分布式系统环节了,好 ...
- oracle函数获取汉字拼音的首字母
CREATE OR REPLACE FUNCTION F_TRANS_PINYIN_CAPITAL(P_NAME IN VARCHAR2) RETURN VARCHAR2 AS V_COMPARE V ...