Ben Hutchings
2019-Jan-07 04:23 UTC
[klibc] [PATCH klibc 0/4] Fix the KLIBCKERNEL{SRC,OBJ} mess
We currently use KLIBCKERNELSRC and KLIBCKERNELOBJ variables which used to be required to point to a kernel source and object directories. However the kernel headers were reorganised starting in Linux 3.7 such that that doesn't work properly. This series removes KLIBCKERNELOBJ and changes the use and documentation of KLIBCKERNELSRC to be consistent. Ben. Ben Hutchings (4): [klibc] Makefile: Add dependencies on $(KLIBCKERNELSRC) [klibc] Kbuild: Remove KLIBCKERNELOBJ variable [klibc] Makefile: Update help text for KLIBCKERNELSRC [klibc] Kbuild.install: Copy UAPI headers instead of reinstalling them Makefile | 16 +++++++--------- scripts/Kbuild.install | 2 +- scripts/Kbuild.klibc | 8 +++----- usr/klibc/arch/i386/MCONFIG | 3 --- usr/klibc/arch/ppc/MCONFIG | 3 --- usr/klibc/arch/ppc64/MCONFIG | 3 --- usr/klibc/arch/riscv64/MCONFIG | 2 -- usr/klibc/arch/x86_64/MCONFIG | 3 --- 8 files changed, 11 insertions(+), 29 deletions(-) -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://www.zytor.com/pipermail/klibc/attachments/20190107/4afeb6d1/attachment.sig>
Ben Hutchings
2019-Jan-07 04:24 UTC
[klibc] [PATCH klibc 1/4] Makefile: Add dependencies on $(KLIBCKERNELSRC)
The error message for a missing $(KLIBCKERNELSRC) won't appear unless it's specified as a target or something depends on it. Make the klcc and klibc targets depend on it. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index cd15149c73ec..43861355b964 100644 --- a/Makefile +++ b/Makefile @@ -112,10 +112,10 @@ klibc.spec: klibc.spec.in $(KLIBCSRC)/version sed -e 's/@@VERSION@@/$(VERSION)/g' < $< > $@ # Build klcc - it is the first target -klcc: $(objtree)/.config +klcc: $(objtree)/.config $(KLIBCKERNELSRC) $(Q)$(MAKE) $(klibc)=klcc -klibc: $(objtree)/.config +klibc: $(objtree)/.config $(KLIBCKERNELSRC) $(Q)$(MAKE) $(klibc)=. test: klibc -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://www.zytor.com/pipermail/klibc/attachments/20190107/e5f56a24/attachment.sig>
Ben Hutchings
2019-Jan-07 04:24 UTC
[klibc] [PATCH klibc 2/4] Kbuild: Remove KLIBCKERNELOBJ variable
Since the UAPI/KAPI header split in Linux 3.7, we have needed KLIBCKERNELSRC to point to the installed UAPI headers. This makes KLIBCKERNELOBJ and the extra header directories based on it completely redundant. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- Makefile | 2 -- scripts/Kbuild.klibc | 8 +++----- usr/klibc/arch/i386/MCONFIG | 3 --- usr/klibc/arch/ppc/MCONFIG | 3 --- usr/klibc/arch/ppc64/MCONFIG | 3 --- usr/klibc/arch/riscv64/MCONFIG | 2 -- usr/klibc/arch/x86_64/MCONFIG | 3 --- 7 files changed, 3 insertions(+), 21 deletions(-) diff --git a/Makefile b/Makefile index 43861355b964..a11d1e6c7ae0 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,6 @@ export VERSION := $(shell cat $(srctree)/$(KLIBCSRC)/version) export KLIBCINC := usr/include export KLIBCOBJ := usr/klibc export KLIBCKERNELSRC ?= linux -export KLIBCKERNELOBJ ?= $(KLIBCKERNELSRC) export VPATH := $(srctree) @@ -135,7 +134,6 @@ test: klibc @echo @echo 'Build options:' @echo 'KLIBCKERNELSRC - Path to a configured linux tree' - @echo 'KLIBCKERNELOBJ - Path to kernel output dir (defaults to KLIBCKERNELSRC)' @echo 'make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' @echo 'make V=2 [targets] 2 => give reason for rebuild of target' @echo diff --git a/scripts/Kbuild.klibc b/scripts/Kbuild.klibc index 35c375edd909..de1cd278e9f8 100644 --- a/scripts/Kbuild.klibc +++ b/scripts/Kbuild.klibc @@ -78,7 +78,7 @@ KLIBCLDFLAGS : KLIBCCFLAGS : # Defaults for arch to override -KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include +KLIBCARCHINCFLAGS # Arch specific definitions for klibc include $(srctree)/$(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG @@ -113,10 +113,8 @@ KLIBCCPPFLAGS := -nostdinc -iwithprefix include \ -I$(KLIBCINC) # kernel include paths KLIBCKERNELSRC ?= $(srctree) -KLIBCKERNELOBJ ?= $(objtree) -KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \ - $(if $(KBUILD_SRC),-I$(KLIBCKERNELOBJ)/include2 \ - -I$(KLIBCKERNELOBJ)/include -I$(srctree)/include) \ +KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \ + $(if $(KBUILD_SRC),-I$(srctree)/include) \ $(KLIBCARCHINCFLAGS) # klibc definitions diff --git a/usr/klibc/arch/i386/MCONFIG b/usr/klibc/arch/i386/MCONFIG index bfec004a3c8b..0704669500f0 100644 --- a/usr/klibc/arch/i386/MCONFIG +++ b/usr/klibc/arch/i386/MCONFIG @@ -31,6 +31,3 @@ KLIBCBITSIZE = 32 # calls, and work on the memory models for this architecture # 96 MB - normal binaries start at 128 MB KLIBCSHAREDFLAGS = -Ttext-segment 0x06000000 - -# Asm includes for i386 are in the merged x86 tree -KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include diff --git a/usr/klibc/arch/ppc/MCONFIG b/usr/klibc/arch/ppc/MCONFIG index 6630df7be4ca..46c5923746f7 100644 --- a/usr/klibc/arch/ppc/MCONFIG +++ b/usr/klibc/arch/ppc/MCONFIG @@ -22,8 +22,5 @@ KLIBCBITSIZE = 32 # to +/- 16 MB KLIBCSHAREDFLAGS = -Ttext 0x0f800200 -# The kernel so far has both asm-ppc* and asm-powerpc. -KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include - # The asm include files live in asm-powerpc KLIBCASMARCH = powerpc diff --git a/usr/klibc/arch/ppc64/MCONFIG b/usr/klibc/arch/ppc64/MCONFIG index 1331e05322c0..a1475935fd3a 100644 --- a/usr/klibc/arch/ppc64/MCONFIG +++ b/usr/klibc/arch/ppc64/MCONFIG @@ -20,8 +20,5 @@ KLIBCBITSIZE = 64 # to +/- 16 MB KLIBCSHAREDFLAGS = -Ttext 0x0f000200 -# The kernel so far has both asm-ppc* and asm-powerpc. -KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include - # The asm include files live in asm-powerpc KLIBCASMARCH = powerpc diff --git a/usr/klibc/arch/riscv64/MCONFIG b/usr/klibc/arch/riscv64/MCONFIG index 38703d937e49..34f077414f8c 100644 --- a/usr/klibc/arch/riscv64/MCONFIG +++ b/usr/klibc/arch/riscv64/MCONFIG @@ -18,5 +18,3 @@ KLIBCBITSIZE = 64 # Normal binaries start at 64 KB, so start the libary at 2 MB. KLIBCSHAREDFLAGS =-Ttext 0x00200200 - -KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/riscv/include diff --git a/usr/klibc/arch/x86_64/MCONFIG b/usr/klibc/arch/x86_64/MCONFIG index 606f041ca3b3..c5f2fa265a26 100644 --- a/usr/klibc/arch/x86_64/MCONFIG +++ b/usr/klibc/arch/x86_64/MCONFIG @@ -36,6 +36,3 @@ KLIBCLDFLAGS = -m elf_x86_64 # in a broken layout with binutils 2.30. Since there's no # architectural page size betwen 4 KB and 2MB, set it to 4 KB. KLIBCSHAREDFLAGS = -Ttext-segment 0x00200000 -z max-page-size=0x1000 - -# Asm includes for x86_64 are in the merged x86 tree -KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://www.zytor.com/pipermail/klibc/attachments/20190107/1eb3fadf/attachment.sig>
Ben Hutchings
2019-Jan-07 04:24 UTC
[klibc] [PATCH klibc 3/4] Makefile: Update help text for KLIBCKERNELSRC
Since the UAPI/KAPI header split in Linux 3.7, we have needed KLIBCKERNELSRC to point to the installed UAPI headers. The "sample invocation" has been updated to reflect this but the rest of the help text has not. Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index a11d1e6c7ae0..09f531eda84f 100644 --- a/Makefile +++ b/Makefile @@ -99,10 +99,10 @@ $(objtree)/.config: $(srctree)/defconfig @false $(KLIBCKERNELSRC): - @echo "Cannot find kernel sources." - @echo "Either make a 'linux' symlink point to a kernel tree " - @echo "configured for the $(KLIBCARCH) architecture or specify " - @echo "KLIBCKERNELSRC=<path> to the build." + @echo "Cannot find kernel UAPI headers." + @echo "Either make a 'linux' symlink point to the usr subdirectory " + @echo "of a kernel tree with headers installed for the $(KLIBCARCH) " + @echo "architecture or specify KLIBCKERNELSRC=<path>." @false rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm) @@ -133,7 +133,7 @@ test: klibc @echo 'test - Run klibc tests' @echo @echo 'Build options:' - @echo 'KLIBCKERNELSRC - Path to a configured linux tree' + @echo 'KLIBCKERNELSRC - Path to usr directory containing UAPI headers' @echo 'make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build' @echo 'make V=2 [targets] 2 => give reason for rebuild of target' @echo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://www.zytor.com/pipermail/klibc/attachments/20190107/32e81f21/attachment.sig>
Ben Hutchings
2019-Jan-07 04:25 UTC
[klibc] [PATCH klibc 4/4] Kbuild.install: Copy UAPI headers instead of reinstalling them
Since the UAPI/KAPI header split in Linux 3.7, we have needed KLIBCKERNELSRC to point to the installed UAPI headers. Invoking "make headers_install" in this directory doesn't work. The previously proposed fix was to invoke make in the parent directory. But since we require the headers to be installed already, we can copy the install tree instead. Make sure to dereference any symbolic links while doing this. Reported-by: Thomas Meyer <thomas at m3y3r.de> Reported-by: Luis R. Rodriguez <mcgrof at kernel.org> Signed-off-by: Ben Hutchings <ben at decadent.org.uk> --- scripts/Kbuild.install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Kbuild.install b/scripts/Kbuild.install index bafd42328ddb..32aec84a1a8c 100644 --- a/scripts/Kbuild.install +++ b/scripts/Kbuild.install @@ -95,7 +95,7 @@ PHONY += header footer descend $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin - $(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install + $(Q)cp -rfL $(KLIBCKERNELSRC)/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. $(Q)chmod -R a+rX,go-w $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: <http://www.zytor.com/pipermail/klibc/attachments/20190107/be724876/attachment.sig>
Seemingly Similar Threads
- [PATCH 00/16] External building, update for 2.6.33 and multiple root devices.
- [PATCH] Fix kernel headers install
- version compatibility between linux and klibc
- Patch: Kbuild.install: *** No rule to make target `headers_install'.
- [PATCH klibc 0/2] Reproducible build