raspberry pi u-boot 中使用 yocto 的额外命令

Extra commands in raspberry pi u-boot using yocto

我想使用 yocto 在 raspberry pi u-boot 中添加自定义命令 我可以按照此处提供的答案使用 make 添加自定义

现在我想在 raspberry pi 中使用 yocto 添加它。 但首先我只想在 u-boot 中添加定时器命令,它存在于 u-boot 源代码的 misc.c 中,我们只需要在 defconfig 文件

中添加 CONFIG_CMD_TIMER=y

到目前为止我尝试了以下设置

  1. 克隆的 poky
  2. 克隆的 meta-raspberrypi
  3. 在 local.conf
  4. 中启用了 u-boot 和 uart
  5. 创建了一个自定义层(在bblayers.conf中添加了自定义层)以添加命令配置

自定义图层中的配方详情

  1. 创建以下目录结构
meta-custom-layer/recipes-bsp/u-boot/
  1. 创建了一个包含以下内容的 .bbappend 文件
$ cat meta-custom-layer/recipes-bsp/u-boot/u-boot_%.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}:"
SRC_URI += " file://rpi_3_defconfig.patch;patchdir=${S}/configs "
  1. meta-custom-layer/recipes-bsp/u-boot/
  2. 的内容
$ ls -l meta-custom-layer/recipes-bsp/u-boot/
drwxr-xr-x 2 bhargav bhargav 4096 May 16 22:04 files
-rw-r--r-- 1 bhargav bhargav  107 May 16 22:04 u-boot_%.bbappend

$ cat meta-custom-layer/recipes-bsp/u-boot/files/rpi_3_defconfig.patch
CONFIG_CMD_TIMER=y
  1. 构建 u-boot 时出现以下错误
$ bitbake u-boot
Loading cache: 100% |########################################################################################################################################################################| Time: 0:00:00
Loaded 2875 entries from dependency cache.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "raspberrypi3-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1"
TUNE_FEATURES        = "aarch64 cortexa53 crc"
TARGET_FPU           = ""
meta                 
meta-poky            
meta-yocto-bsp       = "master:2e11d97b6c95e89aa1f9d3603a966c94c442469e"
meta-raspberrypi     = "master:45ee64377bcc511380edf59191abc90c1ddb210e"
meta-shell           = "master:81fd3448f603a56409389247443439cad4fdaa67"
meta-oe              = "master:679bb4912613f3860e8527557602251e5e5f2c41"
meta-python2         = "master:2684086f91e7074324081196c8a5f9945d39650e"

Initialising tasks: 100% |###################################################################################################################################################################| Time: 0:00:00
Sstate summary: Wanted 16 Found 8 Missed 8 Current 135 (50% match, 94% complete)
NOTE: Executing Tasks
WARNING: u-boot-1_2020.04-r0 do_fetch: Failed to fetch URL file://rpi_3_defconfig.patch;patchdir=/home/bhargav/RPI3/Build/poky/build/tmp/work/raspberrypi3_64-poky-linux/u-boot/1_2020.04-r0/git/configs, attempting MIRRORS if available
ERROR: u-boot-1_2020.04-r0 do_fetch: Fetcher failure: Unable to find file file://rpi_3_defconfig.patch;patchdir=/home/bhargav/RPI3/Build/poky/build/tmp/work/raspberrypi3_64-poky-linux/u-boot/1_2020.04-r0/git/configs anywhere. The paths that were searched were:
    /home/bhargav/RPI3/Build/meta-shell/recipes-bsp/u-boot/poky
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot-2020.04/poky
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot/poky
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/files/poky
    /home/bhargav/RPI3/Build/meta-shell/recipes-bsp/u-boot/raspberrypi3-64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot-2020.04/raspberrypi3-64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot/raspberrypi3-64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/files/raspberrypi3-64
    /home/bhargav/RPI3/Build/meta-shell/recipes-bsp/u-boot/raspberrypi3
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot-2020.04/raspberrypi3
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot/raspberrypi3
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/files/raspberrypi3
    /home/bhargav/RPI3/Build/meta-shell/recipes-bsp/u-boot/aarch64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot-2020.04/aarch64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot/aarch64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/files/aarch64
    /home/bhargav/RPI3/Build/meta-shell/recipes-bsp/u-boot/rpi
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot-2020.04/rpi
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot/rpi
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/files/rpi
    /home/bhargav/RPI3/Build/meta-shell/recipes-bsp/u-boot/aarch64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot-2020.04/aarch64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot/aarch64
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/files/aarch64
    /home/bhargav/RPI3/Build/meta-shell/recipes-bsp/u-boot/
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot-2020.04/
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot/
    /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/files/
    /home/bhargav/RPI3/Build/poky/build/downloads
ERROR: u-boot-1_2020.04-r0 do_fetch: Fetcher failure for URL: 'file://rpi_3_defconfig.patch;patchdir=/home/bhargav/RPI3/Build/poky/build/tmp/work/raspberrypi3_64-poky-linux/u-boot/1_2020.04-r0/git/configs'. Unable to fetch URL from any source.
ERROR: Logfile of failure stored in: /home/bhargav/RPI3/Build/poky/build/tmp/work/raspberrypi3_64-poky-linux/u-boot/1_2020.04-r0/temp/log.do_fetch.13694
ERROR: Task (/home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot_2020.04.bb:do_fetch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 592 tasks of which 591 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/bhargav/RPI3/Build/poky/meta/recipes-bsp/u-boot/u-boot_2020.04.bb:do_fetch
Summary: There was 1 WARNING message shown.
Summary: There were 2 ERROR messages shown, returning a non-zero exit code.

那么我在这里错过了什么?我正在使用 raspberry pi 3B+ 。

FILESEXTRAPATHS_append := "${THISDIR}/文件"

在检查不同的 rpi3 defconfig 文件后找到了正确的文件并为该文件创建了一个补丁。看起来像这样 rpi-timer.patch

diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig
index 9b281a4f15..053d36e244 100644
--- a/configs/rpi_3_defconfig
+++ b/configs/rpi_3_defconfig
@@ -45,3 +45,4 @@ CONFIG_SYS_WHITE_ON_BLACK=y
 CONFIG_CONSOLE_SCROLL_LINES=10
 CONFIG_PHYS_TO_BUS=y
 CONFIG_OF_LIBFDT_OVERLAY=y
+CONFIG_CMD_TIMER=y

现在需要将补丁应用到 yocto 中获取的源。 这是用于应用补丁的 .bbappend 文件 recipes-bsp/u-boot/u-boot_%.bbappend

FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += " file://rpi-timer.patch "