@@ -7,12 +7,13 | |||||
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 | echo "WARNING: if ENABLE_NEXMON is used remember to put the CORRECT KERNELSRC IN KERNELSRC_DIR!!!!!1!" | |||
10 | KERNEL_URL="${KALI_KERNEL_URL}" |
|
11 | KERNEL_URL="${KALI_KERNEL_URL}" | |
|
12 | KERNEL_BRANCH="" | |||
11 | fi |
|
13 | fi | |
12 |
|
14 | |||
13 | # Fetch and build latest raspberry kernel |
|
15 | # Fetch and build latest raspberry kernel | |
14 | if [ "$BUILD_KERNEL" = true ] ; then |
|
16 | if [ "$BUILD_KERNEL" = true ] ; then | |
15 | echo "WARNING: if ENABLE_NEXMON is used remember to put the CORRECT KERNELSRC IN KERNELSRC_DIR!!!!!1!" |
|
|||
16 | # Setup source directory |
|
17 | # Setup source directory | |
17 | mkdir -p "${KERNEL_DIR}" |
|
18 | mkdir -p "${KERNEL_DIR}" | |
18 |
|
19 | |||
@@ -230,24 +231,22 if [ "$BUILD_KERNEL" = true ] ; then | |||||
230 | fi |
|
231 | fi | |
231 |
|
232 | |||
232 | # KERNEL_DEFAULT_GOV was set by user |
|
233 | # KERNEL_DEFAULT_GOV was set by user | |
233 |
if |
|
234 | if [ "$KERNEL_DEFAULT_GOV" != powersave ] && [ -n "$KERNEL_DEFAULT_GOV" ]; then | |
234 | # unset default governor |
|
|||
235 | unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE |
|
|||
236 |
|
235 | |||
237 | case "$KERNEL_DEFAULT_GOV" in |
|
236 | case "$KERNEL_DEFAULT_GOV" in | |
238 |
|
|
237 | performance) | |
239 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y |
|
238 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y | |
240 | ;; |
|
239 | ;; | |
241 |
|
|
240 | userspace) | |
242 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y |
|
241 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y | |
243 | ;; |
|
242 | ;; | |
244 |
|
|
243 | ondemand) | |
245 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y |
|
244 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y | |
246 | ;; |
|
245 | ;; | |
247 |
|
|
246 | conservative) | |
248 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y |
|
247 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y | |
249 | ;; |
|
248 | ;; | |
250 |
|
|
249 | shedutil) | |
251 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y |
|
250 | set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y | |
252 | ;; |
|
251 | ;; | |
253 | *) |
|
252 | *) | |
@@ -255,6 +254,9 if [ "$BUILD_KERNEL" = true ] ; then | |||||
255 | exit 1 |
|
254 | exit 1 | |
256 | ;; |
|
255 | ;; | |
257 | esac |
|
256 | esac | |
|
257 | ||||
|
258 | # unset previous default governor | |||
|
259 | unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE | |||
258 | fi |
|
260 | fi | |
259 |
|
261 | |||
260 |
|
262 |
1 | NO CONTENT: modified file |
|
NO CONTENT: modified file |
@@ -64,6 +64,7 if [ "$ENABLE_CRYPTFS" = true ] ; then | |||||
64 | fi |
|
64 | fi | |
65 | fi |
|
65 | fi | |
66 |
|
66 | |||
|
67 | # Enable Kernel messages on standard output | |||
67 | if [ "$ENABLE_PRINTK" = true ] ; then |
|
68 | if [ "$ENABLE_PRINTK" = true ] ; then | |
68 | install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf" |
|
69 | install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf" | |
69 | fi |
|
70 | fi | |
@@ -86,7 +87,7 fi | |||||
86 | # Install firmware config |
|
87 | # Install firmware config | |
87 | install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" |
|
88 | install_readonly files/boot/config.txt "${BOOT_DIR}/config.txt" | |
88 |
|
89 | |||
89 | #locks cpu at max frequency |
|
90 | # Locks CPU frequency at maximum | |
90 | if [ "$ENABLE_TURBO" = true ] ; then |
|
91 | if [ "$ENABLE_TURBO" = true ] ; then | |
91 | echo "force_turbo=1" >> "${BOOT_DIR}/config.txt" |
|
92 | echo "force_turbo=1" >> "${BOOT_DIR}/config.txt" | |
92 | # helps to avoid sdcard corruption when force_turbo is enabled. |
|
93 | # helps to avoid sdcard corruption when force_turbo is enabled. | |
@@ -149,7 +150,6 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||||
149 |
|
150 | |||
150 | # Activate services |
|
151 | # Activate services | |
151 | chroot_exec systemctl enable pi-bluetooth.hciuart.service |
|
152 | chroot_exec systemctl enable pi-bluetooth.hciuart.service | |
152 | chroot_exec systemctl enable pi-bluetooth.bthelper@serial1.service |
|
|||
153 |
|
153 | |||
154 | else # if ENABLE_BLUETOOTH = false |
|
154 | else # if ENABLE_BLUETOOTH = false | |
155 | # set overlay to disable bluetooth |
|
155 | # set overlay to disable bluetooth | |
@@ -167,13 +167,6 if [ "$ENABLE_CONSOLE" = true ] ; then | |||||
167 | chroot_exec systemctl enable serial-getty@serial0.service |
|
167 | chroot_exec systemctl enable serial-getty@serial0.service | |
168 | else |
|
168 | else | |
169 | echo "enable_uart=0" >> "${BOOT_DIR}/config.txt" |
|
169 | echo "enable_uart=0" >> "${BOOT_DIR}/config.txt" | |
170 | # disable serial console systemd style |
|
|||
171 | #chroot_exec systemctl disable serial-getty@serial0.service |
|
|||
172 | fi |
|
|||
173 |
|
||||
174 | # Remove cmdline.txt entry of starting zswap |
|
|||
175 | if [ "$KERNEL_ZSWAP" = true ] ; then |
|
|||
176 | CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4" |
|
|||
177 | fi |
|
170 | fi | |
178 |
|
171 | |||
179 | if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then |
|
172 | if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then | |
@@ -211,6 +204,11 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then | |||||
211 |
|
204 | |||
212 | # Change back into script root dir |
|
205 | # Change back into script root dir | |
213 | cd "${WORKDIR}" || exit |
|
206 | cd "${WORKDIR}" || exit | |
|
207 | else | |||
|
208 | # Enable ZSWAP in cmdline if systemd-swap is not used | |||
|
209 | if [ "$KERNEL_ZSWAP" = true ] ; then | |||
|
210 | CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4" | |||
|
211 | fi | |||
214 | fi |
|
212 | fi | |
215 |
|
213 | |||
216 | # Install firmware boot cmdline |
|
214 | # Install firmware boot cmdline |
@@ -57,6 +57,20 else # ENABLE_DHCP=false | |||||
57 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\ |
|
57 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\ | |
58 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\ |
|
58 | -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\ | |
59 | "${ETC_DIR}/systemd/network/eth.network" |
|
59 | "${ETC_DIR}/systemd/network/eth.network" | |
|
60 | ||||
|
61 | if [ "$CRYPTFS_DROPBEAR" = true ] ; then | |||
|
62 | # Get cdir from NET_ADDRESS e.g. 24 | |||
|
63 | cdir=$(${NET_ADDRESS} | cut -d '/' -f2) | |||
|
64 | ||||
|
65 | # Convert cdir ro netmask e.g. 24 to 255.255.255.0 | |||
|
66 | NET_MASK=$(cdr2mask "$cdir") | |||
|
67 | ||||
|
68 | # Write static ip settings to "${ETC_DIR}"/initramfs-tools/initramfs.conf | |||
|
69 | sed -i "\$aIP=${NET_ADDRESS}::${NET_GATEWAY}:${NET_MASK}:${HOSTNAME}:" "${ETC_DIR}"/initramfs-tools/initramfs.conf | |||
|
70 | ||||
|
71 | # Regenerate initramfs | |||
|
72 | chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}" | |||
|
73 | fi | |||
60 | fi |
|
74 | fi | |
61 |
|
75 | |||
62 | # Remove empty settings from network configuration |
|
76 | # Remove empty settings from network configuration |
@@ -87,8 +87,7 chroot_remove_cc() { | |||||
87 | COMPILER_PACKAGES="" |
|
87 | COMPILER_PACKAGES="" | |
88 | fi |
|
88 | fi | |
89 | } |
|
89 | } | |
90 | #GPL v2.0 |
|
90 | # GPL v2.0 - #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh | |
91 | #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh |
|
|||
92 | set_kernel_config() { |
|
91 | set_kernel_config() { | |
93 | # flag as $1, value to set as $2, config must exist at "./.config" |
|
92 | # flag as $1, value to set as $2, config must exist at "./.config" | |
94 | TGT="CONFIG_${1#CONFIG_}" |
|
93 | TGT="CONFIG_${1#CONFIG_}" | |
@@ -99,10 +98,18 set_kernel_config() { | |||||
99 | echo "${TGT}"="${2}" >> .config |
|
98 | echo "${TGT}"="${2}" >> .config | |
100 | fi |
|
99 | fi | |
101 | } |
|
100 | } | |
102 |
|
101 | # unset kernel config parameter | ||
103 | unset_kernel_config() { |
|
102 | unset_kernel_config() { | |
104 | # unsets flag with the value of $1, config must exist at "./.config" |
|
103 | # unsets flag with the value of $1, config must exist at "./.config" | |
105 | TGT="CONFIG_${1#CONFIG_}" |
|
104 | TGT="CONFIG_${1#CONFIG_}" | |
106 | sed -i "s/^${TGT}=.*/# ${TGT} is not set/" .config |
|
105 | sed -i "s/^${TGT}=.*/# ${TGT} is not set/" .config | |
107 | } |
|
106 | } | |
108 | # No newline at end of file |
|
107 | ||
|
108 | # https://serverfault.com/a/682849 - converts e.g. /24 to 255.255.255.0 | |||
|
109 | cdr2mask () | |||
|
110 | { | |||
|
111 | # Number of args to shift, 255..255, first non-255 byte, zeroes | |||
|
112 | set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0 | |||
|
113 | [ $1 -gt 1 ] && shift $1 || shift | |||
|
114 | echo ${1-0}.${2-0}.${3-0}.${4-0} | |||
|
115 | } No newline at end of file |
@@ -183,7 +183,7 KERNEL_CCACHE=${KERNEL_CCACHE:=false} | |||||
183 | KERNEL_ZSWAP=${KERNEL_ZSWAP:=false} |
|
183 | KERNEL_ZSWAP=${KERNEL_ZSWAP:=false} | |
184 | KERNEL_VIRT=${KERNEL_VIRT:=false} |
|
184 | KERNEL_VIRT=${KERNEL_VIRT:=false} | |
185 | KERNEL_BPF=${KERNEL_BPF:=false} |
|
185 | KERNEL_BPF=${KERNEL_BPF:=false} | |
186 |
KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:= |
|
186 | KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=powersave} | |
187 |
|
187 | |||
188 | # Kernel compilation from source directory settings |
|
188 | # Kernel compilation from source directory settings | |
189 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} |
|
189 | KERNELSRC_DIR=${KERNELSRC_DIR:=""} | |
@@ -345,6 +345,9 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then | |||||
345 | if [ "$ENABLE_BLUETOOTH" = true ] ; then |
|
345 | if [ "$ENABLE_BLUETOOTH" = true ] ; then | |
346 | APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez" |
|
346 | APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez" | |
347 | fi |
|
347 | fi | |
|
348 | if [ "$ENABLE_WIRELESS" = true ] ; then | |||
|
349 | APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb" | |||
|
350 | fi | |||
348 | else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard |
|
351 | else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard | |
349 | # Check if the internal wireless interface is not supported by the RPi model |
|
352 | # Check if the internal wireless interface is not supported by the RPi model | |
350 | if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then |
|
353 | if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then |
General Comments 0
Vous devez vous connecter pour laisser un commentaire.
Se connecter maintenant