Debian image builder for boards based on the Rockchip RK3308 SoC (arm64):
The build produces a bootable .img.xz disk image containing:
- U-Boot for RK3308
- Custom Linux 6.6 kernel with Rockchip patches
- Linux kernel headers with native arm64 host scripts (for on-device module compilation)
- Debian base system (trixie) with pre-installed packages
- Linux x86_64
- Must run as root (
sudo) debootstrap,qemu-user-static,binfmt-support,parted,xz-utils— installed automatically on first rungcc-aarch64-linux-gnu,libc6:arm64— required for kernel build with native arm64 headers
Ready-to-flash images are available at:
https://download.napilinux.ru/linuximg/napic/debian/
git clone <url>
cd napi-debian-build
sudo ./mkimg.shThe finished image will be placed in artifacts-trixie/.
sudo ./mkimg.sh [options]| Option | Description |
|---|---|
--build-kernel |
Build kernel from source before creating the image |
--branch=rk-6.6 |
Kernel branch (looks for .deb files in kernel-<branch>/) |
--skip-uboot |
Skip U-Boot flashing (rootfs only) |
--skip-xz |
Skip xz compression (faster, larger file) |
IMAGE_SIZE=2048 # Image size in MB (default: 2048)
DISTRIBUTION=trixie # Debian release
HOSTNAME_TARGET=napic # Hostname set inside the image
EXTRA_PKGS=mc,htop # Additional packages
KERNEL_VER=6.6.89 # Kernel version (auto-detected from .deb filename)Example:
sudo IMAGE_SIZE=4096 EXTRA_PKGS=mc,htop ./mkimg.sh --skip-xzconfig.sh — all configuration and helper functions
mkimg.sh — entry point, runs the build pipeline
packages.list — packages to install into the image
napi-archive-keyring.asc — GPG key for deb.napilab.net
kernel-rk-6.6/ — pre-built kernel and headers .deb files
uboot/ — pre-built U-Boot .deb for Napi-C
scripts/
00-build-kernel.sh — build kernel from source (only with --build-kernel)
01-create-image.sh — create .img, partition, format ext4
02-debootstrap.sh — install Debian base system into rootfs
03-install-kernel.sh — install kernel, headers, DTB into rootfs
04-boot-config.sh — generate uEnv.txt, boot.cmd, boot.scr
05-configure.sh — system setup: packages, user, locale, SSH
06-cleanup.sh — unmount and clean up
07-install-uboot.sh — flash U-Boot into image, compress with xz
Two additional APT repositories are configured automatically:
deb.napilab.net — main Napi repository with the kernel and system packages.
repo.napilab.ru — repository with industrial protocol utilities:
| Package | Description |
|---|---|
mbusd |
Modbus RTU → TCP gateway |
mbscan |
Modbus device scanner |
modbus-slave |
Modbus slave emulator |
Edit packages.list — one package per line, comments with #:
# packages.list
mosquitto
mosquitto-clients
i2c-tools
To rebuild the kernel:
sudo ./mkimg.sh --build-kernelThe script will clone the kernel repository into kernel-src/, cross-compile .deb packages using aarch64-linux-gnu-gcc, and place them in kernel-rk-6.6/.
Kernel repository: https://gitlab.nnz-ipc.net/pub/napilinux/kernel.git, branch rk-6.6.
When building with --build-kernel, the build system automatically repackages the linux-headers .deb so that all host utility binaries in scripts/ (such as fixdep, conf, modpost, kallsyms) are compiled for arm64 instead of x86_64. This allows building out-of-tree kernel modules (DKMS, custom drivers) directly on the board without needing a cross-compilation setup.
The repackaging process requires libc6:arm64 and qemu-user-static on the host — these are installed automatically if missing.
To manually repackage an existing headers .deb, use the provided helper script:
sudo bash fix-headers.shAfter installing the image or the headers package, verify that host scripts are native arm64:
file /lib/modules/$(uname -r)/build/scripts/basic/fixdep
# Expected: ELF 64-bit LSB pie executable, ARM aarch64, ...On first boot the image automatically expands the partition to fill the available storage and reboots.
SSH access:
- User:
napi/ password:napilinux - User:
root/ password:napilinux
