Buildroot 構(gòu)建文件系統(tǒng)

簡介

? ? ? ? Buildroot是Linux平臺上一個構(gòu)建嵌入式Linux系統(tǒng)的框架。整個Buildroot是由Makefile腳本和Kconfig配置文件構(gòu)成的。你可以和編譯Linux內(nèi)核一樣,通過buildroot配置,menuconfig修改,編譯出一個完整的可以直接燒寫到機器上運行的Linux系統(tǒng)軟件(包含boot、kernel、rootfs以及rootfs中的各種庫和應(yīng)用程序)。
發(fā)行版:http://buildroot.net/downloads/
歷史版本:http://buildroot.net/downloads/snapshots/
對于buildroot與yocto的差異可移步:Buildroot vs OpenEmbedded or Yocto Project。

開發(fā)環(huán)境介紹

  • 主機操作系統(tǒng):Ubuntu14.04 64位
  • 目標平臺:全志A40I
  • buildroot工具版本:buildroot-2016.11
  • 編譯時間:2019.06.02

構(gòu)建rootfs

? ? ? ? 要構(gòu)建自己的開發(fā)板,首先要創(chuàng)建一個基本的 buildroot配置作為開發(fā)板的基本編譯系統(tǒng)。這里包括toolchain,kernel,bootloader,filesystem 和一個簡單的 busy-box 用戶空間。不要選擇特別的配置,這個配置必須要足夠小,并僅僅作為目標平臺一個基本的 BusyBox 系統(tǒng)。

執(zhí)行make menuconfig

  • Target options:目標板的配置

    • Target Architecture:目標架構(gòu),這里選擇 ARM(little endian),ARM小端模式
    • Target Binary Format:二進制格式,為 ELF
    • Target Architecture Variant:架構(gòu)體為 cortex-A7,內(nèi)核類型
    • Target ABI:應(yīng)用程序二進制接口,為EABI
    • Floating point strategy:浮點數(shù)的策略,選擇為 VFPv4-D16
    • ARM instruction set:arm 匯編指令集,選擇 ARM
  • Build options:主要是一些編譯時用到的選項,比如dl的路徑,下載代碼包使用的路徑,同時運行多個編譯的上限,是否使能編譯器緩沖區(qū)等等,這里按照默認就行了.

  • Toolchain:工具鏈選項

    • Toolchain type:Buildroot提供兩種方式使用toolchain
      • external toolthain:非Buildroot提供的交叉編譯器,這里使用外部,選擇此項
      • Buildroot toolchain:Buildroot本身編譯生成的Buildroot toolchain
    • Enable MMU support:使能 MMU,A40I支持MMU,選上
  • System configuration:系統(tǒng)配置

    • Root FS skeleton:
    • System hostname:填寫A40I
    • Init system:系統(tǒng)初始化,選擇 BusyBox
    • /dev management:設(shè)備文件管理,選擇Dynamic using devtmpfs + eudev,即使用udev動態(tài)加載設(shè)備節(jié)點的方式
    • Path to the permission tables:設(shè)備節(jié)點的配置表設(shè)置,一定要選擇system/device_table_dev.txt,否則后面在dev目錄下將不會生成各種設(shè)備節(jié)點。當然我們也可以手動的配置該文件,添加必要的節(jié)點或刪除不需要的節(jié)點。
    • Enable root login with password:允許終端登陸使用密碼
    • Root password:進入linux控制臺終端后的密碼,為空則登錄時不需要密碼,默認登錄用戶名為root。
    • /bin/sh (busybox' default shell)
    • Run a getty (login prompt) after boot:保持默認,默認為選中。
      • TTY port:配置為 ttyS0
      • Baudrate :波特率,配置為 115200
      • TERM environment variable:默認即可
      • other options to pass to getty:默認即可
    • remount root filesystem read-write during boot:可進行動態(tài)掛載
  • Kernel:內(nèi)核配置
    ? ? 這里內(nèi)核不參與到buildroot的管理中;

  • Target packages:包管理;文件系統(tǒng)通常要包含很多第三方軟件,通過該配置,自動從指定的服務(wù)器上下載源碼包,自動編譯,自動搭建;

    • [*] Show packages that are also provided by busybox
    • Debugging, profiling and benchmark ;這里有非常實用的調(diào)試、分析測試工具,如gdb/stress/iperf3...不過這里構(gòu)建的為發(fā)行版文件系統(tǒng),因此去掉;
    • Filesystem and flash utilities:文件系統(tǒng)和閃存工具,
      • [*] dosfstools
      • [*] mkfs.fat 格式化工具
    • Fonts, cursors, icons, sounds and themes
      • DejaVu fonts
      • mono fonts
      • sans fonts
    • Hardware handling (也包含一些工具,如evtest/hdparm/memtester/minicom)
      • dbus
      • dbus-c++
      • dbus-glib
    • Graphic libraries and applications (graphic/text) --->
      • [*] sdl2 (使用QT做圖形界面,需要的)
    • Libraries
      • Crypto --->
        [*] libgcrypt

        [*] openssl

      • Graphics --->

        • [*] fontconfig (QT 顯示文字信息時還需要與字體相關(guān)的東西)
      • Hardware handling --->
        [*] libinput (使用QT做圖形界面,需要的)

    • Networking applications
      • [*] dhcp (ISC)
      • [*] dhcp server
      • [*] Enable delayed ACK feature
      • [*] iptables
      • [*] iw
      • [*] wpa_supplicant
      • [*] Enable nl80211 support
      • [*] Enable AP mode
      • [*] Enable Wi-Fi Display
      • [*] Enable autoscan
      • [*] Enable EAP
      • [*] Enable syslog support
      • [*] Enable WPS
      • [*] Install wpa_cli binary
      • [*] Install wpa_passphrase binary
    • System tools
      • [*] cpuload
      • [*] htop
    • Additional tools(Lichee)
      • [*] fsck msdos
  • Filesystem images:文件系統(tǒng)選擇,選擇ext4

    • [*] ext2/3/4 root filesystem
      • ext2/3/4 variant (ext4) --->
  • Bootloaders:
    ?? 硬件啟動程序,這里不添加到管理

  • Host utilities:

  • Legacy config options:

保存:
cp .config configs/sun8iw11p1_defconfig

54.3M

參考:
https://blog.csdn.net/kunkliu/article/details/84297260

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容