All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: "Andreas Düring via buildroot" <buildroot@buildroot.org>
Cc: "Andreas Düring" <brpi@duering-andreas.de>
Subject: Re: [Buildroot] Buildroot does not use ccache for compiling Linux kernel?
Date: Sat, 14 Sep 2024 20:25:23 +0200	[thread overview]
Message-ID: <20240914202523.015cff9a@windsurf> (raw)
In-Reply-To: <20240914201937.567067fd@devuanPc.fritz.box>

Hello Andreas,

On Sat, 14 Sep 2024 20:19:37 +0200
Andreas Düring via buildroot <buildroot@buildroot.org> wrote:

> During this process, I realized that ccache, although enabled, is not
> used for compiling the Linux kernel. I think this is because of the
> recipe in linux/linux.mk:
> 
> LINUX_MAKE_FLAGS = \
>         HOSTCC="$(HOSTCC) $(subst -I/,-isystem /,$(subst -I /,-isystem /,$(HOST_CFLAGS))) $(HOST_LDFLAGS)" \
>         ARCH=$(KERNEL_ARCH) \
>         INSTALL_MOD_PATH=$(TARGET_DIR) \
>         CROSS_COMPILE="$(TARGET_CROSS)" \
>         WERROR=0 \
>         REGENERATE_PARSERS=1 \
>         DEPMOD=$(HOST_DIR)/sbin/depmod
> 
> The linux kernel seems to assemble the compiler using TARGET_CROSS,
> e.g.
> CC = $(TARGET_CROSS)gcc
> 
> As a very crude solution, I changed the corresponding line to
>         CROSS_COMPILE="ccache $(TARGET_CROSS)"
> but this is probably not the optimal solution. (I didn't carefully
> check where else CROSS_COMPILE is used).
> 
> If this is a known limitation? Should this be added to the
> documentation?

The thing you're missing is that for target builds, calling ccache is
hidden inside our toolchain wrapper.

When we call $(HOST_DIR)/bin/arm-linux-gcc, it doesn't call the
compiler. It calls our toolchain wrapper
(toolchain/toolchain-wrapper.c), which itself calls the compiler. And
as part of that, it does invoke ccache.

So we are using ccache for all target code, as it's directly done by
our compiler wrapper.

Best regards,

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:[~2024-09-14 18:25 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-14 18:19 [Buildroot] Buildroot does not use ccache for compiling Linux kernel? Andreas Düring via buildroot
2024-09-14 18:25 ` Thomas Petazzoni via buildroot [this message]
2024-09-14 18:35   ` Andreas Düring via buildroot
2024-09-14 19:51 ` Arnout Vandecappelle via buildroot

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=20240914202523.015cff9a@windsurf \
    --to=buildroot@buildroot.org \
    --cc=brpi@duering-andreas.de \
    --cc=thomas.petazzoni@bootlin.com \
    /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.