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