##// END OF EJS Templates
zswap systemdswap
Unknown -
r460:63d5bd9df575
parent child
Show More
@@ -212,6 +212,9 Support for halt,init,poweroff,reboot,runlevel,shutdown,telinit commands
212 212 ---
213 213
214 214 #### Advanced system features:
215 ##### `ENABLE_SYSTEMDSWAP`=false
216 Enables [Systemd-swap service](https://github.com/Nefelim4ag/systemd-swap). Usefull if `KERNEL_ZSWAP` is enabled.
217
215 218 ##### `ENABLE_MINBASE`=false
216 219 Use debootstrap script variant `minbase` which only includes essential packages and apt. This will reduce the disk usage by about 65 MB.
217 220
@@ -415,7 +415,10 if [ "$BUILD_KERNEL" = true ] ; then
415 415 else # BUILD_KERNEL=false
416 416 # echo Install precompiled kernel...
417 417 # echo error: not implemented
418 if [ "$KERNEL_ARCH" = arm64 ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then
418 if [ "$SET_ARCH" = 64 ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then
419 if [ "$KERNEL_ZSWAP" = true ] ; then
420 RPI3_64_KERNEL_URL=RPI3_64_BIS_KERNEL_URL
421 fi
419 422 # Create temporary directory for dl
420 423 temp_dir=$(as_nobody mktemp -d)
421 424
@@ -437,6 +440,27 else # BUILD_KERNEL=false
437 440 #Create cmdline.txt for 15-rpi-config.sh
438 441 touch "${BOOT_DIR}/cmdline.txt"
439 442 fi
443
444 # INstall Kernel from hypriot comptabile with all Raspberry PI
445 if [ "$SET_ARCH" = 32 ] ; then
446 # Create temporary directory for dl
447 temp_dir=$(as_nobody mktemp -d)
448
449 # Fetch kernel
450 as_nobody wget -O "${temp_dir}"/kernel.deb -c "$RPI_32_KERNEL_URL"
451
452 # Fetch kernel header
453 as_nobody wget -O "${temp_dir}"/kernel-header.deb -c "$RPI_32_KERNELHEADER_URL"
454
455 # Install kernel
456 chroot_exec dpkg -i "${temp_dir}"/kernel.deb
457
458 # Install kernel header
459 chroot_exec dpkg -i "${temp_dir}"/kernel-header.deb
460
461 # Remove temporary directory for U-Boot sources
462 rm -fr "${temp_dir}"
463 fi
440 464
441 465 # Check if kernel installation was successful
442 466 KERNEL="$(ls -1 "${R}"/boot/firmware/kernel* | sort | tail -n 1)"
@@ -445,4 +469,4 else # BUILD_KERNEL=false
445 469 cleanup
446 470 exit 1
447 471 fi
448 fi
472 fi
@@ -64,35 +64,6 if [ "$ENABLE_CRYPTFS" = true ] ; then
64 64 fi
65 65 fi
66 66
67 if [ "$KERNEL_ZSWAP" = true ] ; then
68 # Create temporary directory for systemd-swap sources
69 temp_dir=$(as_nobody mktemp -d)
70
71 # Fetch systemd-swap sources
72 as_nobody git -C "${temp_dir}" clone "${ZSWAP_URL}"
73
74 # Copy downloaded systemd-swap sources
75 mv "${temp_dir}/systemd-swap" "${R}/tmp/"
76
77 # Set permissions of the systemd-swap sources
78 chown -R root:root "${R}/tmp/systemd-swap"
79
80 # Remove temporary directory for systemd-swap sources
81 rm -fr "${temp_dir}"
82
83 # Change into downloaded src dir
84 cd "${R}/tmp/systemd-swap" || exit
85
86 # Build package
87 . ./systemd-swap/package.sh debian
88
89 # Install package
90 chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap-*any.deb
91
92 # Change back into script root dir
93 cd "${WORKDIR}" || exit
94 fi
95
96 67 #locks cpu at max frequency
97 68 if [ "$ENABLE_TURBO" = true ] ; then
98 69 echo "force_turbo=1" >> "${BOOT_DIR}/config.txt"
@@ -191,6 +162,48 else
191 162 chroot_exec systemctl disable serial-getty@"$SET_SERIAL".service
192 163 fi
193 164
165 # Remove cmdline.txt entry of starting zswap
166 if [ "$KERNEL_ZSWAP" = true ] ; then
167 CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4"
168 fi
169
170 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
171
172 # Remove cmdline.txt entry of starting zswap
173 if [ "$KERNEL_ZSWAP" = true ] ; then
174 sed -i 's|zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4||g'
175 fi
176 # Create temporary directory for systemd-swap sources
177 temp_dir=$(as_nobody mktemp -d)
178
179 # Fetch systemd-swap sources
180 as_nobody git -C "${temp_dir}" clone "${ZSWAP_URL}"
181
182 # Copy downloaded systemd-swap sources
183 mv "${temp_dir}/systemd-swap" "${R}/tmp/"
184
185 # Set permissions of the systemd-swap sources
186 chown -R root:root "${R}/tmp/systemd-swap"
187
188 # Remove temporary directory for systemd-swap sources
189 rm -fr "${temp_dir}"
190
191 # Change into downloaded src dir
192 cd "${R}/tmp/systemd-swap" || exit
193
194 # Build package
195 . ./systemd-swap/package.sh debian
196
197 # Install package
198 chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap-*any.deb
199
200 # Enable service
201 chroot_exec systemctl enable systemd-swap
202
203 # Change back into script root dir
204 cd "${WORKDIR}" || exit
205 fi
206
194 207 # Remove IPv6 networking support
195 208 if [ "$ENABLE_IPV6" = false ] ; then
196 209 CMDLINE="${CMDLINE} ipv6.disable=1"
@@ -61,11 +61,12 RPI3_64_BIS_KERNEL_URL=${RPI3_64_BIS_KERNEL_URL:=https://github.com/sakaki-/bcmr
61 61 #default bcmrpi3_defconfig target kernel
62 62 RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmrpi3-kernel/releases/download/4.14.80.20181113/bcmrpi3-kernel-4.14.80.20181113.tar.xz}
63 63 #enhanced kernel
64 RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_BIS_KERNEL_URL}
64 RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_DEF_KERNEL_URL}
65 65 BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git}
66 66 NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git}
67 ZSWAP_URL=${ZSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git}
68
67 SYSTEMDSWAP_URL=${SYSTEMDSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git}
68 RPI_32_KERNEL_URL=${RPI_32_KERNEL_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel_20180422-141901_armhf.deb}
69 RPI_32_KERNELHEADER_URL=${RPI_32_KERNELHEADER_URL:=https://github.com/hypriot/rpi-kernel/releases/download/v4.14.34/raspberrypi-kernel-headers_20180422-141901_armhf.deb}
69 70
70 71 # Build directories
71 72 WORKDIR=$(pwd)
@@ -147,6 +148,7 SSH_ROOT_PUB_KEY=${SSH_ROOT_PUB_KEY:=""}
147 148 SSH_USER_PUB_KEY=${SSH_USER_PUB_KEY:=""}
148 149
149 150 # Advanced settings
151 ENABLE_SYSTEMDSWAP=${ENABLE_MINBASE:=false}
150 152 ENABLE_MINBASE=${ENABLE_MINBASE:=false}
151 153 ENABLE_REDUCE=${ENABLE_REDUCE:=false}
152 154 ENABLE_UBOOT=${ENABLE_UBOOT:=false}
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant