Get "'cpio': Exec format error" when building zcu102 image with pynq 2.7

I I have been encountering the problem mentioned in the title when compiling the boot image, and I have not been able to find a solution.

If I only build boot files seems no problem:
make boot_files -C PYNQ/sdbuild BOARDS=ZCU102

But as long as I compile the image, the following error message appears:
make images -C PYNQ/sdbuild BOARDS=ZCU102 PREBUILT=focal.aarch64.2.7.0_2021_11_17.tar.gz

make: Entering directory '/home/xlnx/host/PYNQ/sdbuild'
/opt/qemu/bin/qemu-aarch64-static -version | fgrep 5.2.0
qemu-aarch64 version 5.2.0
vivado -version | fgrep 2020.2
Vivado v2020.2 (64-bit)
vitis -version | fgrep 2020.2
****** Vitis v2020.2 (64-bit)
which petalinux-config
/opt/petalinux/tools/common/petalinux/bin/petalinux-config
which arm-linux-gnueabihf-gcc
/opt/Xilinx/Vitis/2020.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin/arm-linux-gnueabihf-gcc
which microblaze-xilinx-elf-gcc
/opt/Xilinx/Vitis/2020.2/gnu/microblaze/lin/bin/microblaze-xilinx-elf-gcc
which ct-ng
/opt/crosstool-ng/bin/ct-ng
bash /home/xlnx/host/PYNQ/sdbuild/scripts/check_env.sh
Checking system for required packages:
bc gperf bison flex texi2html texinfo help2man gawk libtool libtool-bin build-essential automake libglib2.0-dev device-tree-compiler qemu-user-static binfmt-support multistrap git lib32z1 libbz2-1.0 lib32stdc++6 libssl-dev kpartx zerofree u-boot-tools rpm2cpio libsdl1.2-dev rsync python3-pip gcc-multilib libidn11 curl libncurses5-dev lib32ncurses5
sudo rm -fr /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102
mkdir /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102
(cd /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102 && sudo tar -xf /home/xlnx/host/files/focal.aarch64.2.7.0_2021_11_17.tar.gz)
QEMU_EXE=/opt/qemu/bin/qemu-aarch64-static PYNQ_BOARDDIR=/home/xlnx/host/PYNQ/boards/ZCU102 PYNQ_BOARD=ZCU102 FPGA_MANAGER=1 ARCH=aarch64 PACKAGE_PATH=/home/xlnx/host/PYNQ/boards/ZCU102/packages /home/xlnx/host/PYNQ/sdbuild/scripts/install_packages.sh /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102 ethernet
+ target=/home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102
+ shift
+ fss='proc run dev'
+ for fs in $fss
+ sudo mount -o bind /proc /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/proc
+ for fs in $fss
+ sudo mount -o bind /run /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/run
+ for fs in $fss
+ sudo mount -o bind /dev /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/dev
+ mkdir -p /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/ccache
+ sudo mount -o bind /home/xlnx/host/PYNQ/sdbuild/ccache /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/ccache
+ trap unmount_special EXIT
+ export CFLAGS=
+ CFLAGS=
+ export CPPFLAGS=
+ CPPFLAGS=
+ export PATH=/usr/lib/ccache:/opt/qemu/bin:/opt/crosstool-ng/bin:/opt/Xilinx/Vitis_HLS/2020.2/bin:/opt/Xilinx/Model_Composer/2020.2/bin:/opt/Xilinx/Vitis/2020.2/bin:/opt/Xilinx/Vitis/2020.2/gnu/microblaze/lin/bin:/opt/Xilinx/Vitis/2020.2/gnu/arm/lin/bin:/opt/Xilinx/Vitis/2020.2/gnu/microblaze/linux_toolchain/lin64_le/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch64/lin/aarch64-linux/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch64/lin/aarch64-none/bin:/opt/Xilinx/Vitis/2020.2/gnu/armr5/lin/gcc-arm-none-eabi/bin:/opt/Xilinx/Vitis/2020.2/tps/lnx64/cmake-3.3.2/bin:/opt/Xilinx/Vitis/2020.2/aietools/bin:/opt/Xilinx/Vivado/2020.2/bin:/opt/Xilinx/DocNav:/opt/petalinux/tools/xsct/petalinux/bin:/opt/petalinux/tools/common/petalinux/bin:/opt/petalinux/tools/xsct/gnu/microblaze/lin/bin:/opt/petalinux/tools/xsct/gnu/armr5/lin/gcc-arm-none-eabi/bin:/opt/petalinux/tools/xsct/gnu/aarch64/lin/aarch64-none/bin:/opt/petalinux/tools/xsct/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/xlnx/host:/home/xlnx/host:/opt/qemu/bin:/opt/crosstool-ng/bin
+ PATH=/usr/lib/ccache:/opt/qemu/bin:/opt/crosstool-ng/bin:/opt/Xilinx/Vitis_HLS/2020.2/bin:/opt/Xilinx/Model_Composer/2020.2/bin:/opt/Xilinx/Vitis/2020.2/bin:/opt/Xilinx/Vitis/2020.2/gnu/microblaze/lin/bin:/opt/Xilinx/Vitis/2020.2/gnu/arm/lin/bin:/opt/Xilinx/Vitis/2020.2/gnu/microblaze/linux_toolchain/lin64_le/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch32/lin/gcc-arm-linux-gnueabi/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch64/lin/aarch64-linux/bin:/opt/Xilinx/Vitis/2020.2/gnu/aarch64/lin/aarch64-none/bin:/opt/Xilinx/Vitis/2020.2/gnu/armr5/lin/gcc-arm-none-eabi/bin:/opt/Xilinx/Vitis/2020.2/tps/lnx64/cmake-3.3.2/bin:/opt/Xilinx/Vitis/2020.2/aietools/bin:/opt/Xilinx/Vivado/2020.2/bin:/opt/Xilinx/DocNav:/opt/petalinux/tools/xsct/petalinux/bin:/opt/petalinux/tools/common/petalinux/bin:/opt/petalinux/tools/xsct/gnu/microblaze/lin/bin:/opt/petalinux/tools/xsct/gnu/armr5/lin/gcc-arm-none-eabi/bin:/opt/petalinux/tools/xsct/gnu/aarch64/lin/aarch64-none/bin:/opt/petalinux/tools/xsct/gnu/aarch32/lin/gcc-arm-none-eabi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/xlnx/host:/home/xlnx/host:/opt/qemu/bin:/opt/crosstool-ng/bin
+ export CCACHE_DIR=/ccache
+ CCACHE_DIR=/ccache
+ export CCACHE_MAXSIZE=15G
+ CCACHE_MAXSIZE=15G
+ export CCACHE_SLOPPINESS=file_macro,time_macros
+ CCACHE_SLOPPINESS=file_macro,time_macros
+ export CC=/usr/lib/ccache/gcc
+ CC=/usr/lib/ccache/gcc
+ export CXX=/usr/lib/ccache/g++
+ CXX=/usr/lib/ccache/g++
+ hostresolvfile=/etc/resolv.conf
+ targetresolvfile=/home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf
+ [[ -L /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf ]]
+ sudo mv /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf.link
+ sudo cp -L /etc/resolv.conf /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf
+ for p in $@
+ '[' -n /home/xlnx/host/PYNQ/boards/ZCU102/packages -a -e /home/xlnx/host/PYNQ/boards/ZCU102/packages/ethernet ']'
+ f=/home/xlnx/host/PYNQ/sdbuild/packages/ethernet
+ '[' -e /home/xlnx/host/PYNQ/sdbuild/packages/ethernet/pre.sh ']'
+ /home/xlnx/host/PYNQ/sdbuild/packages/ethernet/pre.sh /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102
+ set -e
+ target=/home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102
+++ dirname /home/xlnx/host/PYNQ/sdbuild/packages/ethernet/pre.sh
++ cd /home/xlnx/host/PYNQ/sdbuild/packages/ethernet
++ pwd
+ script_dir=/home/xlnx/host/PYNQ/sdbuild/packages/ethernet
+ sudo cp /home/xlnx/host/PYNQ/sdbuild/packages/ethernet/eth0 /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/network/interfaces.d
+ '[' -e /home/xlnx/host/PYNQ/sdbuild/packages/ethernet/qemu.sh ']'
+ '[' -e /home/xlnx/host/PYNQ/sdbuild/packages/ethernet/post.sh ']'
+ [[ ! -L /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf ]]
+ sudo rm /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf
+ sudo mv /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf.link /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/etc/resolv.conf
+ unmount_special
+ for fs in $fss
+ sudo umount -l /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/proc
+ for fs in $fss
+ sudo umount -l /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/run
+ for fs in $fss
+ sudo umount -l /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/dev
+ sudo umount -l /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/ccache
+ rmdir /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/ccache
mkdir -p /home/xlnx/host/PYNQ/sdbuild/build/ZCU102/modules
cd /home/xlnx/host/PYNQ/sdbuild/build/ZCU102/modules && tar -xf /home/xlnx/host/PYNQ/sdbuild/build/ZCU102/petalinux_project/build/tmp/deploy/images/modules-plnx_aarch64.tgz
sudo cp -r --no-preserve=ownership /home/xlnx/host/PYNQ/sdbuild/build/ZCU102/modules/* /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102
rm -rf /home/xlnx/host/PYNQ/sdbuild/build/ZCU102/modules
sudo mount -o bind /dev /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102/dev
rpm2cpio /home/xlnx/host/PYNQ/sdbuild/build/ZCU102/petalinux_project/build/tmp/deploy/rpm/kernel-devsrc-1.0-r0.plnx_aarch64.rpm | sudo chroot /home/xlnx/host/PYNQ/sdbuild/build/focal.ZCU102 cpio -id
chroot: failed to run command 'cpio': Exec format error
Makefile:343: recipe for target '/home/xlnx/host/PYNQ/sdbuild/build/ZCU102.tar.gz' failed
make: *** [/home/xlnx/host/PYNQ/sdbuild/build/ZCU102.tar.gz] Error 126
make: Leaving directory '/home/xlnx/host/PYNQ/sdbuild'

ZCU102.spec

ARCH_ZCU102 := aarch64
BSP_ZCU102 := xilinx-zcu102-v2020.2-final.bsp
BITSTREAM_ZCU102 := 
FPGA_MANAGER_ZCU102 := 1
STAGE4_PACKAGES_ZCU102 := ethernet

Do you have any suggested solutions? Thank you.

1 Like