1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 使用Buildroot为Nxp i.mx6ul制作文件系统

使用Buildroot为Nxp i.mx6ul制作文件系统

时间:2020-05-26 17:23:22

相关推荐

使用Buildroot为Nxp i.mx6ul制作文件系统

随着神U s3c2440,6410的停产,NXP 针对中国市场推出低成本方案i.mx6ul,可用于商业级和工业级应用,超长供货周期,市场很有潜力。

官方只支持Yocto,但个人感觉Yocto太多庞大且太复杂,而工业市场业务并不是特别负责,需要用到的软件包有限,且在特定的一个范围。工业市场

对稳定性要求较高,并不需很大的灵活度。

本文将介绍使用Buildroot为i.mx6制作文件系统,相对来说Buildroot较为简单,容易理解,且有接近2千种包支持,稳定性也不是问题。

移植Buildroot前,需要先了解i.mx6体系结构,本文移植基于米尔科技的i.mx6ulx开发板,256MB Nand,256MB RAM,支持SD卡;

i.mx6ul 为Cortex-A7架构,支持Neon;

前序:

在制作文件系统之前,先了解一下几个基本概念。

Uboot:引导操作系统之用;

Linux Kernel:内核,主要关注其稳定性,其中接口驱动最为重要,一般使用官方的Release包,因为官方在标准的Kernel之上针对自家芯片做了一系列的优化工作,且有很多厂商的应用案例,其稳定性得到了一定的验证;不建议使用标准的kernel,尤其是接口驱动稳定性得不到保证。

文件系统:可以看成一系列基本命令的集合,如:ps,insmod,netstat,iptables,ifconfig等等;我们所开发的应用程序也会包含在文件系统之中,并且将使用到文件系统所提供的基本命令和各种标准库以及第三方库等;

制作文件系统:有很多方法,Buildroot和Yocto只是一个辅助框架,其本身已经设定好编译环境,且支持多种平台,可以很方便的帮助用户为特定的平台制作文件系统。当然也可以自行手动建立,文件系统无非就是一堆文件的集合,自行手动编译,打包即可;只是比较耗费精力,稳定性和移植性也得不到保证;所以一般情况下,我们会选用Buildroot等框架辅助我们建立文件系统;

第一步:

下载Buildroot包:

从Buildroot官网下载 /download.html

第二步:

make menuconfig 配置相关选项CPU架构配置,i.mx6ul为小端格式,Cortex-a7架构,浮点运算EABIHf,VFPv4

Target Architecture (ARM (little endian)) ---> x x Target Binary Format (ELF) --->x x Target Architecture Variant (cortex-A7) ---> x x Target ABI (EABIhf) ---> x x Floating point strategy (VFPv4-D16) ---> x x ARM instruction set (ARM) --->

Build Options: 编译选项主要是package下载位置,默认dl目录,主要是配置共享库,shared only

gcc optimization level (optimize for size) ---> x x build code with Stack Smashing Protection (None) --->x x libraries (shared only) --->

Toolchain: 交叉编译工具链,使用NXP 官方提供的即可。根据实际情况设定gcc version和kernel header version;gcc version可以在主机上使用arm-linux-gnueabihf -v查看

rget/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnuThread model: posixgcc version 4.9.3 1031 (prerelease) (Linaro GCC .11)

kernel header version在工具链目录的xxx/libc/include/linux/version.h;

cat /opt/gcc-linaro-4.9-.11-x86_64_arm-linux-gnueabihf/libc/usr/include/linux/version.h#define LINUX_VERSION_CODE 60#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

60 转换为Hex格式0x31100;即3.11.0 版本;但编译过程中Buildroot貌似会自动判断Linux Version,我的主机自动判断是3.17,因此我选择3.17版本;此处还有待考察;

Toolchain type (External toolchain) ---> x xx x *** Toolchain External Options *** x xx x Toolchain (Custom toolchain) ---> x xx x Toolchain origin (Pre-installed toolchain) --->x xx x (/opt/gcc-linaro-4.9-.11-x86_64_arm-linux-gnueabihf/) Toolchain pathx xx x ($(ARCH)-linux-gnueabihf) Toolchain prefixx xx x External toolchain gcc version (4.9.x) ---> x xx x External toolchain kernel headers series (3.17.x) ---> x xx x External toolchain C library (glibc/eglibc) --->

注意使能MMU

[*] Enable MMU support

System configuration:主要是些hostname,banner,busybox,password,console等一些配置

(buildrootbywind) System hostname x xx x (Welcome to Buildroot by wind) System banner x xx x Passwords encoding (md5) ---> x xx x Init system (BusyBox) --->x xx x /dev management (Dynamic using devtmpfs + eudev) ---> x xx x (system/device_table.txt) Path to the permission tables x xx x [ ] support extended attributes in device tables x xx x [ ] Use symlinks to /usr for /bin, /sbin and /lib x xx x [*] Enable root login with password x xx x (123456) Root passwordx xx x /bin/sh (bash) ---> x xx x [*] Run a getty (login prompt) after boot --->

需要注意的地方有2点:bash 和 tty的选择; nxp的tty默认是/dev/ttymxc0;

选择Bash前需打开Show packages that are alse provideed by busybox; 位于Target Package 下

-*- BusyBoxx xx x (package/busybox/busybox.config) BusyBox configuration file to use?x xx x () Additional BusyBox configuration fragment files x xx x [*] Show packages that are also provided by busybox

tty配置为:

--- Run a getty (login prompt) after bootx xx x (/dev/ttymxc0) TTY port x xx x Baudrate (keep kernel default) --->x xx x (vt100) TERM environment variable x xx x () other options to pass to getty

剩下就是Filesystem image配置:主要选择文件系统类型,以及相关参数

Ext2/3/4支持:

[*] ext2/3/4 root filesystem x xx x ext2/3/4 variant (ext4) ---> x xx x () filesystem labelx xx x (60M) exact size x xx x (0) exact number of inodes (leave at 0 for auto calculation)x xx x (5) reserved blocks percentagex xx x (-O ^64bit) additional mke2fs optionsx xx x Compression method (no compression) --

tar 和Ubifs支持,我的板子为256M Nand,使用ubifs,因此必须选择

[*] tar the root filesystemx xx x Compression method (no compression) --->x xx x () other random options to pass to tarx xx x [*] ubifs root filesystem x xx x (0x1f800) logical eraseblock size x xx x (0x800) minimum I/O unit size x xx x (2048) maximum logical eraseblock count x xx x ubifs runtime compression (lzo) ---> x xx x Compression method (no compression) --->

UBI文件系统主要参数根据实际NAND参数来配置即可;Target packages中是一些开源软件,自行根据需要来配置;

至此,配置完毕;

第三步:

make all编译;

输出结果位于output/images 下

烧写文件系统:具体烧写方式请见我另一篇博文 对于ARM的启动,系统升级,烧写过程和文件系统等方面的总结分析

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。