From 7f84c1cfdbfd429b3d962ab338163f75e967bd8f 2018-11-25 22:45:23 From: Unknown Date: 2018-11-25 22:45:23 Subject: [PATCH] set kernel default governor --- diff --git a/README.md b/README.md index 17d7a86..b62ede0 100644 --- a/README.md +++ b/README.md @@ -353,6 +353,9 @@ With this parameter set to true the script expects the existing kernel sources d ##### `RPI_FIRMWARE_DIR`="" The directory (`firmware`) containing a local copy of the firmware from the [RaspberryPi firmware project](https://github.com/raspberrypi/firmware). Default is to download the latest firmware directly from the project. +##### `KERNEL_DEFAULT_GOV`="ONDEMAND" +Set the default cpu governor at kernel compilation. Supported values are: PERFORMANCE POWERSAVE USERSPACE ONDEMAND CONSERVATIVE SCHEDUTIL + ##### `KERNEL_NF`=false Enable Netfilter modules as kernel modules diff --git a/bootstrap.d/13-kernel.sh b/bootstrap.d/13-kernel.sh index ea7843e..cd9fb6f 100644 --- a/bootstrap.d/13-kernel.sh +++ b/bootstrap.d/13-kernel.sh @@ -206,6 +206,36 @@ if [ "$BUILD_KERNEL" = true ] ; then set_kernel_config CONFIG_BPF_EVENTS y set_kernel_config CONFIG_CGROUP_BPF y fi + + # KERNEL_DEFAULT_GOV was set by user + if ! [ "$KERNEL_DEFAULT_GOV" = POWERSAVE ] && [ -n "$KERNEL_DEFAULT_GOV" ]; then + # unset default governor + unset_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE + + case "$KERNEL_DEFAULT_GOV" in + "PERFORMANCE") + set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE y + ;; + "USERSPACE") + set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE y + ;; + "ONDEMAND") + set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND y + ;; + "CONSERVATIVE") + set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE y + ;; + "CONSERVATIVE") + set_kernel_config CONFIG_CPU_FREQ_DEFAULT_GOV_SCHEDUTIL y + ;; + *) + echo "error: unsupported default cpu governor" + exit 1 + ;; + esac + fi + + #Revert to previous directory cd "${WORKDIR}" @@ -249,6 +279,7 @@ if [ "$BUILD_KERNEL" = true ] ; then if [ "$KERNEL_MENUCONFIG" = true ] ; then make -C "${KERNEL_DIR}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" menuconfig fi + # end if "$KERNELSRC_CONFIG" = true fi # Use ccache to cross compile the kernel @@ -265,6 +296,7 @@ if [ "$BUILD_KERNEL" = true ] ; then if grep -q "CONFIG_MODULES=y" "${KERNEL_DIR}/.config" ; then make -C "${KERNEL_DIR}" -j"${KERNEL_THREADS}" ARCH="${KERNEL_ARCH}" CROSS_COMPILE="${CROSS_COMPILE}" CC="${cc}" modules fi + # end if "$KERNELSRC_PREBUILT" = false fi # Check if kernel compilation was successful diff --git a/bootstrap.d/44-nexmon_monitor_patch.sh b/bootstrap.d/44-nexmon_monitor_patch.sh index b514200..a936201 100644 --- a/bootstrap.d/44-nexmon_monitor_patch.sh +++ b/bootstrap.d/44-nexmon_monitor_patch.sh @@ -47,7 +47,7 @@ if [ "$ENABLE_NEXMON" = true ] && [ "$ENABLE_WIRELESS" = true ]; then # Make ancient isl build cd buildtools/isl-0.10 - CC=$CCgcc + CC="${CC}"gcc ./configure make diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index f397de3..187842e 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -175,6 +175,7 @@ KERNEL_CCACHE=${KERNEL_CCACHE:=false} KERNEL_ZSWAP=${KERNEL_ZSWAP:=false} KERNEL_VIRT=${KERNEL_VIRT:=false} KERNEL_BPF=${KERNEL_BPF:=false} +KERNEL_DEFAULT_GOV=${KERNEL_DEFAULT_GOV:=POWERSAVE} # Kernel compilation from source directory settings KERNELSRC_DIR=${KERNELSRC_DIR:=""}