Armadilloフォーラム

ブートローダーのビルドでのエラー

okamotoatsushi

2023年10月13日 17時02分

お世話になっております。

ブートローダーのビルドを実行すると、下記のようなエラーが表示されビルドができません。
件のブートローダーは、過去に開発を行いビルドに成功しており、久しぶりにビルドを行ってみると失敗している状況です。
エラーの原因が分かるようでしたら、教えていただければ幸いです。
よろしくお願いいたします。

atmark@atde9:~/imx-boot-2020.04-at6$ sudo make imx-boot_armadillo_x2
[sudo] atmark のパスワード:
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
! [ -e .git ] || echo "-" > uboot-imx/localversion
make -C uboot-imx O=armadillo_x2 ARCH=arm64 x2_defconfig
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' に入ります
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' に入ります
  GEN     ./Makefile
#
# configuration written to .config
#
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' から出ます
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' から出ます
make -C uboot-imx O=armadillo_x2 CROSS_COMPILE=aarch64-linux-gnu-
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' に入ります
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' に入ります
  GEN     ./Makefile
scripts/kconfig/conf  --syncconfig Kconfig
  CHK     include/config.h
  CFG     u-boot.cfg
  GEN     include/autoconf.mk
  GEN     include/autoconf.mk.dep
  CFG     spl/u-boot.cfg
  GEN     spl/include/autoconf.mk
  CHK     include/config/uboot.release
  Using .. as source for U-Boot
  .. is not clean, please run 'make mrproper'
  in the '..' directory.
make[2]: *** [/home/atmark/imx-boot-2020.04-at6/uboot-imx/Makefile:1764: prepare3] エラー 1
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' から出ます
make[1]: *** [Makefile:167: sub-make] エラー 2
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' から出ます
make: *** [Makefile:164: uboot-imx/armadillo_x2/u-boot.stamp] エラー 2
コメント

at_dominique.m…

2023年10月13日 17時54分

okamotoatsushiさん

お世話になっています、マルティネです。

>   Using .. as source for U-Boot
>   .. is not clean, please run 'make mrproper'
>   in the '..' directory.

このエラーは、uboot-imx ディレクトリに間違って make を実行した時に発生します。エラーメッセージのとおりに uboot-imx ディレクトリに make mrproper を実行すると再びビルドできるようになると思います:

atmark:~/imx-boot$ make -j5 imx-boot_armadillo_x2
...
  Using .. as source for U-Boot
  .. is not clean, please run 'make mrproper'
  in the '..' directory.
...
atmark:~/imx-boot/uboot-imx$ cd uboot-imx
atmark:~/imx-boot/uboot-imx$ make mrproper
  CLEAN   scripts/basic
  CLEAN   scripts/kconfig
  CLEAN   include/config include/generated
atmark:~/imx-boot/uboot-imx$ cd ..
atmark:~/imx-boot$ make -j5 imx-boot_armadillo_x2
# 成功

まだエラーしていたら聞いてください。

よろしくお願いします。

okamotoatsushi

2023年10月16日 12時01分

マルティネ様
ありがとうございます。
uboot-imx ディレクトリに make mrproper を実行すると、前回のエラーの解消ができました。

しかし、再度にビルドを実行すると下記内容の別のエラーが発生いたしました。
原因等
よろしくお願いいたします。


atmark@atde9:~/imx-boot-2020.04-at6$ sudo make imx-boot_armadillo_x2
[sudo] atmark のパスワード:
残念、また試してください。
[sudo] atmark のパスワード:
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
! [ -e .git ] || echo "-" > uboot-imx/localversion
make -C uboot-imx O=armadillo_x2 ARCH=arm64 x2_defconfig
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' に入ります
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' に入ります
GEN ./Makefile
#
# configuration written to .config
#
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' から出ます
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' から出ます
make -C uboot-imx O=armadillo_x2 CROSS_COMPILE=aarch64-linux-gnu-
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' に入ります
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' に入ります
GEN ./Makefile
scripts/kconfig/conf --syncconfig Kconfig
CHK include/config.h
CFG u-boot.cfg
GEN include/autoconf.mk
GEN include/autoconf.mk.dep
CFG spl/u-boot.cfg
GEN spl/include/autoconf.mk
CHK include/config/uboot.release
Using .. as source for U-Boot
GEN ./Makefile
CHK include/generated/version_autogenerated.h
CHK include/generated/timestamp_autogenerated.h
UPD include/generated/timestamp_autogenerated.h
CHK include/generated/generic-asm-offsets.h
CHK include/generated/asm-offsets.h
HOSTCC tools/mkenvimage.o
HOSTLD tools/mkenvimage
HOSTCC tools/fit_image.o
HOSTCC tools/image-host.o
HOSTCC tools/dumpimage.o
HOSTLD tools/dumpimage
HOSTCC tools/mkimage.o
HOSTLD tools/mkimage
CC arch/arm/cpu/armv8/fwcall.o
LD arch/arm/cpu/armv8/built-in.o
WARNING 'lpddr4_pmu_train_1d_imem.bin' not found, resulting binary is not-functional
CC cmd/version.o
LD cmd/built-in.o
CC common/main.o
LD common/built-in.o
CC drivers/fastboot/fb_fsl/fb_fsl_getvar.o
LD drivers/fastboot/fb_fsl/built-in.o
LD drivers/fastboot/built-in.o
LD drivers/built-in.o
CC lib/efi_loader/helloworld.o
AS lib/efi_loader/efi_crt0.o
CC lib/efi_loader/efi_reloc.o
CC lib/efi_loader/efi_freestanding.o
LD lib/efi_loader/helloworld_efi.so
OBJCOPY lib/efi_loader/helloworld.efi
CC lib/smbios.o
CC lib/display_options.o
LD lib/built-in.o
LD u-boot
OBJCOPY u-boot.srec
OBJCOPY u-boot-nodtb.bin
start=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_start | cut -f 1 -d ' '); end=$(aarch64-linux-gnu-nm u-boot | grep __rel_dyn_end | cut -f 1 -d ' '); tools/relocate-rela u-boot-nodtb.bin 0x40200000 $start $end
CAT u-boot-dtb.bin
COPY u-boot.bin
SYM u-boot.sym
CC spl/arch/arm/cpu/armv8/fwcall.o
LD spl/arch/arm/cpu/armv8/built-in.o
WARNING 'lpddr4_pmu_train_1d_imem.bin' not found, resulting binary is not-functional
CC spl/common/spl/spl.o
LD spl/common/spl/built-in.o
CC spl/lib/display_options.o
LD spl/lib/built-in.o
LD spl/u-boot-spl
OBJCOPY spl/u-boot-spl-nodtb.bin
COPY spl/u-boot-spl.bin
MKIMAGE u-boot.img
MKIMAGE u-boot-dtb.img
LD u-boot.elf
WARNING 'lpddr4_pmu_train_1d_imem.bin' not found, resulting binary is not-functional
make[3]: 'SPL' に対して行うべき事はありません.
CFGCHK u-boot.cfg
make[2]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx/armadillo_x2' から出ます
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/uboot-imx' から出ます
cp -afl imx-mkimage/iMX8M/. imx-mkimage/armadillo_x2
cp uboot-imx/armadillo_x2/spl/u-boot-spl.bin imx-mkimage/armadillo_x2/u-boot-spl.bin
cp uboot-imx/armadillo_x2/u-boot-nodtb.bin imx-mkimage/armadillo_x2/u-boot-nodtb.bin
cp uboot-imx/armadillo_x2/tools/mkimage imx-mkimage/armadillo_x2/mkimage_uboot
cp uboot-imx/armadillo_x2/arch/arm/dts/armadillo_x2.dtb imx-mkimage/armadillo_x2/imx8mp-evk.dtb
make -C imx-optee-os O=out ARCH=arm PLATFORM=imx CFG_WERROR=y \
PLATFORM_FLAVOR=mx8mpevk
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/imx-optee-os' に入ります
GEN out/core/include/generated/arm32_sysreg.h
bash: 行 1: scripts/arm32_sysreg.py: 許可がありません
make[1]: *** [core/arch/arm/arm.mk:343: out/core/include/generated/arm32_sysreg.h] エラー 126
make[1]: *** ファイル 'out/core/include/generated/arm32_sysreg.h' を削除します
make[1]: ディレクトリ '/home/atmark/imx-boot-2020.04-at6/imx-optee-os' から出ます
make: *** [Makefile:202: imx-optee-os/out/tee.bin] エラー 2

at_dominique.m…

2023年10月16日 12時42分

okamotoatsushiさん

> しかし、再度にビルドを実行すると下記内容の別のエラーが発生いたしました。

> atmark@atde9:~/imx-boot-2020.04-at6$ sudo make imx-boot_armadillo_x2
> [...]
>   GEN     out/core/include/generated/arm32_sysreg.h
> bash: 行 1: scripts/arm32_sysreg.py: 許可がありません
<code>
 
<code>imx-optee-os/scripts/arm32_sysreg.py

ファイルに実行許可がなくなったみたいですね。
ディレクトリをコピーした時に許可を失ったかもしれません。

実行許可が必要なファイルが大量ありますので、imx-boot を新しく展開してそちらから許可をコピーできます。

# まずは自分のソースを念のために保存します
atmark@atde9:~$ tar czf imx-boot-backup.tar.gz imx-boot-2020.04-at6
 
#問題の確認。モードが -rw- になっています。
atmark@atde9:~$ ls -l imx-boot-2020.04-at6/imx-optee-os/scripts/arm32_sysreg.py
-rw-r--r-- 1 atmark atmark 7128 12月 21  2021 imx-boot-2020.04-at6/imx-optee-os/scripts/arm32_sysreg.py
 
# アーカイブを atmark-techno.com のサイトから取得して、実行許可を修正します。
atmark@atde9:~$ curl -O https://download.atmark-techno.com/armadillo-iot-g4/bootloader/imx-boot-2020.04-at6.tar.gz
atmark@atde9:~$ tar tvf imx-boot-2020.04-at6.tar.gz  | awk '/-rwx/ { print $NF }' | xargs chmod +x
# 確認。モードが -rwx になりました。
atmark@atde9:~$ ls -l imx-boot-2020.04-at6/imx-optee-os/scripts/arm32_sysreg.py
-rwxr-xr-x 1 atmark atmark 7128 12月 21  2021 imx-boot-2020.04-at6/imx-optee-os/scripts/arm32_sysreg.py

それでこのエラーが修正されると思いますが、また別のエラーが発生した場合にソースを新しく展開して変種された内容をコピーした方が早いかもしれません。
いくつかの不具合も修正していますので、ご都合がよろしければ最新のバージョンに更新することも推奨します。

よろしくお願いします。

okamotoatsushi

2023年10月16日 13時30分

マルティネ様
ありがとうございます。

実行許可を修正すると、エラー無くビルドを実行することができました。
お手数をお掛けして、申し訳ございませんでした。
ありがとうございました。