本文共 6706 字,大约阅读时间需要 22 分钟。
随着神U s3c2440,6410的停产,NXP 针对中国市场推出低成本方案i.mx6ul,可用于商业级和工业级应用,10年超长供货周期,市场很有潜力。
官方只支持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官网下载 https://buildroot.org/download.html
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) --->
gcc optimization level (optimize for size) ---> x x build code with Stack Smashing Protection (None) ---> x x libraries (shared only) --->
rget/arm-linux-gnueabihf/_build/builds/destdir/x86_64-unknown-linux-gnuThread model: posixgcc version 4.9.3 20141031 (prerelease) (Linaro GCC 2014.11)
cat /opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/libc/usr/include/linux/version.h#define LINUX_VERSION_CODE 200960#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))200960 转换为Hex格式0x31100;即3.11.0 版本;但编译过程中Buildroot貌似会自动判断Linux Version,我的主机自动判断是3.17,因此我选择3.17版本;此处还有待考察;
Toolchain type (External toolchain) ---> x x x x *** Toolchain External Options *** x x x x Toolchain (Custom toolchain) ---> x x x x Toolchain origin (Pre-installed toolchain) ---> x x x x (/opt/gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf/) Toolchain path x x x x ($(ARCH)-linux-gnueabihf) Toolchain prefix x x x x External toolchain gcc version (4.9.x) ---> x x x x External toolchain kernel headers series (3.17.x) ---> x x x x External toolchain C library (glibc/eglibc) --->注意使能MMU
[*] Enable MMU support
(buildrootbywind) System hostname x x x x (Welcome to Buildroot by wind) System banner x x x x Passwords encoding (md5) ---> x x x x Init system (BusyBox) ---> x x x x /dev management (Dynamic using devtmpfs + eudev) ---> x x x x (system/device_table.txt) Path to the permission tables x x x x [ ] support extended attributes in device tables x x x x [ ] Use symlinks to /usr for /bin, /sbin and /lib x x x x [*] Enable root login with password x x x x (123456) Root password x x x x /bin/sh (bash) ---> x x x 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 下
-*- BusyBox x x x x (package/busybox/busybox.config) BusyBox configuration file to use? x x x x () Additional BusyBox configuration fragment files x x x x [*] Show packages that are also provided by busyboxtty配置为:
--- Run a getty (login prompt) after boot x x x x (/dev/ttymxc0) TTY port x x x x Baudrate (keep kernel default) ---> x x x x (vt100) TERM environment variable x x x x () other options to pass to getty
[*] ext2/3/4 root filesystem x x x x ext2/3/4 variant (ext4) ---> x x x x () filesystem label x x x x (60M) exact size x x x x (0) exact number of inodes (leave at 0 for auto calculation) x x x x (5) reserved blocks percentage x x x x (-O ^64bit) additional mke2fs options x x x x Compression method (no compression) --
[*] tar the root filesystem x x x x Compression method (no compression) ---> x x x x () other random options to pass to tar x x x x [*] ubifs root filesystem x x x x (0x1f800) logical eraseblock size x x x x (0x800) minimum I/O unit size x x x x (2048) maximum logical eraseblock count x x x x ubifs runtime compression (lzo) ---> x x x x Compression method (no compression) --->UBI文件系统主要参数根据实际NAND参数来配置即可;
至此,配置完毕;
make all编译;
输出结果位于output/images 下
烧写文件系统:具体烧写方式请见我另一篇博文
转载地址:http://ctav.baihongyu.com/