1. 程式人生 > 其它 >u-boot 2016.05 新增自己的board 以及config.h uboot移植

u-boot 2016.05 新增自己的board 以及config.h uboot移植

18 CONFIG_SYS_ARCH="arm"
19 CONFIG_SYS_CPU="armv8"
20 CONFIG_SYS_SOC="zynqmp"
21 CONFIG_SYS_VENDOR="xilinx"
22 CONFIG_SYS_BOARD="zynqmp"
23 CONFIG_SYS_CONFIG_NAME="xilinx_zynqmp_xxxx" 單板標頭檔案xilinx_zynqmp_xxxx.h(位於include/configs/)
177 CONFIG_DEFAULT_DEVICE_TREE="zynqmp-xxxx" 裝置樹在arch/arm/dts/下(zynqmp-xxxx.dts)

149 CONFIG_IDENT_STRING=" Xilinx ZynqMP XGPU" uboot啟動時的banner

/include/version.h

---------------------------------------------------------------------------------

修改configs/$(boardname)_defconfig檔案中的CONFIG_SYS_CONFIG_NAME

CONFIG_SYS_CONFIG_NAME="xilinx_zynqmp_xxxx",將xilinx_zynqmp_xxxx.h(位於include/configs/)包含進uboot

---------------------------------------------------------------------------------------------------------------

mkboot: $(BOOT_CONF) $(VERSION_FILE)
echo "mkboot"
$(MAKE) -j8 -C $(SRC_PATH) CROSS_COMPILE=$(CROSS_COMPILE) O=$(BUILD_DIR)

# To locate output files

# O=

# Use "make O=dir/to/store/output/files/"

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

uboot原始碼中"include/configs/$(boardname).h"與"configs/$(boardname)_defconfig"之間有何異同

答:最大的不同就是"configs/boardname_defconfig"中的選項都可以在make menuconfig中進行配置,而"include/configs/boardname.h"中的選項是與開發板相關的一些特性,在make menuconfig中是找不到這些選項的

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

拿到一個uboot 後,我都想新增一個屬於自己的board檔案以及include/configs/*.h 檔案。

如何新增這個些檔案,今天來記錄一下。


複製一份你所參考的板級檔案,比如說board/vscom/baltos/ 複製為board/sbc7109 資料夾 修改board/sbc7109/Kconfig 裡面的內容

    if TARGET_AM335X_SBC7109   // 這個是等下make menuconfig 指定的一個巨集

    config SYS_BOARD            //指定你的board 檔案
    	default "sbc7109"
    
    config SYS_SOC              //指定你的 soc 檔案
       	default "am33xx"

    config SYS_CONFIG_NAME        //指定你的 include/configs/am335x_sbc7109.h 為配置標頭檔案
	default "am335x_sbc7109"

    config CONS_INDEX
	int "UART used for console"
	range 1 6
	default 1
	help
	  The AM335x SoC has a total of 6 UARTs (UART0 to UART5 as referenced
	  in documentation, etc) available to it.  Depending on your specific
	  board you may want something other than UART0.

    endif


修改完這個檔案之後,將board/sbc7109/Kconfig 新增到arch/arm/Kconfig 新增如下內容:

    source "board/sbc7109/Kconfig"

在最後面endmenu 之前新增。


在arch/arm/Kconfig 裡面新增:

    377 config TARGET_AM335X_SBC7109        //這個巨集就是上面那個 if TARGET_AM335X_SBC7109 的前置條件                                          
    378     bool "Support am335x_sbc7109"                                               
    379     select CPU_V7                                                               
    380     select SUPPORT_SPL                                                          
    381     select DM                                                                   
    382     select DM_SERIAL                                                            
    383     select DM_GPIO                                                              


複製 include/configs/baltos.h 為include/configs/am335x_sbc7109.h

    修改include/configs/am335x_sbc7109.h 裡面的一個巨集定義:
    #define CONFIG_SYS_LDSCRIPT     "board/sbc7109/u-boot.lds"


修改board/sbc7109/u-boot.lds 裡面的一個內容

     34     .text :                                                                     
     35     {                                                                           
     36         *(.__image_copy_start)                                                  
     37         *(.vectors)                                                             
     38         CPUDIR/start.o (.text*)                                                 
     39         board/sbc7109/built-in.o (.text*)                                       
     40         *(.text*)                                                               
     41     }                                                                           


複製 configs/am335x_baltos_defconfig 為 configs/am335x_sbc7109_defconfig

    修改configs/am335x_sbc7109_defconfig 裡面的內容,如下:
    將 CONFIG_TARGET_AM335X_BALTOS=y  替換為:
    CONFIG_TARGET_AM335X_SBC7109=y

修改對應board/sbc7109/MAINTAINERS 裡面的內容

    BALTOS BOARD
    M:  Yegor Yefremov <[email protected]>
    S:  Maintained
    F:  board/sbc7109/
    F:  include/configs/am335x_sbc7109.h
    F:  configs/am335x_sbc7109_defconfig


ok ,做完上面的動作,在u-boot 根目錄進行 make am335x_sbc7109_defconfig
cat .config

     23 CONFIG_SYS_ARCH="arm"                                                           
     24 CONFIG_SYS_CPU="armv7"                                                          
     25 CONFIG_SYS_SOC="am33xx"                                                         
     26 CONFIG_SYS_BOARD="sbc7109"                                                      
     27 CONFIG_SYS_CONFIG_NAME="am335x_sbc7109"      


再進行編譯

    make -j2    


完成

Read The Fucking Source Code