All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] kbuild: move ARCH, CPU, etc. to top Makefile to fix random build error
Date: Wed, 01 Apr 2015 16:33:50 -0600	[thread overview]
Message-ID: <551C724E.602@wwwdotorg.org> (raw)
In-Reply-To: <1427803341-28286-1-git-send-email-yamada.masahiro@socionext.com>

On 03/31/2015 06:02 AM, Masahiro Yamada wrote:
> Since the Kconfig conversion, some developers have reported that
> Kbuild sometimes fails completely at random.  According to the error
> reports, it seems to occur for any target board, but only on very
> fast computers.
>
> The log message for the fail case is like this:
>
>    make[1]: *** No rule to make target `../arch//cpu/u-boot.lds',
>    needed by `u-boot.lds'.  Stop.
>
> It looks like the top config.mk has not been included for *some*
> reason, and $(ARCH) has been left blank.
>
> I suspect "autoconf_is_current" is not working in some situation.

That's certainly true. The following code doesn't end up including 
config.mk in the bad case:

> # We want to include arch/$(ARCH)/config.mk only when include/config/auto.conf
> # is up-to-date. When we switch to a different board configuration, old CONFIG
> # macros are still remaining in include/config/auto.conf. Without the following
> # gimmick, wrong config.mk would be included leading nasty warnings/errors.
> autoconf_is_current := $(if $(wildcard $(KCONFIG_CONFIG)),$(shell find . \
> 		-path ./include/config/auto.conf -newer $(KCONFIG_CONFIG)))
> ifneq ($(autoconf_is_current),)
> include $(srctree)/config.mk
> include $(srctree)/arch/$(ARCH)/Makefile
> endif

That's because:

> [swarren at swarren-lx1 tegra-uboot-flasher]$ ls -l --full-time u-boot-*/{.config,include/config/auto.conf}|cat
> -rw-rw-r-- 1 swarren swarren 9219 2015-04-01 15:50:08.000000000 -0600 u-boot-bad/.config
> -rw-rw-r-- 1 swarren swarren  928 2015-04-01 15:50:08.000000000 -0600 u-boot-bad/include/config/auto.conf
> -rw-rw-r-- 1 swarren swarren 9219 2015-04-01 15:51:25.000000000 -0600 u-boot-ok/.config
> -rw-rw-r-- 1 swarren swarren  928 2015-04-01 15:51:26.000000000 -0600 u-boot-ok/include/config/auto.conf

In the bad case, the timestamps are equal (and hence the -newer check 
fails), whereas in the good case they're different. Recall ext* 
filesystems have a 1s timestamp resolution.

Note that this is state left over from "make xxx_defconfig"; If I just 
manually run "make all" in a tree in this state, it'll stay in this 
state forever, and vice-versa for a working tree.

I expect that simulating this condition with some judicious manually 
executed touch commands would be extremely easy.

Possible solutions are:

Is there a -newer-or-equal that could be used in the find command rather 
than -newer?

When running "make xxx_defconfig", can the code there compare the 
timestamp of those two files, and keep looping and touching the 
auto.conf file until the timestamps differ.

Something else entirely? I couldn't see anything relating to 
autoconf_is_current in the kernel's makefiles.

  parent reply	other threads:[~2015-04-01 22:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31 12:02 [U-Boot] [PATCH] kbuild: move ARCH, CPU, etc. to top Makefile to fix random build error Masahiro Yamada
2015-03-31 15:37 ` York Sun
2015-03-31 15:45 ` Stephen Warren
2015-03-31 15:57   ` York Sun
2015-04-01 22:33 ` Stephen Warren [this message]
2015-04-03  3:54   ` Masahiro Yamada

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=551C724E.602@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=u-boot@lists.denx.de \
    /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.