* [PATCH 1/2] Makefile: Add INSTALL_MOD_PATH to the environment used by depmod
@ 2012-03-09 22:02 Alan Ott
2012-03-09 22:13 ` Alan Ott
2012-03-10 23:41 ` [PATCH v2] kbuild: export " Alan Ott
0 siblings, 2 replies; 3+ messages in thread
From: Alan Ott @ 2012-03-09 22:02 UTC (permalink / raw)
To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Alan Ott
Add INSTALL_MOD_PATH explicitly to the environment given to depmod. This
way putting an INSTALL_MOD_PATH line into a GNUmakefile (along with things
like CROSS_COMPILE) will work properly.
Signed-off-by: Alan Ott <alan@signal11.us>
---
It seems to be a common practice to put make variables into a file named
GNUmakefile in the top level of the kernel tree (and then include the normal
Makefile[1] from GNUmakefile). These are typically variables needed for a
cross-compiling environment (such as ARCH and CROSS_COMPILE). The idea
is that when make is invoked, GNUmakefile will be read first and thus
able to set up the environment without the user having to type:
make ARCH=arm CROSS_COMPILE=arm-linux-
every single time they want to make a build.
INSTALL_MOD_PATH doesn't work when put into a GNUmakefile like this. The
difference is that when variables go on the command line like above, they
get put into the environment of the make process as environment variables,
which would then get passed to processes which make spawns (such as depmod),
since they're part of make's environment. When they're put into the
GNUmakefile instead, they become make variables only, and not part of the
environment, and thus not automatically passed to spawned processes such as
depmod.
In the current implementation, if INSTALL_MOD_PATH is put into a
GNUmakefile, then when make modules_install is called, the modules are put
into the right place (because this operation relies on the make variable),
but depmod then can't find the modules (because it doesn't get
INSTALL_MOD_PATH put into its environment).
This patch explicitly adds INSTALL_MOD_PATH to the environment when the
depmod script gets started.
I fully realize that there may very well be a better way to fix this which
I'm not aware of.
Alan.
[1] For example, here's my GNUmakefile, which I put in the root of the
kernel tree:
ARCH=arm
INSTALL_MOD_PATH=/home/alan/work/rootfs
CROSS_COMPILE=arm-linux-
include Makefile
---
Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index 5f1739b..c9c9ac0 100644
--- a/Makefile
+++ b/Makefile
@@ -1525,7 +1525,8 @@ quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))
# Run depmod only if we have System.map and depmod is executable
quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
- cmd_depmod = $(CONFIG_SHELL) $(srctree)/scripts/depmod.sh $(DEPMOD) \
+ cmd_depmod = INSTALL_MOD_PATH=$(INSTALL_MOD_PATH) $(CONFIG_SHELL) \
+ $(srctree)/scripts/depmod.sh $(DEPMOD) \
$(KERNELRELEASE)
# Create temporary dir for module support files
--
1.7.0.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] Makefile: Add INSTALL_MOD_PATH to the environment used by depmod
2012-03-09 22:02 [PATCH 1/2] Makefile: Add INSTALL_MOD_PATH to the environment used by depmod Alan Ott
@ 2012-03-09 22:13 ` Alan Ott
2012-03-10 23:41 ` [PATCH v2] kbuild: export " Alan Ott
1 sibling, 0 replies; 3+ messages in thread
From: Alan Ott @ 2012-03-09 22:13 UTC (permalink / raw)
To: Alan Ott; +Cc: Michal Marek, linux-kbuild, linux-kernel
On 03/09/2012 05:02 PM, Alan Ott wrote:
> Add INSTALL_MOD_PATH explicitly to the environment given to depmod. This
> way putting an INSTALL_MOD_PATH line into a GNUmakefile (along with things
> like CROSS_COMPILE) will work properly.
>
> Signed-off-by: Alan Ott <alan@signal11.us>
> ---
To be clear, this was intended to be patch 1/1. Sorry for the noise.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] kbuild: export INSTALL_MOD_PATH to the environment used by depmod
2012-03-09 22:02 [PATCH 1/2] Makefile: Add INSTALL_MOD_PATH to the environment used by depmod Alan Ott
2012-03-09 22:13 ` Alan Ott
@ 2012-03-10 23:41 ` Alan Ott
1 sibling, 0 replies; 3+ messages in thread
From: Alan Ott @ 2012-03-10 23:41 UTC (permalink / raw)
To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Alan Ott
Export INSTALL_MOD_PATH explicitly to the environment given to depmod. This
way putting an INSTALL_MOD_PATH line into a GNUmakefile (with things
like CROSS_COMPILE and ARCH) will work properly.
Signed-off-by: Alan Ott <alan@signal11.us>
---
Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/Makefile b/Makefile
index 5f1739b..c4a238a 100644
--- a/Makefile
+++ b/Makefile
@@ -385,6 +385,7 @@ export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
export CPP AR NM STRIP OBJCOPY OBJDUMP
export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
+export INSTALL_MOD_PATH
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE CFLAGS_GCOV
--
1.7.0.4
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-03-10 23:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 22:02 [PATCH 1/2] Makefile: Add INSTALL_MOD_PATH to the environment used by depmod Alan Ott
2012-03-09 22:13 ` Alan Ott
2012-03-10 23:41 ` [PATCH v2] kbuild: export " Alan Ott
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®