OrangePi R1 编译 kernel 报错解决

    技术2025-03-13  30

    # 编译报错

    liyongjun@liyongjun:~/project/c/OrangePiH2$ sudo ./build.sh Start compiling the kernel ... make: the '-j' option requires a positive integer argument Usage: make [options] [target] ... Options: -b, -m Ignored for compatibility. -B, --always-make Unconditionally make all targets. -C DIRECTORY, --directory=DIRECTORY Change to DIRECTORY before doing anything. …………

    # 分析出错原因

    错误显示 make 使用了 -j 选项,但是后面没有跟具体的数值,判断应该是这里导致的出错

    # 定位出错位置

    liyongjun@liyongjun:~/project/c/OrangePiH2/scripts$ grep -nr "Start compiling the kernel ..." lib/compilation.sh:87: echo -e "\e[1;31m Start compiling the kernel ...\e[0m"

    # 确认出错原因

    -j${CORES},发现这里代表CPU数量的变量 CORES 没有被正确赋值

    if [ $BUILD_KERNEL = "1" ]; then echo -e "\e[1;31m Start compiling the kernel ...\e[0m" if [ ! -f $LINUX/.config ]; then make -C $LINUX ARCH=arm CROSS_COMPILE=$TOOLS sun8iw7p1smp_defconfig echo -e "\e[1;31m Using sun8iw7p1smp_defconfig\e[0m" fi if [ $KERNELVER = "0" ]; then make -C $LINUX ARCH=arm CROSS_COMPILE=$TOOLS -j${CORES} uImage make -C $LINUX ARCH=arm CROSS_COMPILE=$TOOLS -j${CORES} modules cp $LINUX/arch/arm/boot/uImage $BUILD/kernel/uImage_$PLATFORM else # make kernel make -C $LINUX ARCH=arm CROSS_COMPILE=$TOOLS -j${CORES}

    # 修改

    定义 CORES 变量 ./scripts/lib/compilation.sh

    #!/bin/bash # Functions: # compile_uboot # compile_kernel CORES=1 compile_uboot() {
    Processed: 0.011, SQL: 9