[LEDE-DEV] [PATCH] config: add option to select kernel compile optimization type

Jonas Gorski jonas.gorski at gmail.com
Sun Jan 21 04:37:44 PST 2018


Hi,

On 18 January 2018 at 10:50, Koen Vandeputte
<koen.vandeputte at ncentric.com> wrote:
> A lot of targets have more than sufficient space to allow
> building the kernel for speed iso size.
>
> Export this performance option to the main config:
>
> - Making it easy accessable for users
> - Discarding the need to adjust it in the kernel config each time
> when building from scratch and only using "make oldconfig"
>
> Compiling for size is still the default.

This would be a "regression" for layerscape, as this target sets
CC_OPTIMIZE_FOR_PERFORMANCE to y.

>
> Purely informational:
>
> On my cns3xxx board, kernel size increases by ~100kB
> but boot time decreased by ~8%.
>
> Signed-off-by: Koen Vandeputte <koen.vandeputte at ncentric.com>
> ---
>  config/Config-kernel.in | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/config/Config-kernel.in b/config/Config-kernel.in
> index fa06b5044219..b98c5dd04591 100644
> --- a/config/Config-kernel.in
> +++ b/config/Config-kernel.in
> @@ -194,6 +194,22 @@ config KERNEL_DEBUG_GPIO
>         bool "Compile the kernel with gpio debugging"
>         select KERNEL_DEBUG_KERNEL
>
> +config KERNEL_CC_OPTIMIZE_FOR_PERFORMANCE
> +        bool
> +        default y if COMPILE_KERNEL_FOR_SPEED
> +        default n
> +
> +config KERNEL_CC_OPTIMIZE_FOR_SIZE
> +        bool
> +        default n if COMPILE_KERNEL_FOR_SPEED
> +        default y
> +
> +config COMPILE_KERNEL_FOR_SPEED
> +        bool "Optimize the kernel for speed instead of size"
> +        default n
> +        help
> +          This will compile your kernel for maximum speed (-O2) instead of smaller size (-Os)

The kernel uses a choice here, so I think it would be better to just
copy that. One less config option as well.

Also the options should be removed from the kernel configs then.


Regards
Jonas



More information about the Lede-dev mailing list