aboutsummaryrefslogtreecommitdiff
path: root/bootstrap
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-10-15 12:55:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-10-15 12:55:44 +0200
commit99b03d9291841e00db3369a827d576015cc83afc (patch)
treed87a840b0fcbcf6c117099f4c1bc7dcac27fb33d /bootstrap
parentc7e026ad3e5f53fe181a0a8fdfa1d1a81ec086f1 (diff)
Add ability to provide custom firmware to bootstrap script
Diffstat (limited to 'bootstrap')
-rwxr-xr-xbootstrap32
1 files changed, 29 insertions, 3 deletions
diff --git a/bootstrap b/bootstrap
index 1d3421d..95c988e 100755
--- a/bootstrap
+++ b/bootstrap
@@ -35,6 +35,9 @@
# Pre-configured Linux kernel source .tar.* archive. If unspecified, Debian
# source/configuration will be used.
#
+# --firmware
+# Firmware .tar.* archive to be unpackged into /lib/firmware/.
+#
usage="usage: $0"
owd="$(pwd)"
@@ -110,14 +113,14 @@ case "$arch" in
;;
esac
-extra_pkgs=""
+extra_pkgs="ethtool"
case "$arch" in
x86_64)
#extra_pkgs+=""
;;
aarch64)
- extra_pkgs+="ipxe-qemu"
+ extra_pkgs+=",ipxe-qemu"
;;
esac
@@ -127,6 +130,7 @@ stage=1
stage_max=6
arch_variant=
kernel_source=
+firmware=
while [ "$#" -gt 0 ]; do
case "$1" in
@@ -145,6 +149,11 @@ while [ "$#" -gt 0 ]; do
kernel_source="$1"
shift
;;
+ --firmware)
+ shift
+ firmware="$1"
+ shift
+ ;;
-*)
error "unknown option: $1"
;;
@@ -448,7 +457,7 @@ EOF
# Copy custom kernel source.
#
if [ -n "$kernel_source" ]; then
- sudo install -m 644 "$kernel_source" "$root-3-kernel/usr/src/"
+ sudo cp "$kernel_source" "$root-3-kernel/usr/src/"
fi
# Copy patches.
@@ -641,6 +650,12 @@ fi
#
if [ "$stage" -le "4" ]; then
+ # Copy custom firmware.
+ #
+ if [ -n "$firmware" ]; then
+ sudo cp "$firmware" "$root/usr/src/"
+ fi
+
# Write the setup script that will finish the setup (the service is already
# there from stage 3).
#
@@ -657,6 +672,17 @@ for p in \$(sed -e 's/,/ /g' <<<"$extra_pkgs"); do
apt-get install -y --no-install-recommends "\$p"
done
+# Install custom firmware.
+#
+if [ -n "$firmware" ]; then
+ firmware=\$(basename $firmware)
+ tar -C /lib/firmware -xf /usr/src/\$firmware
+fi
+
+# Final /usr/src cleanup.
+#
+rm -rf /usr/src/*
+
# We want the utility (smartctl) but not the daemon.
#
systemctl disable smartd