[llvm-branch-commits] [libc] Readd instructions on building kernel headers from sources (PR #193657)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Apr 22 21:04:35 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Aiden Grossman (boomanaiden154)

<details>
<summary>Changes</summary>

These existed in this page before
aa0e429576cfb496e66f6bbe76df8982aab6b083. Readd them given I enjoyed
being able to copy and paste them and they're short/simple enough that I
don't think there's a good reason not to just include them.


---
Full diff: https://github.com/llvm/llvm-project/pull/193657.diff


1 Files Affected:

- (modified) libc/docs/full_host_build.rst (+16-1) 


``````````diff
diff --git a/libc/docs/full_host_build.rst b/libc/docs/full_host_build.rst
index 9095be824d25e..efefb90a3c89e 100644
--- a/libc/docs/full_host_build.rst
+++ b/libc/docs/full_host_build.rst
@@ -139,10 +139,25 @@ headers.
    # Use -L to dereference the asm symlink and copy the actual files
    cp -R -L /usr/include/asm $SYSROOT/usr/include/
 
+If you instead want to build the headers from the kernel sources, you can run
+the following commands:
+
+.. code-block:: sh
+
+   # Create the include directory
+   mkdir -p $SYSROOT/usr/include
+
+   git clone --depth=1 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git /tmp/linux
+   make LLVM=1 INSTALL_HDR_PATH=$SYSROOT/usr -C /tmp/linux headers_install
+
+The headers can be built to target non-host architectures by adding the
+``ARCH={arm|arm64|i386}`` to the above invocation of ``make``.
+
 .. note::
    For a more production-ready sysroot, you would typically download a specific
    kernel version and install the headers using ``make headers_install``
-   configured for the target architecture and installation path.
+   configured for the target architecture and installation path using the above
+   instructions.
 
 Step 3: Build and Install Runtimes
 ----------------------------------

``````````

</details>


https://github.com/llvm/llvm-project/pull/193657


More information about the llvm-branch-commits mailing list