Open dreamingsheng opened 4 weeks ago
Run cd kernel_xiaomi_sm7250 cd kernel_xiaomi_sm7250
export PATH="/opt/clang/bin:$PATH"
export CROSS_COMPILE=aarch64-linux-gnu-
export CC=clang export LD=ld.lld export AR=llvm-ar export NM=llvm-nm export OBJCOPY=llvm-objcopy export OBJDUMP=llvm-objdump export STRIP=llvm-strip export HOSTCC=gcc export HOSTCXX=g++
make ARCH=arm64 LLVM=1 LLVM_IAS=1 O=out mrproper make ARCH=arm64 LLVM=1 LLVM_IAS=1 O=out stock_defconfig
make ARCH=arm64 LLVM=1 LLVM_IAS=1 O=out -j$(nproc --all) 2>&1 | tee build.log shell: /usr/bin/bash -e {0} make[1]: Entering directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' Target not found find: ‘arch/arm64/boot/dts/’: No such file or directory find: ‘arch/arm64/boot/dts/’: No such file or directory make[1]: Leaving directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' make[1]: Entering directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' HOSTCC scripts/basic/fixdep GEN ./Makefile HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf drivers/Kconfig:238: can't open file "drivers/kernelsu/Kconfig" make[2]: [../scripts/kconfig/Makefile:104: stock_defconfig] Error 1 make[1]: [/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/Makefile:554: stock_defconfig] Error 2 make[1]: Leaving directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' make: *** [Makefile:146: sub-make] Error 2 Error: Process completed with exit code 2.
简单点的办法: 1.去Google的文档去获取当前内核版本的工具,其实就是那个common内核,只用它带的工具 2.Google那个里面的prebuilt包括编译的工具,一一包含进PATH 3.使用源码里自带的编译脚本,按照提示的语法执行,会自动生成anykernel的包
Run cd kernel_xiaomi_sm7250 cd kernel_xiaomi_sm7250
Export necessary environment variables for the Android Clang toolchain
export PATH="/opt/clang/bin:$PATH"
CROSS_COMPILE points to the prefix of the GNU binutils tools
export CROSS_COMPILE=aarch64-linux-gnu-
Define the compiler as Clang and the linker as LLD
export CC=clang export LD=ld.lld export AR=llvm-ar export NM=llvm-nm export OBJCOPY=llvm-objcopy export OBJDUMP=llvm-objdump export STRIP=llvm-strip export HOSTCC=gcc export HOSTCXX=g++
Clean the build environment and configure the kernel
make ARCH=arm64 LLVM=1 LLVM_IAS=1 O=out mrproper make ARCH=arm64 LLVM=1 LLVM_IAS=1 O=out stock_defconfig
Start the kernel build with logging
make ARCH=arm64 LLVM=1 LLVM_IAS=1 O=out -j$(nproc --all) 2>&1 | tee build.log shell: /usr/bin/bash -e {0} make[1]: Entering directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' Target not found find: ‘arch/arm64/boot/dts/’: No such file or directory find: ‘arch/arm64/boot/dts/’: No such file or directory make[1]: Leaving directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' make[1]: Entering directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' HOSTCC scripts/basic/fixdep GEN ./Makefile HOSTCC scripts/kconfig/conf.o YACC scripts/kconfig/zconf.tab.c LEX scripts/kconfig/zconf.lex.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf drivers/Kconfig:238: can't open file "drivers/kernelsu/Kconfig" make[2]: [../scripts/kconfig/Makefile:104: stock_defconfig] Error 1 make[1]: [/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/Makefile:554: stock_defconfig] Error 2 make[1]: Leaving directory '/home/runner/work/Action_temp/Action_temp/kernel_xiaomi_sm7250/out' make: *** [Makefile:146: sub-make] Error 2 Error: Process completed with exit code 2.