"image is too large" 持续发生在 Raspberrypi 平台的 openbmc 镜像中

"image is too large" keeps on happening to openbmc image for Raspberrypi platform

有人可以给我建议为 Raspberrypi 平台制作 openbmc 映像吗? 在尝试之前,我查看了相关文档,并认为 openbmc 映像可以在 Raspberrypi 上运行。 喜欢 https://kevinleeblog.github.io/project1/2019/11/25/openbmc-for-raspberry-pi-zero/.

所以,我按照这些说明尝试了以下步骤。

#1: Git 克隆 openbmc.git 到我的本地 PC.

tm@tm-VB1:~/Rpi4-64$ git clone https://github.com/openbmc/openbmc.git

Snip the logs but it looks no problem.

Receiving objects: 100% (182121/182121), 84.10 MiB | 5.55 MiB/s, done.

Resolving deltas: 100% (96860/96860), done.

#2: 为树莓派设置 TEMPLATECONF

tm@tm-VB1:~/Rpi4-64$ export TEMPLATECONF=meta-evb/meta-evb-raspberrypi/conf

tm@tm-VB1:~/Rpi4-64$ echo $TEMPLATECONF

meta-evb/meta-evb-raspberrypi/conf

#3:通过“openbmc-env”设置环境

tm@tm-VB1:~/Rpi4-64/openbmc$ . openbmc-env 

### Initializing OE build env ###

Snip the logs but it looks no problem. As you know, the script automatically creates a subdirectory,build, under openbmc.


Common targets are:
  obmc-phosphor-image

tm@tm-VB1:~/Rpi4-64/openbmc/build$

#4:更改目录并为我的 Raspberrypi 平台编辑 local.conf。

tm@tm-VB1:~/Rpi4-64/openbmc/build$ cat ./conf/local.conf

Snip the log for unchanged part.

MACHINE ??= "raspberrypi4-64"   <<< Change here for my platform.

DL_DIR ?= "/home/tm/Yocto/downloads"           <<< Add here for build-time reduction at retry.

SSTATE_DIR ?= "/home/tm/Yocto/sstate-cache"   <<< Add here for build-time reduction at retry.

#5: 根据以下建议更改 FLASH_SIZE 变量。 https://github.com/openbmc/openbmc/issues/3590

tm@tm-VB1:~/Rpi4-64/openbmc/meta-phosphor/classes$ cat image_types_phosphor.bbclass 

Snip the log.

# Flash characteristics in KB unless otherwise noted

FLASH_SIZE ?= "131072"        <<< I changed only this variable from 32768 to 131072.

#6:bitbake 开始。

tm@tm-VB1:~/Rpi4-64/openbmc/bitbake obmc-phosphor-image

然后,发生错误。

ERROR: Logfile of failure stored in: /home/tm/Rpi/openbmc/build/tmp/work/raspberrypi-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/temp/log.do_generate_static.2055074
DEBUG: Executing python function do_generate_static
DEBUG: Executing shell function do_mk_static_nor_image
32768+0 records in
32768+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.09147 s, 367 MB/s
DEBUG: Shell function do_mk_static_nor_image finished
DEBUG: Considering file size=495980 name=/home/tm/Rpi/openbmc/build/tmp/deploy/images/raspberrypi/u-boot.bin
DEBUG: Spanning start=0K end=512K
DEBUG: Compare needed=495980 available=524288 margin=28308
484+1 records in
484+1 records out
495980 bytes (496 kB, 484 KiB) copied, 0.00120141 s, 413 MB/s
DEBUG: Considering file size=8266960 name=/home/tm/Rpi/openbmc/build/tmp/deploy/images/raspberrypi/fitImage-obmc-phosphor-initramfs-raspberrypi-raspberrypi
DEBUG: Spanning start=512K end=4864K
>>>DEBUG: Compare needed=8266960 available=4456448 margin=-3810512
ERROR: Image '/home/tm/Rpi/openbmc/build/tmp/deploy/images/raspberrypi/fitImage-obmc-phosphor-initramfs-raspberrypi-raspberrypi' is too large!
DEBUG: Python function do_generate_static finished

说margin=-3810512.

现在,我的第二次尝试。 我删除了整个 openbmc 目录并执行了与上面相同的步骤。 但是这次,我将 FLASH_SIZE 从 32768 更改为 262144。 与下面的结果相同。

ERROR: obmc-phosphor-image-1.0-r0 do_generate_static: Image '/home/tm/Rpi4/openbmc/build/tmp/deploy/images/raspberrypi4/u-boot.bin' is too large!
ERROR: Logfile of failure stored in: /home/tm/Rpi4/openbmc/build/tmp/work/raspberrypi4-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/temp/log.do_generate_static.2061792
ERROR: Task (/openbmc/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb:do_generate_static) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3915 tasks of which 2633 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
/openbmc/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb:do_generate_static
Summary: There were 2 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.

tm@tm-VB1:~/Rpi4/openbmc/build$ cat /home/tm/Rpi4/openbmc/build/tmp/work/raspberrypi4-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/temp/log.do_generate_static.2061792
DEBUG: Executing python function do_generate_static
DEBUG: Executing shell function do_mk_static_nor_image
32768+0 records in
32768+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.177223 s, 189 MB/s
DEBUG: Shell function do_mk_static_nor_image finished
DEBUG: Considering file size=548224 name=/home/tm/Rpi4/openbmc/build/tmp/deploy/images/raspberrypi4/u-boot.bin
DEBUG: Spanning start=0K end=512K
>>>DEBUG: Compare needed=548224 available=524288 margin=-23936
ERROR: Image '/home/tm/Rpi4/openbmc/build/tmp/deploy/images/raspberrypi4/u-boot.bin' is too large!
DEBUG: Python function do_generate_static finished
tm@tm-VB1:~/Rpi4/openbmc/build$ 

说margin=-23936.

好的。图片太大。所以,我的第三次尝试。 我删除了整个 openbmc 目录并执行了与上面相同的步骤。 但是这次,我将 FLASH_SIZE 从 32768 更改为 9437184。 与下面的结果相同。

ERROR: obmc-phosphor-image-1.0-r0 do_generate_static: Image '/home/tm/Rpi4/openbmc/build/tmp/deploy/images/raspberrypi4/u-boot.bin' is too large!
ERROR: Logfile of failure stored in: /home/tm/Rpi4/openbmc/build/tmp/work/raspberrypi4-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/temp/log.do_generate_static.2058361
ERROR: Task (/openbmc/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb:do_generate_static) failed with exit code '1'
NOTE: Tasks Summary: Attempted 3935 tasks of which 0 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
/openbmc/meta-phosphor/recipes-phosphor/images/obmc-phosphor-image.bb:do_generate_static
Summary: There were 4 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
tm@tm-VB1:~/Rpi4/openbmc$ 

tm@tm-VB1:~/Rpi4/openbmc$ cat /home/tm/Rpi4/openbmc/build/tmp/work/raspberrypi4-openbmc-linux-gnueabi/obmc-phosphor-image/1.0-r0/temp/log.do_generate_static.2058361
DEBUG: Executing python function do_generate_static
DEBUG: Executing shell function do_mk_static_nor_image
32768+0 records in
32768+0 records out
33554432 bytes (34 MB, 32 MiB) copied, 0.173685 s, 193 MB/s
DEBUG: Shell function do_mk_static_nor_image finished
DEBUG: Considering file size=548224 name=/home/tm/Rpi4/openbmc/build/tmp/deploy/images/raspberrypi4/u-boot.bin
DEBUG: Spanning start=0K end=512K
>>>DEBUG: Compare needed=548224 available=524288 margin=-23936
ERROR: Image '/home/tm/Rpi4/openbmc/build/tmp/deploy/images/raspberrypi4/u-boot.bin' is too large!
DEBUG: Python function do_generate_static finished
tm@tm-VB1:~/Rpi4/openbmc$ 

说的margin和256MB的case一样.

我的第四次尝试。 我删除了整个 openbmc 目录并执行了与上面相同的步骤。 我将 MACHINE ??= "raspberrypi4-64" 更改为 "raspberrypi2" 但是这次,我将 FLASH_SIZE 从 32768 更改为 33554432。

和之前一样的结果

我的第 5 次尝试。 我删除了整个 openbmc 目录并执行了与上述相同的步骤。 我用机器??=“raspberrypi2” 但是这次,我将 FLASH_SIZE 从 32768 更改为 67108864.

和之前一样的结果

在我尝试了几种变体之后,它总是说“图像太大”,尽管我将 FLASH_SIZE 更改为更大的图像。 所以,我想知道我是否错过了一些重要的配置,或者它需要另一个参数来解决这个问题,除了 FLASH_SIZE。 对了,我试了一下romulus,成功了。

我的环境是ubuntu-20.04.2.0-desktop-amd64.

非常感谢有人能给我建议让我完成这项工作。

有趣的是,我没有快速修复方法,但我确实注意到过大的分区是 uboot 分区。 uboot 是安装在机器上的较小的独立二进制文件。看起来你的 uboot 构建超过 512k,分区设置为 512k。你的闪光灯尺寸很大 FLASH_SIZE = 9437184" 那比演出还多,(因为 FLASH_SIZE 在 K 中)

如果我是你,我会首先尝试为 raspberry pi 构建一个旧版本的 openbmc。 (它曾经有效,所以你只需要在 uboot 变大之前找到提交)。使用 git 后退一个月,直到您发现它有效。

如果这不起作用,我会尝试修改分区 table。 这里是你 failing

  • 这看起来不错 building uboot 映像看起来不错
  • 增加内核 offset make if build,但 openbmc 中的其他目标不会对这个解决方案满意。所以也许 meta-raspberry-pi 将不得不覆盖分区 table(如果 uboot 不能缩小)

不管你做什么,在 github 上打开一个问题并分享你的更改。也使用 discord, and gerrit.

我刚刚复制了这个问题。我们应该修复它