[PATCH v3 2/3] automation: add binaries/ to artifacts for Yocto arm32 job

Stefano Stabellini posted 3 patches 1 year, 9 months ago
[PATCH v3 2/3] automation: add binaries/ to artifacts for Yocto arm32 job
Posted by Stefano Stabellini 1 year, 9 months ago
From: Stefano Stabellini <stefano.stabellini@amd.com>

Copy the build output of Yocto builds to binaries/ for the arm32 target,
and export binaries/ among the jobs artifacts so that they can be reused
by other jobs.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---
Changes in v2:
- add --copy-output so that whether the binaries get copied or not is
user selectable
- rename OUTPUT to OUTPUTDIR and move it up in the file
---
 automation/build/yocto/build-yocto.sh | 16 ++++++++++++++++
 automation/gitlab-ci/build.yaml       |  4 +++-
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/automation/build/yocto/build-yocto.sh b/automation/build/yocto/build-yocto.sh
index 3601cebc3c..93ce81ce82 100755
--- a/automation/build/yocto/build-yocto.sh
+++ b/automation/build/yocto/build-yocto.sh
@@ -18,6 +18,7 @@ CACHEDIR="$HOME/yocto-cache"
 LOGDIR="$HOME/logs"
 XENDIR="$HOME/xen"
 BUILDDIR="$HOME/build"
+OUTPUTDIR=`pwd`/binaries
 
 # what yocto bsp we support
 TARGET_SUPPORTED="qemuarm qemuarm64 qemux86-64"
@@ -31,6 +32,7 @@ do_build="y"
 do_run="y"
 do_localsrc="n"
 do_dump="n"
+do_copy="n"
 build_result=0
 
 # layers to include in the project
@@ -166,6 +168,16 @@ function project_build() {
         source "${YOCTODIR}/poky/oe-init-build-env" "${destdir}"
 
         bitbake "${build_image}" || exit 1
+        if [ $do_copy = "y" ]
+        then
+            if [ $target = "qemuarm" ]
+            then
+                mkdir -p $OUTPUTDIR
+                cp $BUILDDIR/tmp/deploy/images/qemuarm/zImage $OUTPUTDIR
+                cp $BUILDDIR/tmp/deploy/images/qemuarm/xen-qemuarm $OUTPUTDIR
+                cp $BUILDDIR/tmp/deploy/images/qemuarm/xen-image-minimal-qemuarm.tar.bz2 $OUTPUTDIR
+            fi
+        fi
     ) || return 1
 }
 
@@ -235,6 +247,7 @@ Options:
                    Default: ${CACHEDIR}
   --layer-dir=DIR  directory containing the checkout of yocto layers
                    Default: ${YOCTODIR}
+  --copy-output    Copy output binaries to binaries/
 EOF
 }
 
@@ -290,6 +303,9 @@ do
         --layer-dir=*)
             YOCTODIR="${OPTION#*=}"
             ;;
+        --copy-output)
+            do_copy="y"
+            ;;
         --*)
             echo "Invalid option ${OPTION}"
             help
diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.yaml
index b6ae1c663b..d731642785 100644
--- a/automation/gitlab-ci/build.yaml
+++ b/automation/gitlab-ci/build.yaml
@@ -208,13 +208,14 @@
     - /^coverity-tested\/.*/
     - /^stable-.*/
   script:
-    - ./automation/build/yocto/build-yocto.sh -v --log-dir=./logs --xen-dir=`pwd` ${YOCTO_BOARD}
+    - ./automation/build/yocto/build-yocto.sh -v --log-dir=./logs --xen-dir=`pwd` ${YOCTO_BOARD} ${YOCTO_OUTPUT}
   variables:
     YOCTO_VERSION: kirkstone
     CONTAINER: yocto:${YOCTO_VERSION}-${YOCTO_BOARD}-${YOCTO_HOST}
   artifacts:
     paths:
       - 'logs/*'
+      - binaries/
     when: always
   needs: []
 
@@ -744,6 +745,7 @@ yocto-qemuarm:
   extends: .yocto-test-arm64
   variables:
     YOCTO_BOARD: qemuarm
+    YOCTO_OUTPUT: --copy-output
 
 yocto-qemux86-64:
   extends: .yocto-test-arm64
-- 
2.25.1
Re: [PATCH v3 2/3] automation: add binaries/ to artifacts for Yocto arm32 job
Posted by Michal Orzel 1 year, 9 months ago
Hi Stefano,

On 18/02/2023 01:07, Stefano Stabellini wrote:
> 
> 
> From: Stefano Stabellini <stefano.stabellini@amd.com>
> 
> Copy the build output of Yocto builds to binaries/ for the arm32 target,
> and export binaries/ among the jobs artifacts so that they can be reused
> by other jobs.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>

Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal