你好,游客 登录 注册 搜索
背景:
阅读新闻

Linux文件系统的移植-根文件系统制作

[日期:2012-07-09] 来源:Linux社区  作者:lr-ting [字体:大 中 小]

二、移植步骤

1、  源码下载

我们选择的版本是busybox-1.17.3.tar.bz2下载路径为:http://www.linuxidc.com/Linux/2011-08/40704.htm

2、  解压源码

$ tar xvf  busybox-1.17.3.tar.bz2

3、  进入源码目录

$ cd busybox-1.17.3

4、  配置源码

$ make menuconfig
Busybox Settings --->

       Build Options --->

              [*] Build BusyBox as a static binary (no shared libs)

              [ ] Force NOMMU build

              [ ] Build with Large File Support (for accessing files > 2 GB)

              (arm-cortex_a8-linux-gnueabi-) Cross Compiler prefix

              () Additional CFLAGS

5、  编译

$ make

6、  安装

busybox默认安装路径为源码目录下的_install

$ make install

7、  进入安装目录下

$ cd _install
$ ls
bin  linuxrc  sbin  usr

8、  创建其他需要的目录

$ mkdir  dev etc  mnt proc var tmp sys root

9、  添加库

在_install目录下创建一个lib文件夹,将工具链中的库拷贝到lib目录下

$ mkdir lib
$ cp /home/linux/x-tools/arm-cortex_a8-linux-gnueabi/arm-cortex_a8-linux-gnueabi/lib/*  ./lib/

删除lib下的所有目录、.o文件和.a文件,对库进行瘦身以减小文件系统的大小

$ rm *.o *.a
$ arm-cortex_a8-linux-gnueabi-strip  lib/*

10、 添加系统启动文件

在etc下添加文件inittab

$ vim /etc/inittab

文件内容如下:

#this is run first except when booting in single-user mode.
:: sysinit:/etc/init.d/rcS
# /bin/sh invocations on selected ttys
# Start an "askfirst" shell on the console (whatever that may be)
::askfirst:-/bin/sh
# Stuff to do when restarting the init process
::restart:/sbin/init
# Stuff to do before rebooting
::ctrlaltdel:/sbin/reboot

在etc下添加文件fstab

$ vim /etc/fstab

文件内容如下:

#device     mount-point     type        options         dump     fsck order
proc          /proc         proc        defaults        0          0
tmpfs      /tmp         tmpfs       defaults          0          0
sysfs         /sys          sysfs       defaults         0          0
tmpfs         /dev          tmpfs       defaults         0          0

       这里我们挂在的文件系统有三个proc、sysfs和tmpfs,在内核中proc和sysfs默认都支持,而tmpfs是没有支持的,我们需要添加tmpfs的支持

修改内核配置:

$ make menuconfig
File systems --->
       Pseudo filesystems --->
              [*] Virtual memory file system support (former shm fs)
              [*] Tmpfs POSIX Access Control Lists
linux
相关资讯       Linux内核移植 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款