lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZL7W0+OZeUod+y7e@fjasle.eu>
Date:   Mon, 24 Jul 2023 21:53:55 +0200
From:   Nicolas Schier <nicolas@...sle.eu>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: [PATCH 08/19] kbuild: add a phony target to run a command with
 Kbuild env vars

On Sat, Jul 22, 2023 at 01:47:55PM +0900 Masahiro Yamada wrote:
> There are some cases where we want to run a command with the same
> environment variables as Kbuild uses. For example, 'make coccicheck'
> invokes scripts/coccicheck from the top Makefile so that the script can
> reference to ${LINUXINCLUDE}, ${KBUILD_EXTMOD}, etc. The top Makefile
> defines several phony targets that run a script.
> 
> We do it also for an internally used script, which results in a somewhat
> complex call graph.
> 
> One example:
> 
>  debian/rules binary-arch
>    -> make intdeb-pkg
>       -> scripts/package/builddeb
> 
> It is also tedious to add a dedicated target like 'intdeb-pkg' for each
> use case.
> 
> Add a generic target 'run-command' to run an arbitrary command in an
> environment with all Kbuild variables set.
> 
> The usage is:
> 
>   $ make run-command KBUILD_RUN_COMMAND=<command>
> 
> The concept is similar to:
> 
>   $ dpkg-architecture -c <command>
> 
> This executes <command> in an environment which has all DEB_* variables
> defined.
> 
> Convert the existing 'make intdeb-pkg'.
> 
> Another possible usage is to interrogate a Make variable.
> 
>   $ make run-command KBUILD_RUN_COMMAND='echo $(KBUILD_CFLAGS)'

nice idea, I like that.

Reviewed-by: Nicolas Schier <nicolas@...sle.eu>


> 
> might be useful to see KBUILD_CFLAGS set by the top Makefile.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---
> 
>  Makefile                 | 4 ++++
>  scripts/Makefile.package | 4 ----
>  scripts/package/mkdebian | 3 ++-
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 47690c28456a..f258ef13fa5d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -2133,6 +2133,10 @@ kernelversion:
>  image_name:
>  	@echo $(KBUILD_IMAGE)
>  
> +PHONY += run-command
> +run-command:
> +	$(Q)$(KBUILD_RUN_COMMAND)
> +
>  quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN   $(wildcard $(rm-files)))
>        cmd_rmfiles = rm -rf $(rm-files)
>  
> diff --git a/scripts/Makefile.package b/scripts/Makefile.package
> index e9217e997c68..7cd61a374dae 100644
> --- a/scripts/Makefile.package
> +++ b/scripts/Makefile.package
> @@ -146,10 +146,6 @@ deb-pkg srcdeb-pkg bindeb-pkg:
>  		--no-check-builddeps) \
>  	$(DPKG_FLAGS))
>  
> -PHONY += intdeb-pkg
> -intdeb-pkg:
> -	+$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
> -
>  # snap-pkg
>  # ---------------------------------------------------------------------------
>  PHONY += snap-pkg
> diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
> index ba2453e08d40..9105abab9728 100755
> --- a/scripts/package/mkdebian
> +++ b/scripts/package/mkdebian
> @@ -283,7 +283,8 @@ build: build-arch
>  binary-indep:
>  binary-arch: build-arch
>  	\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
> -	KERNELRELEASE=\$(KERNELRELEASE) intdeb-pkg
> +	KERNELRELEASE=\$(KERNELRELEASE) \
> +	run-command KBUILD_RUN_COMMAND=+\$(srctree)/scripts/package/builddeb
>  
>  clean:
>  	rm -rf debian/files debian/linux-*
> -- 
> 2.39.2

-- 
epost|xmpp: nicolas@...sle.eu          irc://oftc.net/nsc
↳ gpg: 18ed 52db e34f 860e e9fb  c82b 7d97 0932 55a0 ce7f
     -- frykten for herren er opphav til kunnskap --

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ