Hallo. Tmpfiles, root users, external mod-builds again.
On Tue, Oct 31, 2006 at 02:51:36PM +0100, olecom wrote:
> On Tue, Oct 31, 2006 at 02:14:16AM +0100, Horst Schirmeier wrote:
> > On Tue, 31 Oct 2006, Andi Kleen wrote:
> > >
> > > > The problem is, this brings us back to the problem where this whole
> > > > patch orgy began: Gentoo Portage sandbox violations when writing (the
> > > > null symlink) to the kernel tree when building external modules. What
> > > > about using $(M) as a base directory if it is defined?
> > >
> > > I think Jan's $(objdir)/.tmp proposal would be cleanest. Just someone
> > > has to implement it :)
> > >
> > > -Andi
>
> $(objtree) here,
>
> > I'm not sure what you mean by $(objdir); I just got something to work
> > which creates the /dev/null symlink in a (newly created if necessary)
> > directory named
>
> $(objtree) is a directory for all possible outputs of the build precess,
> it's set up by `O=' or `KBUILD_OUTPUT', and this is *not* output for ready
> external modules `$(M)'. Try to play with this, please.
Kind of fix has finally landed. Instead for `O=/$dir' a patch...
Anyway i whould like propose my solution of:
-- external modules build without KBUILD_OUTPUT set;
-- /dev/null, GNU binutils and root users;
-- beauty;
For external modules, there must be information after
`make modules_prepare' in shipped linux-sources. Any build output is
put in $(objtree), and i don't understand why you don't using that.
Please, *try* `make O=/tmp/build M=/usr/local/src/nvatia'. Thank you.
As some kind of buga-feature, "null" isn't in any clean/mrproper
target (for a while ;).
-*- patch -*-
kbuild: improving option checking
GNU binutils, root users, tmpfiles, external modules ro builds must
be fixed to do the right thing now.
In "safe" environment new /dev/null replacement may be used as simply as
`echo > null', `gcc -o null'. In aggressive starting with $(null) is
recommended.
Feature: file $(objtree)/null isn't in any "clear" target (yet).
Cc: Roman Zippel <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: Oleg Verych <[email protected]>
---
-o--=O`C
#oo'L O
<___=E M
--- linux~2.6.20-rc5/scripts/Kbuild.include~blackhole-4-tmpfiles 2007-01-12 19:54:26.000000000 +0100
+++ linux~2.6.20-rc5/scripts/Kbuild.include 2007-01-24 09:19:01.386426000 +0100
@@ -2,5 +2,5 @@
# kbuild: Generic definitions
-# Convinient variables
+# Convinient constants
comma := ,
squote := '
@@ -8,4 +8,7 @@
space := $(empty) $(empty)
+# Immortal black-hole for mortals and roots
+null = $(shell test -L null || (rm -f null; ln -s /dev/null null); echo null)
+
###
# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o
@@ -57,33 +60,43 @@
# See documentation in Documentation/kbuild/makefiles.txt
-# output directory for tests below
-TMPOUT := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/)
-
# as-option
# Usage: cflags-y += $(call as-option, -Wa$(comma)-isa=foo,)
-
-as-option = $(shell if $(CC) $(CFLAGS) $(1) -Wa,-Z -c -o /dev/null \
- -xassembler /dev/null > /dev/null 2>&1; then echo "$(1)"; \
- else echo "$(2)"; fi ;)
+define as-option
+ $(shell
+ if $(CC) $(CFLAGS) $(1) -c -o $(null) -xassembler null >null 2>&1; \
+ then echo $(1); \
+ else echo $(2); \
+ fi)
+endef
# as-instr
# Usage: cflags-y += $(call as-instr, instr, option1, option2)
-
-as-instr = $(shell if echo -e "$(1)" | \
- $(CC) $(AFLAGS) -c -xassembler - \
- -o $(TMPOUT)astest$$$$.out > /dev/null 2>&1; \
- then rm $(TMPOUT)astest$$$$.out; echo "$(2)"; \
- else echo "$(3)"; fi)
+define as-instr
+ $(shell \
+ if printf "$(1)" | $(AS) >$(null) 2>&1 -W -o null; \
+ then echo "$(2)"; \
+ else echo "$(3)"; \
+ fi)
+endef
# cc-option
# Usage: cflags-y += $(call cc-option, -march=winchip-c6, -march=i586)
-
-cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
- > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;)
+define cc-option
+ $(shell \
+ if $(CC) $(CFLAGS) $(1) -S -o $(null) -xc null >null 2>&1; \
+ then echo "$(1)"; \
+ else echo "$(2)"; \
+ fi)
+endef
# cc-option-yn
# Usage: flag := $(call cc-option-yn, -march=winchip-c6)
-cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \
- > /dev/null 2>&1; then echo "y"; else echo "n"; fi;)
+define cc-option-yn
+ $(shell \
+ if $(CC) $(CFLAGS) $(1) -S -o $(null) -xc null >null 2>&1; \
+ then echo "y"; \
+ else echo "n"; \
+ fi)
+endef
# cc-option-align
@@ -103,8 +116,11 @@
# ld-option
# Usage: ldflags += $(call ld-option, -Wl$(comma)--hash-style=both)
-ld-option = $(shell if $(CC) $(1) -nostdlib -xc /dev/null \
- -o $(TMPOUT)ldtest$$$$.out > /dev/null 2>&1; \
- then rm $(TMPOUT)ldtest$$$$.out; echo "$(1)"; \
- else echo "$(2)"; fi)
+define ld-option
+ $(shell \
+ if $(CC) $(1) -nostdlib -o $(null) -xc null >null 2>&1; \
+ then echo "$(1)"; \
+ else echo "$(2)"; \
+ fi)
+endef
###
@@ -116,4 +132,5 @@
# Prefix -I with $(srctree) if it is not an absolute path
addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
+
# Find all -I options and call addtree
flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
@@ -126,5 +143,5 @@
###
-# if_changed - execute command if any prerequisite is newer than
+# if_changed - execute command if any prerequisite is newer than
# target, or command line has changed
# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]