This guide is designed for future AI coding assistants and LLMs working on the CrocNetDistro repository. It outlines the project's architecture, workflows, and key conventions.
CrocNetDistro is a lightweight builder system that generates customized root filesystems (rootfs) for various Linux distributions (Debian/Ubuntu) targeting ARM64 and RISC-V architectures.
It uses Docker, QEMU user-static translation, and debootstrap to build target filesystem images in a containerized environment, which are then packaged as .tar.gz archives.
The project has a modular design where each subdirectory represents a supported distribution.
CrocNetDistro/
βββ Dockerfile # Multi-stage Dockerfile matching host build tools & cross-compilation packages
βββ run.sh # Interactive CLI entrypoint (scans and builds)
βββ makeTar.sh # Packaging script for build outputs
βββ debian-sid/ # Configuration for Debian Unstable (Sid)
βββ debian-trixie/ # Configuration for Debian 13 (Trixie)
βββ ubuntu-resolute/ # Configuration for Ubuntu 26.04 LTS (Resolute Raccoon)
Every distribution directory must contain the following files:
ENV: Environment variables definition (e.g.DISTRO,DISTRO_URL, defaultDISTRO_HOSTNAME,ROOTPW).bootstrap.sh: The post-install customization script that runs inside thechrootjail of the target filesystem (sets hostname, repository sources, installs baseline packages, setups SSH and root passwords).build.sh: The script that orchestratesdebootstrapstage 1 & 2, mounts/proc, initiatesbootstrap.sh, and copies static configurations.kernel.conf: Tailored Linux kernel options required/desired for the distribution.etc/: Custom files copied directly into the target filesystem's/etcdirectory.etc/fstab: Filesystem mounts.etc/resolv.conf: Nameservers configuration.etc/network/interfaces: Network interface defaults.
- Dynamic Discovery:
run.shscans the workspace usingfindto detect directories containing anENVfile:find . -maxdepth 2 -type f -name "ENV" -exec dirname {} \;
- User Input: It presents a text-based menu using
whiptailto select the target distribution directory and the CPU architecture (ARM64orRISC-V). - Docker Build: It triggers a multi-stage Docker build targeting
distro-arm64ordistro-riscv64, passing the target distribution directory and target rootfs name as build arguments. - Chroot Build Execution: The container runs with
--privilegedand-v ./rootfs:/rootfsto executebuild.shwhich populates the host's./rootfsdirectory. - Packaging: Finally,
run.shinvokesmakeTar.shwhich generates adistro-arch-date.tar.gzarchive in the project root.
If requested to add a new distribution (e.g., ubuntu-generic):
- Create Directory: Create a folder named
ubuntu-generic/. - Add Configuration Files: Implement the structure defined in Distribution Directory Layout.
- Update
ENV: Set the correct distribution codename (e.g.export DISTRO=generic) and source repositories URL. - Set Script Permissions: Ensure
bootstrap.shandbuild.share executable (chmod +x). - No Script Updates Needed: You do not need to modify
run.shorDockerfilefor new distributions, as they dynamically search forENVfiles.
- Run Build Command:
./run.sh - Clean Artifacts:
git clean -fdx(be careful, as this removes all built.tar.gzpackages since they are gitignored).