aboutsummaryrefslogtreecommitdiffstats
path: root/main/alpine-conf/0001-update-kernel-add-modloopfw-option.patch
blob: b1cb8498875320a5ebbcf0e1eba47eab7ad77d3b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
From cf789724141b2a16387328ff336fe9b4aee93485 Mon Sep 17 00:00:00 2001
From: Carlo Landmeter <clandmeter@alpinelinux.org>
Date: Fri, 1 Feb 2019 16:31:14 +0000
Subject: [PATCH] update-kernel: add modloopfw option

modloopfw will add additional firmware to the modloop image
to work around not beeing detected by modinfo.
---
 update-kernel.in | 44 +++++++++++++++++++++++++++++++-------------
 1 file changed, 31 insertions(+), 13 deletions(-)

diff --git a/update-kernel.in b/update-kernel.in
index ef38793..94458e1 100644
--- a/update-kernel.in
+++ b/update-kernel.in
@@ -8,6 +8,8 @@
 # Copyright (c) 2014 Timo Teräs
 # Copyright (c) 2014-2015 Kaarle Ritvanen
 
+PREFIX=
+. $PREFIX/lib/libalpine.sh
 
 SCRIPT=update-kernel
 VIRTUAL=.tmp-$SCRIPT
@@ -29,6 +31,7 @@ REPOSITORIES_FILE=/etc/apk/repositories
 SIGNALS="HUP INT TERM"
 TMPDIR=
 features=
+modloopfw=
 
 error() {
 	echo "$SCRIPT: $1" >&2
@@ -44,25 +47,26 @@ usage() {
 		        $SCRIPT -f <flavor> $opts $dest_args
 		        $SCRIPT -b <build_dir> $opts [$dest_args]
 
-		Options: -a|--arch <arch>        Install kernel for specified architecture
-		         -b|--build <build_dir>  Install custom-built kernel
-		         -f|--flavor <flavor>    Install kernel of specified flavor
-		         -F|--feature <feature>  Enable initfs feature
-		         -p|--package <package>  Additional module or firmware package
-		         -s|--modloopsign        Sign modloop with abuild key
-		         -v|--verbose            Verbose output
-		         -k|--apk-pubkey <key>   Include given key in initramfs
-		         -K|--hostkeys           Include host keys in initramfs
-		         -C|--compression        Initramfs compression (see mkinitfs for options)
-		         -M|--media              Boot media directory layout
-		         --repositories-file <f> apk repositories file
+		Options: -a|--arch <arch>          Install kernel for specified architecture
+		         -b|--build <build_dir>    Install custom-built kernel
+		         -e|--modloopfw <firmware> Install extra firmware in modloop
+		         -f|--flavor <flavor>      Install kernel of specified flavor
+		         -F|--feature <feature>    Enable initfs feature
+		         -p|--package <package>    Additional module or firmware package
+		         -s|--modloopsign          Sign modloop with abuild key
+		         -v|--verbose              Verbose output
+		         -k|--apk-pubkey <key>     Include given key in initramfs
+		         -K|--hostkeys             Include host keys in initramfs
+		         -C|--compression          Initramfs compression (see mkinitfs for options)
+		         -M|--media                Boot media directory layout
+		         --repositories-file <f>   apk repositories file
 
 	__EOF__
 	exit $1
 }
 
 QUIET_OPT="--quiet"
-OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,help,package:,modloopsign,verbose,apk-pubkey:,hostkeys,compression:,media,repositories-file: \
+OPTS=$(getopt -l arch:,build-dir:,flavor:,feature:,modloopfw:,help,package:,modloopsign,verbose,apk-pubkey:,hostkeys,compression:,media,repositories-file: \
 	-n $SCRIPT -o a:b:f:F:hp:svk:KC:M -- "$@") || usage 1
 
 eval set -- "$OPTS"
@@ -84,6 +88,10 @@ while :; do
 		shift
 		features="$features $1"
 		;;
+	-e|--modloopfw)
+		shift
+		modloopfw="$modloopfw $1"
+		;;
 	-h|--help)
 		echo "$SCRIPT @VERSION@" >&2
 		usage 0
@@ -277,6 +285,16 @@ find $ROOT/lib/modules -type f -name "*.ko" | xargs modinfo -F firmware | sort -
 	fi
 done
 
+# install extra firmware files in modloop (i.e. not detected by modinfo)
+for _xfw in "$modloopfw"; do
+	if [ -f "$ROOT/lib/firmware/$_xfw" ]; then
+		install -pD "$ROOT/lib/firmware/$_xfw" \
+			"$MODLOOP"/modules/firmware/"$_xfw"
+	else
+		echo "Warning: extra firmware \"$_xfw\" not found!"
+	fi
+done
+
 # include bluetooth firmware in modloop
 if [ -d "$MODLOOP/modules/firmware/brcm" ]; then
 	for _btfw in "$ROOT"/lib/firmware/brcm/*.hcd; do
-- 
2.20.1