aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYing-Chun Liu (PaulLiu) <paul.liu@linaro.org>2022-10-14 16:21:30 +0800
committerYing-Chun Liu (PaulLiu) <paul.liu@linaro.org>2022-10-14 16:22:51 +0800
commitea96dd804f32adaa3e74a620412c5a83d37e8f67 (patch)
tree326bdb7c20f52f0fdd94858094a56669d07175f1
parent2260154ffd3881ce2d73439dcd054a78ca9174a0 (diff)
Update build scripts to use CI's scripts.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
-rw-r--r--README.md37
-rwxr-xr-xbuild_rockpi_image.sh32
-rwxr-xr-xcreate_docker.sh7
-rwxr-xr-xdownload_everything.sh17
-rwxr-xr-xrun_ci_scripts.py31
5 files changed, 79 insertions, 45 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..157b163
--- /dev/null
+++ b/README.md
@@ -0,0 +1,37 @@
+RockPi Cuttlefish Build Scripts
+--------------------------------
+
+This repo hosts the scripts for building rockpi cuttlefish image locally.
+
+Before running the scripts, please run
+ git clone https://git.linaro.org/ci/job/configs.git
+
+We use build scrpits from the CI's job and we setting necessary environment
+locally in our scripts.
+
+## Downloading the image.
+
+Run ./download_everything.sh
+
+It will download everything in ./build directory.
+
+## Building the image.
+
+Run ./build_rockpi_image.sh
+
+The image will be in build/output/
+
+## Setting up docker.
+
+You can run the above scripts directly. Or run it inside a docker.
+To create a docker locally please refer ./create_docker.sh.
+
+After the container created, please add an user account and "su -l"
+to the user.
+
+Then run the download and build scripts inside the container.
+
+
+
+
+
diff --git a/build_rockpi_image.sh b/build_rockpi_image.sh
index ca8e6f4..6d0a7b5 100755
--- a/build_rockpi_image.sh
+++ b/build_rockpi_image.sh
@@ -7,35 +7,9 @@ ionice -c 3 -p "$SELFPID"
#taskset -c -pa 0,1 "$SELFPID"
#ulimit -Sv 10000000
+export KEEP_SOURCE_CODE=1
+
LOG_FILE=rockpi-log-`date +%Y%m%d%H%M%S`.txt
exec > >(tee ${LOG_FILE}) 2>&1
-echo Starting at `date -Iseconds`
-
-UBOOTPATH=`pwd`/u-boot-mainline
-KERNELPATH=`pwd`/kernel
-mkdir -p output/host/image
-OUTPUTPATH=`pwd`/output/host/image
-
-export PATH="$PATH":/sbin:/usr/sbin
-
-# Install deps
-#sudo apt-get install gcc-aarch64-linux-gnu gcc-arm-none-eabi debootstrap qemu-user-static
-#sudo apt install lz4 cpio qemu-system-arm rsync
-#sudo apt install procps
-#sudo apt install gdisk
-
-cd aosp
-source build/envsetup.sh
-
-# clean the image
-rm -f "$OUTPUTPATH"/test.img
-
-# Set the (psudo) Target
-lunch aosp_cf_x86_64_phone-userdebug
-#make -j8
-
-# Remove this line to not rebuild the kernel
-#export SKIP_MRPROPER=1
-# Build image
-./device/google/cuttlefish/tools/create_base_image_arm.sh "$UBOOTPATH" "$KERNELPATH" "$OUTPUTPATH"/test.img
+exec ./run_ci_scripts.py ./configs/android-rockpi-cuttlefish.yaml ./configs/android-rockpi-cuttlefish/builders.sh
diff --git a/create_docker.sh b/create_docker.sh
new file mode 100755
index 0000000..3638f99
--- /dev/null
+++ b/create_docker.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+docker run -d -it \
+ --name linaro-rockpi-builder \
+ --mount type=bind,source=/media/paulliu/514c5743-67da-43fa-a6a4-3427f94d33bb/paulliu,target=/home/paulliu \
+ --privileged \
+ debian:bullseye bash
diff --git a/download_everything.sh b/download_everything.sh
index b31ffca..37440ba 100755
--- a/download_everything.sh
+++ b/download_everything.sh
@@ -4,19 +4,4 @@ SELFPID=$$
renice 10 -p "$SELFPID"
ionice -c 3 -p "$SELFPID"
-UBOOTREPO="https://android.googlesource.com/kernel/manifest/"
-#UBOOTREPO="https://android.googlesource.com/platform/manifest"
-UBOOTBRANCH="u-boot-mainline"
-KERNELREPO="https://android.googlesource.com/kernel/manifest"
-KERNELBRANCH="common-android13-5.15"
-AOSPREPO="https://android.googlesource.com/platform/manifest"
-AOSPBRANCH="master"
-
-# Checkout U-Boot
-mkdir -p u-boot-mainline && cd u-boot-mainline && repo init -u "$UBOOTREPO" -b "$UBOOTBRANCH" && repo sync && cd -
-
-# Checkout Kernel
-mkdir -p kernel && cd kernel && repo init -u "$KERNELREPO" -b "$KERNELBRANCH" && repo sync && cd -
-
-# Checkout AOSP
-mkdir -p aosp && cd aosp && repo init -u "$AOSPREPO" -b "$AOSPBRANCH" && repo sync && cd -
+exec ./run_ci_scripts.py ./configs/android-rockpi-cuttlefish.yaml ./configs/android-rockpi-cuttlefish/downloader.sh
diff --git a/run_ci_scripts.py b/run_ci_scripts.py
new file mode 100755
index 0000000..aa44bcb
--- /dev/null
+++ b/run_ci_scripts.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+
+import argparse
+import yaml
+import os
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument("yaml_file",
+ help="yaml of the CI.")
+ parser.add_argument("shell_script",
+ help="shell script.")
+
+ args = parser.parse_args()
+ yamlFilePath = args.yaml_file
+ shellScriptPath = args.shell_script
+
+ f = open(yamlFilePath, "r")
+ yaml.SafeLoader.add_constructor(u'!include:', lambda l,n: None)
+ yamlData = yaml.load(f, Loader=yaml.SafeLoader)
+ for i in yamlData:
+ parameters = []
+ if ("job" in i and "parameters" in i["job"]):
+ parameters = i["job"]["parameters"]
+ for j in parameters:
+ if ("string" in j and "name" in j["string"] and "default" in j["string"]):
+ paramName = j["string"]["name"]
+ paramValue = j["string"]["default"]
+ os.environ[paramName] = str(paramValue)
+
+ os.system(shellScriptPath)