2014年12月2日星期二

Add Board in U-Boot

1) Create Directory: /board/{VENDOR}/{BRDNAME}

2) Check similar driver? GPIO?

2a) For example, if we want to modify GPIO, create the C src file in /driver/gpio/{MARCH}_gpio.c

2b) In the /drivers/gpio/Makefile, add:
COBJS-$(CONFIG_{MARCH}_GPIO) += {BRDNAME}_gpio.o

2c) Create file: include/configs/{BRDNAME}.h
add #define CONFIG_{BRDNAME}_GPIO

3) CPU

3a) Create configs/{BRDNAME}_defconfig in the /configs directory
CONFIG_{ARCH}=y
CONFIG_TARGET_{BRDNAME}=y


3b) In arch/{ARCH}/Kconfig, add:
config TARGET_{BRDNAME}
    bool "Support {BRDNAME}"
    select CPU_{MARCH}


3c) In arch/{ARCH}/Kconfig, add:
source "board/{VENDOR}/{BRDNAME}/Kconfig"

4) Place relevant src files in
/board/{VENDOR}/{BRDNAME}

5) Add your Device in boards.cfg

6) Add Kconfig file:
if TARGET_{BRDNAME}

config SYS_BOARD
    default "{BRDNAME}"

config SYS_VENDOR
    default "{VENDOR}"

config SYS_SOC
    default "{ARCH}"

config SYS_CONFIG_NAME
    default "{BRDNAME}"

endif