All of lore.kernel.org
 help / color / mirror / Atom feed
From: Romain Naour <romain.naour@openwide.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2/2 v9] package/linux-backports: switch to using the kernel-module infra
Date: Sat, 25 Jul 2015 12:13:59 +0200	[thread overview]
Message-ID: <55B36167.7070707@openwide.fr> (raw)
In-Reply-To: <be87567542fc8e3133115311bc25fd91df40ed38.1437688336.git.yann.morin.1998@free.fr>

Hi Yann, all

Le 23/07/2015 23:55, Yann E. MORIN a ?crit :
> linux-backports manually generates its autoconf.h header, which needs a
> .config file.
> 
> Using a pre- or post-configure hook does not really work, because
> generating that file touches the .config, and thus our .stamp files ar
> enot longer properly time-ordered and running a subsequent make would
> incorrectly believe it has to rebuild linux-backports.
> 
> So, even though this is not a fixup proper, we generate that file from
> the _KCONFIG_FIXUP_CMDS to ensure the stampt file is created after we
> touch .config.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Petr Vorel <petr.vorel@gmail.com>
> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

Reviewed-by: Romain Naour <romain.naour@openwide.fr>

Tested with a x86 3.2 kernel.
Tested-by: Romain Naour <romain.naour@openwide.fr>

> 
> ---
> Changes v8 -> v9:
>   - comment tricky constructs  (Thomas)
>   - use _KCONFIG_FIXUP_CMDS instead of POST_CONFIGURE_HOOKS
> ---
>  package/linux-backports/linux-backports.mk | 48 +++++++++++++++++++-----------
>  1 file changed, 30 insertions(+), 18 deletions(-)
> 
> diff --git a/package/linux-backports/linux-backports.mk b/package/linux-backports/linux-backports.mk
> index e4ac9f4..44ac7e7 100644
> --- a/package/linux-backports/linux-backports.mk
> +++ b/package/linux-backports/linux-backports.mk
> @@ -11,33 +11,44 @@ LINUX_BACKPORTS_SITE = $(BR2_KERNEL_MIRROR)/linux/kernel/projects/backports/stab
>  LINUX_BACKPORTS_LICENSE = GPLv2
>  LINUX_BACKPORTS_LICENSE_FILES = COPYING
>  
> -LINUX_BACKPORTS_DEPENDENCIES = linux
> -
> -LINUX_BACKPORTS_MAKE_OPTS = \
> -	$(LINUX_MAKE_FLAGS) \
> -	KLIB_BUILD=$(LINUX_DIR) \
> -	KLIB=$(TARGET_DIR)
> -
>  ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_DEFCONFIG),y)
>  LINUX_BACKPORTS_KCONFIG_FILE = $(LINUX_BACKPORTS_DIR)/defconfigs/$(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_DEFCONFIG))
>  else ifeq ($(BR2_PACKAGE_LINUX_BACKPORTS_USE_CUSTOM_CONFIG),y)
>  LINUX_BACKPORTS_KCONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CUSTOM_CONFIG_FILE))
>  endif
>  
> -define LINUX_BACKPORTS_BUILD_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) -C $(@D)
> -endef
> -
> -define LINUX_BACKPORTS_INSTALL_TARGET_CMDS
> -	$(TARGET_MAKE_ENV) $(MAKE) $(LINUX_BACKPORTS_MAKE_OPTS) \
> -		-C $(LINUX_DIR) M=$(@D) \
> -		INSTALL_MOD_DIR=backports \
> -		modules_install
> -endef
> -
>  LINUX_BACKPORTS_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_LINUX_BACKPORTS_CONFIG_FRAGMENT_FILES))
>  LINUX_BACKPORTS_KCONFIG_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
>  
> +# linux-backports' build system expects the config options to be present
> +# in the environment, and it is so when using their custom buildsystem,
> +# because they are set in the main Makefile, which then calls a second
> +# Makefile.
> +#
> +# In our case, we do not use that first Makefile. So, we parse the
> +# .config file, filter-out comment lines and put the rest as command
> +# line variables.
> +#
> +# LINUX_BACKPORTS_MAKE_OPTS is used by the kconfig-package infra, while
> +# LINUX_BACKPORTS_MODULE_MAKE_OPTS is used by the kernel-module infra.
> +#
> +LINUX_BACKPORTS_MAKE_OPTS = \
> +	BACKPORT_DIR=$(@D) \
> +	KLIB_BUILD=$(LINUX_DIR) \
> +	KLIB=$(TARGET_DIR)/lib/modules/$(LINUX_VERSION_PROBED) \
> +	INSTALL_MOD_DIR=backports \
> +	`sed -r -e '/^\#/d;' $(@D)/.config`

At first read, I was wondering why $(SED) wasn't used here, but since it
contains -i option we can't use it here. So the .config is not modified.

Thanks Yann for the explanation on IRC ;-)

Thanks Petr for your initial work on this.

Best regards,
Romain

> +
> +LINUX_BACKPORTS_MODULE_MAKE_OPTS = $(LINUX_BACKPORTS_MAKE_OPTS)
> +
> +# This file is not automatically generated by 'oldconfig' that we use in
> +# the kconfig-package infrastructure. In the linux buildsystem, it is
> +# generated by running silentoldconfig, but that's not the case for
> +# linux-backports: it uses a hand-crafted rule to generate that file.
> +define LINUX_BACKPORTS_KCONFIG_FIXUP_CMDS
> +	$(MAKE) -C $(@D) $(LINUX_BACKPORTS_MAKE_OPTS) backport-include/backport/autoconf.h
> +endef
> +
>  # Checks to give errors that the user can understand
>  ifeq ($(BR_BUILDING),y)
>  
> @@ -55,6 +66,7 @@ endif
>  
>  endif # BR_BUILDING
>  
> +$(eval $(kernel-module))
>  $(eval $(kconfig-package))
>  
>  # linux-backports' own .config file needs options from the kernel's own
> 

  reply	other threads:[~2015-07-25 10:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 21:55 [Buildroot] [PATCH 0/2 v9] linux-backports: new package (branch yem/linux-backports) Yann E. MORIN
2015-07-23 21:55 ` [Buildroot] [PATCH 1/2 v9] package/linux-backports: new package Yann E. MORIN
2015-07-25 10:03   ` Romain Naour
2015-07-23 21:55 ` [Buildroot] [PATCH 2/2 v9] package/linux-backports: switch to using the kernel-module infra Yann E. MORIN
2015-07-25 10:13   ` Romain Naour [this message]
2015-07-26 13:43 ` [Buildroot] [PATCH 0/2 v9] linux-backports: new package (branch yem/linux-backports) Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B36167.7070707@openwide.fr \
    --to=romain.naour@openwide.fr \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.