##// END OF EJS Templates
let it break again?
Unknown -
r494:29368aadd81d
parent child
Show More
@@ -7,12 +7,13
7 7
8 8 # Need to use kali kernel src if nexmon is enabled
9 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 11 KERNEL_URL="${KALI_KERNEL_URL}"
12 KERNEL_BRANCH=""
11 13 fi
12 14
13 15 # Fetch and build latest raspberry kernel
14 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 17 # Setup source directory
17 18 mkdir -p "${KERNEL_DIR}"
18 19
@@ -230,24 +231,22 if [ "$BUILD_KERNEL" = true ] ; then
230 231 fi
231 232
232 233 # KERNEL_DEFAULT_GOV was set by user
233 if ! [ "$KERNEL_DEFAULT_GOV" = POWERSAVE ] && [ -n "$KERNEL_DEFAULT_GOV" ]; then
234 # unset default governor
235 unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
234 if [ "$KERNEL_DEFAULT_GOV" != powersave ] && [ -n "$KERNEL_DEFAULT_GOV" ]; then
236 235
237 236 case "$KERNEL_DEFAULT_GOV" in
238 "performance")
237 performance)
239 238 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y
240 239 ;;
241 "userspace")
240 userspace)
242 241 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y
243 242 ;;
244 "ondemand")
243 ondemand)
245 244 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y
246 245 ;;
247 "conservative")
246 conservative)
248 247 set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y
249 248 ;;
250 "shedutil")
249 shedutil)
251 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 254 exit 1
256 255 ;;
257 256 esac
257
258 # unset previous default governor
259 unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE
258 260 fi
259 261
260 262
1 NO CONTENT: modified file
@@ -64,6 +64,7 if [ "$ENABLE_CRYPTFS" = true ] ; then
64 64 fi
65 65 fi
66 66
67 # Enable Kernel messages on standard output
67 68 if [ "$ENABLE_PRINTK" = true ] ; then
68 69 install_readonly files/sysctl.d/83-rpi-printk.conf "${ETC_DIR}/sysctl.d/83-rpi-printk.conf"
69 70 fi
@@ -86,7 +87,7 fi
86 87 # Install firmware config
87 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 91 if [ "$ENABLE_TURBO" = true ] ; then
91 92 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
92 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 151 # Activate services
151 152 chroot_exec systemctl enable pi-bluetooth.hciuart.service
152 chroot_exec systemctl enable pi-bluetooth.bthelper@serial1.service
153 153
154 154 else # if ENABLE_BLUETOOTH = false
155 155 # set overlay to disable bluetooth
@@ -167,13 +167,6 if [ "$ENABLE_CONSOLE" = true ] ; then
167 167 chroot_exec systemctl enable serial-getty@serial0.service
168 168 else
169 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 170 fi
178 171
179 172 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
@@ -211,6 +204,11 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
211 204
212 205 # Change back into script root dir
213 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 212 fi
215 213
216 214 # Install firmware boot cmdline
@@ -57,6 +57,20 else # ENABLE_DHCP=false
57 57 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\
58 58 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\
59 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 74 fi
61 75
62 76 # Remove empty settings from network configuration
@@ -87,8 +87,7 chroot_remove_cc() {
87 87 COMPILER_PACKAGES=""
88 88 fi
89 89 }
90 #GPL v2.0
91 #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
90 # GPL v2.0 - #https://github.com/sakaki-/bcmrpi3-kernel-bis/blob/master/conform_config.sh
92 91 set_kernel_config() {
93 92 # flag as $1, value to set as $2, config must exist at "./.config"
94 93 TGT="CONFIG_${1#CONFIG_}"
@@ -99,10 +98,18 set_kernel_config() {
99 98 echo "${TGT}"="${2}" >> .config
100 99 fi
101 100 }
102
101 # unset kernel config parameter
103 102 unset_kernel_config() {
104 103 # unsets flag with the value of $1, config must exist at "./.config"
105 104 TGT="CONFIG_${1#CONFIG_}"
106 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 183 KERNEL_ZSWAP=${KERNEL_ZSWAP:=false}
184 184 KERNEL_VIRT=${KERNEL_VIRT:=false}
185 185 KERNEL_BPF=${KERNEL_BPF:=false}
186 KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=POWERSAVE}
186 KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=powersave}
187 187
188 188 # Kernel compilation from source directory settings
189 189 KERNELSRC_DIR=${KERNELSRC_DIR:=""}
@@ -345,6 +345,9 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
345 345 if [ "$ENABLE_BLUETOOTH" = true ] ; then
346 346 APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez"
347 347 fi
348 if [ "$ENABLE_WIRELESS" = true ] ; then
349 APT_INCLUDES="${APT_INCLUDES},wireless-tools,crda,wireless-regdb"
350 fi
348 351 else # Raspberry PI 1,1P,2 without Wifi and bluetooth onboard
349 352 # Check if the internal wireless interface is not supported by the RPi model
350 353 if [ "$ENABLE_WIRELESS" = true ] || [ "$ENABLE_BLUETOOTH" = true ]; then
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant