Re: [linux-yocto] [PATCH] Makefile: support make scripts prepare inside SDK

2020-10-01 Thread Bruce Ashfield
On Mon, Sep 28, 2020 at 4:37 AM Chen Qi  wrote:
>
> We need to `make scripts prepare` inside SDK. So add patch
> to defect if we are insdie SDK environment, and if so change some
> PKG_CONFIG_xxx settings so that we will use things from SDK's host
> part.
>
> The problem for `make scripts prepare` inside SDK is that the
> hosts' environments are different. On some hosts, it happens to
> succeed, and on some hosts, it fails. This is because the build mixes
> host's part and SDK's host part.
>
> We do such change to make sure only SDK's host part is involed in build.
>
> Signed-off-by: Chen Qi 
> ---
>  Makefile | 13 -
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index 2f140aa..af41dca 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -277,6 +277,17 @@ ifneq ($(filter $(no-sync-config-targets), 
> $(MAKECMDGOALS)),)
> endif
>  endif
>
> +ifneq ($(SDKTARGETSYSROOT),)
> +ifneq ($(filter scripts prepare, $(MAKECMDGOALS)),)
> +   PKG_CONFIG_SYSROOT_DIR =
> +   PKG_CONFIG_PATH = 
> $(OECORE_NATIVE_SYSROOT)/usr/lib/pkgconfig:$(OECORE_NATIVE_SYSROOT)/usr/share/pkgconfig
> +   export PKG_CONFIG_SYSROOT_DIR
> +   export PKG_CONFIG_PATH
> +$(info Changed PKG_CONFIG_SYSROOT_DIR to '$(PKG_CONFIG_SYSROOT_DIR)')
> +$(info Changed PKG_CONFIG_PATH to '$(PKG_CONFIG_PATH)')

See my reply to the other patch. We shouldn't embed this information
inside of the kernel Makefile's .. it needs to be passed in via
setting the pkg-config binary, which knows it's sysroot, etc.

Bruce

> +endif
> +endif
> +
>  ifneq ($(KBUILD_EXTMOD),)
> may-sync-config :=
>  endif
> @@ -994,7 +1005,7 @@ mod_sign_cmd = true
>  endif
>  export mod_sign_cmd
>
> -HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo 
> -lelf)
> +HOST_LIBELF_LIBS = $(shell export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH); export 
> PKG_CONFIG_SYSROOT_DIR=$(PKG_CONFIG_SYSROOT_DIR); pkg-config libelf --libs 
> 2>/dev/null || echo -lelf)
>
>  ifdef CONFIG_STACK_VALIDATION
>has_libelf := $(call try-run,\
> --
> 2.24.1
>
>
> 
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9102): 
https://lists.yoctoproject.org/g/linux-yocto/message/9102
Mute This Topic: https://lists.yoctoproject.org/mt/77170443/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[linux-yocto] [PATCH] Makefile: support make scripts prepare inside SDK

2020-09-28 Thread Chen Qi
We need to `make scripts prepare` inside SDK. So add patch
to defect if we are insdie SDK environment, and if so change some
PKG_CONFIG_xxx settings so that we will use things from SDK's host
part.

The problem for `make scripts prepare` inside SDK is that the
hosts' environments are different. On some hosts, it happens to
succeed, and on some hosts, it fails. This is because the build mixes
host's part and SDK's host part.

We do such change to make sure only SDK's host part is involed in build.

Signed-off-by: Chen Qi 
---
 Makefile | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 2f140aa..af41dca 100644
--- a/Makefile
+++ b/Makefile
@@ -277,6 +277,17 @@ ifneq ($(filter $(no-sync-config-targets), 
$(MAKECMDGOALS)),)
endif
 endif
 
+ifneq ($(SDKTARGETSYSROOT),)
+ifneq ($(filter scripts prepare, $(MAKECMDGOALS)),)
+   PKG_CONFIG_SYSROOT_DIR = 
+   PKG_CONFIG_PATH = 
$(OECORE_NATIVE_SYSROOT)/usr/lib/pkgconfig:$(OECORE_NATIVE_SYSROOT)/usr/share/pkgconfig
+   export PKG_CONFIG_SYSROOT_DIR
+   export PKG_CONFIG_PATH
+$(info Changed PKG_CONFIG_SYSROOT_DIR to '$(PKG_CONFIG_SYSROOT_DIR)')
+$(info Changed PKG_CONFIG_PATH to '$(PKG_CONFIG_PATH)')
+endif
+endif
+
 ifneq ($(KBUILD_EXTMOD),)
may-sync-config :=
 endif
@@ -994,7 +1005,7 @@ mod_sign_cmd = true
 endif
 export mod_sign_cmd
 
-HOST_LIBELF_LIBS = $(shell pkg-config libelf --libs 2>/dev/null || echo -lelf)
+HOST_LIBELF_LIBS = $(shell export PKG_CONFIG_PATH=$(PKG_CONFIG_PATH); export 
PKG_CONFIG_SYSROOT_DIR=$(PKG_CONFIG_SYSROOT_DIR); pkg-config libelf --libs 
2>/dev/null || echo -lelf)
 
 ifdef CONFIG_STACK_VALIDATION
   has_libelf := $(call try-run,\
-- 
2.24.1


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#9090): 
https://lists.yoctoproject.org/g/linux-yocto/message/9090
Mute This Topic: https://lists.yoctoproject.org/mt/77170443/21656
Group Owner: linux-yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-