script: Make linux-tizen-modules-source git repo up-to-date on the same branch
authorSung-hun Kim <sfoon.kim@samsung.com>
Wed, 6 Nov 2024 10:10:42 +0000 (19:10 +0900)
committerJaehoon Chung <jh80.chung@samsung.com>
Tue, 12 Nov 2024 04:03:21 +0000 (13:03 +0900)
If the version of linux-tizen-modules-source is different from the kernel,
the created boot image may not boot the target exactly.
This patch executes `git pull` on the linux-tizen-modules-source repo after
making the branch of linux-tizen-modules-source synced with the kernel.

If the user don't want it, just passes  "dontpull" as the last argument of
the build script. It will not execute `git pull`.

Change-Id: I553738259e23d1bac1009f0c948beaefb08ed27a
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
build-rpi4.sh

index 7c6855e907d535507564f0a565ad7e6e62b8d65a..cb6865f519a273ffcddd2caf18f9503cdc28dc80 100755 (executable)
@@ -14,11 +14,14 @@ BUILD_ROOT=$PWD
 KERNEL_PATH=`basename ${BUILD_ROOT}`
 
 if [ $# == 0 ]; then
-       echo "Usage : $0 <architecture> [rt] [bootimg]"
+       echo "Usage : $0 <architecture> [rt] [bootimg] [dontpull]"
        echo "  architecture : arm or arm64"
+       echo "  dontpull : do not execute \"git pull\" on linux-tizen-modules-source"
        echo "  e.g) $0 arm"
+       echo "  e.g) $0 arm dontpull"
        echo "  e.g) $0 arm64 rt"
        echo "  e.g) $0 arm64 bootimg"
+       echo "  e.g) $0 arm64 bootimg dontpull"
        echo "  e.g) $0 arm rt bootimg"
        exit
 fi
@@ -102,8 +105,18 @@ function mk_bootimg()
 function mk_tizen_modules()
 {
        if [ -e ${BUILD_ROOT}/../linux-tizen-modules-source ]; then
+               if [ $MODULE_PULL = "1" ]; then
+                       BRANCH=`git rev-parse --abbrev-ref HEAD`
+                       echo "Current branch is "$BRANCH
+               fi
+
                pushd ${BUILD_ROOT}/../linux-tizen-modules-source
 
+               if [ $MODULE_PULL = "1" ]; then
+                       git checkout $BRANCH
+                       git pull
+               fi
+
                ln -s ${PWD}/include kernel
 
                export LOGGER_MAIN_BUFFER_SIZE=256
@@ -218,6 +231,12 @@ if [ "$2" = "bootimg" ] || [ "$3" = "bootimg" ]; then
        IS_BOOTIMG=1
 fi
 
+MODULE_PULL=1
+if [ "$2" = "dontpull" ] || [ "$3" = "dontpull" ] || [ "$4" = "dontpull" ]; then
+       echo "Modules don't be pulled from git repo"
+       MODULE_PULL=0
+fi
+
 if [ "$IS_RT" = "1" ]; then
        echo "Build RT-Kernel"
        BUILD_VERSION=`cat .kernel_buildenv`