[Feature][ZXW-25]add version in ap, boot, cap

Change-Id: I381aa18ef8a692dc302891151f2dd45e6cae0a8b
diff --git a/ap/build/build.sh b/ap/build/build.sh
index 3b20462..6c42e8c 100755
--- a/ap/build/build.sh
+++ b/ap/build/build.sh
@@ -1,5 +1,7 @@
 #!/bin/bash
-
+#xf.li@20230420 add for ZXW-25 start
+export LYNQ_VERSION="T106_AP_version"
+#xf.li@20230420 add for ZXW-25 end
 #TOPDIR_AP define in project/pubconf.mk
 export TOPDIR=${TOPDIR_AP}/..
 export CP_ROOT_DIR=${TOPDIR}/cp
diff --git a/ap/os/linux/linux-3.4.x/init/version.c b/ap/os/linux/linux-3.4.x/init/version.c
index 86fe0cc..01275b6 100644
--- a/ap/os/linux/linux-3.4.x/init/version.c
+++ b/ap/os/linux/linux-3.4.x/init/version.c
@@ -45,4 +45,7 @@
 const char linux_proc_banner[] =
 	"%s version %s"
 	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
+//xf.li@20230420 add for ZXW-25 start
+	" (" LYNQ_VERSION ")"
+//xf.li@20230420 add for ZXW-25 end
 	" (" LINUX_COMPILER ") %s\n";
diff --git a/ap/os/linux/linux-3.4.x/scripts/mkcompile_h b/ap/os/linux/linux-3.4.x/scripts/mkcompile_h
index 198517f..88bad3b 100755
--- a/ap/os/linux/linux-3.4.x/scripts/mkcompile_h
+++ b/ap/os/linux/linux-3.4.x/scripts/mkcompile_h
@@ -44,20 +44,26 @@
 	TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
 fi
 if test -z "$KBUILD_BUILD_USER"; then
-	LINUX_COMPILE_BY="SCM"
+#xf.li@2023.04.14 modify for ZXW-25 start
+	LINUX_COMPILE_BY=${USER}
+
 else
 	LINUX_COMPILE_BY=$KBUILD_BUILD_USER
 fi
 if test -z "$KBUILD_BUILD_HOST"; then
-	LINUX_COMPILE_HOST="ZTE"
+	LINUX_COMPILE_HOST=`uname -n`
 else
 	LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
 fi
+#xf.li@2023.04.10 modify for ZXW-25 end
 
 UTS_VERSION="#$VERSION"
 #zhouguopo modify begin
 UTS_VERSION="#2"
 #zhouguopo modify end
+#xf.li@2023.04.20 modify for ZXW-25 start
+LYNQ_VERSION="$(echo $COMMITID $LYNQ_VERSION)"
+#xf.li@2023.04.20 modify for ZXW-25 end
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
 if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi
@@ -77,7 +83,9 @@
   echo \#define UTS_MACHINE \"$ARCH\"
 
   echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\"
-
+#xf.li@2023.04.14 modify for ZXW-25 start
+  printf '#define LYNQ_VERSION "%s"\n' "$LYNQ_VERSION"
+#xf.li@2023.04.14 modify for ZXW-25 end
   echo \#define LINUX_COMPILE_BY \"`echo $LINUX_COMPILE_BY | $UTS_TRUNCATE`\"
   echo \#define LINUX_COMPILE_HOST \"`echo $LINUX_COMPILE_HOST | $UTS_TRUNCATE`\"
 
diff --git a/boot/common/src/uboot/arch/arm/lib/Makefile b/boot/common/src/uboot/arch/arm/lib/Makefile
index 8a07839..ddd8883 100644
--- a/boot/common/src/uboot/arch/arm/lib/Makefile
+++ b/boot/common/src/uboot/arch/arm/lib/Makefile
@@ -48,7 +48,12 @@
 SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o
 SOBJS-$(CONFIG_USE_ARCH_MEMCPY) += memcpy.o
 endif
-
+#xf.li@2023.04.14 modify for ZXW-25 start
+LYNQ_CONFIG_VERSION = "T106_AP_version_CAP_version_inside"
+CFLAGS += -DLYNQ_VERSION=\"$(LYNQ_CONFIG_VERSION)\"
+LYNQ_CONFIG_COMMITID = "e2a3410390ff0ad762462ccb6af8faa5e16dcd61"
+CFLAGS += -DLYNQ_COMMITID=\"$(LYNQ_CONFIG_COMMITID)\"
+#xf.li@2023.04.14 modify for ZXW-25 end
 SRCS	:= $(GLSOBJS:.o=.S) $(GLCOBJS:.o=.c) \
 	   $(SOBJS-y:.o=.S) $(COBJS-y:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS-y) $(COBJS-y))
diff --git a/boot/common/src/uboot/arch/arm/lib/board.c b/boot/common/src/uboot/arch/arm/lib/board.c
index 6a2f577..d82689c 100755
--- a/boot/common/src/uboot/arch/arm/lib/board.c
+++ b/boot/common/src/uboot/arch/arm/lib/board.c
@@ -64,6 +64,11 @@
 	debug("U-Boot code: 0x%08lX -> 0x%08lX  BSS: -> 0x%08lX\n",
 	       _TEXT_BASE,
 	       _bss_start_ofs + _TEXT_BASE, _bss_end_ofs + _TEXT_BASE);
+//xf.li@2023.04.14 modify for ZXW-25 start
+#ifdef LYNQ_VERSION
+	debug("LYNQ_VERSION:"LYNQ_VERSION" LYNQ_COMMITID: "LYNQ_COMMITID"\n");
+#endif
+//xf.li@2023.04.14 modify for ZXW-25 end
 #ifdef CONFIG_MODEM_SUPPORT
 	debug("Modem Support enabled\n");
 #endif
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf b/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
index bcfe0af..9cc2d8b 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
+++ b/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
@@ -66,3 +66,7 @@
 
 #OEMAPP_CFG value:"PLATFORM","GSW"
 MOBILETEK_OEMAPP_CFG = "PLATFORM"
+
+LYNQ_CONFIG_COMMITID = "e2a3410390ff0ad762462ccb6af8faa5e16dcd61"
+LYNQ_CONFIG_VERSION = "T106_ap_version_cap_0425"
+LYNQ_CONFIG_SW_VERSION = "T106_ap_version_MR3.02b06.00"
diff --git a/cap/zx297520v3/sources/poky/meta/classes/kernel.bbclass b/cap/zx297520v3/sources/poky/meta/classes/kernel.bbclass
index 2a3cb21..8815a42 100644
--- a/cap/zx297520v3/sources/poky/meta/classes/kernel.bbclass
+++ b/cap/zx297520v3/sources/poky/meta/classes/kernel.bbclass
@@ -167,9 +167,12 @@
 export OS = "${TARGET_OS}"
 export CROSS_COMPILE = "${TARGET_PREFIX}"
 export KBUILD_BUILD_VERSION = "1"
-export KBUILD_BUILD_USER ?= "oe-user"
-export KBUILD_BUILD_HOST ?= "oe-host"
-
+#xf.li@2023.04.14 modify for ZXW-25 start
+#export KBUILD_BUILD_USER ?= "oe-user"
+#export KBUILD_BUILD_HOST ?= "oe-host"
+export LYNQ_VERSION ?= "${LYNQ_CONFIG_VERSION}"
+export COMMITID ?= "${LYNQ_CONFIG_COMMITID}"
+#xf.li@2023.04.14 modify for ZXW-25 end
 KERNEL_RELEASE ?= "${KERNEL_VERSION}"
 
 # The directory where built kernel lies in the kernel tree
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/proc/version.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/proc/version.c
index b449f18..8424e54 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/proc/version.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/fs/proc/version.c
@@ -5,7 +5,9 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/utsname.h>
-
+//#xf.li@2023.04.14 modify for ZXW-25 start
+#include <generated/compile.h>
+//#xf.li@2023.04.14 modify for ZXW-25 end
 static int version_proc_show(struct seq_file *m, void *v)
 {
 	seq_printf(m, linux_proc_banner,
@@ -18,6 +20,9 @@
 static int __init proc_version_init(void)
 {
 	proc_create_single("version", 0, NULL, version_proc_show);
+//#xf.li@2023.04.14 modify for ZXW-25 start
+	printk("LYNQ_VERSION: ("LYNQ_VERSION") "UTS_VERSION" \n");
+//#xf.li@2023.04.14 modify for ZXW-25 end
 	return 0;
 }
 fs_initcall(proc_version_init);
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/version.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/version.c
index cba3411..5e6425b 100644
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/version.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/init/version.c
@@ -50,6 +50,9 @@
 const char linux_proc_banner[] =
 	"%s version %s"
 	" (" LINUX_COMPILE_BY "@" LINUX_COMPILE_HOST ")"
+//xf.li@20230420 add for ZXW-25 start
+	" (" LYNQ_VERSION ")"
+//xf.li@20230420 add for ZXW-25 end
 	" (" LINUX_COMPILER ") %s\n";
 
 BUILD_SALT;
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/scripts/mkcompile_h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/scripts/mkcompile_h
index a72b154..f03dd15 100755
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/scripts/mkcompile_h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/scripts/mkcompile_h
@@ -30,7 +30,9 @@
 	TIMESTAMP=$KBUILD_BUILD_TIMESTAMP
 fi
 if test -z "$KBUILD_BUILD_USER"; then
-	LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
+#xf.li@2023.04.14 modify for ZXW-25 start
+	LINUX_COMPILE_BY=${USER}
+#xf.li@2023.04.10 modify for ZXW-25 end
 else
 	LINUX_COMPILE_BY=$KBUILD_BUILD_USER
 fi
@@ -39,7 +41,6 @@
 else
 	LINUX_COMPILE_HOST=$KBUILD_BUILD_HOST
 fi
-
 UTS_VERSION="#$VERSION"
 CONFIG_FLAGS=""
 if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi
@@ -49,7 +50,9 @@
 # Truncate to maximum length
 UTS_LEN=64
 UTS_VERSION="$(echo $UTS_VERSION $CONFIG_FLAGS $TIMESTAMP | cut -b -$UTS_LEN)"
-
+#xf.li@2023.04.14 modify for ZXW-25 start
+LYNQ_VERSION="$(echo $COMMITID $LYNQ_VERSION)"
+#xf.li@2023.04.14 modify for ZXW-25 end
 # Generate a temporary compile.h
 
 { echo /\* This file is auto generated, version $VERSION \*/
@@ -58,7 +61,9 @@
   echo \#define UTS_MACHINE \"$ARCH\"
 
   echo \#define UTS_VERSION \"$UTS_VERSION\"
-
+#xf.li@2023.04.14 modify for ZXW-25 start
+  printf '#define LYNQ_VERSION "%s"\n' "$LYNQ_VERSION"
+#xf.li@2023.04.14 modify for ZXW-25 end
   printf '#define LINUX_COMPILE_BY "%s"\n' "$LINUX_COMPILE_BY"
   echo \#define LINUX_COMPILE_HOST \"$LINUX_COMPILE_HOST\"
 
diff --git a/update_version.sh b/update_version.sh
new file mode 100644
index 0000000..dc5dbe3
--- /dev/null
+++ b/update_version.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+#export LYNQ_VERSION="T106_lynq_version_ap_build_sh"
+LYNQ_AP_VERSION="T106_ap_version"
+LYNQ_CAP_INSIDE_VERSION="cap_0425"
+LYNQ_CAP_VERSION="MR3.02b06.00"
+COMMIT_ID="$(git rev-parse HEAD)"
+
+LYNQ_SW_INSIDE_VERSION="LYNQ_CONFIG_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_INSIDE_VERSION}\""
+LYNQ_SW_VERSION="LYNQ_CONFIG_SW_VERSION = \"${LYNQ_AP_VERSION}_${LYNQ_CAP_VERSION}\""
+LYNQ_AP_SW_VERSION="export LYNQ_VERSION=\"${LYNQ_AP_VERSION}\""
+LYNQ_COMMITID="LYNQ_CONFIG_COMMITID = \"${COMMIT_ID}\""
+LYNQ_BOOT_COMMIT_ID="LYNQ_COMMIT_ID = \"${COMMIT_ID}\""
+eval sed -i 's/^.*LYNQ_CONFIG_VERSION.*$/"${LYNQ_SW_INSIDE_VERSION}"/' $(pwd)/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
+eval sed -i 's/^.*LYNQ_CONFIG_SW_VERSION.*$/"${LYNQ_SW_VERSION}"/' $(pwd)/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
+eval sed -i 's/^.*LYNQ_CONFIG_COMMITID.*$/"${LYNQ_COMMITID}"/' $(pwd)/cap/zx297520v3/sources/meta-zxic-custom/conf/lynq_base.conf
+eval sed -i 's/^.*LYNQ_VERSION.*$/"${LYNQ_AP_SW_VERSION}"/' $(pwd)/ap/build/build.sh
+eval sed -i 's/^.*LYNQ_CONFIG_VERSION[[:space:]]=.*$/"${LYNQ_SW_INSIDE_VERSION}"/' $(pwd)/boot/common/src/uboot/arch/arm/lib/Makefile
+eval sed -i 's/^.*LYNQ_CONFIG_COMMITID[[:space:]]=.*$/"${LYNQ_COMMITID}"/' $(pwd)/boot/common/src/uboot/arch/arm/lib/Makefile
+
+