From 1507428f968db5c60bba87093c59663c81ca0ec0 Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Fri, 17 Mar 2023 13:42:39 +0000 Subject: [PATCH 01/10] cassini-distro: Explicitly set DISTRO_FEATURES As recommended by the yocto project we should explicitly set the DISTRO_FEATURES variable to ensure we only build packages/features we need. The results in a significant reduction in the number of packages being built. Changelog: other Signed-off-by: Drew Reed --- meta-cassini-distro/conf/distro/cassini.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta-cassini-distro/conf/distro/cassini.conf b/meta-cassini-distro/conf/distro/cassini.conf index de9471f..712f6e2 100644 --- a/meta-cassini-distro/conf/distro/cassini.conf +++ b/meta-cassini-distro/conf/distro/cassini.conf @@ -13,7 +13,7 @@ DISTRO_VERSION = "unstable" # systemd as the init system INIT_MANAGER = "systemd" -DISTRO_FEATURES:append = " virtualization ipv6 seccomp k3s cassini-parsec" +DISTRO_FEATURES = "largefile usbhost ipv4 virtualization seccomp k3s cassini-parsec" # Apply feature specific config USER_CLASSES:append = " cassini-distro-features" -- GitLab From 3ac671fc1949dedb803bfad2af060f33e8dd1128 Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Mon, 3 Apr 2023 15:19:47 +0000 Subject: [PATCH 02/10] ci: Fix yamllint issue Split the definition of `.if-new-merge-request` over 2 lines to meet the yamllint 80 character line length rule Signed-off-by: Drew Reed --- .gitlab/ci/docker-image-builds.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitlab/ci/docker-image-builds.yml b/.gitlab/ci/docker-image-builds.yml index 2e5638b..80a0c41 100644 --- a/.gitlab/ci/docker-image-builds.yml +++ b/.gitlab/ci/docker-image-builds.yml @@ -4,7 +4,8 @@ --- # Conditions .if-new-merge-request: &if-new-merge-request - if: '$CI_MERGE_REQUEST_IID && ($CI_MERGE_REQUEST_PROJECT_ID != $CI_MERGE_REQUEST_SOURCE_PROJECT_ID)' + if: "$CI_MERGE_REQUEST_IID && + ($CI_MERGE_REQUEST_PROJECT_ID != $CI_MERGE_REQUEST_SOURCE_PROJECT_ID)" Build-Utility-Docker-Arch-Image: extends: .build-docker-image -- GitLab From 8e25206c57f7102f8db4e1d4e4bcdfc17efeff0d Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Thu, 6 Apr 2023 09:58:00 +0000 Subject: [PATCH 03/10] ci: Fix a number of spellcheck issues Includes the build directory in the spellcheck exclude list so the checker can be run locally after a build has been done. Fixes the include pattern for the meta-cassini-* directories so it matches correctly. Remove non-existent /gitlab directory from the exclude list. Add used words to the dictionary to clear remaining existing issues. Signed-off-by: Drew Reed --- .codeclimate.yml | 4 ++-- meta-cassini-config/qa-checks/cassini-dictionary | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.codeclimate.yml b/.codeclimate.yml index 821f402..592f427 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -42,8 +42,7 @@ plugins: - "*.yml" - "*.yaml" - "*.json" - - "/meta-cassini-*" - - "/gitlab/" + - "/meta-cassini-*/**/*" - "*.png" - "/documentation/conf.py" - "/documentation/variables.py" @@ -57,6 +56,7 @@ plugins: - ".csslintrc" - ".eslintignore" - ".gitignore" + - "/build/" dict_path: "meta-cassini-config/qa-checks/cassini-dictionary" yamllint: enabled: true diff --git a/meta-cassini-config/qa-checks/cassini-dictionary b/meta-cassini-config/qa-checks/cassini-dictionary index 454df2d..a3d9cba 100644 --- a/meta-cassini-config/qa-checks/cassini-dictionary +++ b/meta-cassini-config/qa-checks/cassini-dictionary @@ -4,6 +4,7 @@ 3.2.1+git0+ab4d0cf908 3rd 4.16+stable0+f265444922 +4gb 512kb CASSINI CHANGELOG.md @@ -29,6 +30,7 @@ baremetal-sdk.yml baremetal.yml baremetal_architecture.png bblayers.conf +binaries bitbake bootloader bsp @@ -71,9 +73,12 @@ containerized containers_kernelcfg_check.bbclass contributing_documentation_build_validation corstone-1000 +corstone1000 +corstone1000-image-corstone1000-mps3.wic.nopt corstone1000-mps3 corstone1000-mps3.yml cortex-a +cortex-a35 customizable customization customizations @@ -96,6 +101,7 @@ docker's docs.lavasoftware.org dom0 domu +download-fpga-images e.g efi endpoint @@ -106,6 +112,8 @@ filesystem filesystems foobar forking_workflow.html +fpga +fpga-prototyping-boards frobbing functionalities fvp @@ -174,6 +182,7 @@ manual_build_system_target_platforms manual_yocto_layers_layer_dependency_overview maxdepth mb +mcc merchantability merge_requests meta-arm-bsp @@ -198,6 +207,7 @@ oci openembedded optionally ostree +output_dir parallaxsecond parsec-cli-tests.sh parsec-simple-e2e-tests @@ -248,6 +258,7 @@ runtime-integration-tests sc2086 sc2288 schedulable +sd sdk sdl seccomp @@ -286,6 +297,7 @@ systemd systemready tests.yml titlesonly +tmp toctree top_level_test_name ua_test_clean_env -- GitLab From 266a00222f4273ba2748d4b544124fe4e17e3299 Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Thu, 6 Apr 2023 11:58:05 +0000 Subject: [PATCH 04/10] [cassini-bsp, cassini-distro] Move platform specific settings Moved the Corstone-1000 specific items out of the generic distro layer and into the bsp layer where machine specific settings should live. Changelog: other Signed-off-by: Drew Reed --- .../include/corstone1000-mps3-cassini-extra-settings.inc | 3 +++ .../recipes-core/images/cassini-image-base.bbappend | 7 +++++++ meta-cassini-distro/classes/cassini-image.bbclass | 4 +--- .../recipes-core/images/cassini-image-base.bb | 5 +---- 4 files changed, 12 insertions(+), 7 deletions(-) create mode 100644 meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend diff --git a/meta-cassini-bsp/conf/machine/include/corstone1000-mps3-cassini-extra-settings.inc b/meta-cassini-bsp/conf/machine/include/corstone1000-mps3-cassini-extra-settings.inc index eaa9c89..ca0422d 100644 --- a/meta-cassini-bsp/conf/machine/include/corstone1000-mps3-cassini-extra-settings.inc +++ b/meta-cassini-bsp/conf/machine/include/corstone1000-mps3-cassini-extra-settings.inc @@ -2,6 +2,9 @@ # # SPDX-License-Identifier: MIT +# Generate the cassini wic image +IMAGE_FSTYPES += "wic wic.gz wic.bmap" + # Remove initramfs image generation for cassini distribution due to size restrictions INITRAMFS_IMAGE:remove:libc-glibc = "corstone1000-initramfs-image" diff --git a/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend b/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend new file mode 100644 index 0000000..cfee27c --- /dev/null +++ b/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend @@ -0,0 +1,7 @@ +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +# Ensure cassini-image-* also builds the firmware for corstone1000 using a different libc +do_image_complete[depends] = "${@bb.utils.contains('MACHINE','corstone1000-mps3', \ + 'corstone1000-deploy-image:do_deploy', '', d)}" diff --git a/meta-cassini-distro/classes/cassini-image.bbclass b/meta-cassini-distro/classes/cassini-image.bbclass index 072361f..4e3ae75 100644 --- a/meta-cassini-distro/classes/cassini-image.bbclass +++ b/meta-cassini-distro/classes/cassini-image.bbclass @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# Copyright (c) 2022-2023 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: MIT @@ -8,8 +8,6 @@ IMAGE_BUILDINFO_VARS = " \ inherit core-image extrausers image-buildinfo -IMAGE_FSTYPES:corstone1000 += "wic wic.gz wic.bmap" - # meta-virtualization/recipes-containers/k3s/README.md states that K3s requires # 2GB of space in the rootfs to ensure containers can start CASSINI_ROOTFS_EXTRA_SPACE ?= "2000000" diff --git a/meta-cassini-distro/recipes-core/images/cassini-image-base.bb b/meta-cassini-distro/recipes-core/images/cassini-image-base.bb index 6fe0698..afaf594 100644 --- a/meta-cassini-distro/recipes-core/images/cassini-image-base.bb +++ b/meta-cassini-distro/recipes-core/images/cassini-image-base.bb @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# Copyright (c) 2022-2023 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: MIT @@ -9,6 +9,3 @@ IMAGE_LINGUAS = " " LICENSE = "MIT" inherit cassini-image - -# Ensure cassini-image-* also builds the firmware for platforms that use a different libc -EXTRA_IMAGEDEPENDS:append:corstone1000 = " corstone1000-deploy-image" -- GitLab From dd55c7b85671be2e8446664a3ef69c2b5812927c Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Mon, 30 Jan 2023 14:40:02 +0000 Subject: [PATCH 05/10] [cassini-bsp, cassini-config] Add Corstone-1000 FVP to build Modify the kas configurations to add corstone1000-fvp as a new target and setup other files to allow the FVP build to complete. Changelog: feature Signed-off-by: Drew Reed --- ...orstone1000-fvp-cassini-extra-settings.inc | 21 +++++++++++++++++ .../images/cassini-image-base.bbappend | 13 ++++++++++- .../images/corstone1000-deploy-image.bb | 4 ++-- .../wic/corstone1000-efidisk.wks.in | 6 ++--- meta-cassini-config/kas/ci.yml | 4 ++++ meta-cassini-config/kas/corstone1000-fvp.yml | 23 +++++++++++++++++++ 6 files changed, 65 insertions(+), 6 deletions(-) create mode 100644 meta-cassini-bsp/conf/machine/include/corstone1000-fvp-cassini-extra-settings.inc create mode 100644 meta-cassini-config/kas/corstone1000-fvp.yml diff --git a/meta-cassini-bsp/conf/machine/include/corstone1000-fvp-cassini-extra-settings.inc b/meta-cassini-bsp/conf/machine/include/corstone1000-fvp-cassini-extra-settings.inc new file mode 100644 index 0000000..dac7b66 --- /dev/null +++ b/meta-cassini-bsp/conf/machine/include/corstone1000-fvp-cassini-extra-settings.inc @@ -0,0 +1,21 @@ +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +include conf/machine/include/corstone1000-mps3-cassini-extra-settings.inc + +# FVP parameters +FVP_CONFIG[diagnostics] = "0" +# Corstone-1000's FVP need images to have a extra empty space at the end or the FVP +# truncates the mmc card size resulting in invalid GPT entries as the GPT last block is +# beyond the MMC cards reported size, so we use the padded image here +FVP_CONFIG[board.msd_mmc.p_mmc_file] = "${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.wic.pad" +FVP_CONFIG[board.msd_mmc.diagnostics] = "0" +# Setup the second MMC card +FVP_CONFIG[board.msd_mmc_2.card_type] ?= "SDHC" +FVP_CONFIG[board.msd_mmc_2.p_fast_access] ?= "0" +FVP_CONFIG[board.msd_mmc_2.diagnostics] ?= "0" +FVP_CONFIG[board.msd_mmc_2.p_max_block_count] ?= "0xFFFF" +FVP_CONFIG[board.msd_config_2.pl180_fifo_depth] ?= "16" + +FVP_DATA = "board.flash0=${DEPLOY_DIR_IMAGE}/corstone1000-image-corstone1000-fvp.wic.nopt@0x68100000" diff --git a/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend b/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend index cfee27c..7d9485d 100644 --- a/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend +++ b/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/cassini-image-base.bbappend @@ -2,6 +2,17 @@ # # SPDX-License-Identifier: MIT +# Corstone-1000's FVP needs images to have a extra empty space at the end or the FVP +# truncates the MMC card resulting in invalid GPT entries as the GPT last block is +# beyond the MMC cards reported size +IMAGE_TYPES += "wic.pad" + +CONVERSIONTYPES += "pad" + +CONVERSION_CMD:pad = "cp ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type} ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.pad && dd if=/dev/zero count=1024 bs=512 >> ${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.pad" + +IMAGE_FSTYPES:append:corstone1000-fvp = " wic.pad.gz" + # Ensure cassini-image-* also builds the firmware for corstone1000 using a different libc -do_image_complete[depends] = "${@bb.utils.contains('MACHINE','corstone1000-mps3', \ +do_image_complete[depends] = "${@bb.utils.contains_any('MACHINE','corstone1000-mps3 corstone1000-fvp', \ 'corstone1000-deploy-image:do_deploy', '', d)}" diff --git a/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/corstone1000-deploy-image.bb b/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/corstone1000-deploy-image.bb index ef8a3af..d4bcca5 100644 --- a/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/corstone1000-deploy-image.bb +++ b/meta-cassini-bsp/meta-arm/meta-arm-bsp/recipes-core/images/corstone1000-deploy-image.bb @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# Copyright (c) 2022-2023 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: MIT @@ -8,7 +8,7 @@ inherit deploy nopackages LICENSE = "MIT" PACKAGE_ARCH = "${MACHINE_ARCH}" -COMPATIBLE_MACHINE = "(corstone1000-mps3)" +COMPATIBLE_MACHINE = "(corstone1000-mps3|corstone1000-fvp)" do_configure[noexec] = "1" do_compile[noexec] = "1" do_install[noexec] = "1" diff --git a/meta-cassini-bsp/meta-arm/meta-arm-bsp/wic/corstone1000-efidisk.wks.in b/meta-cassini-bsp/meta-arm/meta-arm-bsp/wic/corstone1000-efidisk.wks.in index 3a65fd0..0a7dfef 100644 --- a/meta-cassini-bsp/meta-arm/meta-arm-bsp/wic/corstone1000-efidisk.wks.in +++ b/meta-cassini-bsp/meta-arm/meta-arm-bsp/wic/corstone1000-efidisk.wks.in @@ -1,4 +1,4 @@ -# Copyright (c) 2022 Arm Limited or its affiliates. All rights reserved. +# Copyright (c) 2022-2023 Arm Limited or its affiliates. All rights reserved. # # SPDX-License-Identifier: MIT @@ -6,8 +6,8 @@ # long-description: Creates a partitioned EFI disk image that the user # can directly dd to boot media. Uses a custom grub.cfg file to configure the boot. -part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --ondisk sda --label msdos --active --align 1024 +part /boot --source bootimg-efi --sourceparams="loader=grub-efi" --label msdos --align 1024 --use-uuid --active -part / --source rootfs --ondisk sda --fstype=ext4 --label root --align 1024 --uuid=6a60524d-061d-454a-bfd1-38989910eccd +part / --source rootfs --fstype=ext4 --label root --align 1024 --use-uuid --uuid 6a60524d-061d-454a-bfd1-38989910eccd bootloader --ptable gpt --configfile="${GRUB_CFG_FILE}" --timeout=5 diff --git a/meta-cassini-config/kas/ci.yml b/meta-cassini-config/kas/ci.yml index cfaf286..d37131d 100644 --- a/meta-cassini-config/kas/ci.yml +++ b/meta-cassini-config/kas/ci.yml @@ -5,6 +5,10 @@ --- header: version: 11 + +env: + FVP_CORSTONE1000_EULA_ACCEPT: "True" + local_conf_header: ci: | INHERIT += "rm_work" diff --git a/meta-cassini-config/kas/corstone1000-fvp.yml b/meta-cassini-config/kas/corstone1000-fvp.yml new file mode 100644 index 0000000..e13de00 --- /dev/null +++ b/meta-cassini-config/kas/corstone1000-fvp.yml @@ -0,0 +1,23 @@ +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +--- +header: + version: 11 + includes: + - meta-cassini-config/kas/corstone1000-mps3.yml + +env: + FVP_CORSTONE1000_EULA_ACCEPT: "False" + TESTIMAGE_AUTO: "0" + +local_conf_header: + fvp-config: | + INHERIT += "${@bb.utils.contains(\ + 'BUILD_ARCH', 'x86_64', 'fvpboot', '', d)}" + LICENSE_FLAGS_ACCEPTED:append = " ${@oe.utils.vartrue(\ + 'FVP_CORSTONE1000_EULA_ACCEPT', 'Arm-FVP-EULA', '', d)}" + IMAGE_CLASSES:append = " testimage" + +machine: corstone1000-fvp -- GitLab From 6a0cd0701b6e28b5fc37b67b2dcf018839c2e0e8 Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Mon, 30 Jan 2023 15:27:24 +0000 Subject: [PATCH 06/10] doc: Add Corstone1000 FVP documentation Modify the documentation to include corstone1000-fvp details Signed-off-by: Drew Reed --- documentation/user_manual/corstone1000fvp.rst | 83 +++++++++++++++++++ documentation/user_manual/index.rst | 1 + documentation/variables.py | 1 + .../qa-checks/cassini-dictionary | 1 + 4 files changed, 86 insertions(+) create mode 100644 documentation/user_manual/corstone1000fvp.rst diff --git a/documentation/user_manual/corstone1000fvp.rst b/documentation/user_manual/corstone1000fvp.rst new file mode 100644 index 0000000..8d3d73e --- /dev/null +++ b/documentation/user_manual/corstone1000fvp.rst @@ -0,0 +1,83 @@ +.. + # Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. + # + # SPDX-License-Identifier: MIT + +########################################## +Getting Started with Arm Corstone-1000 FVP +########################################## + +This document explains how to boot the Cassini distro on the Arm Corstone-1000 FVP. + +***** +Build +***** + +The provided kas configuration file meta-cassini-config/kas/corstone1000-fvp.yml can be used to build images +that are targeting the Corstone-1000 FVP. + +.. note:: + To build and run any image for the Corstone-1000 FVP the user has to + accept its |EULA|_, which can be done by executing + the following command in the build environment: + + .. code-block:: console + + export FVP_CORSTONE1000_EULA_ACCEPT=True + + +Building FVP images +=================== + +To build a Corstone-1000 FVP image: + + .. code-block:: console + + kas build --update meta-cassini-config/kas/cassini.yml:meta-cassini-config/kas/corstone1000-fvp.yml + +*** +Run +*** + +The resulting Cassini distribution image can be logged into as ``root`` user. + +Running the FVP +=============== + +To start the FVP and get the console: + + .. code-block:: console + + kas shell -c="../layers/meta-arm/scripts/runfvp --verbose --console" \ + meta-cassini-config/kas/cassini.yml:meta-cassini-config/kas/corstone1000-fvp.yml + +.. _reproduce_run-time_integration_tests: + +********** +Validation +********** + +The following validation tests can be performed on the Cassini Reference Stack: + + * System Integration Tests: + + * Cassini Architecture Stack: + + .. code-block:: console + + TESTIMAGE_AUTO=1 kas build meta-cassini-config/kas/cassini.yml:meta-cassini-config/kas/corstone1000-fvp.yml + + The previous test takes around 2 minutes to complete. + + A similar output should be printed out: + + .. code-block:: console + + NOTE: Executing Tasks + Creating terminal default on host_terminal_0 + default: Waiting for login prompt + RESULTS: + RESULTS - linuxboot.LinuxBootTest.test_linux_boot: PASSED (23.70s) + SUMMARY: + cassini-image-base () - Ran 1 test in 23.704s + cassini-image-base - OK - All required tests passed (successes=1, skipped=0, failures=0, errors=0) diff --git a/documentation/user_manual/index.rst b/documentation/user_manual/index.rst index cf1a84e..1bf88c6 100644 --- a/documentation/user_manual/index.rst +++ b/documentation/user_manual/index.rst @@ -12,3 +12,4 @@ User Manual build corstone1000 + corstone1000fvp diff --git a/documentation/variables.py b/documentation/variables.py index b464d0b..b819bf3 100644 --- a/documentation/variables.py +++ b/documentation/variables.py @@ -61,6 +61,7 @@ general_links = { "link:Nginx": "https://www.nginx.com/", "link:Potential firmware damage notice": "https://community.arm.com/developer/tools-software/oss-platforms/w/docs/604/notice-potential-damage-to-n1sdp-boards-if-using-latest-firmware-release", "link:GitLab Issues": "https://gitlab.arm.com/cassini/meta-cassini/-/issues", + "link:EULA": "https://developer.arm.com/downloads/-/arm-ecosystem-fvps/eula", } layer_definitions = { diff --git a/meta-cassini-config/qa-checks/cassini-dictionary b/meta-cassini-config/qa-checks/cassini-dictionary index a3d9cba..36b2e65 100644 --- a/meta-cassini-config/qa-checks/cassini-dictionary +++ b/meta-cassini-config/qa-checks/cassini-dictionary @@ -77,6 +77,7 @@ corstone1000 corstone1000-image-corstone1000-mps3.wic.nopt corstone1000-mps3 corstone1000-mps3.yml +corstone1000fvp cortex-a cortex-a35 customizable -- GitLab From 75746dd0625cbf9744e4b60f043adb04eeb18963 Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Thu, 6 Apr 2023 11:56:42 +0000 Subject: [PATCH 07/10] ci: Build Corstone-1000 FVP images Update the ci pipeline to build images for the corstone1000-fvp machine. Signed-off-by: Drew Reed --- .gitlab-ci.yml | 3 +- .gitlab/ci/corstone1000-image-builds.yml | 59 ++++++++++++++++++++++++ .gitlab/ci/templates/image_build.yml.j2 | 49 ++++++++++++++------ .gitlab/ci/trigger-image-builds.yml | 10 ++++ 4 files changed, 106 insertions(+), 15 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 022ec98..ac35e2b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -14,7 +14,8 @@ variables: BUILD_PLATFORM: value: none description: Comma seperated list of platforms to build - (none, all-platforms, corstone1000-mps3, n1sdp) + (none, all-platforms, corstone1000-mps3, corstone1000-fvp, + n1sdp) BUILD_HOST_ARCH: value: arm64 description: What build host architecture should be used diff --git a/.gitlab/ci/corstone1000-image-builds.yml b/.gitlab/ci/corstone1000-image-builds.yml index d0fd4ca..04602d5 100644 --- a/.gitlab/ci/corstone1000-image-builds.yml +++ b/.gitlab/ci/corstone1000-image-builds.yml @@ -10,6 +10,7 @@ RUN_TESTS: 'none' +# Corstone-1000 MPS3 builds cassini/tests/corstone1000-mps3: extends: .corstone1000_generator variables: @@ -60,3 +61,61 @@ cassini-sdk/corstone1000-mps3: $BUILD_PLATFORM =~ /corstone1000-mps3/)' - !reference [".build-image:rules:k3s-sdk", rules] - !reference [".build-image:rules:corstone1000", rules] + +# Corstone-1000 FVP builds +cassini/tests/corstone1000-fvp: + extends: .corstone1000_generator + variables: + MACHINE: corstone1000-fvp + BUILD_HOST_ARCH: x86_64 + rules: + - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && + ($BUILD_PLATFORM =~ /all-platforms/ || + $BUILD_PLATFORM =~ /corstone1000-fvp/)' + - !reference [".build-image:rules:k3s", rules] + - !reference [".build-image:rules:corstone1000", rules] + +cassini/security/tests/corstone1000-fvp: + extends: .corstone1000_generator + variables: + MACHINE: corstone1000-fvp + BUILD_HOST_ARCH: x86_64 + rules: + - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && + ($BUILD_PLATFORM =~ /all-platforms/ || + $BUILD_PLATFORM =~ /corstone1000-fvp/)' + - !reference [".build-image:rules:k3s-security", rules] + - !reference [".build-image:rules:corstone1000", rules] + +cassini-dev/tests/corstone1000-fvp: + extends: .corstone1000_generator + variables: + MACHINE: corstone1000-fvp + BUILD_HOST_ARCH: x86_64 + rules: + - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && + ($BUILD_PLATFORM =~ /all-platforms/ || + $BUILD_PLATFORM =~ /corstone1000-fvp/) + && ($FREQUENCY == "nightly")' + +cassini-dev/security/tests/corstone1000-fvp: + extends: .corstone1000_generator + variables: + MACHINE: corstone1000-fvp + BUILD_HOST_ARCH: x86_64 + rules: + - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && + ($BUILD_PLATFORM =~ /all-platforms/ || + $BUILD_PLATFORM =~ /corstone1000-fvp/) + && ($FREQUENCY == "nightly")' + +cassini-sdk/corstone1000-fvp: + extends: .corstone1000_generator + variables: + MACHINE: corstone1000-fvp + rules: + - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && + ($BUILD_PLATFORM =~ /all-platforms/ || + $BUILD_PLATFORM =~ /corstone1000-fvp/)' + - !reference [".build-image:rules:k3s-sdk", rules] + - !reference [".build-image:rules:corstone1000", rules] diff --git a/.gitlab/ci/templates/image_build.yml.j2 b/.gitlab/ci/templates/image_build.yml.j2 index a19c6a9..08cfa6c 100644 --- a/.gitlab/ci/templates/image_build.yml.j2 +++ b/.gitlab/ci/templates/image_build.yml.j2 @@ -21,7 +21,10 @@ Image-Build-{{ CI_JOB_NAME_SLUG }}: - echo "IMAGE_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/${ARTIFACT_DIR}/$(readlink ${IMAGE}-{{ MACHINE }}.wic.gz)" >> ${CI_PROJECT_DIR}/build_data.env - echo "IMAGE=${IMAGE}" >> ${CI_PROJECT_DIR}/build_data.env - echo "ARTIFACT_DIR=${ARTIFACT_DIR}" >> ${CI_PROJECT_DIR}/build_data.env -{% if MACHINE == 'corstone1000-mps3' %} +{% if MACHINE == 'n1sdp' %} + - export FW_IMAGE=$(ls -- *-board-firmware_primary.tar.gz | sed "s/-board-firmware_primary\.tar\.gz//") + - echo "FW_IMAGE=${FW_IMAGE}" >> ${CI_PROJECT_DIR}/build_data.env +{% elif MACHINE.startswith('corstone1000') %} - echo "BL1_IMAGE_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/work/build/tmp/deploy/images/{{ MACHINE }}/bl1.bin" >> ${CI_PROJECT_DIR}/build_data.env - echo "BL1_IMAGE=bl1.bin" >> ${CI_PROJECT_DIR}/build_data.env - export UTIL_IMAGE=$(ls -- *-{{ MACHINE }}.tar.bz2 | sed "s/-{{ MACHINE }}\.tar\.bz2//") @@ -30,6 +33,14 @@ Image-Build-{{ CI_JOB_NAME_SLUG }}: - export FW_IMAGE=$(ls -- *-{{ MACHINE }}.wic.nopt | sed "s/-{{ MACHINE }}\.wic\.nopt//") - echo "FW_IMAGE_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/work/build/tmp/deploy/images/{{ MACHINE }}/$(readlink ${FW_IMAGE}-{{ MACHINE }}.wic.nopt)" >> ${CI_PROJECT_DIR}/build_data.env - echo "FW_IMAGE=${FW_IMAGE}" >> ${CI_PROJECT_DIR}/build_data.env + - echo "EXTSYS_IMAGE_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/work/build/tmp/deploy/images/{{ MACHINE }}/es_flashfw.bin" >> ${CI_PROJECT_DIR}/build_data.env + - echo "EXTSYS_IMAGE=es_flashfw.bin" >> ${CI_PROJECT_DIR}/build_data.env +{% if MACHINE == 'corstone1000-fvp' %} + - export FVP_CONFIG=$(ls -- *-{{ MACHINE }}.fvpconf | sed "s/-{{ MACHINE }}\.fvpconf//") + - echo "FVP_CONFIG_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/work/build/tmp/deploy/images/{{ MACHINE }}/$(readlink ${FVP_CONFIG}-{{ MACHINE }}.fvpconf)" >> ${CI_PROJECT_DIR}/build_data.env + - echo "FVP_CONFIG=${FVP_CONFIG}" >> ${CI_PROJECT_DIR}/build_data.env + - echo "IMAGE_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/${ARTIFACT_DIR}/$(readlink ${IMAGE}-{{ MACHINE }}.wic.pad.gz)" >> ${CI_PROJECT_DIR}/build_data.env +{% endif %} {% endif %} # Store built images - | @@ -37,15 +48,21 @@ Image-Build-{{ CI_JOB_NAME_SLUG }}: flock --timeout 120 200 rm -rf ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }} mkdir --parents ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }} - cp $(readlink ${IMAGE}-{{ MACHINE }}.wic.bmap) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/ - cp $(readlink ${IMAGE}-{{ MACHINE }}.wic.bz2) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/ + cp $(readlink ${IMAGE}-{{ MACHINE }}.wic.bmap) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/${IMAGE}-{{ MACHINE }}.wic.bmap + cp $(readlink ${IMAGE}-{{ MACHINE }}.wic.gz) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/${IMAGE}-{{ MACHINE }}.wic.gz {% if MACHINE == 'n1sdp' %} - cp *-board-firmware_primary.tar.gz ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/ -{% elif MACHINE == 'corstone1000-mps3' %} - cp bl1.bin ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/ - cp $(readlink ${UTIL_IMAGE}-{{ MACHINE }}.tar.bz2) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/ - cp $(readlink ${FW_IMAGE}-{{ MACHINE }}.wic.nopt) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/ -{% else %} + cp ${FW_IMAGE}-board-firmware_primary.tar.gz ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/${FW_IMAGE}-board-firmware_primary.tar.gz +{% elif MACHINE.startswith('corstone1000') %} + cp bl1.bin ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/bl1.bin + cp es_flashfw.bin ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/es_flashfw.bin + cp $(readlink ${FW_IMAGE}-{{ MACHINE }}.wic.nopt) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/${FW_IMAGE}-{{ MACHINE }}.wic.nopt + if [ -e ${UTIL_IMAGE}-{{ MACHINE }}.tar.bz2 ]; then + cp $(readlink ${UTIL_IMAGE}-{{ MACHINE }}.tar.bz2) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/${UTIL_IMAGE}-{{ MACHINE }}.tar.bz2 + fi +{% if MACHINE == 'corstone1000-fvp' %} + cp $(readlink ${FVP_CONFIG}-{{ MACHINE }}.fvpconf) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/${FVP_CONFIG}-{{ MACHINE }}.fvpconf + cp $(readlink ${IMAGE}-{{ MACHINE }}.wic.pad.gz) ${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}/${IMAGE}-{{ MACHINE }}.wic.pad.gz +{% endif %} {% endif %} ) 200>${IMAGE_DIR}/{{ CI_JOB_NAME_SLUG }}.lock - popd # ${KAS_WORK_DIR}/build/tmp/deploy/images/{{ MACHINE }} @@ -57,11 +74,15 @@ Image-Build-{{ CI_JOB_NAME_SLUG }}: - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/*-*-*.wic.bmap {% if MACHINE == 'n1sdp' %} - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/*-board-firmware_primary.tar.gz -{% elif MACHINE == 'corstone1000-mps3' %} - - $KAS_WORK_DIR//build/tmp/deploy/images/{{ MACHINE }}/bl1.bin - - $KAS_WORK_DIR//build/tmp/deploy/images/{{ MACHINE }}/*-*-*.wic.nopt - - $KAS_WORK_DIR//build/tmp/deploy/images/{{ MACHINE }}/*-*-*.tar.bz2 -{% else %} +{% elif MACHINE.startswith('corstone1000') %} + - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/bl1.bin + - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/es_flashfw.bin + - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/*-*-*.wic.nopt + - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/*-*-*.tar.bz2 +{% if MACHINE == 'corstone1000-fvp' %} + - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/*-*-*.fvpconf + - $KAS_WORK_DIR/build/tmp/deploy/images/{{ MACHINE }}/*-*-*.wic.pad.gz +{% endif %} {% endif %} - build_data.env reports: diff --git a/.gitlab/ci/trigger-image-builds.yml b/.gitlab/ci/trigger-image-builds.yml index 667b041..5209802 100644 --- a/.gitlab/ci/trigger-image-builds.yml +++ b/.gitlab/ci/trigger-image-builds.yml @@ -28,6 +28,16 @@ merge_jobs: optional: true - job: cassini-dev/security/tests/corstone1000-mps3 optional: true + - job: cassini/tests/corstone1000-fvp + optional: true + - job: cassini/security/tests/corstone1000-fvp + optional: true + - job: cassini-sdk/corstone1000-fvp + optional: true + - job: cassini-dev/tests/corstone1000-fvp + optional: true + - job: cassini-dev/security/tests/corstone1000-fvp + optional: true before_script: - | cat << EOF > ${CI_JOB_FILE} -- GitLab From c3f05ff489b8b9221cfcc4ca6d59b349ea67899f Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Tue, 31 Jan 2023 15:50:17 +0000 Subject: [PATCH 08/10] ci: Build a Corstone-1000 FVP container Build the Corstone-1000 FVP into a docker container for use in lava. Use the same version of the FVP that the yocto build fetches. Signed-off-by: Drew Reed --- .../cs1k-fvp-test-image/Dockerfile | 58 +++++++++++++++++++ .../cs1k-fvp-test-image/entrypoint.sh | 12 ++++ .../Dockerfiles/cs1k-fvp-test-image/network | 15 +++++ .gitlab/ci/lava-test-fvp-build.yml | 45 ++++++++++++++ .gitlab/ci/templates/image_build.yml.j2 | 3 + .gitlab/ci/trigger-image-builds.yml | 2 + 6 files changed, 135 insertions(+) create mode 100644 .gitlab/Dockerfiles/cs1k-fvp-test-image/Dockerfile create mode 100644 .gitlab/Dockerfiles/cs1k-fvp-test-image/entrypoint.sh create mode 100644 .gitlab/Dockerfiles/cs1k-fvp-test-image/network create mode 100644 .gitlab/ci/lava-test-fvp-build.yml diff --git a/.gitlab/Dockerfiles/cs1k-fvp-test-image/Dockerfile b/.gitlab/Dockerfiles/cs1k-fvp-test-image/Dockerfile new file mode 100644 index 0000000..3e25264 --- /dev/null +++ b/.gitlab/Dockerfiles/cs1k-fvp-test-image/Dockerfile @@ -0,0 +1,58 @@ +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT +ARG DOCKERHUB_MIRROR= + +FROM ${DOCKERHUB_MIRROR}ubuntu:focal + +ARG MODEL="Corstone-1000-23" +ARG MODEL_CODE="FVP_Corstone_1000" +ARG MODEL_VERSION="11.19_21" +ARG FVP_ARCH="Linux64" + +RUN apt-get update \ + && apt-get install --no-install-recommends --yes \ + bc \ + ca-certificates \ + curl \ + gcc-8 \ + gnupg2 \ + libatomic1 \ + libdbus-1-3 \ + libssl1.1 \ + libvirt-clients \ + libvirt-daemon-system \ + telnet \ + tree \ + software-properties-common \ + unzip \ + wget \ + && apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 60C317803A41BA51845E371A1E9377A2BA9EF27F \ + && add-apt-repository ppa:ubuntu-toolchain-r/test \ + && apt-get install --only-upgrade libstdc++6 -y \ + && apt-get clean \ + && rm -rf /var/cache/apt + +# Create model directory +RUN mkdir /opt/model + +# Setup networking +COPY network /etc/libvirt/hooks/ +COPY entrypoint.sh / +RUN chmod 755 /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +# Add FVP and Testing Binaries +ADD "https://developer.arm.com/-/media/Arm%20Developer%20Community/Downloads/OSS/FVP/${MODEL}/Linux/${MODEL_CODE}_${MODEL_VERSION}_${FVP_ARCH}.tgz" /tmp/ + +RUN cd /tmp \ + && tar -zxvf "/tmp/${MODEL_CODE}_${MODEL_VERSION}_${FVP_ARCH}.tgz" \ + && ./FVP_Corstone_1000.sh --i-agree-to-the-contained-eula \ + --no-interactive \ + --destination /opt \ + && rm -rf /tmp/* + +EXPOSE 5000/tcp +EXPOSE 5001/tcp +EXPOSE 5002/tcp +EXPOSE 5003/tcp diff --git a/.gitlab/Dockerfiles/cs1k-fvp-test-image/entrypoint.sh b/.gitlab/Dockerfiles/cs1k-fvp-test-image/entrypoint.sh new file mode 100644 index 0000000..16ac48b --- /dev/null +++ b/.gitlab/Dockerfiles/cs1k-fvp-test-image/entrypoint.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +# Start libvirt daemon +if [ -z "$SKIP_LIBVIRT" ] ; then + /usr/sbin/libvirtd & +fi + +# Continue with specified command +exec "$@" diff --git a/.gitlab/Dockerfiles/cs1k-fvp-test-image/network b/.gitlab/Dockerfiles/cs1k-fvp-test-image/network new file mode 100644 index 0000000..f04eee2 --- /dev/null +++ b/.gitlab/Dockerfiles/cs1k-fvp-test-image/network @@ -0,0 +1,15 @@ +#!/bin/bash +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT + +# If the change occurs to the "default" libvirt managed network +if [ "${1}" = "default" ] ; then + # If the network is started + if [ "${2}" = "started" ] ; then + ip tuntap add mode tap tap01 + ip link set tap01 promisc on + ip link set tap01 up + brctl addif virbr0 tap01 + fi +fi diff --git a/.gitlab/ci/lava-test-fvp-build.yml b/.gitlab/ci/lava-test-fvp-build.yml new file mode 100644 index 0000000..4d5d73a --- /dev/null +++ b/.gitlab/ci/lava-test-fvp-build.yml @@ -0,0 +1,45 @@ +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT +--- +# FVP is not available for arm based hosts yet +Fetch-FVP-Version-Info: + extends: .kas_build_cassini + stage: Setup + tags: + - x86_64 + # Store the build artifacts from the job. The download urls of these artifacts are later used by lava jobs to download and test the image. + variables: + KAS_CONFIGS: "cassini/tests/corstone1000-fvp" + FVP_CORSTONE1000_EULA_ACCEPT: "True" + script: + # Run build + - echo "Building target $KAS_CONFIGS" + - KASFILES=$(./.gitlab/scripts/jobs-to-kas ${KAS_CONFIGS}) + - echo KASFILES = $KASFILES + - export BB_NUMBER_THREADS="${KUBERNETES_CPU_REQUEST}" + - export PARALLEL_MAKE="-j ${KUBERNETES_CPU_REQUEST}" + - kas shell --update --force-checkout $KASFILES -c 'bitbake -e fvp-corstone1000-native' > fvp_data.txt + - grep '^MODEL' fvp_data.txt | tr -d '"' > fvp_data.env + - grep '^PV' fvp_data.txt | tr -d '"' >> fvp_data.env + artifacts: + paths: + - fvp_data.env + reports: + dotenv: fvp_data.env + expire_in: '1 days' + +Build-FVP-Docker-Image: + extends: .build-docker-image + stage: Build + variables: + DOCKER_IMAGE_NAME: cs1k-fvp-test-image + BUILD_CONTEXT: $CI_PROJECT_DIR/.gitlab/Dockerfiles/$DOCKER_IMAGE_NAME + BUILDAH_ARGS: --build-arg ARMLMD_LICENSE_FILE=${ARMLMD_LICENSE_FILE} + needs: + - Fetch-FVP-Version-Info + script: + - BUILDAH_ARGS="${BUILDAH_ARGS} --build-arg MODEL=${MODEL}" + - BUILDAH_ARGS="${BUILDAH_ARGS} --build-arg MODEL_CODE=${MODEL_CODE}" + - BUILDAH_ARGS="${BUILDAH_ARGS} --build-arg MODEL_VERSION=${PV}" + - !reference [".build-docker-image", script] diff --git a/.gitlab/ci/templates/image_build.yml.j2 b/.gitlab/ci/templates/image_build.yml.j2 index 08cfa6c..f3d2d31 100644 --- a/.gitlab/ci/templates/image_build.yml.j2 +++ b/.gitlab/ci/templates/image_build.yml.j2 @@ -97,6 +97,9 @@ Lava-Test-Prep-{{ CI_JOB_NAME_SLUG }}: extends: .test-preparation needs: - Image-Build-{{ CI_JOB_NAME_SLUG }} +{% if MACHINE == 'corstone1000-fvp' %} + - Build-FVP-Docker-Image +{% endif %} variables: MACHINE: "{{ MACHINE }}" diff --git a/.gitlab/ci/trigger-image-builds.yml b/.gitlab/ci/trigger-image-builds.yml index 5209802..987830a 100644 --- a/.gitlab/ci/trigger-image-builds.yml +++ b/.gitlab/ci/trigger-image-builds.yml @@ -49,10 +49,12 @@ merge_jobs: - gitlab-ci/yocto-build-base_gitlab-ci.yml - gitlab-ci/kas-build-base_gitlab-ci.yml - gitlab-ci/lava-test-base_gitlab-ci.yml + - gitlab-ci/docker-image-base_gitlab-ci.yml - local: .gitlab/ci/rules.yml - local: .gitlab/ci/cassini-build.yml - local: .gitlab/ci/yocto-qa.yml - local: .gitlab/ci/lava-test.yml + - local: .gitlab/ci/lava-test-fvp-build.yml EOF trigger_jobs: -- GitLab From 3ba22c29e5780a69182278690b22d4dc2ec8061e Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Wed, 12 Apr 2023 10:20:52 +0000 Subject: [PATCH 09/10] ci: Run Corstone-1000 FVP sanity test in lava farm Add the running of a sanity boot test for the corstone1000-fvp images Changelog: other Signed-off-by: Drew Reed --- .gitlab/ci/corstone1000-image-builds.yml | 4 + .gitlab/ci/lava-test-fvp-build.yml | 10 +- .gitlab/ci/lava-test.yml | 61 +++++++++--- .gitlab/ci/templates/image_build.yml.j2 | 3 +- .../lava/corstone1000-fvp/sanity_job.yml.j2 | 90 +++++++++++++++++ .gitlab/scripts/fvpconf-to-lava.py | 99 +++++++++++++++++++ 6 files changed, 249 insertions(+), 18 deletions(-) create mode 100644 .gitlab/lava/corstone1000-fvp/sanity_job.yml.j2 create mode 100755 .gitlab/scripts/fvpconf-to-lava.py diff --git a/.gitlab/ci/corstone1000-image-builds.yml b/.gitlab/ci/corstone1000-image-builds.yml index 04602d5..cd16c6b 100644 --- a/.gitlab/ci/corstone1000-image-builds.yml +++ b/.gitlab/ci/corstone1000-image-builds.yml @@ -68,6 +68,7 @@ cassini/tests/corstone1000-fvp: variables: MACHINE: corstone1000-fvp BUILD_HOST_ARCH: x86_64 + RUN_TESTS: sanity rules: - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && ($BUILD_PLATFORM =~ /all-platforms/ || @@ -80,6 +81,7 @@ cassini/security/tests/corstone1000-fvp: variables: MACHINE: corstone1000-fvp BUILD_HOST_ARCH: x86_64 + RUN_TESTS: sanity rules: - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && ($BUILD_PLATFORM =~ /all-platforms/ || @@ -92,6 +94,7 @@ cassini-dev/tests/corstone1000-fvp: variables: MACHINE: corstone1000-fvp BUILD_HOST_ARCH: x86_64 + RUN_TESTS: sanity rules: - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && ($BUILD_PLATFORM =~ /all-platforms/ || @@ -103,6 +106,7 @@ cassini-dev/security/tests/corstone1000-fvp: variables: MACHINE: corstone1000-fvp BUILD_HOST_ARCH: x86_64 + RUN_TESTS: sanity rules: - if: '($BUILD_IMAGE =~ /all-images/ || $BUILD_IMAGE =~ /k3s/) && ($BUILD_PLATFORM =~ /all-platforms/ || diff --git a/.gitlab/ci/lava-test-fvp-build.yml b/.gitlab/ci/lava-test-fvp-build.yml index 4d5d73a..406c7f1 100644 --- a/.gitlab/ci/lava-test-fvp-build.yml +++ b/.gitlab/ci/lava-test-fvp-build.yml @@ -8,7 +8,8 @@ Fetch-FVP-Version-Info: stage: Setup tags: - x86_64 - # Store the build artifacts from the job. The download urls of these artifacts are later used by lava jobs to download and test the image. + # Store the build artifacts from the job. The download urls of these + # artifacts are later used by lava jobs to download and test the image. variables: KAS_CONFIGS: "cassini/tests/corstone1000-fvp" FVP_CORSTONE1000_EULA_ACCEPT: "True" @@ -19,7 +20,10 @@ Fetch-FVP-Version-Info: - echo KASFILES = $KASFILES - export BB_NUMBER_THREADS="${KUBERNETES_CPU_REQUEST}" - export PARALLEL_MAKE="-j ${KUBERNETES_CPU_REQUEST}" - - kas shell --update --force-checkout $KASFILES -c 'bitbake -e fvp-corstone1000-native' > fvp_data.txt + - kas shell + --update + --force-checkout $KASFILES + -c 'bitbake -e fvp-corstone1000-native' > fvp_data.txt - grep '^MODEL' fvp_data.txt | tr -d '"' > fvp_data.env - grep '^PV' fvp_data.txt | tr -d '"' >> fvp_data.env artifacts: @@ -27,7 +31,7 @@ Fetch-FVP-Version-Info: - fvp_data.env reports: dotenv: fvp_data.env - expire_in: '1 days' + expire_in: "1 days" Build-FVP-Docker-Image: extends: .build-docker-image diff --git a/.gitlab/ci/lava-test.yml b/.gitlab/ci/lava-test.yml index 14c7377..1875545 100644 --- a/.gitlab/ci/lava-test.yml +++ b/.gitlab/ci/lava-test.yml @@ -14,15 +14,18 @@ script: - mkdir cassini-firmware - pushd cassini-firmware + - joburl=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID} + - datafile=${CI_PROJECT_DIR}/build_data.env - | case "${MACHINE}" in 'n1sdp') echo "Building SD Card image for N1SDP" + fwfile=cassini-firmware.zip # Update the PMIC_FORCE parameter in the config.txt file in the # firmware package to TRUE. # Setting it to FALSE will require user input so the boot process # halts. - fwtar=${MACHINE}-board-firmware_primary.tar.gz + fwtar=${FW_IMAGE}-board-firmware_primary.tar.gz tar -zxvf ../work/build/tmp/deploy/images/${MACHINE}/${fwtar} config="PMIC_FORCE:" current_value=" FALSE" @@ -36,10 +39,13 @@ current_value=" 0" new_value=" 1" sed -i "s/$config$current_value/$config$new_value/" config.txt - zip -r ../cassini-firmware.zip * + zip -r ../${fwfile} * + echo "FIRMWARE_ARTIFACT_URL=${joburl}/artifacts/${fwfile}" \ + >> ${datafile} ;; 'corstone1000-mps3') echo "Building FPGA image set for Corstone1000 MPS3 board" + fwfile=cassini-firmware.zip mkdir -p ~/.ssh eval "$(ssh-agent -s)" if [ -n "${SSH_PRIVATE_GERRIT+x}" ]; then @@ -50,31 +56,34 @@ https://${CI_SERVER_HOST} git clone https://${CI_SERVER_HOST}/${CORSTONE1000_CI_PATH} export \ - BUILD_DIR=$(pwd)/../work/build/tmp/deploy/images/corstone1000-mps3/ + BUILD_DIR=$(pwd)/../work/build/tmp/deploy/images/corstone1000-mps3 # The `LavaPrepTool.py` requires specfic file name to prep for lava cp ${BUILD_DIR}/corstone1000-image-${MACHINE}.wic.nopt \ - ${BUILD_DIR}/corstone1000-flash-firmware-image-${MACHINE}.wic.nopt + ${BUILD_DIR}/corstone1000-flash-firmware-image-${MACHINE}.wic.nopt python3 corstone1000-ci/LavaPrepTool.py create_mps3 --config \ - corstone1000-ci/configs/cassini_create_mps3.yml + corstone1000-ci/configs/cassini_create_mps3.yml # LavaPrepTool creates this under cassini-firmware/, but Gitlab is # looking in the parent directory. So we move it. - mv cassini-firmware.zip ../ + mv ${fwfile} ../ + echo "FIRMWARE_ARTIFACT_URL=${joburl}/artifacts/${fwfile}" \ + >> ${datafile} + ;; + 'corstone1000-fvp') + echo "Nothing to be done for Corstone1000 FVP" + echo "FIRMWARE_ARTIFACT_URL=${FW_IMAGE_ARTIFACT_URL}" >> ${datafile} ;; - *) + *) echo "Unkown machine ${MACHINE}" exit 1 ;; esac - - joburl=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID} - - fwfile=cassini-firmware.zip - - datafile=${CI_PROJECT_DIR}/build_data.env - - echo "FIRMWARE_ARTIFACT_URL=${joburl}/artifacts/${fwfile}" >> ${datafile} - popd # cassini-firmware - cat ${CI_PROJECT_DIR}/build_data.env artifacts: paths: - - build_data.env - - cassini-firmware.zip + - "build_data.env" + - "cassini-firmware.zip" + - "**/*.fvpconf" reports: dotenv: build_data.env expire_in: "1 days" @@ -92,8 +101,32 @@ private_token=${CASSINI_CI_LAYERS_TOKEN} BL1_ARTIFACT: ${BL1_IMAGE_ARTIFACT_URL}? private_token=${CASSINI_CI_LAYERS_TOKEN} - FLASH_ARTIFACT: ${FW_IMAGE_ARTIFACT_URL}? + EXTSYS_ARTIFACT: ${EXTSYS_IMAGE_ARTIFACT_URL}? + private_token=${CASSINI_CI_LAYERS_TOKEN} LAVA_JOB_TEMPLATE: .gitlab/lava/$MACHINE/$LAVA_JOB.j2 + script: + # Fill in job template with image locations + - | + if [ ${MACHINE} == 'corstone1000-fvp' ]; then + j2 ${LAVA_JOB_TEMPLATE} -o ${LAVA_JOB}.tmp + pushd ${ARTIFACT_DIR} + FVP_CONFIG_FILE=$(readlink ${FVP_CONFIG}-${MACHINE}.fvpconf) + popd + python3 .gitlab/scripts/fvpconf-to-lava.py \ + "${ARTIFACT_DIR}/${FVP_CONFIG_FILE}" \ + "${LAVA_JOB}.tmp" \ + "${LAVA_JOB}.tmp.j2" + export LAVA_JOB_TEMPLATE="${LAVA_JOB}.tmp.j2" + fi + - !reference [".submit-lava-job", script] + artifacts: + paths: + - test_data.env + - $LAVA_JOB.tmp + - $LAVA_JOB.tmp.j2 + reports: + dotenv: test_data.env + expire_in: 1 day .ptest-tests: extends: .submit-cassini-lava-job diff --git a/.gitlab/ci/templates/image_build.yml.j2 b/.gitlab/ci/templates/image_build.yml.j2 index f3d2d31..1127eb4 100644 --- a/.gitlab/ci/templates/image_build.yml.j2 +++ b/.gitlab/ci/templates/image_build.yml.j2 @@ -16,8 +16,9 @@ Image-Build-{{ CI_JOB_NAME_SLUG }}: - pushd ${KAS_WORK_DIR}/build/tmp/deploy/images/{{ MACHINE }} - export IMAGE=$(ls -- *-{{ MACHINE }}.wic.bmap | sed "s/-{{ MACHINE }}\.wic\.bmap//") - export ARTIFACT_DIR="$(realpath --relative-to=${CI_PROJECT_DIR} ${KAS_WORK_DIR})/build/tmp/deploy/images/{{ MACHINE }}" + - echo "ARTIFACT_DIR=${ARTIFACT_DIR}" > ${CI_PROJECT_DIR}/build_data.env - echo "ARTIFACT_DIR = ${ARTIFACT_DIR}" - - echo "BMAP_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/${ARTIFACT_DIR}/$(readlink ${IMAGE}-{{ MACHINE }}.wic.bmap)" > ${CI_PROJECT_DIR}/build_data.env + - echo "BMAP_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/${ARTIFACT_DIR}/$(readlink ${IMAGE}-{{ MACHINE }}.wic.bmap)" >> ${CI_PROJECT_DIR}/build_data.env - echo "IMAGE_ARTIFACT_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/jobs/${CI_JOB_ID}/artifacts/${ARTIFACT_DIR}/$(readlink ${IMAGE}-{{ MACHINE }}.wic.gz)" >> ${CI_PROJECT_DIR}/build_data.env - echo "IMAGE=${IMAGE}" >> ${CI_PROJECT_DIR}/build_data.env - echo "ARTIFACT_DIR=${ARTIFACT_DIR}" >> ${CI_PROJECT_DIR}/build_data.env diff --git a/.gitlab/lava/corstone1000-fvp/sanity_job.yml.j2 b/.gitlab/lava/corstone1000-fvp/sanity_job.yml.j2 new file mode 100644 index 0000000..a1e106a --- /dev/null +++ b/.gitlab/lava/corstone1000-fvp/sanity_job.yml.j2 @@ -0,0 +1,90 @@ +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT +--- +device_type: fvp +job_name: {{ CI_JOB_NAME }} + +timeouts: + connection: + minutes: 3 + job: + minutes: 80 + actions: + auto-login-action: + minutes: 5 + fvp-deploy: + minutes: 20 + download-retry: + minutes: 20 + http-download: + minutes: 20 + +metadata: + source: {{ CI_PROJECT_URL }} + path: .gitlab/lava/corstone1000-fvp/sanity_job.yml.j2 + gitlab-job-url: {{ CI_JOB_URL }} + +priority: medium +visibility: + group: + - cassini + +notify: + criteria: + status: finished + callbacks: + - url: "{{ CI_API_V4_URL }}/projects/{{ CI_PROJECT_ID }}/jobs/{{ TEST_COMPLETE_JOB_ID }}/play" + method: POST + token: "{{ LAVA_CALLBACK_TOKEN }}" + header: "PRIVATE-TOKEN" + dataset: minimal + +actions: +- deploy: + to: fvp + images: + bl1: + url: {{ BL1_ARTIFACT }} + cs1000: + url: {{ FIRMWARE_ARTIFACT }} + extsys: + url: {{ EXTSYS_ARTIFACT }} + mmc0: + url: {{ IMAGE_ARTIFACT }} + compression: gz + +- boot: + method: fvp + docker: + name: "{{ CI_REGISTRY }}/{{ CI_PROJECT_PATH }}/cs1k-fvp-test-image:{{ DOCKER_IMAGE_TAG }}" + image: /opt/models/Linux64_GCC-9.3/FVP_Corstone-1000 + version_string: 'Fast Models [^\\n]+' + timeout: + minutes: 10 + console_string: 'host_terminal_0: Listening for serial connection on port (?P\d+)' + feedbacks: + - '(?Phost_terminal_1): Listening for serial connection on port (?P\d+)' + - '(?Psecenc_terminal): Listening for serial connection on port (?P\d+)' + - '(?Pextsys_terminal): Listening for serial connection on port (?P\d+)' + arguments: + - "-C se.trustedBootROMloader.fname={BL1}" + - "-C board.msd_mmc.p_mmc_file={MMC0}" + - "-C extsys_harness0.extsys_flashloader.fname={EXTSYS}" + - "-C extsys0.extsys_terminal.start_telnet=1" + - "-C host.host_terminal_0.start_telnet=1" + - "-C host.host_terminal_1.start_telnet=1" + - "-C se.secenc_terminal.start_telnet=1" + - "--data board.flash0={CS1000}@0x68100000" + auto_login: + login_prompt: 'corstone1000-fvp login:.*' + username: cassini + login_commands: + - cassini123 + - cassini123 + - sudo su - + prompts: + - 'New password: ' + - 'Re-enter new password: ' + - '@corstone1000-fvp:.+\$ ' + - '@corstone1000-fvp:.+# ' diff --git a/.gitlab/scripts/fvpconf-to-lava.py b/.gitlab/scripts/fvpconf-to-lava.py new file mode 100755 index 0000000..d1d98c2 --- /dev/null +++ b/.gitlab/scripts/fvpconf-to-lava.py @@ -0,0 +1,99 @@ +#!/usr/bin/env python3 +# Copyright (c) 2023 Arm Limited or its affiliates. All rights reserved. +# +# SPDX-License-Identifier: MIT +import argparse +import json +import re +import sys +import yaml + + +def main(): + parser = argparse.ArgumentParser( + description='Adds FVP config options to lava test files') + + parser.add_argument("fvpconf", help="Yocto build generated fvpconf file") + parser.add_argument("lavafile", help="Input lava definition file") + parser.add_argument("lavaout", default="lava_definition.yml", + help="Output lava definition file") + + args = parser.parse_args() + + with open(args.fvpconf, "r") as fvpconf_file: + fvpconf = json.load(fvpconf_file) + + PatchLavaFile(fvpconf, args.lavafile, args.lavaout) + + +def PatchLavaFile(fvpconf, lavafile, lavaout): + with open(lavafile) as lavafile: + lavadata = yaml.safe_load(lavafile) + + # Update the fvpconf with parts of lava script that need retaining + for action in lavadata['actions']: + if "boot" in action and action['boot']['method'] == "fvp": + fvpconf = ParseArgs(fvpconf, action['boot']['arguments']) + + newArguments = [] + for arg, data in fvpconf['parameters'].items(): + newArguments.append("-C " + arg + "=\"" + data + "\"") + + for data in fvpconf['data']: + newArguments.append("--data " + data) + + # Now update the lava file data with the fvpconf + for i in range(len(lavadata['actions'])): + if ("boot" in lavadata['actions'][i] and + lavadata['actions'][i]['boot']['method'] == "fvp"): + lavadata['actions'][i]['boot']['arguments'] = newArguments + + # And finally output the new file + with open(lavaout, 'w') as lavaout: + yaml.dump(lavadata, lavaout, + default_flow_style=False) + + +def ParseArgs(fvpconf, lavaargs): + cargs = {} + data = {} + + finddata = re.compile(r'^(-(C|-data))\s+(.+)?=(.+)$') + findreplacement = re.compile(r'^.*{[0-9A-Z_]+}.*$') + for arg in lavaargs: + # print(arg) + match = finddata.match(arg) + + argtype = match.group(1) + argname = match.group(3) + argdata = match.group(4) + + if findreplacement.match(argdata): + # print("Found: " + argtype) + if argtype == "-C": + cargs[argname] = argdata + elif argtype == "--data": + data[argname + "="] = argdata + else: + print("Unnknown arg type found: " + argtype) + + # parameters is a dictionary + fvpconf['parameters'].update(cargs) + # data is a list of strings + for i in range(len(fvpconf['data'])): + if fvpconf['data'][i].startswith(tuple(data.keys())): + elementname = fvpconf['data'][i].split('=')[0] + "=" + # Need to sort out the load address if one exists + # as we want the version from the fvpconf file + # not the origional in the lava file + loadaddress = fvpconf['data'][i].split('@')[1] + if loadaddress != "": + loadaddress = "@" + loadaddress + fvpconf['data'][i] = elementname + \ + data[elementname].split('@')[0] + loadaddress + + return fvpconf + + +if __name__ == '__main__': + main() -- GitLab From d9d34c4515eceefe1300ca1ac288a72186040f70 Mon Sep 17 00:00:00 2001 From: Drew Reed Date: Wed, 12 Apr 2023 10:23:27 +0000 Subject: [PATCH 10/10] ci: Update Corstone-1000 MPS3 sanity test The Corstone-1000 MPS3 sanity test should ensure the board can boot to a state where it is able to run tests.As the tests should be run as root we need to ensure the default cassini user is able to switch to the root user automatically when required. The prompt string has also been updated to be consistent with the FVP sanity script so that it no longer matches an earlier string in the boot log. Signed-off-by: Drew Reed --- .gitlab/lava/corstone1000-mps3/sanity_job.yml.j2 | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab/lava/corstone1000-mps3/sanity_job.yml.j2 b/.gitlab/lava/corstone1000-mps3/sanity_job.yml.j2 index feadfc9..eecf6e0 100644 --- a/.gitlab/lava/corstone1000-mps3/sanity_job.yml.j2 +++ b/.gitlab/lava/corstone1000-mps3/sanity_job.yml.j2 @@ -133,9 +133,11 @@ actions: login_prompt: 'corstone1000-mps3 login:.*' username: cassini login_commands: - - cassini123 - - cassini123 + - cassini123 + - cassini123 + - sudo su - prompts: - 'New password: ' - 'Re-enter new password: ' - - '(.*)corstone1000-mps3:' + - '@corstone1000-mps3:.+\$ ' + - '@corstone1000-mps3:.+# ' -- GitLab