buildroot配置根文件系統

環境: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

 

修改用戶信息、時間顯示

/etc/profile

#if [ "$PS1" ]; then
#       if [ "`id -u`" -eq 0 ]; then
#               export PS1='# '
#       else
#               export PS1='$ '
#       fi
#fi
PS1='[\u@\h]:\w$'
export PS1

復位開發

後續在添加內容

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章