[LEDE-DEV] [PATCH] config: add option to select kernel compile optimization type
Koen Vandeputte
koen.vandeputte at ncentric.com
Mon Jan 22 01:17:56 PST 2018
On 2018-01-21 13:46, Arjen de Korte wrote:
> Citeren Jonas Gorski <jonas.gorski at gmail.com>:
>
>> 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.
>
> One thing that wonders me, couldn't the option CONFIG_TARGET_OPTIONS=y
> and CONFIG_TARGET_OPTIMIZATION that is already available be used for
> this as well? So far I have used this to set the optimization used,
> which seems to do the job just fine (for the whole target, not just
> the kernel).
>
>
Only packages are affected by this flag. (If they don't override it by
setting -O flags themselves)
Also, using this one for the kernel too changes building to "all or nothing"
Depending on target space, it can be useful to just have a fast kernel
(O2), with slower packages (Os) or vice-versa
More information about the Lede-dev
mailing list