forked from hetzneronline/installimage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kernel_module_config.functions.sh
94 lines (83 loc) · 2.36 KB
/
kernel_module_config.functions.sh
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
#!/usr/bin/env bash
#
# kernel module config functions
#
# (c) 2023, Hetzner Online GmbH
#
unwanted_kernel_modules() {
echo pcspkr
debian_based_image && echo snd_pcsp
}
board_requires_drm_blacklisting() {
has_fujitsu_board &&
{
[[ "$(board_name)" == D3417-B1 ]] ||
[[ "$(board_name)" == D3417-B2 ]] ||
[[ "$(board_name)" == D3401-H1 ]] ||
[[ "$(board_name)" == D3401-H2 ]]
} &&
return
[[ "$IAM" == ubuntu ]] &&
((IMG_VERSION >= 2204)) &&
! hwe_image &&
[[ "$(board_vendor)" == 'ASUSTeK COMPUTER INC.' ]] &&
[[ "$(board_name)" == 'PRIME B760M-A D4' ]] &&
return 0
[[ "$IAM" == ubuntu ]] &&
((IMG_VERSION == 2004)) &&
hwe_image &&
[[ "$(board_vendor)" == 'ASUSTeK COMPUTER INC.' ]] &&
[[ "$(board_name)" == 'PRIME B760M-A D4' ]] &&
return 0
{
{ [[ "$IAM" == debian ]] && ((IMG_VERSION < 1300)) } ||
{ [[ "$IAM" == ubuntu ]] && ((IMG_VERSION < 2204)) }
} &&
[[ "$(board_vendor)" == 'Gigabyte Technology Co., Ltd.' ]] &&
has_b360hd3p_board &&
return 0
return 1
}
buggy_kernel_modules() {
if board_requires_drm_blacklisting; then
echo i915
[[ "$IAM" == ubuntu ]] && echo i915_bdw
printf '%s\n' amdgpu drm nouveau radeon
fi
if [[ "$IAM" == archlinux ]] || debian_based_image; then
printf '%s\n' mei mei-me
fi
echo sm750fb
}
blacklist_unwanted_and_buggy_kernel_modules() {
local blacklist_conf="$FOLD/hdd/etc/modprobe.d/blacklist-$C_SHORT.conf"
# skip if virtual machine
is_virtual_machine && return
debug '# blacklisting unwanted and buggy kernel modules'
{
echo "### $COMPANY - installimage"
echo "### unwanted kernel modules"
while read m; do
echo "blacklist $m"
done < <(unwanted_kernel_modules)
echo "### buggy kernel modules"
while read m; do
echo "blacklist $m"
done < <(buggy_kernel_modules)
} > "$blacklist_conf"
diff -Naur /dev/null "$blacklist_conf" | debugoutput
}
configure_kernel_modules() {
local conf="$FOLD/hdd/etc/modprobe.d/$C_SHORT.conf"
# skip if drm is blacklisted
board_requires_drm_blacklisting && return
# skip if virtual machine
is_virtual_machine && return
debug '# configuring kernel modules'
{
echo "### $COMPANY - installimage"
echo 'options drm edid_firmware=edid/1280x1024.bin'
} > "$conf"
diff -Naur /dev/null "$conf" | debugoutput
}
# vim: ai:ts=2:sw=2:et