65 lines
1.1 KiB
Bash
Executable File
65 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
|
|
PACKAGE_CONFIG=${PACKAGE_CONFIG:-package.config}
|
|
. ${PACKAGE_CONFIG}
|
|
|
|
|
|
CUR_DIR=`dirname $(realpath $0)`
|
|
|
|
if [ ! -e "${CROSS_COMPILE}gcc" ]; then
|
|
CROSS_COMPILE=aarch64-linux-gnu-
|
|
fi
|
|
|
|
FOLDER_NAME=${FOLDER_NAME:build}
|
|
FOLDER="`pwd`/${FOLDER_NAME}/"
|
|
KBUILD_BUILD_USER=acosail
|
|
KBUILD_BUILD_HOST=acosail
|
|
ARCH=arm64
|
|
|
|
export ARCH CROSS_COMPILE KBUILD_BUILD_USER KBUILD_BUILD_HOST
|
|
|
|
PARAMS="-C ${SRC} INSTALL_MOD_STRIP=1 O=${FOLDER} -j${CORES}"
|
|
|
|
echo "build kernel"
|
|
|
|
if [ ! -d "${FOLDER}" ]; then
|
|
mkdir ${FOLDER}
|
|
cp $CUR_DIR/conf/${CONFIG_NAME} ${FOLDER}.config
|
|
fi
|
|
|
|
CMD=
|
|
|
|
if [ "_$1" == "_deb" ]; then
|
|
echo "build debs"
|
|
CMD=bindeb-pkg
|
|
RET=$?
|
|
elif [ "_$1" == "_menu" ]; then
|
|
CMD=menuconfig
|
|
elif [ "_$1" == "_c" ]; then
|
|
CMD=
|
|
elif [ "_$1" == "_mrproper" ]; then
|
|
CMD=mrproper
|
|
else
|
|
CMD=targz-pkg
|
|
fi
|
|
|
|
make ${PARAMS} ${CMD}
|
|
RET=$?
|
|
|
|
if [ "$RET" -eq 0 ]; then
|
|
if [ "_${CMD}" == "_targz-pkg" ]; then
|
|
echo "copy kernel tar file to images/"
|
|
cp ${FOLDER}linux-5.15.80.bpo*.tar.gz $CUR_DIR/images/linux-5.15.0+-arm64.tar.gz
|
|
fi
|
|
|
|
cd $CUR_DIR
|
|
echo "current version:"
|
|
cat ${FOLDER}/include/config/kernel.release
|
|
echo "done"
|
|
else
|
|
echo "kernel build error!"
|
|
fi
|
|
|
|
exit $RET
|