From 99b03d9291841e00db3369a827d576015cc83afc Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 15 Oct 2022 12:55:44 +0200 Subject: Add ability to provide custom firmware to bootstrap script --- bootstrap | 32 +++++++++++++++++++++++++++++--- 1 file 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 -- cgit v1.1