S3C2440 制作最新busybox文件系统

2. 制作基本文件系统

2.1 下载源码

文件系统是根据busybox来制作的.
所以网上下载: https://busybox.net/downloads/
我下的是最新的1.31版本, 用tar vxJf 解压后.

2.2 配置交叉编译环境

make defconfig
make menuconfig
setting->
Cross compile prefix和Path to sysroot要配置
[/opt/gcc-4.6.4/bin/arm-linux-]
[/opt/gcc-4.6.4/arm-arm1176jzfssf-linux-gnueabi/sysroot]

 

2.3 裁剪同百度

不裁也行

2.4 编译

make V=s ...
最后成功后: 
  LINK    busybox_unstripped
Trying libraries: crypt m resolv
 Library crypt is not needed, excluding it
 Library m is needed, can't exclude it (yet)
 Library resolv is needed, can't exclude it (yet)
Final link with: m resolv
  DOC     busybox.pod
  DOC     BusyBox.txt
  DOC     busybox.1
  DOC     BusyBox.html


ls 出现了busybox

执行make install busybox, 生成_install 文件夹.

2.5 制作文件系统

将_install 拷贝到外头
cp -rf _install ../rootfs/
1. 补全文件夹
mkdir proc etc var lib dev sys ...

2. 寻找依赖库,cp到lib中

3.创建dev/console
    sudo mknod console c 5 1
4. 创建dev/tty123
    sudo mknod tty1 c 4 1
    sudo mknod tty2 c 4 3
    sudo mknod tty3 c 4 3
    
5. 配置/etc脚本
5.1 将案例的etc全部拷贝过来
    cp ../examples/bootfloppy/etc/* etc/ -arf
    [fstab  init.d  inittab  profile]
6. nfs启动或者制作文件系统
[ 2. 寻找依赖库,cp到lib中 ]

busybox动态依赖库:
readelf -d busybox | grep NEEDED

ld-linux.so.3     动态链接库
libc.so.6        c库    
libm.so.6        math库
还有
libpthread.so.0/opt/gcc-4.6.4/arm-arm1176jzfssf-linux-gnueabi/lib 里面找到需要的库,然后cp到_install/lib下.
[ 6. nfs启动或者制作文件系统 ]
因为 这个版本的linux内核的FSsetting中,没有看见Yaffs2的支持,所以暂时先做jffs2的文件系统.

ubuntu: sudo apt-get install mtd-utils    //下载制作工具
mkfs.jffs2 -n -d rootfs/ --pad=0x800000 -s 2048 -e 0x20000 -l -o rootfs.jffs2

--pad=0x800000 填充到8M
-s 2048 根据nand flash决定, 我的页大小是2k,
-e 每次擦除128K, 块大小是128k

生成 rootfs.jffs2 

 

2.6 烧录测试

还是用tftp
mtdparts=nandflash0:256k@0(bootloader),128k(params),4m(kernel),-(root)

tftp 0x30000000 rootfs.jffs2
nand erase root
nand write.jffs2 0x30000000 root $(filesize)

因为是jffs2文件系统,所以启动的时候要修改bootmargs
bootargs=root=/dev/mtdblock3 init=/linuxrc console=ttySAC0,115200 rootfstype=jffs2 

要制定roottype=jffs2 才能识别到.
如果遇到错误:检查2个问题:

1, 是未能识别到文件系统,还是文件系统linuxrc执行错误.

第一种的话,未能识别到文件系统,尝试挂载其他文件系统,均错误,所以painc.
这种错误回来添加roottype=jffs2

第二种,
VFS: Mounted root (jffs2 filesystem) on device 31:3.
Freeing unused kernel memory: 196K
This architecture does not have kernel memory protection.

linuxrc(1): undefind instruct :pc=(ptrval)
...
Kernel panic -not syncing: Attempted to kill init! exitcode=0x00000004

可以看到,文件系统已经识别到,但是在执行init程序的时候,发现未定义指令,报错了.

这个问题困扰了很久,最后百度了很久,找到了原因. 
在对busybox 执行了objdump后, 确实发现了clz这条指令,帖子上说,这条指令是armv5以后的cpu才支持的,而我的s3c2440是armv4t,当然会报错了,在找到原因后,就想着怎么解决. 在CFLAGS中加入-mach=armv4t 编译也没有用.


既然如此,我就索性把gcc编译器版本降到3.+的版本, 
make menuconfig
把之前的

[/opt/gcc-4.6.4/bin/arm-linux-]
[/opt/gcc-4.6.4/arm-arm1176jzfssf-linux-gnueabi/sysroot]

改成
[/opt/gcc-3.../arm-linux-]        //路径根据个人
[]                                //3.+的gcc中,好像没有rootfs这个文件夹,索性置空

编译,通过,然后objdump,发现clz已经没了,胜利在望,
make install,将/bin/下的busybox 替换成之前已经做好的文件系统中的bin/busybox

然后重新打包成 jffs2文件. 
tftp烧录,
启动,
通过.

ALSA device list:
  No soundcards found.
 VFS: Mounted root (jffs2 filesystem) on device 31:3.
Freeing unused kernel memory: 196K
This architecture does not have kernel memory protection.
Run /linuxrc as init process
tmpfs: No value for mount option 'default'
mount: mounting tmpfs on /tmp failed: Invalid argument
sysfs: Unknown parameter 'default'
mount: mounting sysfs on /sys failed: Invalid argument

-n Processing /etc/profile... 
Done

通过撒花.

 

2.7 文件系统的完善

那些个启动脚本啊, 文件系统挂载,再说吧,太琐碎了,百度相关就好.

来源:http://www.cnblogs.com/kmist/p/11362907.html


智能推荐

linux input输入子系统分析《二》:s3c2440的ADC简单驱动实例分析

1      mini2440的ADC驱动实例 这节与输入子系统无关,出现在这里是因为后面的章节会讲到触摸屏输入子系统驱动,由于触摸屏也使用ADC,因此本节是为了说明ADC通过驱动代码是如何控制的。 本节重点:   如何通过原理图查找ADC硬件使用的资源 如何通过芯片手册查找ADC硬件的操作方法 ADC设备驱动程序的初始化流程 ...

Linux2.6.39在S3C2440上的移植(二)添加yaffs2文件系统

1、主机环境:VMare下ubuntu10.04 ,1G内存。 2、编译编译环境:arm-linux-gcc 3、开发板:Micro2440,2M nor flash,256M nand flash。 4、u-boot-version:u-boot-2010.06 5、linux -version:Linux-2.6.39 2.1、yaffs2文件系统移植 a)获取yaffs2 源代码 针对嵌入式...

嵌入式Linux学习笔记11——S3C2440挂载NFS根文件系统时报错及解决办法

环境: 虚拟机:Ubuntu 18.04 文件系统:fs_mini_mdev.yaffs2 uboot:u-boot-1.1.6_jz2440 内核:linux-2.6.22.6_jz2440 报错: uboot不能够继续加载文件系统,处于卡死状态 VFS: Unable to mount root fs via NFS, trying floppy. VFS: Cannot open root ...

【S3C2440③】GPIO实验

实验1 —— 点亮一个LED 1.看原理图确定硬件如何连接 原理图中表示了芯片控制LED的硬件电路以及芯片的引脚与LED如何连接。 2. 看主芯片手册确定如何控制引脚 具体:如何让GPF4输出高低电平? 2.1.配置GPF4为输出模式(GPFCON) 设置GPFCON寄存器的第[9:8]位=0b01。 2.2.配置GPF4输出高/低电平(GPFDAT) GPFDAT的第4位...

S3C2440 FLASH 介绍

S3C2440 有27 根地址线ADDR[26:0],8 根片选信号ngcs0-ngcs7,对应bank0-bank7. 当访问BankN(N=0,1,2,...7) 的地址空间,ngcsN(N=0,1,2,...7) 引脚为低电平,选中外设。 每一个Bank容量:2^27=2^7 * 2^10 * 2^10 = 128Mbyte 总共有8个Bank,所以总寻址大小是:8*128Mbyte = 1...

猜你喜欢

场效应管放大电路

金属-氧化物-半导体(MOS)场效应管 N沟道增强型MOSFET 栅源加电压,在电场作用下产生沟道。产生沟道的门限开启电压VT。 漏源加电压,产生电压梯度,导致沟道夹断。预夹断的临界条件 输出特性 特性方程 可变电阻区                         &...

【响应式】foundation栅格布局的“尝鲜”与“填坑”

  提到响应式,就不得不提两个响应式框架——bootstrap和foundation。在标题上我已经说明白啦,今天给大家介绍的是foundation框架。 何为“尝鲜”?就是带大伙初步一下foundation的灵活和强大 何为“踩坑”?就是我把我使用的时候踩过的坑给标个记号,这样大伙用的时候就可以“绕道而...

word2vec笔记

word2vec 词向量 one hot Distributed representation CBOW&Skip-Gram CBOW Skip-Gram sigmoid函数 Huffman树 基于Hierarchical Softmax的模型 基于Negative Sampling的模型 本文基于word2vec原理CBOW与Skip-Gram模型基础 CBOW与Skip-Gram的模型...

2021-03-14

官网:https://router.vuejs.org/zh/guide/essentials/navigation.html 一、安装路由 npm install vue-router --save-dev 在src目录下创建router目录 使用 vuecli3创建项目选择路由会自动创建route目录 在main.js引入router 二、配置路由 1、 hash: 使用 URL hash 值...

文献阅读-ICRA2020-精确的实时数据驱动的对RAVEN-II手术机器人末端执行器位置估计器

文章序号、所属单元及链接:1646-Surgical Robotics Laparascopy 一作所属单位:University of Washington 读后体会:以我浅薄的学术认知原本认为这篇论文挺牛逼的,实验细节给的很多,关键是结果提升很大。跟老师交流之后才知道这论文只能骗骗外行人,关键的问题是他是空载进行实验的,绳驱动机器人负载和空载的差距很大,还需要考虑绳经过一段时间使用之后动态特性...

问答精选

SQL, update command not ending properly

It keeps saying : ORA-00933: SQL command not properly ended Pls help me or give me a link to a solution You can use a correlated subquery instead:...

How can I escape $.each loop with my data?

I'm doing an Json call to retrieve an a list of locations with information details for each location. longitude and latitude are included in this info. I am using Google's distance matrix api to get t...

How to display all the columns (and their type) in all tables of all schemas in a database?

Suppose you have a database which has an 'n' number of schemas with an 'n' number of tables each. Each of these contain an 'n' number of columns. How would I print all this data along with the data ty...

How to set the java.library.path in intelliJ Idea

Could anyone please help how do I solve this error: I am using IDEA IDE as a first time, and have been using Resin_4.0.37 as a server to test my work. As soon as I start my lcoal server in debug mode ...

How to calculate mouse coordinate based on resolution c#

i am trying to develop a remote desktop apps with c#. so i have couple of question regarding mouse coordinate calculation based on picture box suppose i have picture box and i want to capture mouse co...

相关问题

相关文章

热门文章

推荐文章

相关标签

推荐问答