Compiling on Host Using chroot
Steps to Create chroot/QEMU Environment on a Linux PC
Warning
Tested on Ubuntu 20.04, 22.04, and 24.04.
Ubuntu 18.04 is not supported due to its outdated QEMU version.
Download the Archived Tarball¶
Visit the Kneron Developer Center and navigate to the KNEO Pi section. Download the archived tarball kneo_pi_chroot_{version}.tar.gz
from the chroot environment folder for setting up the chroot environment.
Set Up a chroot environment¶
-
Install required packages
-
Prepare the chroot directory
-
Move the KNEO Pi Arch Linux ARM tarball to chroot directory and extract
-
Configure pacman cache and permissions
Create and set permissions for the package cache
sudo mkdir -p ./chroot/var/cache/pacman/pkg sudo chmod 755 ./chroot/var/cache/pacman/pkg sudo chown root:root ./chroot/var/cache/pacman/pkg
Bind-mount the system pacman cache to avoid redundant downloads
-
Copy the QEMU static binary into the chroot environment
-
Enter the chroot environment
chroot into the prepared environment
Finally, chroot environment has been created
Build Binaries in chroot Environment¶
In this guide, we use KNEO Pi examples as a demonstration of the build process.
Building the NNM examples
[root@host_pc_name /]# git clone https://github.com/kneron/kneopi-examples.git
[root@host_pc_name /]# cd kneopi-examples/ai_application/nnm
[root@host_pc_name nnm]# sh build_all.sh
Copy the built binaries to your KNEO Pi
Trouble Shooting on SCP Problem
If you encounter the following problem:
Bad owner or permissions on /etc/ssh/ssh_config.d/20-systemd-ssh-proxy.conf
/usr/sbin/scp: Connection closed
Please run:
Exiting the chroot Environment¶
To exit the chroot environment, simply type:
If you need to remove the chroot setup, make sure to unmount any bound directories: