Example-Projects: update Linux kernel

Fangrui Song 2020-06-13 10:38:34 -07:00
parent eca053382d
commit a55d4aa591

@ -1,13 +1,32 @@
## Linux kernel ## Linux kernel
defconfig LLVM=1 enables a full set of LLVM tools: clang, llvm-objcopy, llvm-objdump, llvm-nm, etc.
```sh ```sh
# Use clang 9 or newer. # Use clang 9 or newer.
make O=out.x86_64 CC=/path/to/clang defconfig make O=/tmp/out/x86_64 ARCH=x86_64 LLVM=1 defconfig
make O=out.x86_64 CC=/path/to/clang # generate .<target>.cmd files make O=/tmp/out/x86_64 ARCH=x86_64 LLVM=1 -k bzImage modules # generate .<target>.cmd files
scripts/gen_compile_commands.py -d out.x86_64
ln -s out.x86_64/compile_commands.json 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 .<target>.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
``` ```
<small>2019-11-09: ARCH=x86_64 defconfig => 1.4G .ccls-cache</small> <small>2019-11-09: ARCH=x86_64 defconfig => 1.4G .ccls-cache</small>