From a55d4aa59140d1acab2db89eebb7acbb91f960c6 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 13 Jun 2020 10:38:34 -0700 Subject: [PATCH] Example-Projects: update Linux kernel --- Example-Projects.md | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Example-Projects.md b/Example-Projects.md index f32c1bc..9bf012b 100644 --- a/Example-Projects.md +++ b/Example-Projects.md @@ -1,13 +1,32 @@ ## Linux kernel -defconfig +LLVM=1 enables a full set of LLVM tools: clang, llvm-objcopy, llvm-objdump, llvm-nm, etc. ```sh # Use clang 9 or newer. -make O=out.x86_64 CC=/path/to/clang defconfig -make O=out.x86_64 CC=/path/to/clang # generate ..cmd files -scripts/gen_compile_commands.py -d out.x86_64 -ln -s out.x86_64/compile_commands.json +make O=/tmp/out/x86_64 ARCH=x86_64 LLVM=1 defconfig +make O=/tmp/out/x86_64 ARCH=x86_64 LLVM=1 -k bzImage modules # generate ..cmd files + +scripts/gen_compile_commands.py -d /tmp/out/x86_64 +ln -s /tmp/out/x86_64/compile_commands.json +``` + +For older kernel (before http://git.kernel.org/linus/a0d1c951ef08ed24f35129267e3595d86f57f5d3), use +``` +make O=/tmp/out/x86_64 CC=/path/to/clang defconfig +make O=/tmp/out/x86_64 CC=/path/to/clang bzImage modules # generate ..cmd files +``` + +For other architectures: +```sh +make O=/tmp/out/arm ARCH=arm CROSS_COMPILE=arm-linux-gnu- LLVM=1 defconfig +make O=/tmp/out/arm ARCH=arm CROSS_COMPILE=arm-linux-gnu- LLVM=1 -k zImage modules + +make O=/tmp/out/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 defconfig +make O=/tmp/out/arm64 ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 -k Image.gz modules + +make O=/tmp/out/powerpc ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 powernv_defconfig +make O=/tmp/out/powerpc ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 -k zImage.epapr modules ``` 2019-11-09: ARCH=x86_64 defconfig => 1.4G .ccls-cache