Bsp build for rock Pi S fails

trying to setup my build my own image.

P: Running debootstrap second stage under QEMU
chroot: failed to run command ‘/usr/bin/env’: Exec format error

Pretty much followed the ‘docker based’ instructions from here:
https://github.com/radxa/rockchip-bsp
and replaced ‘rockpi4b’ with ‘rockpis’
(see instruction rockpis here: https://wiki.radxa.com/RockpiS/dev/Debian)

after running the docker, I am able to build successfully u-boot and the kernel for the rk3308.
./build/mk-uboot.sh rockpis
./build/mk-kernel.sh rockpis

Building the image gets me an error:

export ARCH=arm64
cd rootfs
sudo apt-get install binfmt-support qemu-user-static cpio gdisk
sudo dpkg -i ubuntu-build-service/packages/*
sudo apt-get install -f

RELEASE=stretch TARGET=base ARCH=$ARCH ./mk-base-debian.sh

I: Extracting libsmartcols1…
I: Extracting libuuid1…
I: Extracting mount…
I: Extracting util-linux…
I: Extracting liblzma5…
I: Extracting zlib1g…
P: Running debootstrap second stage under QEMU
chroot: failed to run command ‘/usr/bin/env’: Exec format error
P: Begin unmounting filesystems…
P: Saving caches…
if [ -f binary-tar.tar.gz ]; then
tar -jcf linaro-stretch-alip-date +%Y%m%d-1.config.tar.bz2 auto/ config/ configure;
sudo mv binary.contents linaro-stretch-alip-date +%Y%m%d-1.contents;
sudo mv chroot.packages.live linaro-stretch-alip-date +%Y%m%d-1.packages;
sudo mv binary-tar.tar.gz linaro-stretch-alip-date +%Y%m%d-1.tar.gz;
md5sum linaro-stretch-alip-date +%Y%m%d-1.build-log.txt linaro-stretch-alip-date +%Y%m%d-1.config.tar.bz2 linaro-stretch-alip-date +%Y%m%d-1.contents linaro-stretch-alip-date +%Y%m%d-1.packages linaro-stretch-alip-date +%Y%m%d-1.tar.gz > linaro-stretch-alip-date +%Y%m%d-1.md5sums.txt;
sha1sum linaro-stretch-alip-date +%Y%m%d-1.build-log.txt linaro-stretch-alip-date +%Y%m%d-1.config.tar.bz2 linaro-stretch-alip-date +%Y%m%d-1.contents linaro-stretch-alip-date +%Y%m%d-1.packages linaro-stretch-alip-date +%Y%m%d-1.tar.gz > linaro-stretch-alip-date +%Y%m%d-1.sha1sums.txt;
fi
Failed to run livebuild, please check your network connection.
-------eoq----------------------

Does any body know a fix for this?
The error msg is not telling me much?
any package missing that needs to be installed?

PS: I tried building a rockpi4 image and the same error happens. so it does not seem to be rockpis specific.

In the mean time you can try different approach: https://github.com/armbian/build
Legacy kernel sources are the same, while there is also mainline based (not fully complete) support:
https://docs.armbian.com/Developer-Guide_Build-Preparation/

thanks igorp,
I will look into that. Does armbian allow you to build minimal images?

I tried to build everything on a fedora 31 system, when I hit the issue with

chroot: failed to run command ‘/usr/bin/env’: Exec format error

I think the build script inside the docker instance tries to execute something that is missing on my fedora machine. does someone has some insides how to debug it so I can find the culprit.

Anyhow, I installed virtualbox running Ubuntu16.04, then followed pretty much the build README step by step. and now everything builds with problem. Finally I have a new system.img. and it works too. Boots the rock PIS board just fine.

c

1 Like

Huh. In theory it should work. Did you come further than:

Great. Now also works on Ubuntu 20.04 … is there 16.04 still in the docs somewhere?

PS: i just used 16.04 because I already had that setup with virtualbox.

FYI: docker itself just run fine on fedora (was installed using dnf/rpm). I was able to build the uboot and kernel without problem. It is only build-rootfs that runs into some debootstrap issues.

missing executable I assume? just don’t know what exactly. Looking at the error msg it could 32/64 bit issue?

Not sure if this error is proper but for building images and writing image directly to SD card you need to enable privileged mode.

Host system must be 64bit for sure.