aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-09-12 12:23:08 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-09-12 12:23:08 +0200
commit2f106cc55047a8f77d64c28dde0911343013879b (patch)
tree2daae33a550792b8699742942d31a5c544112d23
parent224f5cc31e75eb072faffc3d313252cdb80cb05d (diff)
Add support for aarch64
-rwxr-xr-xbootstrap39
1 files changed, 32 insertions, 7 deletions
diff --git a/bootstrap b/bootstrap
index c202e4c..2b6230a 100755
--- a/bootstrap
+++ b/bootstrap
@@ -4,6 +4,8 @@
#
# Assumptions/expectations:
#
+# - Bootstrapping for the host CPU (currently x86_64 or aarch64).
+#
# - Host debootstrap/debian-archive-keyring matching release.
#
# - /btrfs/<user> is a btrfs directory where the current user can create
@@ -32,6 +34,20 @@ id="$(id -un)"
btrfs=/btrfs
root="$btrfs/$id/buildos"
+arch="$(uname -m)"
+
+case "$arch" in
+ x86_64)
+ debian_arch=amd64
+ ;;
+ aarch64)
+ debian_arch=arm64
+ ;;
+ *)
+ error "unsupported architecture: $arch"
+ ;;
+esac
+
# Source distribution and packages. Base packages are installed on stage 1 via
# debootstrap. Extra packages are added on stage 4 via apt-get install. The
# idea is to be able to add extra packages without upgrading the base system.
@@ -42,7 +58,7 @@ root="$btrfs/$id/buildos"
# - some packages (such as CPU microcode updates) are in non-free.
# - systemd-container seems to be required by host systemd-nspawn.
# - must explicitly select between dbus and dbus-broker
-# - not installing linux-image-amd64 since building custom below
+# - not installing linux-image-* since building custom below
#
release="testing"
components="main,contrib,non-free"
@@ -52,8 +68,7 @@ mirror="http://http.us.debian.org/debian/"
base_pkgs="locales,klibc-utils,sudo"
base_pkgs+=",udev,dbus,systemd-timesyncd,systemd-container"
base_pkgs+=",kmod,linux-base,firmware-linux-free,irqbalance"
-base_pkgs+=",intel-microcode" #,amd64-microcode
-base_pkgs+=",pciutils,usbutils,dmidecode,cpuid"
+base_pkgs+=",pciutils,usbutils,dmidecode"
base_pkgs+=",hdparm,btrfs-progs"
base_pkgs+=",lm-sensors,smartmontools,linux-cpupower"
@@ -66,10 +81,20 @@ base_pkgs+=",tftp-hpa,tftpd-hpa"
base_pkgs+=",zstd,xz-utils"
base_pkgs+=",less,nano,time"
+base_pkgs+=",g++,make"
-base_pkgs+=",qemu-system-x86,qemu-utils,socat"
+base_pkgs+=",qemu-utils,socat"
-base_pkgs+=",g++,make"
+case "$arch" in
+ x86_64)
+ base_pkgs+=",cpuid"
+ base_pkgs+=",intel-microcode" #,amd64-microcode
+ base_pkgs+=",qemu-system-x86"
+ ;;
+ aarch64)
+ base_pkgs+=",qemu-system-arm"
+ ;;
+esac
extra_pkgs=""
@@ -212,7 +237,7 @@ if [ "$stage" -eq "1" ]; then
sudo debootstrap \
--foreign \
- --arch=amd64 \
+ --arch="$debian_arch" \
--merged-usr \
--variant=minbase \
--components="$components" \
@@ -425,7 +450,7 @@ apt-get install -y dwarves
cd /usr/src
tar xf linux-source-*
mv linux-source-*/ linux
-xzcat linux-config-*/config.amd64_none_amd64.xz >linux/.config
+xzcat linux-config-*/config.${debian_arch}_none_${debian_arch}.xz >linux/.config
cd linux
# Adjust configuration.