拿到一个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"      


再进行编译

扫描二维码关注公众号,回复: 12635199 查看本文章
    make -j2 

猜你喜欢

转载自blog.csdn.net/wlf_go/article/details/113844622