ANDROID: revert scripts/setlocalversion to track upstream.

Revert all Android-ism in scripts/setlocalversion to prevent
future merge conflicts.

This reverts scripts/setlocalversion to the following commit:
534293368a
"Merge tag 'kbuild-fixes-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild"

Also fix up Makefile for the invocation to be the same
as upstream according to:
0597dfed43
"Merge ec31f868ec ("setlocalversion: absorb $(KERNELVERSION)") into android-mainline"

Test: TH
Bug: 278110711
Change-Id: I6b06b227c006c56c734ede656a55e897d6203d5a
Signed-off-by: Yifan Hong <elsk@google.com>
This commit is contained in:
Yifan Hong
2023-05-10 13:08:07 -07:00
parent 1ef87dde39
commit bbf887fdf3
2 changed files with 3 additions and 33 deletions
+1 -1
View File
@@ -1315,7 +1315,7 @@ endif
$(sort $(KBUILD_LDS) $(KBUILD_VMLINUX_OBJS) $(KBUILD_VMLINUX_LIBS)): . ;
ifeq ($(origin KERNELRELEASE),file)
filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree) $(BRANCH) $(KMI_GENERATION)
filechk_kernel.release = $(srctree)/scripts/setlocalversion $(srctree)
else
filechk_kernel.release = echo $(KERNELRELEASE)
endif
+2 -32
View File
@@ -11,7 +11,7 @@
#
usage() {
echo "Usage: $0 [--no-local] [srctree] [branch] [kmi-generation]" >&2
echo "Usage: $0 [--no-local] [srctree]" >&2
exit 1
}
@@ -22,28 +22,10 @@ if test "$1" = "--no-local"; then
fi
srctree=.
android_release=
kmi_generation=
if test $# -gt 0; then
srctree=$1
shift
fi
if test $# -gt 0; then
# Extract the Android release version. If there is no match, then return 255
# and clear the var $android_release
android_release=`echo "$1" | sed -e '/android[0-9]\{2,\}/!{q255}; \
s/^\(android[0-9]\{2,\}\)-.*/\1/'`
if test $? -ne 0; then
android_release=
fi
shift
if test $# -gt 0; then
kmi_generation=$1
[ $(expr $kmi_generation : '^[0-9]\+$') -eq 0 ] && usage
shift
fi
fi
if test $# -gt 0 -o ! -d "$srctree"; then
usage
fi
@@ -75,12 +57,6 @@ scm_version()
return
fi
if [ -n "$android_release" ] && [ -n "$kmi_generation" ]; then
printf '%s' "-$android_release-$kmi_generation"
elif [ -n "$android_release" ]; then
printf '%s' "-$android_release"
fi
# If a localversion*' file and the corresponding annotated tag exist,
# use it. This is the case in linux-next.
tag=${file_localversion#-}
@@ -191,10 +167,4 @@ elif [ "${LOCALVERSION+set}" != "set" ]; then
scm_version="$(scm_version --short)"
fi
# ANDROID: add the abXXX number if BUILD_NUMBER is set
build_num=""
if test -n "${BUILD_NUMBER}"; then
build_num="-ab${BUILD_NUMBER}"
fi
echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}${build_num}"
echo "${KERNELVERSION}${file_localversion}${config_localversion}${LOCALVERSION}${scm_version}"