File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,29 @@ configure_kernel() {
8282 fi
8383}
8484
85+ set_kernel_version () {
86+ # the default upstream algorithm for KERNELRELEASE from
87+ # linux/scripts/setlocalversion would be fine, but prepend flavor name for
88+ # the package names to be like linux-image-flavor-kernelrelease instead of
89+ # linux-image-kernelrelease
90+
91+ # produce a version based on latest tag name, number of commits on top, and
92+ # sha of latest commit, for instance: v6.16, v6.17-rc3-289-gfe3ad7,
93+ # v6.17-rc4
94+ localversion=" $( git describe --tags --abbrev=1) "
95+
96+ # remove leading "v" and prepend flavor
97+ localversion=" ${FLAVOR} -${localversion# v} "
98+
99+ log_i " Local version is $localversion "
100+
101+ # create or update tag
102+ git tag --force " $localversion "
103+
104+ # create localversion file for linux/scripts/setlocalversion
105+ echo " $localversion " > localversion
106+ }
107+
85108build_kernel () {
86109 echo " -${FLAVOR} " > localversion
87110 make -C linux " -j$( nproc) " \
@@ -99,6 +122,9 @@ get_kernel
99122log_i " Configuring Linux with base config ${CONFIG} and config fragments $* "
100123configure_kernel " $@ "
101124
125+ log_i " Setting local kernel version for flavor ${FLAVOR} "
126+ set_kernel_version
127+
102128log_i " Building Linux deb"
103129build_kernel
104130
You can’t perform that action at this time.
0 commit comments