[klibc] [klibc:master] Simplify build instructions

klibc-bot for Ben Hutchings ben at decadent.org.uk
Fri Feb 1 15:21:04 PST 2019

Commit-ID:  b8fc25ef83f8fbf85c07a237f4d8a0af95ea88ad
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=b8fc25ef83f8fbf85c07a237f4d8a0af95ea88ad
Author:     Ben Hutchings <ben at decadent.org.uk>
AuthorDate: Fri, 1 Feb 2019 23:52:48 +0100
Committer:  Ben Hutchings <ben at decadent.org.uk>
CommitDate: Sat, 2 Feb 2019 00:09:23 +0100

[klibc] Simplify build instructions

Recommend installing the kernel UAPI headers under the klibc source
directory.  This reduces the second build step to just "make" (for
most native builds).

Explain the alternative options in a subsection of README.klibc.

Signed-off-by: Ben Hutchings <ben at decadent.org.uk>

 Makefile               |  8 ++++----
 usr/klibc/README.klibc | 27 +++++++++++++++++----------
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/Makefile b/Makefile
index 0df463a5..c99b962f 100644
--- a/Makefile
+++ b/Makefile
@@ -99,10 +99,10 @@ $(objtree)/.config: $(srctree)/defconfig
-	@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>."
+	@echo 'Missing kernel UAPI headers in $(KLIBCKERNELSRC)/include.'
+	@echo 'Install them by running:'
+	@echo '    make headers_install INSTALL_HDR_PATH=$(abspath $(KLIBCKERNELSRC))'
+	@echo 'in the kernel source directory.'
 rpmbuild = $(shell which rpmbuild 2>/dev/null || which rpm)
diff --git a/usr/klibc/README.klibc b/usr/klibc/README.klibc
index 59ffd351..ea10c55f 100644
--- a/usr/klibc/README.klibc
+++ b/usr/klibc/README.klibc
@@ -9,17 +9,13 @@ work in progress, and a lot of things are still missing.
-The build procedure is not very polished yet, but it should work like
+The build procedure is not very polished yet, but for a native build
+with the default configuration it should be simple:
-Extract a recent Linux kernel into a directory and run
-"make headers_install".
-Now enter the klibc dir and point KLIBCKERNELSRC to the
-usr subdirectory of the configured linux tree
-"make  KLIBCKERNELSRC=`pwd`/../linux/usr/".
-It is also possible to install the kernel headers elsewhere and
-point to them there.
+1. In a recent Linux kernel source directory, run:
+       make headers_install INSTALL_HDR_PATH=<klibc-source-dir>/linux
+2. In the klibc source directory, run:
+       make
@@ -40,6 +36,17 @@ If you are on ARM, and want to build a thumb version of the library
 (this is supported), change OPTFLAGS in arch/arm/MCONFIG to build
 thumb code.
+Building without kernel source
+If you already have a copy of the current kernel UAPI headers, you
+don't need the kernel source as well.  You can either:
+1. Copy or link to the UAPI headers so that they appear under the
+   "linux/include" subdirectory.
+2. Set the KLIBCKERNELSRC variable on the "make" command line to
+   point to the *parent* of the UAPI headers directory.
 Architecture support

More information about the klibc mailing list