Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: David Lawson <david.lawson1@tx.rr.com>, buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v3] Makefile: fix use of many br2-external trees
Date: Wed, 21 Sep 2022 20:13:20 +0200	[thread overview]
Message-ID: <20220921201320.0a7f80c0@windsurf> (raw)
In-Reply-To: <20220920194645.670432-1-yann.morin.1998@free.fr>

On Tue, 20 Sep 2022 21:46:45 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> The top level Makefile in buildroot has a recursive rule which causes
> the appearance of a hang as the number of directories in BR2_EXTERNAL
> increases. When the number of directories in BR2_EXTERNAL is small, the
> recursion occurs, but make detects the recursion and determines the
> target does not have to be remade. This allows make to progress.
> 
> This is the failing rule:
> 
>     define percent_defconfig
>     # Override the BR2_DEFCONFIG from COMMON_CONFIG_ENV with the new defconfig
>     %_defconfig: $(BUILD_DIR)/buildroot-config/conf $(1)/configs/%_defconfig outputmakefile
>         @$$(COMMON_CONFIG_ENV) BR2_DEFCONFIG=$(1)/configs/$$@ \
>                 $$< --defconfig=$(1)/configs/$$@ $$(CONFIG_CONFIG_IN)
>     endef
>     $(eval $(foreach d,$(call reverse,$(TOPDIR) $(BR2_EXTERNAL_DIRS)),$(call percent_defconfig,$(d))$(sep)))
> 
> The rule for %defconfig is created for each directory in BR2_EXTERNAL.
> When the rule is matched, the stem is 'defconfig_name'. The second
> prerequisite is expanded to $(1)/configs/defconfig_name_defconfig. The
> rule, and all of the other rules defined by this macro, are invoked
> again, but the stem is now $(1)/configs/defconfig_name_defconfig. The
> second prerequisite is now expanded to
> $(1)/configs/($1)/configs/defconfig_name_defconfig. This expansion
> continues until make detects the infinite recursion.
> 
> With up to 5 br2-external trees, the time is very small, so that it is
> not noticeable. But starting with 6 br2-external trees, the time is
> insanely big (so much so that we did not even let it finish after it ran
> for hours); see timings toward the end of the commit log.

Wow, insane stuff!

> One of the rationale behind this code, is that we want the defconfig
> files from br2-external trees further down the list, to override
> defconfig files from those earlier in the list, even overriding the
> defconfig files from Buildroot itself.

This is the part I would like to challenge. Why do we want to allow
BR2_EXTERNAL to override defconfigs from the main tree? We do not allow
this for packages, why should we allow it for defconfigs?

To me, allowing the override of defconfigs is actually a bad idea: when
you run "make foo_defconfig", it's no longer really clear which
"foo_defconfig" is really going to be used. Yes, it's well defined, but
it isn't "obvious".

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2022-09-21 18:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-20 19:46 [Buildroot] [PATCH v3] Makefile: fix use of many br2-external trees Yann E. MORIN
2022-09-21 18:13 ` Thomas Petazzoni [this message]
2022-09-21 18:28   ` Yann E. MORIN
2022-09-21 18:32   ` Arnout Vandecappelle
2022-09-21 18:57     ` Yann E. MORIN

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=20220921201320.0a7f80c0@windsurf \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@buildroot.org \
    --cc=david.lawson1@tx.rr.com \
    --cc=yann.morin.1998@free.fr \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox