# Forced architecture LXC-CT builder Scripts support ARM builds only. This only works if the binary of the target system can run on the host one, if that is not the case it will fail trying to build it. For example you are able to build an armHF contaiter on a arm64(Aarch64) system, or an build i368(x86) container on a amd64(x86_64) system. ## Usage Use `buildDistroBuilder.sh` to build distrobuilder with the required patch Use `buildCT.sh -i` to iteratively build a LXC-Container template Use `buildCT.sh -a -d -v ` to iteratively build a LXC-Container template **Available Distros** * Debian11 (Debian 11) * Debian12 (Debian 12) * Alpine318 (Alpine 3.18) * RasPiOS11 (Raspbian/Raspberry Pi OS 11) **Available Variants** * minimal (Bare minimal for CT to run) * default (Adds nano and ssh server) **Available Architecture** * armhf (All distros) * aarch64 (Alpine) * armv7 (Alpine) * arm64 (Debian) * armel (Debian) ## Install software dependencies dependencies avalible in apt ``` apt install ca-certificates git make debootstrap curl gcc libc-dev nano gnupg2 rsync xz-utils --no-install-recommends -y ``` Golang in the apt repo is not new enough install it directly from release binary ``` rm -rf /usr/local/go curl -L https://go.dev/dl/go$(curl -Ls https://go.dev/VERSION?m=text |sed 's/go//g').linux-.tar.gz -o /tmp/go.tar.gz tar -C /usr/local -xzf /tmp/go.tar.gz echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile export PATH=$PATH:/usr/local/go/bin ``` ## How it works It applies a patch to [distrobuilder](https://github.com/lxc/distrobuilder) before building it, this patch disables the default architecture mapping behavior, and allows an architecture to be forced using the `image.architecture_mapped=` parameter. the default behavior will check the architecture of the host system and map it to the target CT distro (for example if building a Debian container on a Aarch64 system it will map it to arm64) Tesed on [distrobuilder](https://github.com/lxc/distrobuilder) commit `29e94ac90dc52ae4e5fc0c6ad34951d4369aa001`