bianbu-linux-6.6/scripts/build_kernel.sh
James Deng aeb934e360 scripts: Fixed build_kernel.sh error
Change-Id: I4878ac43a94b4fb6757f45eb25cd64e0aaac9fcb
2024-11-28 18:27:34 +08:00

62 lines
1.3 KiB
Bash
Executable file

#!/bin/bash -e
SCRIPT="./scripts/build_kernel.sh"
CLEAN=false
BUILD_DEB=false
while getopts "cdh" opt
do
case $opt in
c)
CLEAN=true
;;
d)
BUILD_DEB=true
;;
?)
echo "Usage: Run on the top of linux directory"
echo "$SCRIPT [-c] [-d]"
exit 1
;;
esac
done
if [ $0 != $SCRIPT ]
then
echo "Run $(basename $SCRIPT) on the top of linux directory"
exit 1
fi
command -v riscv64-unknown-linux-gnu-gcc > /dev/null || \
(echo "Install cross compile and add to PATH" && exit 1)
export ARCH=riscv
export CROSS_COMPILE=riscv64-unknown-linux-gnu-
export KERNELRELEASE=6.1.15
export LOCALVERSION=""
if [ $CLEAN = true ]
then
make distclean
if [ $BUILD_DEB = true ]
then
rm -f ../linux-headers-$KERNELRELEASE_*_riscv64.deb
rm -f ../linux-image-$KERNELRELEASE_*_riscv64.deb
rm -f ../linux-image-$KERNELRELEASE-dbg_*_riscv64.deb
rm -f ../linux-libc-dev_*_riscv64.deb
rm -f ../linux-riscv-spacemit_*_riscv64.*
fi
fi
make k1_defconfig
if [ $BUILD_DEB = true ]
then
KDEB_SOURCENAME=linux-riscv-spacemit \
KDEB_PKGVERSION=6.1.15-$(TZ=Asia/Shanghai date +"%Y%m%d%H%M%S") \
KDEB_CHANGELOG_DIST=mantic-porting \
make -j$(nproc) bindeb-pkg
else
make -j$(nproc)
fi