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