【uboot】移植學習筆記

2020-06-10:

uboot移植空餘時間再搞,先搞定需要用的驅動

 

語法筆記:

1.Kconfig:

    imply <dep_symble> if [<expre>]: 弱反向依賴,當條件成立時,所依賴的項也被選中,但可被配置爲n

1.u-boot.cfg

依賴關係: u-boot.cfg  <-  include/config.h/

rk3399uboot移植過程中,查看.config中CONFIG_SYS_SOC/BOARD/VENDOR的值和原sdk中並不相同,則在此之前步驟有誤。

尋找關於這幾個宏定義的位置,在u-boot.cfg中有對應的#define,對比新舊uboot文件夾中兩個文件中的值可以確認.config文件中的相關變量差異與此有關,使用make -n 參數並將輸出寫入log,查找到有關的操作爲:

make -f ./scripts/Makefile.autoconf u-boot.cfg

查看Makefile.autoconf文件,找到生成依賴爲:

u-boot.cfg: include/config.h FORCE
	$(call cmd,u_boot_cfg)

查找config.h,追溯到根目錄makefile,根據主Makefile進行梳理:

all: $(ALL-y) cfg
    cfg: u-boot.cfg
        u-boot.cfg spl/u-boot.cfg tpl/u-boot.cfg: include/config.h    #多個u-boot.cfg目標均依賴於這個config.h
            $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.autoconf $(@)    #這裏知道u-boot.cfg的生成方法

...

2.firefly-linux_sdk配置過程

firefly的linux sdk封裝了各類操作的執行腳本,其中uboot編譯過程的對應關係爲:

${LINUX_SDK_DIR}/u-boot/make.sh:
prepare    #完成make ${RK_UBOOT_DEFCONFIG}_defconfig的配置,其中宏定義在device/rockchip/rk3399/${BOARD}.mk中定義
...
make CROSS_COMPILE=${TOOLCHAIN_GCC}  all --jobs=${JOB} ${OUTOPT}    #完成make編譯
...

make xxx_defconfig的生成規則:

%config: scripts_basic outputmakefile FORCE
	$(Q)$(MAKE) $(build)=scripts/kconfig $@

# Basic helpers built in scripts/
scripts_basic:
	$(Q)$(MAKE) $(build)=scripts/basic
	$(Q)rm -f .tmp_quiet_recordmcount

# outputmakefile generates a Makefile in the output directory, if using a
# separate output directory. This allows convenient use of make in the
# output directory.
outputmakefile:
ifneq ($(KBUILD_SRC),)
	$(Q)ln -fsn $(srctree) source
	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
	    $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
endif

3.移植關注的主要位置

arch/arm/mach-rockchip/rk3399/Kconfig:    #SOC相關
board/rockchip/evb_rk3399/Kconfig         #開發板相關
configs/firefly-rk3399_defconfig          #定製化配置

4.u-boot-2020-04增加2017-09的相關指令:

|CMD_LOAD_ANDROID: defconfig, cmd/Kconfig,
|_依賴-ANDROID_BOOT_IMG: common/Kconfig, ./Kconfig
  |_依賴-FASTBOOT:cmd/Kconfig:source "cmd/fastboot/Kconfig"

5.uboot-2020-04使用uboot-2017-09env參數啓動,提示錯誤信息爲:

無法識別boot_android和bootrkp命令,在uboot mainline代碼中沒有這個兩個關鍵字,firefly的sdk中有,因此需要移植這兩個命令.

boot_android->
    do_boot_android->
        android_bootloader_boot_flow->
            android_bootloader_boot_kernel

以此看來移植的重點便是將boot_andoird的一系列驅動移植到新版本中;

6.

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章