环境:ubuntu16.04
交叉编译器:gcc-linaro4.9.4
编译器路径:/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin
nfs挂载路径:/home/arjun/linux/nfs/buildrootfs
客户端地址:192.168.8.60
服务器地址:192.168.8.57
硬件主芯片:imx6ull 存储:EMMC
测试linux内核文件和设备树以及nfs服务器可以使用
setenv mybootnfs 'nfs 80800000 192.168.8.57:/home/arjun/linux/nfs/zImage;nfs 83000000 192.168.8.57:/home/arjun/linux/nfs/imx6ull-arjun-emmc.dtb;bootz 80800000 - 83000000'
run mybootnfs //开始测试
列出支持的芯片
make list-defconfigs
打开图形界面配置
make menuconfig
出现一下错误
*** Unable to find the ncurses libraries or the
*** required header files.
*** 'make menuconfig' requires the ncurses libraries.
***
*** Install ncurses (ncurses-devel or libncurses-dev
*** depending on your distribution) and try again.
安装库文件
apt-get install libncurses5-dev
初步选项配置
Target options --->
Target Architecture (ARM (little endian)) --->
Target Binary Format (ELF) --->
Target Architecture Variant (cortex-A7) --->
Target ABI (EABIhf) --->
Floating point strategy (NEON/VFPv4) --->
ARM instruction set (ARM) --->
Toolchain --->
Toolchain type (External toolchain) --->
Toolchain (Custom toolchain) --->
Toolchain origin (Pre-installed toolchain) --->
(/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf) Toolchain path
(arm-linux-gnueabihf) Toolchain prefix
External toolchain gcc version (4.9.x) --->
External toolchain kernel headers series (4.1.x) --->
External toolchain C library (glibc/eglibc) --->
[*] Toolchain has SSP support? (NEW)
[*] Toolchain has RPC support? (NEW)
[*] Toolchain has C++ support?
[*] Enable MMU support (NEW)
System configuration --->
(arjun_imx6ull) System hostname
(Welcome to Arjun i.mx6ull) System banner
Init system (BusyBox) --->
/dev management (Dynamic using devtmpfs + mdev) --->
[*] Enable root login with password
(123456) Root password
Filesystem images --->
[*] ext2/3/4 root filesystem
ext2/3/4 variant (ext4) --->
Kernel --->
[ ] Linux Kernel
Bootloaders --->
[ ] U-Boot
编译
make 漫长等待
开发板sd卡uboot启动 NFS挂载buildroot生成的根文件系统
bootargs=console=tty1 console=ttymxc0,115200 root=/dev/nfs rw nfsroot=192.168.8.57:/home/arjun/linux/nfs/buildrootfs ip=192.168.8.60:192.168.8.57:192.168.8.1:255.255.255.0::eth0:off
setenv bootargs 'console=tty1 console=ttymxc0,115200 root=/dev/nfs rw nfsroot=192.168.8.57:/home/arjun/linux/nfs/buildrootfs ip=192.168.8.60:192.168.8.57:192.168.8.1:255.255.255.0::eth0:off'
saveenv
建议保存 buildroot-xxx/dl 文件夹,里面包含了库,软件安装包以及使用图形界面时候保存配置文件 .config,另存文件名后下次使用修改为.config 加快配置
添加其他第三方软件和库
Target packages --->
Libraries --->
Audio/Sound --->
--- alsa-lib
(/dev/snd) directory with ALSA device files
(all) built PCM plugins
(all) built control plugins
[*] aload
-*- mixer
-*- pcm
-*- rawmidi
[*] hwdep
-*- seq
[*] alisp
[*] old-symbols
Audio and video applications --->
--- alsa-utils
[*] alsaconf
[*] aconnect
[*] alsactl
[*] alsaloop
[*] alsamixer
[*] alsaucm
[*] alsatplg
[*] amidi
[*] amixer
[*] aplay/arecord
[*] aplaymidi
[*] arecordmidi
[*] aseqdump
[*] aseqnet
[*] bat
[*] iecset
[*] speaker-test
buildroot配置下busybox安装包
busybox 安装包位置
ls /buildrootfs/dl/busybox busybox-1.29.3.tar.bz2
busybox解压文件位置
/output/build/busybox-1.29.3
buildroot添加busybox配置
位置/output/build/busybox-1.29.3/Makefile
添加编译环境,编译器路径
164 CROSS_COMPILE ?=/usr/local/arm/gcc-linaro-4.9.4-2017.01-x86_64_arm-linux-gnueabihf/bin/arm/arm-linux-gnueabihf-
190 ARCH ?=arm
busybox 支持中文
vim libbb/printable_string.c
30 break;
31 // if (c >= 0x7f)
32 // break;
33 s++;
43 if (c == '\0')
44 break;
45 // if (c < ' ' || c >= 0x7f)
46 if(c < ' ')
47 *d = '?';
48 d++;
使能 unicode码
# vim libbb/unicode.c
1022 // *d++ = (c >= ' ' && c < 0x7f) ? c : '?';
1023 *d++ = (c>=' ')?c:'?';
1024 src++;
1025 }
1026 *d = '\0';
1030 unsigned char c = *d;
1031 // if (c < ' ' || c >= 0x7f)
1032 if(c < ' ')
1033 *d = '?';
1034 d++;
busybox默认配置
make defconfig
图形配置界面
make menuconfig
Settings --->
--- Library Tuning
[*] vi-style line editing commands
[*] Support Unicode
[*] Check $LC_ALL, $LC_CTYPE and $LANG environment variables
--- Build Options
[ ] Build static binary (no shared libs)
Linux Module Utilities --->
[ ] Simplified modutils
Linux System Utilities --->
[*] mdev (16 kb)
[*] Support /etc/mdev.conf
[*] Support subdirs/symlinks
[*] Support regular expressions substitutions when renaming device
[*] Support command execution at device addition/removal
[*] Support loading of firmware
位置buildrootfs目录下
查看buildroot下包含的可以编译软件
make show-targets
alsa-lib alsa-utils busybox host-fakeroot host-makedevs host-patchelf ifupdown-scripts initscripts linux-headers skeleton skeleton-init-common skeleton-init-sysv toolchain toolchain-buildroot uclibc rootfs-tar
编译busybox
make busybox
再次编译buildroot
make
编译好的根文件目录 /output/image/rootfs.tar
将rootfs.tar 拷贝到/home/arjun/linux/nfs/buildrootfs解压
tar -vxf rootfs.tar
测试buildroot根文件系统
ping www.baidu.com
出现错误 ping: bad address 'www.baidu.com'
修改文件
vi /etc/resolv.conf
nameserver 114.114.114.114
nameserver 192.168.8.1