linux: do not always depend on host-lzop
v2 cover linux: do not always depend on host-lzop
From: "Yann E. MORIN" <[email protected]>
Hello All!
Here is a small series that makes Linux not always depend on host-lzop, and also cleans up a little bit the linux.mk.
Changes v1 -> v2:
- use simpler sed expression (Peter)
- don't use 'define' to define the function (Arnout)
- initrd and initramfs may also require lzo (Peter)
- move qstrip to the initial assignment (Arnout)
- check the linux config file exists (Peter)
Regards,
Yann E. MORIN.
----------------------------------------------------------------
Yann E. MORIN (3):
packages infra: add function to get a Kconfig option
linux: only depend on host-lzop if needed
linux: check the configuration file exists
linux/linux.mk | 15 +++++++++++++-- package/pkg-utils.mk | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/3 packages infra: add function to get a Kconfig option
From: "Yann E. MORIN" <[email protected]>
We so far have no mean to get the value from a Kconfig option from the .config file of a package (eg. linux, busybox...).
Add a new function that returns the unmangled value of an option. It expect two arguments:
- the Kconfig option name (complete, with leading CONFIG if necessary)
- the .config file to get it from
Note that, if the Kconfig option is a string, the returned value will contain the leading and trailing double-quotes.
---
Changes v1 -> v2:
- use simpler sed expression (Peter)
- use simple assignment, not a define (Arnout)
Note: when we have the Kconfig's 'config' script, we can revisit this to use 'config' instead of our own sed hack.
--- package/pkg-utils.mk | 2 ++ 1 file changed, 2 insertions(+)
package/pkg-utils.mk +2 -0
@@ -52,6 +52,8 @@ define KCONFIG_DISABLE_OPT echo "# $(1) is not set" >> $(2) endef +KCONFIG_GET_OPT = $(shell sed -e 's/^$(1)=//p' $(2)) + # Helper functions to determine the name of a package and its # directory from its makefile directory, using the $(MAKEFILE_LIST) # variable provided by make. This is used by the *TARGETS macros to
Signature · 1 line
1.8.1.2
PATCH v2 2/3 linux: only depend on host-lzop if needed
In reply to Yann E. MORINFrom: "Yann E. MORIN" <[email protected]>
There is no reason to always depend on host-lzop, even when the kernel compression is not LZO.
Since LZO is not the default compression option in the kernel (and there is not sign that will change in the foreseeable future), it will always appear in a config file, whether it is a complete config file or it is only a defconfig.
So, only depend on host-lzop if the LZO compression is enabled in the kernel config file (either the defconfig or the custom config file). This includes:
- kernel compression itself
- initrd compression
- initramfs compression
---
Changes v1 -> v2:
- also select if initrd or initramfs compression is lzo (Peter)
--- linux/linux.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
linux/linux.mk +9 -2
@@ -41,7 +41,7 @@ endif LINUX_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) LINUX_INSTALL_IMAGES = YES -LINUX_DEPENDENCIES += host-kmod host-lzop +LINUX_DEPENDENCIES += host-kmod ifeq ($(BR2_LINUX_KERNEL_UBOOT_IMAGE),y) LINUX_DEPENDENCIES += host-uboot-tools
@@ -163,7 +163,14 @@ LINUX_POST_PATCH_HOOKS += LINUX_APPLY_PATCHES ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y) KERNEL_SOURCE_CONFIG = $(KERNEL_ARCH_PATH)/configs/$(call qstrip,$(BR2_LINUX_KERNEL_DEFCONFIG))_defconfig else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y) -KERNEL_SOURCE_CONFIG = $(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE) +KERNEL_SOURCE_CONFIG = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE)) +endif + +ifeq ($(call KCONFIG_GET_OPT,CONFIG_KERNEL_LZO,$(KERNEL_SOURCE_CONFIG)),y) +LINUX_DEPENDENCIES += host-lzop +endif +ifeq ($(call KCONFIG_GET_OPT,CONFIG_RD_LZO,$(KERNEL_SOURCE_CONFIG)),y) +LINUX_DEPENDENCIES += host-lzop endif define LINUX_CONFIGURE_CMDS
Signature · 1 line
1.8.1.2
PATCH v2 3/3 linux: check the configuration file exists
In reply to Yann E. MORINFrom: "Yann E. MORIN" <[email protected]>
... and abort early, before we even use it.
--- linux/linux.mk | 4 ++++ 1 file changed, 4 insertions(+)
linux/linux.mk +4 -0
@@ -166,6 +166,10 @@ else ifeq ($(BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG),y) KERNEL_SOURCE_CONFIG = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE)) endif +ifeq ($(wildcard $(KERNEL_SOURCE_CONFIG)),) +$(error Configuration file '$(KERNEL_SOURCE_CONFIG)' not found.) +endif + ifeq ($(call KCONFIG_GET_OPT,CONFIG_KERNEL_LZO,$(KERNEL_SOURCE_CONFIG)),y) LINUX_DEPENDENCIES += host-lzop endif
Signature · 1 line
1.8.1.2
v2 cover linux: do not always depend on host-lzop
In reply to Yann E. MORINDear Yann E. MORIN,
Quoted 2 lines · Yann E. MORIN
Here is a small series that makes Linux not always depend on host-lzop, and also cleans up a little bit the linux.mk.
Series applied, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
v2 cover linux: do not always depend on host-lzop
Hello,
Quoted 8 lines · Thomas Petazzoni
Dear Yann E. MORIN,
Quoted 2 lines · Yann E. MORIN
Here is a small series that makes Linux not always depend on host-lzop, and also cleans up a little bit the linux.mk.
Series applied, thanks.
And I've reverted it because it simply cannot work with internal defconfig of the kernel, since they are only available after the kernel has been extracted, which is too late to declare whether we need the host-lzop dependency or not.
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com