All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vincent Davis Jr <vince@underview.tech>
To: linux-kbuild@vger.kernel.org, masahiroy@kernel.org
Cc: nathan@kernel.org, nicolas@fjasle.eu,
	Vincent Davis Jr <vince@underview.tech>
Subject: [PATCH] Makefile: add KCFLAGS to build with Yocto SDK
Date: Tue, 13 May 2025 00:04:09 -0400	[thread overview]
Message-ID: <20250513040409.147881-1-vince@underview.tech> (raw)

When running

make -C \
"${SDKTARGETSYSROOT}/lib/modules/<kernel version>/build" \
modules_prepare

Issue that are encountered include

make -f ./Makefile syncconfig
make -f ./scripts/Makefile.build obj=scripts/basic
   92 | #include <sys/types.h>
      |          ^~~~~~~~~~~~~
compilation terminated.

ld: cannot find Scrt1.o: No such file or directory
ld: cannot find crti.o: No such file or directory
ld: cannot find crtbeginS.o: No such file or directory
ld: cannot find -lgcc: No such file or directory
ld: cannot find -lgcc_s: No such file or directory
ld: cannot find -lc: No such file or directory
ld: cannot find -lgcc: No such file or directory
ld: cannot find -lgcc_s: No such file or directory
ld: cannot find crtendS.o: No such file or directory
ld: cannot find crtn.o: No such file or directory

Solved by setting KCFLAGS as the yocto project SDK
KCFLAGS is set to --sysroot="${SDKTARGETSYSROOT}".

Signed-off-by: Vincent Davis Jr <vince@underview.tech>
---
 Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 64c514f4bc19..bbe7b0503841 100644
--- a/Makefile
+++ b/Makefile
@@ -459,7 +459,7 @@ HOSTRUSTC = rustc
 HOSTPKG_CONFIG	= pkg-config
 
 KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
-			 -O2 -fomit-frame-pointer -std=gnu11
+			 -O2 -fomit-frame-pointer -std=gnu11 $(KCFLAGS)
 KBUILD_USERCFLAGS  := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
 KBUILD_USERLDFLAGS := $(USERLDFLAGS)
 
@@ -491,7 +491,7 @@ KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS) \
 		       -I $(srctree)/scripts/include
 KBUILD_HOSTRUSTFLAGS := $(rust_common_flags) -O -Cstrip=debuginfo \
 			-Zallow-features= $(HOSTRUSTFLAGS)
-KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
+KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS) $(KCFLAGS)
 KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
 KBUILD_PROCMACROLDFLAGS := $(or $(PROCMACROLDFLAGS),$(KBUILD_HOSTLDFLAGS))
 
-- 
2.43.0


             reply	other threads:[~2025-05-13  4:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-13  4:04 Vincent Davis Jr [this message]
2025-05-13 14:38 ` [PATCH] Makefile: add KCFLAGS to build with Yocto SDK Masahiro Yamada
2025-05-14  1:47   ` Vincent Davis
2025-05-14  1:57     ` Vincent Davis
2025-05-20  0:47   ` Vincent Davis

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=20250513040409.147881-1-vince@underview.tech \
    --to=vince@underview.tech \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=nathan@kernel.org \
    --cc=nicolas@fjasle.eu \
    /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.