77# git repo/branch to use
88GIT_REPO=" https://github.com/torvalds/linux"
99GIT_BRANCH=" master"
10+ # where to clone / build
11+ WORK_DIR=" linux"
1012# base config to use
1113CONFIG=" defconfig"
1214# flavor name
@@ -64,21 +66,21 @@ check_dependencies() {
6466}
6567
6668get_kernel () {
67- git clone --depth=1 --branch " ${GIT_BRANCH} " " ${GIT_REPO} " linux
69+ git clone --depth=1 --branch " ${GIT_BRANCH} " " ${GIT_REPO} " " ${WORK_DIR} "
6870}
6971
7072configure_kernel () {
71- rm -vf linux /kernel/configs/local.config
73+ rm -vf " ${WORK_DIR} /kernel/configs/local.config"
7274 for fragment in " $@ " ; do
7375 log_i " Adding config fragment to local.config: ${fragment} "
74- touch linux /kernel/configs/local.config
75- cat " $fragment " >> linux /kernel/configs/local.config
76+ touch " ${WORK_DIR} /kernel/configs/local.config"
77+ cat " $fragment " >> " ${WORK_DIR} /kernel/configs/local.config"
7678 done
7779
7880 if [ -r kernel/configs/local.config ]; then
79- make -C linux ARCH=arm64 " ${CONFIG} " local.config
81+ make -C " ${WORK_DIR} " ARCH=arm64 " ${CONFIG} " local.config
8082 else
81- make -C linux ARCH=arm64 " ${CONFIG} "
83+ make -C " ${WORK_DIR} " ARCH=arm64 " ${CONFIG} "
8284 fi
8385}
8486
@@ -91,23 +93,23 @@ set_kernel_version() {
9193 # produce a version based on latest tag name, number of commits on top, and
9294 # sha of latest commit, for instance: v6.16, v6.17-rc3-289-gfe3ad7,
9395 # v6.17-rc4
94- localversion=" $( GIT_DIR=linux /.git git describe --tags --abbrev=1) "
96+ localversion=" $( GIT_DIR=" ${WORK_DIR} /.git" git describe --tags --abbrev=1) "
9597
9698 # remove leading "v" and prepend flavor
9799 localversion=" ${FLAVOR} -${localversion# v} "
98100
99101 log_i " Local version is $localversion "
100102
101103 # create or update tag
102- GIT_DIR=linux /.git git tag --force " $localversion "
104+ GIT_DIR=" ${WORK_DIR} /.git" git tag --force " $localversion "
103105
104106 # create localversion file for linux/scripts/setlocalversion
105- echo " $localversion " > linux /localversion
107+ echo " $localversion " > " ${WORK_DIR} /localversion"
106108}
107109
108110build_kernel () {
109111 echo " -${FLAVOR} " > localversion
110- make -C linux " -j$( nproc) " \
112+ make -C " ${WORK_DIR} " " -j$( nproc) " \
111113 ARCH=arm64 DEB_HOST_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- \
112114 KDEB_SOURCENAME=" linux-${FLAVOR} " \
113115 deb-pkg
0 commit comments