From 816670ca587b6812c6fe7d80f1c3a121091e8f63 2018-11-26 01:57:39 From: Unknown Date: 2018-11-26 01:57:39 Subject: [PATCH] zswap userland sup --- diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index cb1930b..c91b0ef 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -91,7 +91,7 @@ if [ "$BUILD_KERNEL" = true ] ; then cd "${KERNEL_DIR}" || exit # enable ZSWAP see https://askubuntu.com/a/472227 or https://wiki.archlinux.org/index.php/zswap - if [ "$KERNEL_ZSWAP" = true ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then + if [ "$KERNEL_ZSWAP" = true ] ; then set_kernel_config CONFIG_ZPOOL y set_kernel_config CONFIG_ZSWAP y set_kernel_config CONFIG_ZBUD y @@ -109,7 +109,7 @@ if [ "$BUILD_KERNEL" = true ] ; then fi # Netfilter kernel support See https://github.com/raspberrypi/linux/issues/2177#issuecomment-354647406 - if [ "$KERNEL_NF" = true ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then + if [ "$KERNEL_NF" = true ] ; then set_kernel_config CONFIG_IP_NF_TARGET_SYNPROXY m set_kernel_config CONFIG_NETFILTER_XT_MATCH_CGROUP m set_kernel_config CONFIG_NETFILTER_XT_MATCH_IPCOMP m @@ -216,7 +216,7 @@ if [ "$BUILD_KERNEL" = true ] ; then fi # 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 - if [ "$KERNEL_BPF" = true ] && { [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; } ; then + if [ "$KERNEL_BPF" = true ] ; then set_kernel_config CONFIG_BPF_SYSCALL y set_kernel_config CONFIG_BPF_EVENTS y set_kernel_config CONFIG_BPF_STREAM_PARSER y diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 9e8d9ed..98d005a 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -64,12 +64,40 @@ if [ "$ENABLE_CRYPTFS" = true ] ; then fi fi +if [ "$KERNEL_ZSWAP" = true ] ; then + # Create temporary directory for systemd-swap sources + temp_dir=$(as_nobody mktemp -d) + + # Fetch systemd-swap sources + as_nobody git -C "${temp_dir}" clone "${ZSWAP_URL}" + + # Copy downloaded systemd-swap sources + mv "${temp_dir}/systemd-swap" "${R}/tmp/" + + # Set permissions of the systemd-swap sources + chown -R root:root "${R}/tmp/systemd-swap" + + # Remove temporary directory for systemd-swap sources + rm -fr "${temp_dir}" + + # Change into downloaded src dir + cd "${R}/tmp/systemd-swap" || exit + + # Build package + . ./systemd-swap/package.sh debian + + # Install package + chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap-*any.deb + + # Change back into script root dir + cd "${WORKDIR}" || exit +fi + #locks cpu at max frequency if [ "$ENABLE_TURBO" = true ] ; then echo "force_turbo=1" >> "${BOOT_DIR}/config.txt" # helps to avoid sdcard corruption when force_turbo is enabled. echo "boot_delay=1" >> "${BOOT_DIR}/config.txt" - fi if [ "$ENABLE_PRINTK" = true ] ; then diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 187842e..dfd82f0 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -64,6 +64,8 @@ RPI3_64_DEF_KERNEL_URL=${RPI3_64_DEF_KERNEL_URL:=https://github.com/sakaki-/bcmr RPI3_64_KERNEL_URL=${RPI3_64_KERNEL_URL:=$RPI3_64_BIS_KERNEL_URL} BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} NEXMON_URL=${NEXMON_URL:=https://github.com/seemoo-lab/nexmon.git} +ZSWAP_URL=${ZSWAP_URL:=https://github.com/Nefelim4ag/systemd-swap.git} + # Build directories WORKDIR=$(pwd)