To be a better coder
分类: LINUX
2020-04-20 14:43:08
1、从arm64路径下拷贝个默认配置出来
cp ./arch/arm64/configs/defconfig .config
2、配置选项
make ARCH=arm64 CROSS_COMPILE=~/tools/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- menuconfig
3、编译内核
make ARCH=arm64 CROSS_COMPILE=~/tools/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- all
在根目录下会产生vmlinux*,arch/arm64/boot/下会产生Image和Image.gz
~/workspace/linux-4.4.132$ ls
arch Documentation ipc Makefile README System.map
block drivers Kbuild mm REPORTING-BUGS tools
certs firmware Kconfig modules.builtin samples usr
COPYING fs kernel modules.order scripts virt
CREDITS include lib Module.symvers security vmlinux
crypto init MAINTAINERS net sound vmlinux.o
~/workspace/linux-4.4.132/arch/arm64/boot$ ls
dts Image Image.gz install.sh Makefile
4、最后,在内核目录平级,写个脚本来方便编译:
vim makeKernel
#!/bin/bash cd ~/workspace/linux-4.4.132 #make ARCH=arm64 CROSS_COMPILE=~/tools/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- menuconfig make ARCH=arm64 CROSS_COMPILE=~/tools/gcc-linaro-7.2.1-2017.11-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu- all
chmod +x makeKernel
之后,直接运行makeKenrel就能编译内核了。
完工。