aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-01-04 10:25:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-01-04 10:25:32 +0200
commit4f2e96fd345da16d01dd6f4d6d9d0bca0d0aec78 (patch)
tree55b4408c4f04ee77e1fc9a4e08cbcfdae4a5a3a7
parent7b017e42d37bddcfb1cfc05ba62e5b82d57e6148 (diff)
Add ability to build custom/patched packages (untested)
-rwxr-xr-xbootstrap47
1 files changed, 41 insertions, 6 deletions
diff --git a/bootstrap b/bootstrap
index dc00947..a691245 100755
--- a/bootstrap
+++ b/bootstrap
@@ -4,12 +4,14 @@
#
# Assumptions/expectations:
#
-# - host debootstrap/debian-archive-keyring matching release
+# - Host debootstrap/debian-archive-keyring matching release.
#
# - /btrfs/<user> is a btrfs directory where the current user can create
-# snapshots
+# snapshots.
#
-# - sudo is passwordless (used to run debootstrap, systemd-nspawn, etc)
+# - sudo is passwordless (used to run debootstrap, systemd-nspawn, etc).
+#
+# - This script is executed from the buildos/ source directory.
#
# Options:
#
@@ -19,7 +21,7 @@
#
# 1 - bootstrap phase 1
# 2 - bootstrap phase 2
-# 3 - kernel build
+# 3 - kernel build (and package patching, if necessary)
# 4 - setup
# 5 - create footfs
# 6 - create kernel image and initrd
@@ -374,17 +376,47 @@ EOF
subvol_delete "$root-3-kernel"
subvol_snapshot "$root" "$root-3-kernel"
+ # Copy patches.
+ #
+ #sudo cp ./patches/tftp-hpa-partial-upload.patch "$root-3-kernel/bootstrap/"
+
write <<EOF /bootstrap/setup "$root-3-kernel"
#!/bin/bash
trap "exit 1" ERR
set -x
+# Add deb-src to each deb entry in /etc/apt/sources.list.
+#
+sed -ri -e 's/^deb (.+)/deb \1\ndeb-src \1/' /etc/apt/sources.list
+
+apt-get update
+apt-get install -y build-essential devscripts
+
+# Build custom/patched packages.
+#
+cd /usr/src
+
+if false; then
+mkdir tftpd-hpa
+cd tftpd-hpa
+apt-get install -y libwrap0-dev
+apt-get source tftpd-hpa
+cd tftp-hpa-*/
+patch -p1 </bootstrap/tftp-hpa-partial-upload.patch
+dch -n "Apply patches."
+cd ../tftp-hpa-*/ # May get renamed.
+dpkg-buildpackage -us -uc
+cd ../..
+fi
+
+# Build kernel.
+#
# This seems to be the simplest method of building the standard Debian
# kernel with adjusted configuration. Taken from the Debian Kernel Handbook.
#
apt-get update
-apt-get install -y build-essential linux-source
+apt-get install -y linux-source
apt-get install -y bison flex
apt-get install -y libelf-dev
apt-get install -y libssl-dev
@@ -426,8 +458,9 @@ EOF
nspawn "$root-3-kernel" --boot
- # Copy the kernel over and install it.
+ # Copy the kernel and packages over and install them.
#
+ #sudo cp "$root-3-kernel/usr/src/tftpd-hpa/tftpd-hpa_"*.deb "$root/usr/src/"
sudo cp "$root-3-kernel/usr/src/linux-image-"*.deb "$root/usr/src/"
write <<EOF /bootstrap/setup
@@ -436,7 +469,9 @@ EOF
trap "exit 1" ERR
set -x
+#dpkg -i /usr/src/tftpd-hpa_*.deb
dpkg -i /usr/src/linux-image-*.deb
+
rm -rf /usr/src/*
cd /
ln -s boot/vmlinuz-* /vmlinuz