##// END OF EJS Templates
fixes
Unknown -
r669:682120bd8eb1
parent child
Show More
@@ -1,887 +1,888
1 #
1 #
2 # Build and Setup RPi2/3 Kernel
2 # Build and Setup RPi2/3 Kernel
3 #
3 #
4
4
5 # Load utility functions
5 # Load utility functions
6 . ./functions.sh
6 . ./functions.sh
7
7
8 # Need to use kali kernel src if nexmon is enabled
8 # Need to use kali kernel src if nexmon is enabled
9 if [ "$ENABLE_NEXMON" = true ] ; then
9 if [ "$ENABLE_NEXMON" = true ] ; then
10 KERNEL_URL="${KALI_KERNEL_URL}"
10 KERNEL_URL="${KALI_KERNEL_URL}"
11 # Clear Branch and KernelSRC_DIR if using nexmon. Everyone will forget to clone kali kernel instead of nomrla kernel
11 # Clear Branch and KernelSRC_DIR if using nexmon. Everyone will forget to clone kali kernel instead of nomrla kernel
12 KERNEL_BRANCH=""
12 KERNEL_BRANCH=""
13 KERNELSRC_DIR=""
13 KERNELSRC_DIR=""
14 fi
14 fi
15
15
16 # Fetch and build latest raspberry kernel
16 # Fetch and build latest raspberry kernel
17 if [ "$BUILD_KERNEL" = true ] ; then
17 if [ "$BUILD_KERNEL" = true ] ; then
18 # Setup source directory
18 # Setup source directory
19 mkdir -p "${KERNEL_DIR}"
19 mkdir -p "${KERNEL_DIR}"
20
20
21 # Copy existing kernel sources into chroot directory
21 # Copy existing kernel sources into chroot directory
22 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
22 if [ -n "$KERNELSRC_DIR" ] && [ -d "$KERNELSRC_DIR" ] ; then
23 # Copy kernel sources and include hidden files
23 # Copy kernel sources and include hidden files
24 cp -r "${KERNELSRC_DIR}/". "${KERNEL_DIR}"
24 cp -r "${KERNELSRC_DIR}/". "${KERNEL_DIR}"
25
25
26 # Clean the kernel sources
26 # Clean the kernel sources
27 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
27 if [ "$KERNELSRC_CLEAN" = true ] && [ "$KERNELSRC_PREBUILT" = false ] ; then
28 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
28 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" mrproper
29 fi
29 fi
30 else # KERNELSRC_DIR=""
30 else # KERNELSRC_DIR=""
31 # Create temporary directory for kernel sources
31 # Create temporary directory for kernel sources
32 temp_dir=$(as_nobody mktemp -d)
32 temp_dir=$(as_nobody mktemp -d)
33
33
34 # Fetch current RPi2/3 kernel sources
34 # Fetch current RPi2/3 kernel sources
35 if [ -z "${KERNEL_BRANCH}" ] ; then
35 if [ -z "${KERNEL_BRANCH}" ] ; then
36 as_nobody -H git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" linux
36 as_nobody -H git -C "${temp_dir}" clone --depth=1 "${KERNEL_URL}" linux
37 else
37 else
38 as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux
38 as_nobody -H git -C "${temp_dir}" clone --depth=1 --branch "${KERNEL_BRANCH}" "${KERNEL_URL}" linux
39 fi
39 fi
40
40
41 # Copy downloaded kernel sources
41 # Copy downloaded kernel sources
42 cp -r "${temp_dir}/linux/"* "${KERNEL_DIR}"
42 cp -r "${temp_dir}/linux/"* "${KERNEL_DIR}"
43
43
44 # Remove temporary directory for kernel sources
44 # Remove temporary directory for kernel sources
45 rm -fr "${temp_dir}"
45 rm -fr "${temp_dir}"
46
46
47 # Set permissions of the kernel sources
47 # Set permissions of the kernel sources
48 chown -R root:root "${R}/usr/src"
48 chown -R root:root "${R}/usr/src"
49 fi
49 fi
50
50
51 # Calculate optimal number of kernel building threads
51 # Calculate optimal number of kernel building threads
52 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
52 if [ "$KERNEL_THREADS" = "1" ] && [ -r /proc/cpuinfo ] ; then
53 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
53 KERNEL_THREADS=$(grep -c processor /proc/cpuinfo)
54 fi
54 fi
55
55
56 if [ "$ENABLE_QEMU" = true ] && [ "$KERNEL_ARCH" = arm64 ]; then
56 if [ "$ENABLE_QEMU" = true ] && [ "$KERNEL_ARCH" = arm64 ]; then
57 cp "${KERNEL_DIR}"/arch/arm/configs/vexpress_defconfig "${KERNEL_DIR}"/arch/arm64/configs/
57 cp "${KERNEL_DIR}"/arch/arm/configs/vexpress_defconfig "${KERNEL_DIR}"/arch/arm64/configs/
58 fi
58 fi
59
59
60 # Configure and build kernel
60 # Configure and build kernel
61 if [ "$KERNELSRC_PREBUILT" = false ] ; then
61 if [ "$KERNELSRC_PREBUILT" = false ] ; then
62 # Remove device, network and filesystem drivers from kernel configuration
62 # Remove device, network and filesystem drivers from kernel configuration
63 if [ "$KERNEL_REDUCE" = true ] ; then
63 if [ "$KERNEL_REDUCE" = true ] ; then
64 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
64 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
65 sed -i\
65 sed -i\
66 -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\
66 -e "s/\(^CONFIG_SND.*\=\).*/\1n/"\
67 -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\
67 -e "s/\(^CONFIG_SOUND.*\=\).*/\1n/"\
68 -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\
68 -e "s/\(^CONFIG_AC97.*\=\).*/\1n/"\
69 -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\
69 -e "s/\(^CONFIG_VIDEO_.*\=\).*/\1n/"\
70 -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\
70 -e "s/\(^CONFIG_MEDIA_TUNER.*\=\).*/\1n/"\
71 -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\
71 -e "s/\(^CONFIG_DVB.*\=\)[ym]/\1n/"\
72 -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\
72 -e "s/\(^CONFIG_REISERFS.*\=\).*/\1n/"\
73 -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\
73 -e "s/\(^CONFIG_JFS.*\=\).*/\1n/"\
74 -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\
74 -e "s/\(^CONFIG_XFS.*\=\).*/\1n/"\
75 -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\
75 -e "s/\(^CONFIG_GFS2.*\=\).*/\1n/"\
76 -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\
76 -e "s/\(^CONFIG_OCFS2.*\=\).*/\1n/"\
77 -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\
77 -e "s/\(^CONFIG_BTRFS.*\=\).*/\1n/"\
78 -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\
78 -e "s/\(^CONFIG_HFS.*\=\).*/\1n/"\
79 -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\
79 -e "s/\(^CONFIG_JFFS2.*\=\)[ym]/\1n/"\
80 -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\
80 -e "s/\(^CONFIG_UBIFS.*\=\).*/\1n/"\
81 -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\
81 -e "s/\(^CONFIG_SQUASHFS.*\=\)[ym]/\1n/"\
82 -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\
82 -e "s/\(^CONFIG_W1.*\=\)[ym]/\1n/"\
83 -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\
83 -e "s/\(^CONFIG_HAMRADIO.*\=\).*/\1n/"\
84 -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\
84 -e "s/\(^CONFIG_CAN.*\=\).*/\1n/"\
85 -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\
85 -e "s/\(^CONFIG_IRDA.*\=\).*/\1n/"\
86 -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\
86 -e "s/\(^CONFIG_BT_.*\=\).*/\1n/"\
87 -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\
87 -e "s/\(^CONFIG_WIMAX.*\=\)[ym]/\1n/"\
88 -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\
88 -e "s/\(^CONFIG_6LOWPAN.*\=\).*/\1n/"\
89 -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\
89 -e "s/\(^CONFIG_IEEE802154.*\=\).*/\1n/"\
90 -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\
90 -e "s/\(^CONFIG_NFC.*\=\).*/\1n/"\
91 -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\
91 -e "s/\(^CONFIG_FB_TFT=.*\=\).*/\1n/"\
92 -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\
92 -e "s/\(^CONFIG_TOUCHSCREEN.*\=\).*/\1n/"\
93 -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\
93 -e "s/\(^CONFIG_USB_GSPCA_.*\=\).*/\1n/"\
94 -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\
94 -e "s/\(^CONFIG_DRM.*\=\).*/\1n/"\
95 "${KERNEL_DIR}/.config"
95 "${KERNEL_DIR}/.config"
96 fi
96 fi
97
97
98 if [ "$KERNELSRC_CONFIG" = true ] ; then
98 if [ "$KERNELSRC_CONFIG" = true ] ; then
99 # Load default raspberry kernel configuration
99 # Load default raspberry kernel configuration
100 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
100 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" "${KERNEL_DEFCONFIG}"
101
101
102 #Switch to KERNELSRC_DIR so we can use set_kernel_config
102 #Switch to KERNELSRC_DIR so we can use set_kernel_config
103 cd "${KERNEL_DIR}" || exit
103 cd "${KERNEL_DIR}" || exit
104
104
105 # Enable RPI POE HAT fan
105 # Enable RPI POE HAT fan
106 if [ "$KERNEL_POEHAT" = true ]; then
106 if [ "$KERNEL_POEHAT" = true ]; then
107 set_kernel_config CONFIG_SENSORS_RPI_POE_FAN m
107 set_kernel_config CONFIG_SENSORS_RPI_POE_FAN m
108 fi
108 fi
109
109
110 # Enable per-interface network priority control
110 # Enable per-interface network priority control
111 # (for systemd-nspawn)
111 # (for systemd-nspawn)
112 if [ "$KERNEL_NSPAN" = true ]; then
112 if [ "$KERNEL_NSPAN" = true ]; then
113 set_kernel_config CONFIG_CGROUP_NET_PRIO y
113 set_kernel_config CONFIG_CGROUP_NET_PRIO y
114 fi
114 fi
115
115
116 # Compile in BTRFS
116 # Compile in BTRFS
117 if [ "$KERNEL_BTRFS" = true ]; then
117 if [ "$KERNEL_BTRFS" = true ]; then
118 set_kernel_config CONFIG_BTRFS_FS y
118 set_kernel_config CONFIG_BTRFS_FS y
119 set_kernel_config CONFIG_BTRFS_FS_POSIX_ACL y
119 set_kernel_config CONFIG_BTRFS_FS_POSIX_ACL y
120 set_kernel_config CONFIG_BTRFS_FS_REF_VERIFY y
120 set_kernel_config CONFIG_BTRFS_FS_REF_VERIFY y
121 fi
121 fi
122
122
123 # Diffie-Hellman operations on retained keys
123 # Diffie-Hellman operations on retained keys
124 # (required for >keyutils-1.6)
124 # (required for >keyutils-1.6)
125 if [ "$KERNEL_DHKEY" = true ]; then
125 if [ "$KERNEL_DHKEY" = true ]; then
126 set_kernel_config CONFIG_KEY_DH_OPERATIONS y
126 set_kernel_config CONFIG_KEY_DH_OPERATIONS y
127 fi
127 fi
128
128
129 if [ "$KERNEL_ARCH" = arm64 ] && [ "$ENABLE_QEMU" = false ]; then
129 if [ "$KERNEL_ARCH" = arm64 ] && [ "$ENABLE_QEMU" = false ]; then
130 # Mask this temporarily during switch to rpi-4.19.y
130 # Mask this temporarily during switch to rpi-4.19.y
131 #Fix SD_DRIVER upstream and downstream mess in 64bit RPIdeb_config
131 #Fix SD_DRIVER upstream and downstream mess in 64bit RPIdeb_config
132 # use correct driver MMC_BCM2835_MMC instead of MMC_BCM2835_SDHOST - see https://www.raspberrypi.org/forums/viewtopic.php?t=210225
132 # use correct driver MMC_BCM2835_MMC instead of MMC_BCM2835_SDHOST - see https://www.raspberrypi.org/forums/viewtopic.php?t=210225
133 #set_kernel_config CONFIG_MMC_BCM2835 n
133 #set_kernel_config CONFIG_MMC_BCM2835 n
134 #set_kernel_config CONFIG_MMC_SDHCI_IPROC n
134 #set_kernel_config CONFIG_MMC_SDHCI_IPROC n
135 #set_kernel_config CONFIG_USB_DWC2 n
135 #set_kernel_config CONFIG_USB_DWC2 n
136 #sed -i "s|depends on MMC_BCM2835_MMC && MMC_BCM2835_DMA|depends on MMC_BCM2835_MMC|" "${KERNEL_DIR}"/drivers/mmc/host/Kconfig
136 #sed -i "s|depends on MMC_BCM2835_MMC && MMC_BCM2835_DMA|depends on MMC_BCM2835_MMC|" "${KERNEL_DIR}"/drivers/mmc/host/Kconfig
137
137
138 #VLAN got disabled without reason in arm64bit
138 #VLAN got disabled without reason in arm64bit
139 set_kernel_config CONFIG_IPVLAN m
139 set_kernel_config CONFIG_IPVLAN m
140 fi
140 fi
141
141
142 # enable ZSWAP see https://askubuntu.com/a/472227 or https://wiki.archlinux.org/index.php/zswap
142 # enable ZSWAP see https://askubuntu.com/a/472227 or https://wiki.archlinux.org/index.php/zswap
143 if [ "$KERNEL_ZSWAP" = true ] ; then
143 if [ "$KERNEL_ZSWAP" = true ] ; then
144 set_kernel_config CONFIG_ZPOOL y
144 set_kernel_config CONFIG_ZPOOL y
145 set_kernel_config CONFIG_ZSWAP y
145 set_kernel_config CONFIG_ZSWAP y
146 set_kernel_config CONFIG_ZBUD y
146 set_kernel_config CONFIG_ZBUD y
147 set_kernel_config CONFIG_Z3FOLD y
147 set_kernel_config CONFIG_Z3FOLD y
148 set_kernel_config CONFIG_ZSMALLOC y
148 set_kernel_config CONFIG_ZSMALLOC y
149 set_kernel_config CONFIG_PGTABLE_MAPPING y
149 set_kernel_config CONFIG_PGTABLE_MAPPING y
150 set_kernel_config CONFIG_LZO_COMPRESS y
150 set_kernel_config CONFIG_LZO_COMPRESS y
151 fi
151 fi
152
152
153 if [ RPI_MODEL = 4 ] ; then
153 if [ "$RPI_MODEL" = 4 ] ; then
154 # Following are set in current 32-bit LPAE kernel
154 # Following are set in current 32-bit LPAE kernel
155 set_kernel_config CONFIG_CGROUP_PIDS y
155 set_kernel_config CONFIG_CGROUP_PIDS y
156 set_kernel_config CONFIG_NET_IPVTI m
156 set_kernel_config CONFIG_NET_IPVTI m
157 set_kernel_config CONFIG_NF_TABLES_SET m
157 set_kernel_config CONFIG_NF_TABLES_SET m
158 set_kernel_config CONFIG_NF_TABLES_INET y
158 set_kernel_config CONFIG_NF_TABLES_INET y
159 set_kernel_config CONFIG_NF_TABLES_NETDEV y
159 set_kernel_config CONFIG_NF_TABLES_NETDEV y
160 set_kernel_config CONFIG_NF_FLOW_TABLE m
160 set_kernel_config CONFIG_NF_FLOW_TABLE m
161 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
161 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
162 set_kernel_config CONFIG_NFT_CONNLIMIT m
162 set_kernel_config CONFIG_NFT_CONNLIMIT m
163 set_kernel_config CONFIG_NFT_TUNNEL m
163 set_kernel_config CONFIG_NFT_TUNNEL m
164 set_kernel_config CONFIG_NFT_OBJREF m
164 set_kernel_config CONFIG_NFT_OBJREF m
165 set_kernel_config CONFIG_NFT_FIB_IPV4 m
165 set_kernel_config CONFIG_NFT_FIB_IPV4 m
166 set_kernel_config CONFIG_NFT_FIB_IPV6 m
166 set_kernel_config CONFIG_NFT_FIB_IPV6 m
167 set_kernel_config CONFIG_NFT_FIB_INET m
167 set_kernel_config CONFIG_NFT_FIB_INET m
168 set_kernel_config CONFIG_NFT_SOCKET m
168 set_kernel_config CONFIG_NFT_SOCKET m
169 set_kernel_config CONFIG_NFT_OSF m
169 set_kernel_config CONFIG_NFT_OSF m
170 set_kernel_config CONFIG_NFT_TPROXY m
170 set_kernel_config CONFIG_NFT_TPROXY m
171 set_kernel_config CONFIG_NF_DUP_NETDEV m
171 set_kernel_config CONFIG_NF_DUP_NETDEV m
172 set_kernel_config CONFIG_NFT_DUP_NETDEV m
172 set_kernel_config CONFIG_NFT_DUP_NETDEV m
173 set_kernel_config CONFIG_NFT_FWD_NETDEV m
173 set_kernel_config CONFIG_NFT_FWD_NETDEV m
174 set_kernel_config CONFIG_NFT_FIB_NETDEV m
174 set_kernel_config CONFIG_NFT_FIB_NETDEV m
175 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
175 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
176 set_kernel_config CONFIG_NF_FLOW_TABLE m
176 set_kernel_config CONFIG_NF_FLOW_TABLE m
177 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
177 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
178 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
178 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
179 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
179 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
180 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
180 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
181 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
181 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
182 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
182 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
183 set_kernel_config CONFIG_NFT_DUP_IPV6 m
183 set_kernel_config CONFIG_NFT_DUP_IPV6 m
184 set_kernel_config CONFIG_NFT_FIB_IPV6 m
184 set_kernel_config CONFIG_NFT_FIB_IPV6 m
185 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 m
185 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 m
186 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
186 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
187 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
187 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
188 set_kernel_config CONFIG_NF_LOG_BRIDGE m
188 set_kernel_config CONFIG_NF_LOG_BRIDGE m
189 set_kernel_config CONFIG_MT76_CORE m
189 set_kernel_config CONFIG_MT76_CORE m
190 set_kernel_config CONFIG_MT76_LEDS m
190 set_kernel_config CONFIG_MT76_LEDS m
191 set_kernel_config CONFIG_MT76_USB m
191 set_kernel_config CONFIG_MT76_USB m
192 set_kernel_config CONFIG_MT76x2_COMMON m
192 set_kernel_config CONFIG_MT76x2_COMMON m
193 set_kernel_config CONFIG_MT76x0U m
193 set_kernel_config CONFIG_MT76x0U m
194 set_kernel_config CONFIG_MT76x2U m
194 set_kernel_config CONFIG_MT76x2U m
195 set_kernel_config CONFIG_TOUCHSCREEN_ILI210X m
195 set_kernel_config CONFIG_TOUCHSCREEN_ILI210X m
196 set_kernel_config CONFIG_BCM_VC_SM m
196 set_kernel_config CONFIG_BCM_VC_SM m
197 set_kernel_config CONFIG_BCM2835_SMI_DEV m
197 set_kernel_config CONFIG_BCM2835_SMI_DEV m
198 set_kernel_config CONFIG_RPIVID_MEM m
198 set_kernel_config CONFIG_RPIVID_MEM m
199 set_kernel_config CONFIG_HW_RANDOM_BCM2835 y
199 set_kernel_config CONFIG_HW_RANDOM_BCM2835 y
200 set_kernel_config CONFIG_TCG_TPM m
200 set_kernel_config CONFIG_TCG_TPM m
201 set_kernel_config CONFIG_HW_RANDOM_TPM y
201 set_kernel_config CONFIG_HW_RANDOM_TPM y
202 set_kernel_config CONFIG_TCG_TIS m
202 set_kernel_config CONFIG_TCG_TIS m
203 set_kernel_config CONFIG_TCG_TIS_SPI m
203 set_kernel_config CONFIG_TCG_TIS_SPI m
204 set_kernel_config CONFIG_I2C_MUX m
204 set_kernel_config CONFIG_I2C_MUX m
205 set_kernel_config CONFIG_I2C_MUX_GPMUX m
205 set_kernel_config CONFIG_I2C_MUX_GPMUX m
206 set_kernel_config CONFIG_I2C_MUX_PCA954x m
206 set_kernel_config CONFIG_I2C_MUX_PCA954x m
207 set_kernel_config CONFIG_SPI_GPIO m
207 set_kernel_config CONFIG_SPI_GPIO m
208 set_kernel_config CONFIG_BATTERY_MAX17040 m
208 set_kernel_config CONFIG_BATTERY_MAX17040 m
209 set_kernel_config CONFIG_SENSORS_GPIO_FAN m
209 set_kernel_config CONFIG_SENSORS_GPIO_FAN m
210 set_kernel_config CONFIG_SENSORS_RASPBERRYPI_HWMON m
210 set_kernel_config CONFIG_SENSORS_RASPBERRYPI_HWMON m
211 set_kernel_config CONFIG_BCM2835_THERMAL y
211 set_kernel_config CONFIG_BCM2835_THERMAL y
212 set_kernel_config CONFIG_RC_CORE y
212 set_kernel_config CONFIG_RC_CORE y
213 set_kernel_config CONFIG_RC_MAP y
213 set_kernel_config CONFIG_RC_MAP y
214 set_kernel_config CONFIG_LIRC y
214 set_kernel_config CONFIG_LIRC y
215 set_kernel_config CONFIG_RC_DECODERS y
215 set_kernel_config CONFIG_RC_DECODERS y
216 set_kernel_config CONFIG_IR_NEC_DECODER m
216 set_kernel_config CONFIG_IR_NEC_DECODER m
217 set_kernel_config CONFIG_IR_RC5_DECODER m
217 set_kernel_config CONFIG_IR_RC5_DECODER m
218 set_kernel_config CONFIG_IR_RC6_DECODER m
218 set_kernel_config CONFIG_IR_RC6_DECODER m
219 set_kernel_config CONFIG_IR_JVC_DECODER m
219 set_kernel_config CONFIG_IR_JVC_DECODER m
220 set_kernel_config CONFIG_IR_SONY_DECODER m
220 set_kernel_config CONFIG_IR_SONY_DECODER m
221 set_kernel_config CONFIG_IR_SANYO_DECODER m
221 set_kernel_config CONFIG_IR_SANYO_DECODER m
222 set_kernel_config CONFIG_IR_SHARP_DECODER m
222 set_kernel_config CONFIG_IR_SHARP_DECODER m
223 set_kernel_config CONFIG_IR_MCE_KBD_DECODER m
223 set_kernel_config CONFIG_IR_MCE_KBD_DECODER m
224 set_kernel_config CONFIG_IR_XMP_DECODER m
224 set_kernel_config CONFIG_IR_XMP_DECODER m
225 set_kernel_config CONFIG_IR_IMON_DECODER m
225 set_kernel_config CONFIG_IR_IMON_DECODER m
226 set_kernel_config CONFIG_RC_DEVICES y
226 set_kernel_config CONFIG_RC_DEVICES y
227 set_kernel_config CONFIG_RC_ATI_REMOTE m
227 set_kernel_config CONFIG_RC_ATI_REMOTE m
228 set_kernel_config CONFIG_IR_IMON m
228 set_kernel_config CONFIG_IR_IMON m
229 set_kernel_config CONFIG_IR_MCEUSB m
229 set_kernel_config CONFIG_IR_MCEUSB m
230 set_kernel_config CONFIG_IR_REDRAT3 m
230 set_kernel_config CONFIG_IR_REDRAT3 m
231 set_kernel_config CONFIG_IR_STREAMZAP m
231 set_kernel_config CONFIG_IR_STREAMZAP m
232 set_kernel_config CONFIG_IR_IGUANA m
232 set_kernel_config CONFIG_IR_IGUANA m
233 set_kernel_config CONFIG_IR_TTUSBIR m
233 set_kernel_config CONFIG_IR_TTUSBIR m
234 set_kernel_config CONFIG_RC_LOOPBACK m
234 set_kernel_config CONFIG_RC_LOOPBACK m
235 set_kernel_config CONFIG_IR_GPIO_CIR m
235 set_kernel_config CONFIG_IR_GPIO_CIR m
236 set_kernel_config CONFIG_IR_GPIO_TX m
236 set_kernel_config CONFIG_IR_GPIO_TX m
237 set_kernel_config CONFIG_IR_PWM_TX m
237 set_kernel_config CONFIG_IR_PWM_TX m
238 set_kernel_config CONFIG_VIDEO_V4L2_SUBDEV_API y
238 set_kernel_config CONFIG_VIDEO_V4L2_SUBDEV_API y
239 set_kernel_config CONFIG_VIDEO_AU0828_RC y
239 set_kernel_config CONFIG_VIDEO_AU0828_RC y
240 set_kernel_config CONFIG_VIDEO_CX231XX m
240 set_kernel_config CONFIG_VIDEO_CX231XX m
241 set_kernel_config CONFIG_VIDEO_CX231XX_RC y
241 set_kernel_config CONFIG_VIDEO_CX231XX_RC y
242 set_kernel_config CONFIG_VIDEO_CX231XX_ALSA m
242 set_kernel_config CONFIG_VIDEO_CX231XX_ALSA m
243 set_kernel_config CONFIG_VIDEO_CX231XX_DVB m
243 set_kernel_config CONFIG_VIDEO_CX231XX_DVB m
244 set_kernel_config CONFIG_VIDEO_TM6000 m
244 set_kernel_config CONFIG_VIDEO_TM6000 m
245 set_kernel_config CONFIG_VIDEO_TM6000_ALSA m
245 set_kernel_config CONFIG_VIDEO_TM6000_ALSA m
246 set_kernel_config CONFIG_VIDEO_TM6000_DVB m
246 set_kernel_config CONFIG_VIDEO_TM6000_DVB m
247 set_kernel_config CONFIG_DVB_USB m
247 set_kernel_config CONFIG_DVB_USB m
248 set_kernel_config CONFIG_DVB_USB_DIB3000MC m
248 set_kernel_config CONFIG_DVB_USB_DIB3000MC m
249 set_kernel_config CONFIG_DVB_USB_A800 m
249 set_kernel_config CONFIG_DVB_USB_A800 m
250 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB m
250 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB m
251 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB_FAULTY y
251 set_kernel_config CONFIG_DVB_USB_DIBUSB_MB_FAULTY y
252 set_kernel_config CONFIG_DVB_USB_DIBUSB_MC m
252 set_kernel_config CONFIG_DVB_USB_DIBUSB_MC m
253 set_kernel_config CONFIG_DVB_USB_DIB0700 m
253 set_kernel_config CONFIG_DVB_USB_DIB0700 m
254 set_kernel_config CONFIG_DVB_USB_UMT_010 m
254 set_kernel_config CONFIG_DVB_USB_UMT_010 m
255 set_kernel_config CONFIG_DVB_USB_CXUSB m
255 set_kernel_config CONFIG_DVB_USB_CXUSB m
256 set_kernel_config CONFIG_DVB_USB_M920X m
256 set_kernel_config CONFIG_DVB_USB_M920X m
257 set_kernel_config CONFIG_DVB_USB_DIGITV m
257 set_kernel_config CONFIG_DVB_USB_DIGITV m
258 set_kernel_config CONFIG_DVB_USB_VP7045 m
258 set_kernel_config CONFIG_DVB_USB_VP7045 m
259 set_kernel_config CONFIG_DVB_USB_VP702X m
259 set_kernel_config CONFIG_DVB_USB_VP702X m
260 set_kernel_config CONFIG_DVB_USB_GP8PSK m
260 set_kernel_config CONFIG_DVB_USB_GP8PSK m
261 set_kernel_config CONFIG_DVB_USB_NOVA_T_USB2 m
261 set_kernel_config CONFIG_DVB_USB_NOVA_T_USB2 m
262 set_kernel_config CONFIG_DVB_USB_TTUSB2 m
262 set_kernel_config CONFIG_DVB_USB_TTUSB2 m
263 set_kernel_config CONFIG_DVB_USB_DTT200U m
263 set_kernel_config CONFIG_DVB_USB_DTT200U m
264 set_kernel_config CONFIG_DVB_USB_OPERA1 m
264 set_kernel_config CONFIG_DVB_USB_OPERA1 m
265 set_kernel_config CONFIG_DVB_USB_AF9005 m
265 set_kernel_config CONFIG_DVB_USB_AF9005 m
266 set_kernel_config CONFIG_DVB_USB_AF9005_REMOTE m
266 set_kernel_config CONFIG_DVB_USB_AF9005_REMOTE m
267 set_kernel_config CONFIG_DVB_USB_PCTV452E m
267 set_kernel_config CONFIG_DVB_USB_PCTV452E m
268 set_kernel_config CONFIG_DVB_USB_DW2102 m
268 set_kernel_config CONFIG_DVB_USB_DW2102 m
269 set_kernel_config CONFIG_DVB_USB_CINERGY_T2 m
269 set_kernel_config CONFIG_DVB_USB_CINERGY_T2 m
270 set_kernel_config CONFIG_DVB_USB_DTV5100 m
270 set_kernel_config CONFIG_DVB_USB_DTV5100 m
271 set_kernel_config CONFIG_DVB_USB_AZ6027 m
271 set_kernel_config CONFIG_DVB_USB_AZ6027 m
272 set_kernel_config CONFIG_DVB_USB_TECHNISAT_USB2 m
272 set_kernel_config CONFIG_DVB_USB_TECHNISAT_USB2 m
273 set_kernel_config CONFIG_DVB_USB_AF9015 m
273 set_kernel_config CONFIG_DVB_USB_AF9015 m
274 set_kernel_config CONFIG_DVB_USB_LME2510 m
274 set_kernel_config CONFIG_DVB_USB_LME2510 m
275 set_kernel_config CONFIG_DVB_USB_RTL28XXU m
275 set_kernel_config CONFIG_DVB_USB_RTL28XXU m
276 set_kernel_config CONFIG_VIDEO_EM28XX_RC m
276 set_kernel_config CONFIG_VIDEO_EM28XX_RC m
277 set_kernel_config CONFIG_SMS_SIANO_RC m
277 set_kernel_config CONFIG_SMS_SIANO_RC m
278 set_kernel_config CONFIG_VIDEO_IR_I2C m
278 set_kernel_config CONFIG_VIDEO_IR_I2C m
279 set_kernel_config CONFIG_VIDEO_ADV7180 m
279 set_kernel_config CONFIG_VIDEO_ADV7180 m
280 set_kernel_config CONFIG_VIDEO_TC358743 m
280 set_kernel_config CONFIG_VIDEO_TC358743 m
281 set_kernel_config CONFIG_VIDEO_OV5647 m
281 set_kernel_config CONFIG_VIDEO_OV5647 m
282 set_kernel_config CONFIG_DVB_M88DS3103 m
282 set_kernel_config CONFIG_DVB_M88DS3103 m
283 set_kernel_config CONFIG_DVB_AF9013 m
283 set_kernel_config CONFIG_DVB_AF9013 m
284 set_kernel_config CONFIG_DVB_RTL2830 m
284 set_kernel_config CONFIG_DVB_RTL2830 m
285 set_kernel_config CONFIG_DVB_RTL2832 m
285 set_kernel_config CONFIG_DVB_RTL2832 m
286 set_kernel_config CONFIG_DVB_SI2168 m
286 set_kernel_config CONFIG_DVB_SI2168 m
287 set_kernel_config CONFIG_DVB_GP8PSK_FE m
287 set_kernel_config CONFIG_DVB_GP8PSK_FE m
288 set_kernel_config CONFIG_DVB_USB m
288 set_kernel_config CONFIG_DVB_USB m
289 set_kernel_config CONFIG_DVB_LGDT3306A m
289 set_kernel_config CONFIG_DVB_LGDT3306A m
290 set_kernel_config CONFIG_FB_SIMPLE y
290 set_kernel_config CONFIG_FB_SIMPLE y
291 set_kernel_config CONFIG_SND_BCM2708_SOC_IQAUDIO_CODEC m
291 set_kernel_config CONFIG_SND_BCM2708_SOC_IQAUDIO_CODEC m
292 set_kernel_config CONFIG_SND_BCM2708_SOC_I_SABRE_Q2M m
292 set_kernel_config CONFIG_SND_BCM2708_SOC_I_SABRE_Q2M m
293 set_kernel_config CONFIG_SND_AUDIOSENSE_PI m
293 set_kernel_config CONFIG_SND_AUDIOSENSE_PI m
294 set_kernel_config CONFIG_SND_SOC_AD193X m
294 set_kernel_config CONFIG_SND_SOC_AD193X m
295 set_kernel_config CONFIG_SND_SOC_AD193X_SPI m
295 set_kernel_config CONFIG_SND_SOC_AD193X_SPI m
296 set_kernel_config CONFIG_SND_SOC_AD193X_I2C m
296 set_kernel_config CONFIG_SND_SOC_AD193X_I2C m
297 set_kernel_config CONFIG_SND_SOC_CS4265 m
297 set_kernel_config CONFIG_SND_SOC_CS4265 m
298 set_kernel_config CONFIG_SND_SOC_DA7213 m
298 set_kernel_config CONFIG_SND_SOC_DA7213 m
299 set_kernel_config CONFIG_SND_SOC_ICS43432 m
299 set_kernel_config CONFIG_SND_SOC_ICS43432 m
300 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4 m
300 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4 m
301 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4_I2C m
301 set_kernel_config CONFIG_SND_SOC_TLV320AIC32X4_I2C m
302 set_kernel_config CONFIG_SND_SOC_I_SABRE_CODEC m
302 set_kernel_config CONFIG_SND_SOC_I_SABRE_CODEC m
303 set_kernel_config CONFIG_HID_BIGBEN_FF m
303 set_kernel_config CONFIG_HID_BIGBEN_FF m
304 #set_kernel_config CONFIG_USB_XHCI_PLATFORM y
304 #set_kernel_config CONFIG_USB_XHCI_PLATFORM y
305 set_kernel_config CONFIG_USB_TMC m
305 set_kernel_config CONFIG_USB_TMC m
306 set_kernel_config CONFIG_USB_UAS y
306 set_kernel_config CONFIG_USB_UAS y
307 set_kernel_config CONFIG_USBIP_VUDC m
307 set_kernel_config CONFIG_USBIP_VUDC m
308 set_kernel_config CONFIG_USB_CONFIGFS m
308 set_kernel_config CONFIG_USB_CONFIGFS m
309 set_kernel_config CONFIG_USB_CONFIGFS_SERIAL y
309 set_kernel_config CONFIG_USB_CONFIGFS_SERIAL y
310 set_kernel_config CONFIG_USB_CONFIGFS_ACM y
310 set_kernel_config CONFIG_USB_CONFIGFS_ACM y
311 set_kernel_config CONFIG_USB_CONFIGFS_OBEX y
311 set_kernel_config CONFIG_USB_CONFIGFS_OBEX y
312 set_kernel_config CONFIG_USB_CONFIGFS_NCM y
312 set_kernel_config CONFIG_USB_CONFIGFS_NCM y
313 set_kernel_config CONFIG_USB_CONFIGFS_ECM y
313 set_kernel_config CONFIG_USB_CONFIGFS_ECM y
314 set_kernel_config CONFIG_USB_CONFIGFS_ECM_SUBSET y
314 set_kernel_config CONFIG_USB_CONFIGFS_ECM_SUBSET y
315 set_kernel_config CONFIG_USB_CONFIGFS_RNDIS y
315 set_kernel_config CONFIG_USB_CONFIGFS_RNDIS y
316 set_kernel_config CONFIG_USB_CONFIGFS_EEM y
316 set_kernel_config CONFIG_USB_CONFIGFS_EEM y
317 set_kernel_config CONFIG_USB_CONFIGFS_MASS_STORAGE y
317 set_kernel_config CONFIG_USB_CONFIGFS_MASS_STORAGE y
318 set_kernel_config CONFIG_USB_CONFIGFS_F_LB_SS y
318 set_kernel_config CONFIG_USB_CONFIGFS_F_LB_SS y
319 set_kernel_config CONFIG_USB_CONFIGFS_F_FS y
319 set_kernel_config CONFIG_USB_CONFIGFS_F_FS y
320 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC1 y
320 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC1 y
321 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC2 y
321 set_kernel_config CONFIG_USB_CONFIGFS_F_UAC2 y
322 set_kernel_config CONFIG_USB_CONFIGFS_F_MIDI y
322 set_kernel_config CONFIG_USB_CONFIGFS_F_MIDI y
323 set_kernel_config CONFIG_USB_CONFIGFS_F_HID y
323 set_kernel_config CONFIG_USB_CONFIGFS_F_HID y
324 set_kernel_config CONFIG_USB_CONFIGFS_F_UVC y
324 set_kernel_config CONFIG_USB_CONFIGFS_F_UVC y
325 set_kernel_config CONFIG_USB_CONFIGFS_F_PRINTER y
325 set_kernel_config CONFIG_USB_CONFIGFS_F_PRINTER y
326 set_kernel_config CONFIG_LEDS_PCA963X m
326 set_kernel_config CONFIG_LEDS_PCA963X m
327 set_kernel_config CONFIG_LEDS_IS31FL32XX m
327 set_kernel_config CONFIG_LEDS_IS31FL32XX m
328 set_kernel_config CONFIG_LEDS_TRIGGER_NETDEV m
328 set_kernel_config CONFIG_LEDS_TRIGGER_NETDEV m
329 set_kernel_config CONFIG_RTC_DRV_RV3028 m
329 set_kernel_config CONFIG_RTC_DRV_RV3028 m
330 set_kernel_config CONFIG_AUXDISPLAY y
330 set_kernel_config CONFIG_AUXDISPLAY y
331 set_kernel_config CONFIG_HD44780 m
331 set_kernel_config CONFIG_HD44780 m
332 set_kernel_config CONFIG_FB_TFT_SH1106 m
332 set_kernel_config CONFIG_FB_TFT_SH1106 m
333 set_kernel_config CONFIG_VIDEO_CODEC_BCM2835 m
333 set_kernel_config CONFIG_VIDEO_CODEC_BCM2835 m
334 set_kernel_config CONFIG_BCM2835_POWER y
334 set_kernel_config CONFIG_BCM2835_POWER y
335 set_kernel_config CONFIG_INV_MPU6050_IIO m
335 set_kernel_config CONFIG_INV_MPU6050_IIO m
336 set_kernel_config CONFIG_INV_MPU6050_I2C m
336 set_kernel_config CONFIG_INV_MPU6050_I2C m
337 set_kernel_config CONFIG_SECURITYFS y
337 set_kernel_config CONFIG_SECURITYFS y
338
338
339 # Safer to build this in
339 # Safer to build this in
340 set_kernel_config CONFIG_BINFMT_MISC y
340 set_kernel_config CONFIG_BINFMT_MISC y
341
341
342 # pulseaudio wants a buffer of at least this size
342 # pulseaudio wants a buffer of at least this size
343 set_kernel_config CONFIG_SND_HDA_PREALLOC_SIZE 2048
343 set_kernel_config CONFIG_SND_HDA_PREALLOC_SIZE 2048
344
344
345 # PR#3063: enable 3D acceleration with 64-bit kernel on RPi4
345 # PR#3063: enable 3D acceleration with 64-bit kernel on RPi4
346 # set the appropriate kernel configs unlocked by this PR
346 # set the appropriate kernel configs unlocked by this PR
347 set_kernel_config CONFIG_ARCH_BCM y
347 set_kernel_config CONFIG_ARCH_BCM y
348 set_kernel_config CONFIG_ARCH_BCM2835 y
348 set_kernel_config CONFIG_ARCH_BCM2835 y
349 set_kernel_config CONFIG_DRM_V3D m
349 set_kernel_config CONFIG_DRM_V3D m
350 set_kernel_config CONFIG_DRM_VC4 m
350 set_kernel_config CONFIG_DRM_VC4 m
351 set_kernel_config CONFIG_DRM_VC4_HDMI_CEC y
351 set_kernel_config CONFIG_DRM_VC4_HDMI_CEC y
352
352
353 # PR#3144: add arm64 pcie bounce buffers; enables 4GiB on RPi4
353 # PR#3144: add arm64 pcie bounce buffers; enables 4GiB on RPi4
354 # required by PR#3144; should already be applied, but just to be safe
354 # required by PR#3144; should already be applied, but just to be safe
355 set_kernel_config CONFIG_PCIE_BRCMSTB y
355 set_kernel_config CONFIG_PCIE_BRCMSTB y
356 set_kernel_config CONFIG_BCM2835_MMC y
356 set_kernel_config CONFIG_BCM2835_MMC y
357
357
358 # Snap needs squashfs. The ubuntu eoan-preinstalled-server image at
358 # Snap needs squashfs. The ubuntu eoan-preinstalled-server image at
359 # http://cdimage.ubuntu.com/ubuntu-server/daily-preinstalled/current/ uses snap
359 # http://cdimage.ubuntu.com/ubuntu-server/daily-preinstalled/current/ uses snap
360 # during cloud-init setup at first boot. Without this the login accounts are not
360 # during cloud-init setup at first boot. Without this the login accounts are not
361 # created and the user can not login.
361 # created and the user can not login.
362 set_kernel_config CONFIG_SQUASHFS y
362 set_kernel_config CONFIG_SQUASHFS y
363
363
364 # Ceph support for Block Device (RBD) and Filesystem (FS)
364 # Ceph support for Block Device (RBD) and Filesystem (FS)
365 # https://docs.ceph.com/docs/master/
365 # https://docs.ceph.com/docs/master/
366 set_kernel_config CONFIG_CEPH_LIB m
366 set_kernel_config CONFIG_CEPH_LIB m
367 set_kernel_config CONFIG_CEPH_LIB_USE_DNS_RESOLVER y
367 set_kernel_config CONFIG_CEPH_LIB_USE_DNS_RESOLVER y
368 set_kernel_config CONFIG_CEPH_FS m
368 set_kernel_config CONFIG_CEPH_FS m
369 set_kernel_config CONFIG_CEPH_FSCACHE y
369 set_kernel_config CONFIG_CEPH_FSCACHE y
370 set_kernel_config CONFIG_CEPH_FS_POSIX_ACL y
370 set_kernel_config CONFIG_CEPH_FS_POSIX_ACL y
371 set_kernel_config CONFIG_BLK_DEV_RBD m
371 set_kernel_config CONFIG_BLK_DEV_RBD m
372 fi
372
373
373 # enable basic KVM support; see https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453
374 # enable basic KVM support; see https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=210546&start=25#p1300453
374 if [ "$KERNEL_VIRT" = true ] && { [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ]; } ; then
375 if [ "$KERNEL_VIRT" = true ] && { [ "$RPI_MODEL" = 2 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] || [ "$RPI_MODEL" = 4 ]; } ; then
375 set_kernel_config CONFIG_HAVE_KVM y
376 set_kernel_config CONFIG_HAVE_KVM y
376 set_kernel_config CONFIG_HIGH_RES_TIMERS y
377 set_kernel_config CONFIG_HIGH_RES_TIMERS y
377 set_kernel_config CONFIG_HAVE_KVM_IRQCHIP y
378 set_kernel_config CONFIG_HAVE_KVM_IRQCHIP y
378 set_kernel_config CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL y
379 set_kernel_config CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL y
379 set_kernel_config CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT y
380 set_kernel_config CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT y
380 set_kernel_config CONFIG_HAVE_KVM_EVENTFD y
381 set_kernel_config CONFIG_HAVE_KVM_EVENTFD y
381 set_kernel_config CONFIG_HAVE_KVM_IRQFD y
382 set_kernel_config CONFIG_HAVE_KVM_IRQFD y
382 set_kernel_config CONFIG_HAVE_KVM_IRQ_ROUTING y
383 set_kernel_config CONFIG_HAVE_KVM_IRQ_ROUTING y
383 set_kernel_config CONFIG_HAVE_KVM_MSI y
384 set_kernel_config CONFIG_HAVE_KVM_MSI y
384 set_kernel_config CONFIG_KVM y
385 set_kernel_config CONFIG_KVM y
385 set_kernel_config CONFIG_KVM_ARM_HOST y
386 set_kernel_config CONFIG_KVM_ARM_HOST y
386 set_kernel_config CONFIG_KVM_ARM_PMU y
387 set_kernel_config CONFIG_KVM_ARM_PMU y
387 set_kernel_config CONFIG_KVM_COMPAT y
388 set_kernel_config CONFIG_KVM_COMPAT y
388 set_kernel_config CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT y
389 set_kernel_config CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT y
389 set_kernel_config CONFIG_KVM_MMIO y
390 set_kernel_config CONFIG_KVM_MMIO y
390 set_kernel_config CONFIG_KVM_VFIO y
391 set_kernel_config CONFIG_KVM_VFIO y
391 set_kernel_config CONFIG_KVM_MMU_AUDIT y
392 set_kernel_config CONFIG_KVM_MMU_AUDIT y
392 set_kernel_config CONFIG_VHOST m
393 set_kernel_config CONFIG_VHOST m
393 set_kernel_config CONFIG_VHOST_CROSS_ENDIAN_LEGACY y
394 set_kernel_config CONFIG_VHOST_CROSS_ENDIAN_LEGACY y
394 set_kernel_config CONFIG_VHOST_NET m
395 set_kernel_config CONFIG_VHOST_NET m
395 set_kernel_config CONFIG_VIRTUALIZATION y
396 set_kernel_config CONFIG_VIRTUALIZATION y
396 set_kernel_config CONFIG_MMU_NOTIFIER y
397 set_kernel_config CONFIG_MMU_NOTIFIER y
397
398
398 set_kernel_config CONFIG_SLAB_FREELIST_RANDOM=y
399 set_kernel_config CONFIG_SLAB_FREELIST_RANDOM=y
399 set_kernel_config CONFIG_SLAB_FREELIST_HARDENED=y
400 set_kernel_config CONFIG_SLAB_FREELIST_HARDENED=y
400
401
401 # erratum
402 # erratum
402 set_kernel_config ARM64_ERRATUM_834220 y
403 set_kernel_config ARM64_ERRATUM_834220 y
403 # https://sourceforge.net/p/kvm/mailman/message/18440797/
404 # https://sourceforge.net/p/kvm/mailman/message/18440797/
404 set_kernel_config CONFIG_PREEMPT_NOTIFIERS y
405 set_kernel_config CONFIG_PREEMPT_NOTIFIERS y
405 fi
406 fi
406
407
407 # enable apparmor,integrity audit,
408 # enable apparmor,integrity audit,
408 if [ "$KERNEL_SECURITY" = true ] ; then
409 if [ "$KERNEL_SECURITY" = true ] ; then
409
410
410 # security filesystem, security models and audit
411 # security filesystem, security models and audit
411 set_kernel_config CONFIG_SECURITYFS y
412 set_kernel_config CONFIG_SECURITYFS y
412 set_kernel_config CONFIG_SECURITY y
413 set_kernel_config CONFIG_SECURITY y
413 set_kernel_config CONFIG_AUDIT y
414 set_kernel_config CONFIG_AUDIT y
414
415
415 # harden strcpy and memcpy
416 # harden strcpy and memcpy
416 set_kernel_config CONFIG_HARDENED_USERCOPY y
417 set_kernel_config CONFIG_HARDENED_USERCOPY y
417 set_kernel_config CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR y
418 set_kernel_config CONFIG_HAVE_HARDENED_USERCOPY_ALLOCATOR y
418 set_kernel_config CONFIG_FORTIFY_SOURCE y
419 set_kernel_config CONFIG_FORTIFY_SOURCE y
419
420
420 # integrity sub-system
421 # integrity sub-system
421 set_kernel_config CONFIG_INTEGRITY y
422 set_kernel_config CONFIG_INTEGRITY y
422 set_kernel_config CONFIG_INTEGRITY_ASYMMETRIC_KEYS y
423 set_kernel_config CONFIG_INTEGRITY_ASYMMETRIC_KEYS y
423 set_kernel_config CONFIG_INTEGRITY_AUDIT y
424 set_kernel_config CONFIG_INTEGRITY_AUDIT y
424 set_kernel_config CONFIG_INTEGRITY_SIGNATURE y
425 set_kernel_config CONFIG_INTEGRITY_SIGNATURE y
425 set_kernel_config CONFIG_INTEGRITY_TRUSTED_KEYRING y
426 set_kernel_config CONFIG_INTEGRITY_TRUSTED_KEYRING y
426
427
427 # This option provides support for retaining authentication tokens and access keys in the kernel.
428 # This option provides support for retaining authentication tokens and access keys in the kernel.
428 set_kernel_config CONFIG_KEYS y
429 set_kernel_config CONFIG_KEYS y
429 set_kernel_config CONFIG_KEYS_COMPAT y
430 set_kernel_config CONFIG_KEYS_COMPAT y
430
431
431 # Apparmor
432 # Apparmor
432 set_kernel_config CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE 0
433 set_kernel_config CONFIG_SECURITY_APPARMOR_BOOTPARAM_VALUE 0
433 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH_DEFAULT y
434 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH_DEFAULT y
434 set_kernel_config CONFIG_DEFAULT_SECURITY_APPARMOR y
435 set_kernel_config CONFIG_DEFAULT_SECURITY_APPARMOR y
435 set_kernel_config CONFIG_SECURITY_APPARMOR y
436 set_kernel_config CONFIG_SECURITY_APPARMOR y
436 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH y
437 set_kernel_config CONFIG_SECURITY_APPARMOR_HASH y
437 set_kernel_config CONFIG_DEFAULT_SECURITY "apparmor"
438 set_kernel_config CONFIG_DEFAULT_SECURITY "apparmor"
438
439
439 # restrictions on unprivileged users reading the kernel
440 # restrictions on unprivileged users reading the kernel
440 set_kernel_config CONFIG_SECURITY_DMESG_RESTRICT y
441 set_kernel_config CONFIG_SECURITY_DMESG_RESTRICT y
441
442
442 # network security hooks
443 # network security hooks
443 set_kernel_config CONFIG_SECURITY_NETWORK y
444 set_kernel_config CONFIG_SECURITY_NETWORK y
444 set_kernel_config CONFIG_SECURITY_NETWORK_XFRM y
445 set_kernel_config CONFIG_SECURITY_NETWORK_XFRM y
445 set_kernel_config CONFIG_SECURITY_PATH y
446 set_kernel_config CONFIG_SECURITY_PATH y
446 set_kernel_config CONFIG_SECURITY_YAMA n
447 set_kernel_config CONFIG_SECURITY_YAMA n
447
448
448 set_kernel_config CONFIG_SECURITY_SELINUX n
449 set_kernel_config CONFIG_SECURITY_SELINUX n
449 set_kernel_config CONFIG_SECURITY_SMACK n
450 set_kernel_config CONFIG_SECURITY_SMACK n
450 set_kernel_config CONFIG_SECURITY_TOMOYO n
451 set_kernel_config CONFIG_SECURITY_TOMOYO n
451 set_kernel_config CONFIG_SECURITY_APPARMOR_DEBUG n
452 set_kernel_config CONFIG_SECURITY_APPARMOR_DEBUG n
452 set_kernel_config CONFIG_SECURITY_LOADPIN n
453 set_kernel_config CONFIG_SECURITY_LOADPIN n
453 set_kernel_config CONFIG_HARDENED_USERCOPY_PAGESPAN n
454 set_kernel_config CONFIG_HARDENED_USERCOPY_PAGESPAN n
454 set_kernel_config CONFIG_IMA n
455 set_kernel_config CONFIG_IMA n
455 set_kernel_config CONFIG_EVM n
456 set_kernel_config CONFIG_EVM n
456 set_kernel_config CONFIG_FANOTIFY_ACCESS_PERMISSIONS y
457 set_kernel_config CONFIG_FANOTIFY_ACCESS_PERMISSIONS y
457 set_kernel_config CONFIG_NFSD_V4_SECURITY_LABEL y
458 set_kernel_config CONFIG_NFSD_V4_SECURITY_LABEL y
458 set_kernel_config CONFIG_PKCS7_MESSAGE_PARSER y
459 set_kernel_config CONFIG_PKCS7_MESSAGE_PARSER y
459 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYRING y
460 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYRING y
460 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE y
461 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE y
461 set_kernel_config CONFIG_SECONDARY_TRUSTED_KEYRING y
462 set_kernel_config CONFIG_SECONDARY_TRUSTED_KEYRING y
462 set_kernel_config CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY n
463 set_kernel_config CONFIG_IMA_KEYRINGS_PERMIT_SIGNED_BY_BUILTIN_OR_SECONDARY n
463 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYS m
464 set_kernel_config CONFIG_SYSTEM_TRUSTED_KEYS m
464 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE 4096
465 set_kernel_config CONFIG_SYSTEM_EXTRA_CERTIFICATE_SIZE 4096
465
466
466 set_kernel_config CONFIG_ARM64_CRYPTO y
467 set_kernel_config CONFIG_ARM64_CRYPTO y
467 set_kernel_config CONFIG_CRYPTO_SHA256_ARM64 m
468 set_kernel_config CONFIG_CRYPTO_SHA256_ARM64 m
468 set_kernel_config CONFIG_CRYPTO_SHA512_ARM64 m
469 set_kernel_config CONFIG_CRYPTO_SHA512_ARM64 m
469 set_kernel_config CONFIG_CRYPTO_SHA1_ARM64_CE m
470 set_kernel_config CONFIG_CRYPTO_SHA1_ARM64_CE m
470 set_kernel_config CRYPTO_GHASH_ARM64_CE m
471 set_kernel_config CRYPTO_GHASH_ARM64_CE m
471 set_kernel_config CRYPTO_SHA2_ARM64_CE m
472 set_kernel_config CRYPTO_SHA2_ARM64_CE m
472 set_kernel_config CONFIG_CRYPTO_CRCT10DIF_ARM64_CE m
473 set_kernel_config CONFIG_CRYPTO_CRCT10DIF_ARM64_CE m
473 set_kernel_config CONFIG_CRYPTO_CRC32_ARM64_CE m
474 set_kernel_config CONFIG_CRYPTO_CRC32_ARM64_CE m
474 set_kernel_config CONFIG_CRYPTO_AES_ARM64 m
475 set_kernel_config CONFIG_CRYPTO_AES_ARM64 m
475 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE m
476 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE m
476 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_CCM y
477 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_CCM y
477 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_BLK y
478 set_kernel_config CONFIG_CRYPTO_AES_ARM64_CE_BLK y
478 set_kernel_config CONFIG_CRYPTO_AES_ARM64_NEON_BLK m
479 set_kernel_config CONFIG_CRYPTO_AES_ARM64_NEON_BLK m
479 set_kernel_config CONFIG_CRYPTO_CHACHA20_NEON m
480 set_kernel_config CONFIG_CRYPTO_CHACHA20_NEON m
480 set_kernel_config CONFIG_CRYPTO_AES_ARM64_BS m
481 set_kernel_config CONFIG_CRYPTO_AES_ARM64_BS m
481 fi
482 fi
482
483
483 # Netfilter kernel support See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406
484 # Netfilter kernel support See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406
484 if [ "$KERNEL_NF" = true ] ; then
485 if [ "$KERNEL_NF" = true ] ; then
485 set_kernel_config CONFIG_IP_NF_SECURITY m
486 set_kernel_config CONFIG_IP_NF_SECURITY m
486 set_kernel_config CONFIG_NETLABEL y
487 set_kernel_config CONFIG_NETLABEL y
487 set_kernel_config CONFIG_IP6_NF_SECURITY m
488 set_kernel_config CONFIG_IP6_NF_SECURITY m
488 set_kernel_config CONFIG_IP_NF_TARGET_SYNPROXY m
489 set_kernel_config CONFIG_IP_NF_TARGET_SYNPROXY m
489 set_kernel_config CONFIG_NETFILTER_XT_TARGET_AUDIT m
490 set_kernel_config CONFIG_NETFILTER_XT_TARGET_AUDIT m
490 set_kernel_config CONFIG_NETFILTER_XT_MATCH_CGROUP m
491 set_kernel_config CONFIG_NETFILTER_XT_MATCH_CGROUP m
491 set_kernel_config CONFIG_NETFILTER_XT_MATCH_IPCOMP m
492 set_kernel_config CONFIG_NETFILTER_XT_MATCH_IPCOMP m
492 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
493 set_kernel_config CONFIG_NETFILTER_XT_MATCH_SOCKET m
493 set_kernel_config CONFIG_NFT_FIB_INET m
494 set_kernel_config CONFIG_NFT_FIB_INET m
494 set_kernel_config CONFIG_NFT_FIB_IPV4 m
495 set_kernel_config CONFIG_NFT_FIB_IPV4 m
495 set_kernel_config CONFIG_NFT_FIB_IPV6 m
496 set_kernel_config CONFIG_NFT_FIB_IPV6 m
496 set_kernel_config CONFIG_NFT_FIB_NETDEV m
497 set_kernel_config CONFIG_NFT_FIB_NETDEV m
497 set_kernel_config CONFIG_NFT_OBJREF m
498 set_kernel_config CONFIG_NFT_OBJREF m
498 set_kernel_config CONFIG_NFT_RT m
499 set_kernel_config CONFIG_NFT_RT m
499 set_kernel_config CONFIG_NFT_SET_BITMAP m
500 set_kernel_config CONFIG_NFT_SET_BITMAP m
500 set_kernel_config CONFIG_NF_CONNTRACK_TIMEOUT y
501 set_kernel_config CONFIG_NF_CONNTRACK_TIMEOUT y
501 set_kernel_config CONFIG_NF_LOG_ARP m
502 set_kernel_config CONFIG_NF_LOG_ARP m
502 set_kernel_config CONFIG_NF_SOCKET_IPV4 m
503 set_kernel_config CONFIG_NF_SOCKET_IPV4 m
503 set_kernel_config CONFIG_NF_SOCKET_IPV6 m
504 set_kernel_config CONFIG_NF_SOCKET_IPV6 m
504 set_kernel_config CONFIG_BRIDGE_EBT_BROUTE m
505 set_kernel_config CONFIG_BRIDGE_EBT_BROUTE m
505 set_kernel_config CONFIG_BRIDGE_EBT_T_FILTER m
506 set_kernel_config CONFIG_BRIDGE_EBT_T_FILTER m
506 set_kernel_config CONFIG_BRIDGE_NF_EBTABLES m
507 set_kernel_config CONFIG_BRIDGE_NF_EBTABLES m
507 set_kernel_config CONFIG_IP6_NF_IPTABLES m
508 set_kernel_config CONFIG_IP6_NF_IPTABLES m
508 set_kernel_config CONFIG_IP6_NF_MATCH_AH m
509 set_kernel_config CONFIG_IP6_NF_MATCH_AH m
509 set_kernel_config CONFIG_IP6_NF_MATCH_EUI64 m
510 set_kernel_config CONFIG_IP6_NF_MATCH_EUI64 m
510 set_kernel_config CONFIG_IP6_NF_NAT m
511 set_kernel_config CONFIG_IP6_NF_NAT m
511 set_kernel_config CONFIG_IP6_NF_TARGET_MASQUERADE m
512 set_kernel_config CONFIG_IP6_NF_TARGET_MASQUERADE m
512 set_kernel_config CONFIG_IP6_NF_TARGET_NPT m
513 set_kernel_config CONFIG_IP6_NF_TARGET_NPT m
513 set_kernel_config CONFIG_IP_SET_BITMAP_IPMAC m
514 set_kernel_config CONFIG_IP_SET_BITMAP_IPMAC m
514 set_kernel_config CONFIG_IP_SET_BITMAP_PORT m
515 set_kernel_config CONFIG_IP_SET_BITMAP_PORT m
515 set_kernel_config CONFIG_IP_SET_HASH_IP m
516 set_kernel_config CONFIG_IP_SET_HASH_IP m
516 set_kernel_config CONFIG_IP_SET_HASH_IPMARK m
517 set_kernel_config CONFIG_IP_SET_HASH_IPMARK m
517 set_kernel_config CONFIG_IP_SET_HASH_IPPORT m
518 set_kernel_config CONFIG_IP_SET_HASH_IPPORT m
518 set_kernel_config CONFIG_IP_SET_HASH_IPPORTIP m
519 set_kernel_config CONFIG_IP_SET_HASH_IPPORTIP m
519 set_kernel_config CONFIG_IP_SET_HASH_IPPORTNET m
520 set_kernel_config CONFIG_IP_SET_HASH_IPPORTNET m
520 set_kernel_config CONFIG_IP_SET_HASH_MAC m
521 set_kernel_config CONFIG_IP_SET_HASH_MAC m
521 set_kernel_config CONFIG_IP_SET_HASH_NET m
522 set_kernel_config CONFIG_IP_SET_HASH_NET m
522 set_kernel_config CONFIG_IP_SET_HASH_NETIFACE m
523 set_kernel_config CONFIG_IP_SET_HASH_NETIFACE m
523 set_kernel_config CONFIG_IP_SET_HASH_NETNET m
524 set_kernel_config CONFIG_IP_SET_HASH_NETNET m
524 set_kernel_config CONFIG_IP_SET_HASH_NETPORT m
525 set_kernel_config CONFIG_IP_SET_HASH_NETPORT m
525 set_kernel_config CONFIG_IP_SET_HASH_NETPORTNET m
526 set_kernel_config CONFIG_IP_SET_HASH_NETPORTNET m
526 set_kernel_config CONFIG_IP_SET_LIST_SET m
527 set_kernel_config CONFIG_IP_SET_LIST_SET m
527 set_kernel_config CONFIG_NETFILTER_XTABLES m
528 set_kernel_config CONFIG_NETFILTER_XTABLES m
528 set_kernel_config CONFIG_NETFILTER_XTABLES m
529 set_kernel_config CONFIG_NETFILTER_XTABLES m
529 set_kernel_config CONFIG_NFT_BRIDGE_META m
530 set_kernel_config CONFIG_NFT_BRIDGE_META m
530 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
531 set_kernel_config CONFIG_NFT_BRIDGE_REJECT m
531 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV4 m
532 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV4 m
532 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
533 set_kernel_config CONFIG_NFT_CHAIN_NAT_IPV6 m
533 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV4 m
534 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV4 m
534 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
535 set_kernel_config CONFIG_NFT_CHAIN_ROUTE_IPV6 m
535 set_kernel_config CONFIG_NFT_COMPAT m
536 set_kernel_config CONFIG_NFT_COMPAT m
536 set_kernel_config CONFIG_NFT_COUNTER m
537 set_kernel_config CONFIG_NFT_COUNTER m
537 set_kernel_config CONFIG_NFT_CT m
538 set_kernel_config CONFIG_NFT_CT m
538 set_kernel_config CONFIG_NFT_DUP_IPV4 m
539 set_kernel_config CONFIG_NFT_DUP_IPV4 m
539 set_kernel_config CONFIG_NFT_DUP_IPV6 m
540 set_kernel_config CONFIG_NFT_DUP_IPV6 m
540 set_kernel_config CONFIG_NFT_DUP_NETDEV m
541 set_kernel_config CONFIG_NFT_DUP_NETDEV m
541 set_kernel_config CONFIG_NFT_EXTHDR m
542 set_kernel_config CONFIG_NFT_EXTHDR m
542 set_kernel_config CONFIG_NFT_FWD_NETDEV m
543 set_kernel_config CONFIG_NFT_FWD_NETDEV m
543 set_kernel_config CONFIG_NFT_HASH m
544 set_kernel_config CONFIG_NFT_HASH m
544 set_kernel_config CONFIG_NFT_LIMIT m
545 set_kernel_config CONFIG_NFT_LIMIT m
545 set_kernel_config CONFIG_NFT_LOG m
546 set_kernel_config CONFIG_NFT_LOG m
546 set_kernel_config CONFIG_NFT_MASQ m
547 set_kernel_config CONFIG_NFT_MASQ m
547 set_kernel_config CONFIG_NFT_MASQ_IPV4 m
548 set_kernel_config CONFIG_NFT_MASQ_IPV4 m
548 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
549 set_kernel_config CONFIG_NFT_MASQ_IPV6 m
549 set_kernel_config CONFIG_NFT_META m
550 set_kernel_config CONFIG_NFT_META m
550 set_kernel_config CONFIG_NFT_NAT m
551 set_kernel_config CONFIG_NFT_NAT m
551 set_kernel_config CONFIG_NFT_NUMGEN m
552 set_kernel_config CONFIG_NFT_NUMGEN m
552 set_kernel_config CONFIG_NFT_QUEUE m
553 set_kernel_config CONFIG_NFT_QUEUE m
553 set_kernel_config CONFIG_NFT_QUOTA m
554 set_kernel_config CONFIG_NFT_QUOTA m
554 set_kernel_config CONFIG_NFT_REDIR m
555 set_kernel_config CONFIG_NFT_REDIR m
555 set_kernel_config CONFIG_NFT_REDIR_IPV4 m
556 set_kernel_config CONFIG_NFT_REDIR_IPV4 m
556 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
557 set_kernel_config CONFIG_NFT_REDIR_IPV6 m
557 set_kernel_config CONFIG_NFT_REJECT m
558 set_kernel_config CONFIG_NFT_REJECT m
558 set_kernel_config CONFIG_NFT_REJECT_INET m
559 set_kernel_config CONFIG_NFT_REJECT_INET m
559 set_kernel_config CONFIG_NFT_REJECT_IPV4 m
560 set_kernel_config CONFIG_NFT_REJECT_IPV4 m
560 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
561 set_kernel_config CONFIG_NFT_REJECT_IPV6 m
561 set_kernel_config CONFIG_NFT_SET_HASH m
562 set_kernel_config CONFIG_NFT_SET_HASH m
562 set_kernel_config CONFIG_NFT_SET_RBTREE m
563 set_kernel_config CONFIG_NFT_SET_RBTREE m
563 set_kernel_config CONFIG_NF_CONNTRACK_IPV4 m
564 set_kernel_config CONFIG_NF_CONNTRACK_IPV4 m
564 set_kernel_config CONFIG_NF_CONNTRACK_IPV6 m
565 set_kernel_config CONFIG_NF_CONNTRACK_IPV6 m
565 set_kernel_config CONFIG_NF_DEFRAG_IPV4 m
566 set_kernel_config CONFIG_NF_DEFRAG_IPV4 m
566 set_kernel_config CONFIG_NF_DEFRAG_IPV6 m
567 set_kernel_config CONFIG_NF_DEFRAG_IPV6 m
567 set_kernel_config CONFIG_NF_DUP_IPV4 m
568 set_kernel_config CONFIG_NF_DUP_IPV4 m
568 set_kernel_config CONFIG_NF_DUP_IPV6 m
569 set_kernel_config CONFIG_NF_DUP_IPV6 m
569 set_kernel_config CONFIG_NF_DUP_NETDEV m
570 set_kernel_config CONFIG_NF_DUP_NETDEV m
570 set_kernel_config CONFIG_NF_LOG_BRIDGE m
571 set_kernel_config CONFIG_NF_LOG_BRIDGE m
571 set_kernel_config CONFIG_NF_LOG_IPV4 m
572 set_kernel_config CONFIG_NF_LOG_IPV4 m
572 set_kernel_config CONFIG_NF_LOG_IPV6 m
573 set_kernel_config CONFIG_NF_LOG_IPV6 m
573 set_kernel_config CONFIG_NF_NAT_IPV4 m
574 set_kernel_config CONFIG_NF_NAT_IPV4 m
574 set_kernel_config CONFIG_NF_NAT_IPV6 m
575 set_kernel_config CONFIG_NF_NAT_IPV6 m
575 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV4 y
576 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV4 y
576 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV6 y
577 set_kernel_config CONFIG_NF_NAT_MASQUERADE_IPV6 y
577 set_kernel_config CONFIG_NF_NAT_PPTP m
578 set_kernel_config CONFIG_NF_NAT_PPTP m
578 set_kernel_config CONFIG_NF_NAT_PROTO_GRE m
579 set_kernel_config CONFIG_NF_NAT_PROTO_GRE m
579 set_kernel_config CONFIG_NF_NAT_REDIRECT y
580 set_kernel_config CONFIG_NF_NAT_REDIRECT y
580 set_kernel_config CONFIG_NF_NAT_SIP m
581 set_kernel_config CONFIG_NF_NAT_SIP m
581 set_kernel_config CONFIG_NF_NAT_SNMP_BASIC m
582 set_kernel_config CONFIG_NF_NAT_SNMP_BASIC m
582 set_kernel_config CONFIG_NF_NAT_TFTP m
583 set_kernel_config CONFIG_NF_NAT_TFTP m
583 set_kernel_config CONFIG_NF_REJECT_IPV4 m
584 set_kernel_config CONFIG_NF_REJECT_IPV4 m
584 set_kernel_config CONFIG_NF_REJECT_IPV6 m
585 set_kernel_config CONFIG_NF_REJECT_IPV6 m
585 set_kernel_config CONFIG_NF_TABLES m
586 set_kernel_config CONFIG_NF_TABLES m
586 set_kernel_config CONFIG_NF_TABLES_ARP m
587 set_kernel_config CONFIG_NF_TABLES_ARP m
587 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
588 set_kernel_config CONFIG_NF_TABLES_BRIDGE m
588 set_kernel_config CONFIG_NF_TABLES_INET m
589 set_kernel_config CONFIG_NF_TABLES_INET m
589 set_kernel_config CONFIG_NF_TABLES_IPV4 y
590 set_kernel_config CONFIG_NF_TABLES_IPV4 y
590 set_kernel_config CONFIG_NF_TABLES_IPV6 y
591 set_kernel_config CONFIG_NF_TABLES_IPV6 y
591 set_kernel_config CONFIG_NF_TABLES_NETDEV m
592 set_kernel_config CONFIG_NF_TABLES_NETDEV m
592 set_kernel_config CONFIG_NF_TABLES_SET m
593 set_kernel_config CONFIG_NF_TABLES_SET m
593 set_kernel_config CONFIG_NF_TABLES_INET y
594 set_kernel_config CONFIG_NF_TABLES_INET y
594 set_kernel_config CONFIG_NF_TABLES_NETDEV y
595 set_kernel_config CONFIG_NF_TABLES_NETDEV y
595 set_kernel_config CONFIG_NFT_CONNLIMIT m
596 set_kernel_config CONFIG_NFT_CONNLIMIT m
596 set_kernel_config CONFIG_NFT_TUNNEL m
597 set_kernel_config CONFIG_NFT_TUNNEL m
597 set_kernel_config CONFIG_NFT_SOCKET m
598 set_kernel_config CONFIG_NFT_SOCKET m
598 set_kernel_config CONFIG_NFT_TPROXY m
599 set_kernel_config CONFIG_NFT_TPROXY m
599 set_kernel_config CONFIG_NF_FLOW_TABLE m
600 set_kernel_config CONFIG_NF_FLOW_TABLE m
600 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
601 set_kernel_config CONFIG_NFT_FLOW_OFFLOAD m
601 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
602 set_kernel_config CONFIG_NF_FLOW_TABLE_INET m
602 set_kernel_config CONFIG_NF_TABLES_ARP y
603 set_kernel_config CONFIG_NF_TABLES_ARP y
603 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV4 y
604 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV4 y
604 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 y
605 set_kernel_config CONFIG_NF_FLOW_TABLE_IPV6 y
605 set_kernel_config CONFIG_NF_TABLES_BRIDGE y
606 set_kernel_config CONFIG_NF_TABLES_BRIDGE y
606 set_kernel_config CONFIG_NF_CT_NETLINK_TIMEOUT m
607 set_kernel_config CONFIG_NF_CT_NETLINK_TIMEOUT m
607 set_kernel_config CONFIG_NFT_OSF m
608 set_kernel_config CONFIG_NFT_OSF m
608
609
609 fi
610 fi
610
611
611 # Enables BPF syscall for systemd-journald see https://github.com/torvalds/linux/blob/master/init/Kconfig#L848 or https://groups.google.com/forum/#!topic/linux.gentoo.user/_2aSc_ztGpA
612 # Enables BPF syscall for systemd-journald see https://github.com/torvalds/linux/blob/master/init/Kconfig#L848 or https://groups.google.com/forum/#!topic/linux.gentoo.user/_2aSc_ztGpA
612 if [ "$KERNEL_BPF" = true ] ; then
613 if [ "$KERNEL_BPF" = true ] ; then
613 set_kernel_config CONFIG_BPF_SYSCALL y
614 set_kernel_config CONFIG_BPF_SYSCALL y
614 set_kernel_config CONFIG_BPF_EVENTS y
615 set_kernel_config CONFIG_BPF_EVENTS y
615 set_kernel_config CONFIG_BPF_STREAM_PARSER y
616 set_kernel_config CONFIG_BPF_STREAM_PARSER y
616 set_kernel_config CONFIG_CGROUP_BPF y
617 set_kernel_config CONFIG_CGROUP_BPF y
617 set_kernel_config CONFIG_XDP_SOCKETS y
618 set_kernel_config CONFIG_XDP_SOCKETS y
618 fi
619 fi
619
620
620 # KERNEL_DEFAULT_GOV was set by user
621 # KERNEL_DEFAULT_GOV was set by user
621 if [ "$KERNEL_DEFAULT_GOV" != powersave ] && [ -n "$KERNEL_DEFAULT_GOV" ] ; then
622 if [ "$KERNEL_DEFAULT_GOV" != powersave ] && [ -n "$KERNEL_DEFAULT_GOV" ] ; then
622
623
623 case "$KERNEL_DEFAULT_GOV" in
624 case "$KERNEL_DEFAULT_GOV" in
624 performance)
625 performance)
625 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y
626 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y
626 ;;
627 ;;
627 userspace)
628 userspace)
628 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y
629 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y
629 ;;
630 ;;
630 ondemand)
631 ondemand)
631 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y
632 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y
632 ;;
633 ;;
633 conservative)
634 conservative)
634 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y
635 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y
635 ;;
636 ;;
636 shedutil)
637 shedutil)
637 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y
638 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y
638 ;;
639 ;;
639 *)
640 *)
640 echo "error: unsupported default cpu governor"
641 echo "error: unsupported default cpu governor"
641 exit 1
642 exit 1
642 ;;
643 ;;
643 esac
644 esac
644
645
645 # unset previous default governor
646 # unset previous default governor
646 unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
647 unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
647 fi
648 fi
648
649
649 #Revert to previous directory
650 #Revert to previous directory
650 cd "${WORKDIR}" || exit
651 cd "${WORKDIR}" || exit
651
652
652 # Set kernel configuration parameters to enable qemu emulation
653 # Set kernel configuration parameters to enable qemu emulation
653 if [ "$ENABLE_QEMU" = true ] ; then
654 if [ "$ENABLE_QEMU" = true ] ; then
654 echo "CONFIG_FHANDLE=y" >> "${KERNEL_DIR}"/.config
655 echo "CONFIG_FHANDLE=y" >> "${KERNEL_DIR}"/.config
655 echo "CONFIG_LBDAF=y" >> "${KERNEL_DIR}"/.config
656 echo "CONFIG_LBDAF=y" >> "${KERNEL_DIR}"/.config
656
657
657 if [ "$KERNEL_CRYPTFS" = true ] ; then
658 if [ "$KERNEL_CRYPTFS" = true ] ; then
658 {
659 {
659 echo "CONFIG_EMBEDDED=y"
660 echo "CONFIG_EMBEDDED=y"
660 echo "CONFIG_EXPERT=y"
661 echo "CONFIG_EXPERT=y"
661 echo "CONFIG_DAX=y"
662 echo "CONFIG_DAX=y"
662 echo "CONFIG_MD=y"
663 echo "CONFIG_MD=y"
663 echo "CONFIG_BLK_DEV_MD=y"
664 echo "CONFIG_BLK_DEV_MD=y"
664 echo "CONFIG_MD_AUTODETECT=y"
665 echo "CONFIG_MD_AUTODETECT=y"
665 echo "CONFIG_BLK_DEV_DM=y"
666 echo "CONFIG_BLK_DEV_DM=y"
666 echo "CONFIG_BLK_DEV_DM_BUILTIN=y"
667 echo "CONFIG_BLK_DEV_DM_BUILTIN=y"
667 echo "CONFIG_DM_CRYPT=y"
668 echo "CONFIG_DM_CRYPT=y"
668 echo "CONFIG_CRYPTO_BLKCIPHER=y"
669 echo "CONFIG_CRYPTO_BLKCIPHER=y"
669 echo "CONFIG_CRYPTO_CBC=y"
670 echo "CONFIG_CRYPTO_CBC=y"
670 echo "CONFIG_CRYPTO_XTS=y"
671 echo "CONFIG_CRYPTO_XTS=y"
671 echo "CONFIG_CRYPTO_SHA512=y"
672 echo "CONFIG_CRYPTO_SHA512=y"
672 echo "CONFIG_CRYPTO_MANAGER=y"
673 echo "CONFIG_CRYPTO_MANAGER=y"
673 } >> "${KERNEL_DIR}"/.config
674 } >> "${KERNEL_DIR}"/.config
674 fi
675 fi
675 fi
676 fi
676
677
677 # Copy custom kernel configuration file
678 # Copy custom kernel configuration file
678 if [ -n "$KERNELSRC_USRCONFIG" ] ; then
679 if [ -n "$KERNELSRC_USRCONFIG" ] ; then
679 cp "$KERNELSRC_USRCONFIG" "${KERNEL_DIR}"/.config
680 cp "$KERNELSRC_USRCONFIG" "${KERNEL_DIR}"/.config
680 fi
681 fi
681
682
682 # Set kernel configuration parameters to their default values
683 # Set kernel configuration parameters to their default values
683 if [ "$KERNEL_OLDDEFCONFIG" = true ] ; then
684 if [ "$KERNEL_OLDDEFCONFIG" = true ] ; then
684 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig
685 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" olddefconfig
685 fi
686 fi
686
687
687 # Start menu-driven kernel configuration (interactive)
688 # Start menu-driven kernel configuration (interactive)
688 if [ "$KERNEL_MENUCONFIG" = true ] ; then
689 if [ "$KERNEL_MENUCONFIG" = true ] ; then
689 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
690 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig
690 fi
691 fi
691 # end if "$KERNELSRC_CONFIG" = true
692 # end if "$KERNELSRC_CONFIG" = true
692 fi
693 fi
693
694
694 # Use ccache to cross compile the kernel
695 # Use ccache to cross compile the kernel
695 if [ "$KERNEL_CCACHE" = true ] ; then
696 if [ "$KERNEL_CCACHE" = true ] ; then
696 cc="ccache ${CROSS_COMPILE}gcc"
697 cc="ccache ${CROSS_COMPILE}gcc"
697 else
698 else
698 cc="${CROSS_COMPILE}gcc"
699 cc="${CROSS_COMPILE}gcc"
699 fi
700 fi
700
701
701 # Cross compile kernel and dtbs
702 # Cross compile kernel and dtbs
702 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
703 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" "${KERNEL_BIN_IMAGE}" dtbs
703
704
704 # Cross compile kernel modules
705 # Cross compile kernel modules
705 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
706 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
706 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
707 make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules
707 fi
708 fi
708 # end if "$KERNELSRC_PREBUILT" = false
709 # end if "$KERNELSRC_PREBUILT" = false
709 fi
710 fi
710
711
711 # Check if kernel compilation was successful
712 # Check if kernel compilation was successful
712 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then
713 if [ ! -r "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" ] ; then
713 echo "error: kernel compilation failed! (kernel image not found)"
714 echo "error: kernel compilation failed! (kernel image not found)"
714 cleanup
715 cleanup
715 exit 1
716 exit 1
716 fi
717 fi
717
718
718 # Install kernel modules
719 # Install kernel modules
719 if [ "$ENABLE_REDUCE" = true ] ; then
720 if [ "$ENABLE_REDUCE" = true ] ; then
720 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
721 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
721 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
722 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=../../.. modules_install
722 fi
723 fi
723 else
724 else
724 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
725 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
725 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
726 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_MOD_PATH=../../.. modules_install
726 fi
727 fi
727
728
728 # Install kernel firmware
729 # Install kernel firmware
729 if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then
730 if grep -q "^firmware_install:" "${KERNEL_DIR}/Makefile" ; then
730 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
731 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_FW_PATH=../../../lib firmware_install
731 fi
732 fi
732 fi
733 fi
733
734
734 # Install kernel headers
735 # Install kernel headers
735 if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then
736 if [ "$KERNEL_HEADERS" = true ] && [ "$KERNEL_REDUCE" = false ] ; then
736 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
737 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" INSTALL_HDR_PATH=../.. headers_install
737 fi
738 fi
738
739
739 # Prepare boot (firmware) directory
740 # Prepare boot (firmware) directory
740 mkdir "${BOOT_DIR}"
741 mkdir "${BOOT_DIR}"
741
742
742 # Get kernel release version
743 # Get kernel release version
743 KERNEL_VERSION=$(cat "${KERNEL_DIR}/include/config/kernel.release")
744 KERNEL_VERSION=$(cat "${KERNEL_DIR}/include/config/kernel.release")
744
745
745 # Copy kernel configuration file to the boot directory
746 # Copy kernel configuration file to the boot directory
746 install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}"
747 install_readonly "${KERNEL_DIR}/.config" "${R}/boot/config-${KERNEL_VERSION}"
747
748
748 # Prepare device tree directory
749 # Prepare device tree directory
749 mkdir "${BOOT_DIR}/overlays"
750 mkdir "${BOOT_DIR}/overlays"
750
751
751 # Ensure the proper .dtb is located
752 # Ensure the proper .dtb is located
752 if [ "$KERNEL_ARCH" = "arm" ] ; then
753 if [ "$KERNEL_ARCH" = "arm" ] ; then
753 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do
754 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/"*.dtb ; do
754 if [ -f "${dtb}" ] ; then
755 if [ -f "${dtb}" ] ; then
755 install_readonly "${dtb}" "${BOOT_DIR}/"
756 install_readonly "${dtb}" "${BOOT_DIR}/"
756 fi
757 fi
757 done
758 done
758 else
759 else
759 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb ; do
760 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/broadcom/"*.dtb ; do
760 if [ -f "${dtb}" ] ; then
761 if [ -f "${dtb}" ] ; then
761 install_readonly "${dtb}" "${BOOT_DIR}/"
762 install_readonly "${dtb}" "${BOOT_DIR}/"
762 fi
763 fi
763 done
764 done
764 fi
765 fi
765
766
766 # Copy compiled dtb device tree files
767 # Copy compiled dtb device tree files
767 if [ -d "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays" ] ; then
768 if [ -d "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays" ] ; then
768 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtbo ; do
769 for dtb in "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/"*.dtbo ; do
769 if [ -f "${dtb}" ] ; then
770 if [ -f "${dtb}" ] ; then
770 install_readonly "${dtb}" "${BOOT_DIR}/overlays/"
771 install_readonly "${dtb}" "${BOOT_DIR}/overlays/"
771 fi
772 fi
772 done
773 done
773
774
774 if [ -f "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" ] ; then
775 if [ -f "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" ] ; then
775 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README"
776 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/dts/overlays/README" "${BOOT_DIR}/overlays/README"
776 fi
777 fi
777 fi
778 fi
778
779
779 if [ "$ENABLE_UBOOT" = false ] ; then
780 if [ "$ENABLE_UBOOT" = false ] ; then
780 # Convert and copy kernel image to the boot directory
781 # Convert and copy kernel image to the boot directory
781 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
782 "${KERNEL_DIR}/scripts/mkknlimg" "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
782 else
783 else
783 # Copy kernel image to the boot directory
784 # Copy kernel image to the boot directory
784 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
785 install_readonly "${KERNEL_DIR}/arch/${KERNEL_ARCH}/boot/${KERNEL_BIN_IMAGE}" "${BOOT_DIR}/${KERNEL_IMAGE}"
785 fi
786 fi
786
787
787 # Remove kernel sources
788 # Remove kernel sources
788 if [ "$KERNEL_REMOVESRC" = true ] ; then
789 if [ "$KERNEL_REMOVESRC" = true ] ; then
789 rm -fr "${KERNEL_DIR}"
790 rm -fr "${KERNEL_DIR}"
790 else
791 else
791 # Prepare compiled kernel modules
792 # Prepare compiled kernel modules
792 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
793 if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then
793 if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then
794 if grep -q "^modules_prepare:" "${KERNEL_DIR}/Makefile" ; then
794 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
795 make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" modules_prepare
795 fi
796 fi
796
797
797 # Create symlinks for kernel modules
798 # Create symlinks for kernel modules
798 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build"
799 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/build"
799 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source"
800 chroot_exec ln -sf /usr/src/linux "/lib/modules/${KERNEL_VERSION}/source"
800 fi
801 fi
801 fi
802 fi
802
803
803 else # BUILD_KERNEL=false
804 else # BUILD_KERNEL=false
804 if [ "$SET_ARCH" = 64 ] ; then
805 if [ "$SET_ARCH" = 64 ] ; then
805 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
806 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
806 # Use Sakakis modified kernel if ZSWAP is active
807 # Use Sakakis modified kernel if ZSWAP is active
807 if [ "$KERNEL_ZSWAP" = true ] || [ "$KERNEL_VIRT" = true ] || [ "$KERNEL_NF" = true ] || [ "$KERNEL_BPF" = true ] ; then
808 if [ "$KERNEL_ZSWAP" = true ] || [ "$KERNEL_VIRT" = true ] || [ "$KERNEL_NF" = true ] || [ "$KERNEL_BPF" = true ] ; then
808 RPI3_64_KERNEL_URL="${RPI3_64_BIS_KERNEL_URL}"
809 RPI3_64_KERNEL_URL="${RPI3_64_BIS_KERNEL_URL}"
809 fi
810 fi
810
811
811 # Create temporary directory for dl
812 # Create temporary directory for dl
812 temp_dir=$(as_nobody mktemp -d)
813 temp_dir=$(as_nobody mktemp -d)
813
814
814 # Fetch kernel dl
815 # Fetch kernel dl
815 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL"
816 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI3_64_KERNEL_URL"
816 fi
817 fi
817 if [ "$SET_ARCH" = 64 ] && [ "$RPI_MODEL" = 4 ] ; then
818 if [ "$SET_ARCH" = 64 ] && [ "$RPI_MODEL" = 4 ] ; then
818 # Create temporary directory for dl
819 # Create temporary directory for dl
819 temp_dir=$(as_nobody mktemp -d)
820 temp_dir=$(as_nobody mktemp -d)
820
821
821 # Fetch kernel dl
822 # Fetch kernel dl
822 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI4_64_KERNEL_URL"
823 as_nobody wget -O "${temp_dir}"/kernel.tar.xz -c "$RPI4_64_KERNEL_URL"
823 fi
824 fi
824
825
825 #extract download
826 #extract download
826 tar -xJf "${temp_dir}"/kernel.tar.xz -C "${temp_dir}"
827 tar -xJf "${temp_dir}"/kernel.tar.xz -C "${temp_dir}"
827
828
828 #move extracted kernel to /boot/firmware
829 #move extracted kernel to /boot/firmware
829 mkdir "${R}/boot/firmware"
830 mkdir "${R}/boot/firmware"
830 cp "${temp_dir}"/boot/* "${R}"/boot/firmware/
831 cp "${temp_dir}"/boot/* "${R}"/boot/firmware/
831 cp -r "${temp_dir}"/lib/* "${R}"/lib/
832 cp -r "${temp_dir}"/lib/* "${R}"/lib/
832
833
833 # Remove temporary directory for kernel sources
834 # Remove temporary directory for kernel sources
834 rm -fr "${temp_dir}"
835 rm -fr "${temp_dir}"
835
836
836 # Set permissions of the kernel sources
837 # Set permissions of the kernel sources
837 chown -R root:root "${R}/boot/firmware"
838 chown -R root:root "${R}/boot/firmware"
838 chown -R root:root "${R}/lib/modules"
839 chown -R root:root "${R}/lib/modules"
839 fi
840 fi
840
841
841 # Install Kernel from hypriot comptabile with all Raspberry PI (dunno if its compatible with RPI4 - better compile your own kernel)
842 # Install Kernel from hypriot comptabile with all Raspberry PI (dunno if its compatible with RPI4 - better compile your own kernel)
842 if [ "$SET_ARCH" = 32 ] && [ "$RPI_MODEL" != 4 ] ; then
843 if [ "$SET_ARCH" = 32 ] && [ "$RPI_MODEL" != 4 ] ; then
843 # Create temporary directory for dl
844 # Create temporary directory for dl
844 temp_dir=$(as_nobody mktemp -d)
845 temp_dir=$(as_nobody mktemp -d)
845
846
846 # Fetch kernel
847 # Fetch kernel
847 as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL"
848 as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL"
848
849
849 # Copy downloaded kernel package
850 # Copy downloaded kernel package
850 mv "${temp_dir}"/kernel.deb "${R}"/tmp/kernel.deb
851 mv "${temp_dir}"/kernel.deb "${R}"/tmp/kernel.deb
851
852
852 # Set permissions
853 # Set permissions
853 chown -R root:root "${R}"/tmp/kernel.deb
854 chown -R root:root "${R}"/tmp/kernel.deb
854
855
855 # Install kernel
856 # Install kernel
856 chroot_exec dpkg -i /tmp/kernel.deb
857 chroot_exec dpkg -i /tmp/kernel.deb
857
858
858 # move /boot to /boot/firmware to fit script env.
859 # move /boot to /boot/firmware to fit script env.
859 #mkdir "${BOOT_DIR}"
860 #mkdir "${BOOT_DIR}"
860 mkdir "${temp_dir}"/firmware
861 mkdir "${temp_dir}"/firmware
861 mv "${R}"/boot/* "${temp_dir}"/firmware/
862 mv "${R}"/boot/* "${temp_dir}"/firmware/
862 mv "${temp_dir}"/firmware "${R}"/boot/
863 mv "${temp_dir}"/firmware "${R}"/boot/
863
864
864 #same for kernel headers
865 #same for kernel headers
865 if [ "$KERNEL_HEADERS" = true ] ; then
866 if [ "$KERNEL_HEADERS" = true ] ; then
866 # Fetch kernel header
867 # Fetch kernel header
867 as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL"
868 as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL"
868 mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb
869 mv "${temp_dir}"/kernel-header.deb "${R}"/tmp/kernel-header.deb
869 chown -R root:root "${R}"/tmp/kernel-header.deb
870 chown -R root:root "${R}"/tmp/kernel-header.deb
870 # Install kernel header
871 # Install kernel header
871 chroot_exec dpkg -i /tmp/kernel-header.deb
872 chroot_exec dpkg -i /tmp/kernel-header.deb
872 rm -f "${R}"/tmp/kernel-header.deb
873 rm -f "${R}"/tmp/kernel-header.deb
873 fi
874 fi
874
875
875 # Remove temporary directory and files
876 # Remove temporary directory and files
876 rm -fr "${temp_dir}"
877 rm -fr "${temp_dir}"
877 rm -f "${R}"/tmp/kernel.deb
878 rm -f "${R}"/tmp/kernel.deb
878 fi
879 fi
879
880
880 # Check if kernel installation was successful
881 # Check if kernel installation was successful
881 KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)"
882 KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)"
882 if [ -z "$KERNEL" ] ; then
883 if [ -z "$KERNEL" ] ; then
883 echo "error: kernel installation failed! (/boot/kernel* not found)"
884 echo "error: kernel installation failed! (/boot/kernel* not found)"
884 cleanup
885 cleanup
885 exit 1
886 exit 1
886 fi
887 fi
887 fi
888 fi
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant