Skip to content

Instantly share code, notes, and snippets.

@neildavis
Last active April 24, 2023 17:06
Show Gist options
  • Select an option

  • Save neildavis/10c5ab23c10e43a3b17de2b407530002 to your computer and use it in GitHub Desktop.

Select an option

Save neildavis/10c5ab23c10e43a3b17de2b407530002 to your computer and use it in GitHub Desktop.
Building Raspberry Pi OS schroots
# Install sbuild tools
DEBIAN_FRONTEND=noninteractive apt update && apt install -y sbuild debhelper ubuntu-dev-tools piuparts binfmt-support qemu-user-static
# Setup config files for sbuild
cat << EOF | tee -a ~/.mk_sbuild.rc
SCHROOT_CONF_SUFFIX="source-root-users=root,sbuild,admin
source-root-groups=root,sbuild,admin
preserve-environment=true"
# you will want to undo the below for stable releases, read `man mk-sbuild` for details
# during the development cycle, these pockets are not used, but will contain important
# updates after each release of Ubuntu
SKIP_UPDATES="1"
SKIP_PROPOSED="1"
SKIP_SECURITY="1"
# if you have e.g. apt-cacher-ng around
# DEBOOTSTRAP_PROXY=http://127.0.0.1:3142/
EOF
cat << EOF | tee -a ~/.sbuildrc
# Name to use as override in .changes files for the Maintainer: field
# (mandatory, no default!).
$maintainer_name='Joe Bloggs <[email protected]>';
#$mailto='[email protected]';
# Default distribution to build.
#$distribution = "bionic";
# Build arch-all by default.
#$build_arch_all = 1;
# When to purge the build directory afterwards; possible values are "never",
# "successful", and "always". "always" is the default. It can be helpful
# to preserve failing builds for debugging purposes. Switch these comments
# if you want to preserve even successful builds, and then use
# "schroot -e --all-sessions" to clean them up manually.
EOF
# Build 32-bit schroot (based on Raspbian)
#wget -qO- http://raspbian.raspberrypi.org/raspbian.public.key | gpg --import -
wget -qO- https://archive.raspbian.org/raspbian.public.key | gpg --import -
mk-sbuild --arch=armhf bullseye --debootstrap-mirror=http://raspbian.raspberrypi.org/raspbian --name=bullseye --debootstrap-keyring "$HOME/.gnupg/pubring.kbx --merged-usr" --skip-proposed --skip-updates --skip-security
# Build 64-bit schroot (based on Debian arm64)
wget -qO- https://ftp-master.debian.org/keys/archive-key-11.asc | gpg --import -
mk-sbuild --arch=arm64 bullseye --debootstrap-mirror=http://deb.debian.org/debian --name=bullseye --debootstrap-keyring "$HOME/.gnupg/pubring.kbx --merged-usr" --skip-proposed --skip-updates --skip-security
# Install build dep's into schroot:
sudo sbuild-apt bullseye-armhf apt-get install liballegro5-dev liballegro-acodec5-dev liballegro-audio5-dev liballegro-image5-dev liballegro-ttf5-dev
sudo sbuild-apt bullseye-arm64 apt-get install liballegro5-dev liballegro-acodec5-dev liballegro-audio5-dev liballegro-image5-dev liballegro-ttf5-dev
# Destroy chroots (follow instruction from output of these commands - it does NOTHING on its own!)
sbuild-destroychroot bullseye-armhf
sbuild-destroychroot bullseye-arm64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment