You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

BitBake构建tegra-bootfiles时DEPENDS中dtc未触发编译的问题

解决tegra-bootfiles自定义任务找不到dtc命令的依赖问题

我为meta-tegra中的tegra-bootfiles配方编写了.bbappend文件,在DEPENDS:append字段中添加了dtc和dtc-native依赖。但执行bitbake tegra-bootfiles时,自定义的do_process_eeprom任务报错找不到dtc命令,dtc并未被触发构建。

相关.bbappend代码

# Hack: The fetch task is disabled on this recipe, so the following is just for the task signature.
FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:"
SRC_URI:append:p3768-0000-p3767-0000 = "\
    file://tegra234-mb1-bct-gpio-p3767-hdmi-a03.dtsi \
    file://tegra234-mb1-bct-pinmux-p3767-hdmi-a03.dtsi \
"

DEPENDS:append = " dtc dtc-native"

addtask do_process_eeprom before do_install

do_process_eeprom() {
    dtc -I dtb -O dts ${S}/bootloader/t186ref/tegra234-bpmp-3767-0001-3509-a02.dtb > ${S}/bootloader/t186ref/tegra234-bpmp-3767-0001-3509-a02.dts
    sed -i 's/gbe-uphy-config = <0x08>/gbe-uphy-config = <0x09>/g' ${S}/bootloader/t186ref/tegra234-bpmp-3767-0001-3509-a02.dts
    dtc -I dts -O dtb -o ${S}/bootloader/t186ref/tegra234-bpmp-3767-0001-3509-a02.dtb ${S}/bootloader/t186ref/tegra234-bpmp-3767-0001-3509-a02.dts
    rm -rf ${S}/bootloader/t186ref/tegra234-bpmp-3767-0001-3509-a02.dts

    sed -i 's/cvb_eeprom_read_size = <0x100>/cvb_eeprom_read_size = <0x0>/g' ${S}/bootloader/t186ref/BCT/tegra234-mb2-bct-misc-p3767-0000.dts
    sed -i 's/cvb_eeprom_read_size = <0x100>/cvb_eeprom_read_size = <0x0>/g' ${S}/bootloader/t186ref/BCT/tegra234-mb2-bct-misc-p3701-0002-p3711-0000.dts
    sed -i 's/cvb_eeprom_read_size = <0x100>/cvb_eeprom_read_size = <0x0>/g' ${S}/bootloader/t186ref/BCT/tegra234-mb2-bct-misc-p3701-0002-p3740-0002.dts

    # Define the text to add
    text_to_add='        reg@322 { /* GPIO_M_SCR_00_0 */\n            exclusion-info = <2>;\n            value = <0x38009696>;\n        };\n'

    # Use sed to add the text after "tfs {" in the file
    sed -i '/tfc {/a\'"$text_to_add"'' ${S}/bootloader/t186ref/BCT/tegra234-mb2-bct-scr-p3767-0000.dts

}


# Hack: As the fetch task is disabled for this recipe, we have to directly access the files."
CUSTOM_DTSI_DIR := "${THISDIR}/${BPN}"

do_install:append:p3768-0000-p3767-0000() {
    install -m 0644 ${CUSTOM_DTSI_DIR}/tegra234-mb1-bct-gpio-p3767-hdmi-a03.dtsi ${D}${datadir}/tegraflash/
    install -m 0644 ${CUSTOM_DTSI_DIR}/tegra234-mb1-bct-pinmux-p3767-hdmi-a03.dtsi ${D}${datadir}/tegraflash/
}

构建错误日志

dtc -I dtb -O dts /home/user/poky/build/tmp/work-shared/L4T-tegra-35.4.1-r0/Linux_for_Tegra/bootloader/t186ref/tegra234-bpmp-3767-0001-3509-a02.dtb
/home/user/poky/build/tmp/work/p3768_0000_p3767_0000-poky-linux/tegra-bootfiles/35.4.1-r0/temp/run.do_process_eeprom.1462074: 141: dtc: not found
+ bb_sh_exit_handler
+ ret=127
+ [ 127 != 0 ]
+ echo WARNING: exit code 127 from a shell command.
+ exit 127

+ ls -A

+ [ deploy-source-date-epoch ]
+ set +e

+ tar -I pzstd -8 -p 12 -cS -f /home/user/poky/build/sstate-cache/4e/90/sstate:tegra-bootfiles:p3768_0000_p3767_0000-poky-linux:35.4.1:r0:p3768_0000_p3767_0000:10:4e90edf4eefa9b94a2e7fc008d6fa4b569642b6903ff9a967da1236cec8b2dc1_deploy_source_date_epoch.tar.zst.Ij3TcnB1 deploy-source-date-epoch

ERROR: tegra-bootfiles-35.4.1-r0 do_process_eeprom: ExecutionError('/home/user/poky/build/tmp/work/p3768_0000_p3767_0000-poky-linux/tegra-bootfiles/35.4.1-r0/temp/run.do_process_eeprom.1462074', 127, None, None)
ERROR: Logfile of failure stored in: /home/user/poky/build/tmp/work/p3768_0000_p3767_0000-poky-linux/tegra-bootfiles/35.4.1-r0/temp/log.do_process_eeprom.1462074
ERROR: Task (/home/user/poky/meta-tegra/recipes-bsp/tegra-binaries/tegra-bootfiles_35.4.1.bb:do_process_eeprom) failed with exit code '1'

解决思路

  • 修正依赖类型,只保留native工具
    自定义任务在构建主机上执行,无需目标机的dtc包,仅需依赖dtc-native。修改DEPENDS字段:

    DEPENDS:append = " dtc-native"
    
  • 为自定义任务添加显式依赖声明
    让do_process_eeprom任务明确依赖dtc-native的do_populate_sysroot任务,确保BitBake先构建并部署dtc-native到环境中:

    do_process_eeprom[depends] += "dtc-native:do_populate_sysroot"
    
  • 验证任务执行环境
    可在do_process_eeprom开头添加PATH打印,确认dtc-native的路径是否被正确加入:

    do_process_eeprom() {
        echo "Current PATH: $PATH"
        # 原有任务代码...
    }
    
  • 清理缓存后重新构建
    之前的任务签名可能已缓存,清理后重新生成:

    bitbake -c cleansstate tegra-bootfiles
    bitbake tegra-bootfiles
    

内容的提问来源于stack exchange,提问作者user22615348

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 15:48:11