summaryrefslogtreecommitdiff
path: root/setup-disk.in
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-02 16:45:30 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-02 16:45:30 +0200
commitd0aec8d10a352c281a75576f3f648d9a70d0eed6 (patch)
tree518cbe7594b0e87e0a9a11bd2e7998a9bfc3bfe1 /setup-disk.in
parent427a14cb8d80675dd8944701e9e3c5b5220a06fa (diff)
downloadalpine-conf-d0aec8d10a352c281a75576f3f648d9a70d0eed6.zip
setup-disk: only install firmware that is used
Diffstat (limited to 'setup-disk.in')
-rw-r--r--setup-disk.in12
1 files changed, 11 insertions, 1 deletions
diff --git a/setup-disk.in b/setup-disk.in
index 21d5288..9008237 100644
--- a/setup-disk.in
+++ b/setup-disk.in
@@ -469,6 +469,16 @@ setup_raspberrypi_bootloader() {
echo "root=$root modules=$modules $kernel_opts" > "$mnt"/boot/cmdline.txt
}
+# detect which firmware packages to install, if any
+select_firmware_pkgs() {
+ local firmware_pkgs=$( (cd /sys/module/ && echo *) \
+ | xargs modinfo -F firmware 2>/dev/null \
+ | awk -F/ '{print $1 == $0 ? "linux-firmware-other" : "linux-firmware-"$1}' \
+ | sort -u)
+ echo ${firmware_pkgs:-linux-firmware-none}
+ echo DEBUG:${firmware_pkgs:-linux-firmware-none} >&2
+}
+
install_mounted_root() {
local mnt="$1"
shift 1
@@ -633,7 +643,7 @@ install_mounted_root() {
local pkgs=$(grep -h -v -w sfdisk "$mnt"/etc/apk/world \
"$mnt"/var/lib/apk/world 2>/dev/null)
- pkgs="$pkgs acct linux-$KERNEL_FLAVOR alpine-base $(select_bootloader_pkg)"
+ pkgs="$pkgs acct linux-$KERNEL_FLAVOR alpine-base $(select_bootloader_pkg) $(select_firmware_pkgs)"
if [ "$(rc --sys)" = "XEN0" ]; then
pkgs="$pkgs xen-hypervisor"
fi