韦东山笔记之用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 ...
随机推荐
- JOptionPane简介
------------------siwuxie095 JOptionPane 是弹出窗体(对话框)的集合类,它本身 并不是一个具体的 ...
- mongodb操作数据集合
1.创建数据集: a.创建不设置参数的默认数据集(默认数据集自带一个流水id,_id) db.createCollection("mycol") //创建默认集合 b.创建指定参数 ...
- map-reduce的八个流程
下面讲解这八个流程 Inputformat-->map-->(combine)-->partition-->copy&merge-->sort-->red ...
- 3、perl进阶
1.条件判断与循环结构(if (unless) while(until) for foreach next last redo) if (unless) 关系运算符: 数字关系运算符(>,& ...
- Win7环境下Sublime Text 3下安装NodeJS插件
1.首先下载安装Node.JS,配置好环境变量(安装好Node.JS默认是配置好了环境变量的). 2.Sublime Text 3下安装NodeJS插件. 参考的两篇文章:http://www.cnb ...
- 八数码 Java实现
参考http://blog.csdn.net/helloworld10086/article/details/41853389 package com.EightNumber.view; import ...
- return 、break和continue的区别和作用
1.return关键字并不是专门用于跳出循环的,return的功能是结束一个方法. 一旦在循环体内执行到一个return语句,return语句将会结束该方法,循环自然也随之结束.与continue和b ...
- C# 写 LeetCode easy #27 Remove Element
27. Remove Element Given an array nums and a value val, remove all instances of that value in-place ...
- Educational Codeforces Round 57 (Rated for Div. 2)D(动态规划)
#include<bits/stdc++.h>using namespace std;char s[100007];long long a[100007];long long dp[100 ...
- Java SE自学阶段的笔记整理
其他知识点 1.String和Char的区别: (1)String是字符串类型,Char是字符类型: (2)Char要用单引号,String要用双引号: (3)String是一个类,具有面向对象的特性 ...