u-boot 2016.05 添加自己的board 以及config.h


拿到一個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 <yegorslists@googlemail.com>
    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    

完成


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM