Skip to contentSkip to conversation

Enable Corstone-1000 multiconfig builds

PATCH New [email protected] 1 participant 5 messages Feb 20, 2024

lore
Share & tools
lore
#0 lore raw

cover Enable Corstone-1000 multiconfig builds

From: Drew Reed <[email protected]>

To enable greater testing of Corstone-1000 using mass storage image to overcome the rootfs size limitation of the standard flash based image. This patchset now enables us to continue to build Corstone-1000 as we always have done but the CI system now builds and uses a larger test mass storage image capable of running the standard testimage test set.

Drew Reed (4):
meta-arm: Support firmware building under a multiconfig bsp,ci: Build Corstone-1000 firmware under multiconfig
bsp: Restore the ability to build firmware only
ci: Add back testing of firmware only builds

 .gitlab-ci.yml                                | 10 ++++--
 ci/corstone1000-common.yml                    | 28 +++++++++-------
 ci/corstone1000-firmware-only.yml             | 25 ++++++++++++++
 ci/corstone1000-fvp.yml                       |  5 ---
 .../conf/machine/corstone1000-fvp.conf        |  3 +-
 .../conf/machine/include/corstone1000.inc     | 14 ++++++--
 .../corstone1000-firmware-deploy-image.inc    | 11 +++++++
 .../images/firmware-deploy-image.bbappend     |  4 +++
 .../linux/files/corstone1000/defconfig        | 33 +++++++++++++++++++
 .../wic/corstone1000-flash-firmware.wks.in    |  2 +-
 meta-arm-bsp/wic/efi-disk-no-swap.wks.in      | 10 ++++++
 meta-arm/conf/multiconfig/firmware.conf       | 13 ++++++++
 .../images/firmware-deploy-image.bb           | 31 +++++++++++++++++
 13 files changed, 166 insertions(+), 23 deletions(-)
 create mode 100644 ci/corstone1000-firmware-only.yml
 create mode 100644 meta-arm-bsp/recipes-bsp/images/corstone1000-firmware-deploy-image.inc
 create mode 100644 meta-arm-bsp/recipes-bsp/images/firmware-deploy-image.bbappend
 create mode 100644 meta-arm-bsp/wic/efi-disk-no-swap.wks.in
 create mode 100644 meta-arm/conf/multiconfig/firmware.conf
 create mode 100644 meta-arm/recipes-bsp/images/firmware-deploy-image.bb

--
2.43.0

#1 lore raw

PATCH 1/4 meta-arm: Support firmware building under a multiconfig

From: Drew Reed <[email protected]>

To enable building rescue or bootstrap images that can be included into firmware a "firmware" multiconfig option is required to allow the building with different options to any mass storage image they may also be built.

As this multiconfig build will occur under a different TMPDIR, we also provide a deployment image to allow easy copying of the firmware into another deploy dir.

---
 meta-arm/conf/multiconfig/firmware.conf       | 13 ++++++++
 .../images/firmware-deploy-image.bb           | 31 +++++++++++++++++++
 2 files changed, 44 insertions(+)
 create mode 100644 meta-arm/conf/multiconfig/firmware.conf
 create mode 100644 meta-arm/recipes-bsp/images/firmware-deploy-image.bb
meta-arm/conf/multiconfig/firmware.conf new file +13 -0
new file mode 100644
index 00000000..95de4d24
@@ -0,0 +1,13 @@
+# Config that can be used to build firmware in a seperate tmp area
+# and with a smaller libc enabled by default
+
+DISTROOVERRIDES = "firmware"
+
+TMPDIR:append = "_${MACHINE}"
+TCLIBC="musl"
+
+# Ignore the testimage flags to include ssh-server-dropbear
+IMAGE_CLASSES:remove = "testimage"
+IMAGE_FEATURES:remove = "ssh-server-dropbear"
+CORE_IMAGE_EXTRA_INSTALL:remove = "ssh-pregen-hostkeys"
+TESTIMAGE_AUTO = "0"
meta-arm/recipes-bsp/images/firmware-deploy-image.bb new file +31 -0
new file mode 100644
index 00000000..76c82738
@@ -0,0 +1,31 @@
+SUMMARY = "Firmware image deploying multi-config firmware"
+DESCRIPTION = "Image for deploying a firmware set on platforms using multi-config"
+LICENSE = "MIT"
+
+inherit deploy nopackages
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+COMPATIBLE_MACHINE ?= "invalid"
+do_configure[noexec] = "1"
+do_compile[noexec] = "1"
+do_install[noexec] = "1"
+
+# Users of this recipe are expected to provide the list of firmware images
+# that need to be deployed by setting this variable.
+FIRMWARE_BINARIES ?= ""
+
+do_deploy() {
+    firmware_loc="${TMPDIR}_${MACHINE}/deploy/images/${MACHINE}"
+    for firmware in ${FIRMWARE_BINARIES}; do
+        echo "cp -av ${firmware_loc}/${firmware} ${DEPLOYDIR}/"
+        cp -av "${firmware_loc}/${firmware}" ${DEPLOYDIR}/
+        if [ -L "${firmware_loc}/${firmware}" ]; then
+            echo "cp -av ${firmware_loc}/$(readlink ${firmware_loc}/${firmware}) ${DEPLOYDIR}/"
+            cp -av "${firmware_loc}/$(readlink ${firmware_loc}/${firmware})" ${DEPLOYDIR}/
+        fi
+    done
+}
+
+do_deploy[umask] = "022"
+
+addtask deploy after do_prepare_recipe_sysroot
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/4 bsp,ci: Build Corstone-1000 firmware under multiconfig

In reply to [email protected]

From: Drew Reed <[email protected]>

By building the Corstone-1000 firmware under the firmware multiconfig we can also build a minimal standard core image to be mounted in the fvp as a mass storage device.
To do this we had to enable the MMC card interface in the Corstone-1000 kernel configuration.

---
 ci/corstone1000-common.yml                    | 28 +++++++++-------
 ci/corstone1000-fvp.yml                       |  5 ---
 .../conf/machine/corstone1000-fvp.conf        |  3 +-
 .../conf/machine/include/corstone1000.inc     | 13 ++++++--
 .../corstone1000-firmware-deploy-image.inc    | 11 +++++++
 .../images/firmware-deploy-image.bbappend     |  4 +++
 .../linux/files/corstone1000/defconfig        | 33 +++++++++++++++++++
 .../wic/corstone1000-flash-firmware.wks.in    |  2 +-
 meta-arm-bsp/wic/efi-disk-no-swap.wks.in      | 10 ++++++
 9 files changed, 89 insertions(+), 20 deletions(-)
 create mode 100644 meta-arm-bsp/recipes-bsp/images/corstone1000-firmware-deploy-image.inc
 create mode 100644 meta-arm-bsp/recipes-bsp/images/firmware-deploy-image.bbappend
 create mode 100644 meta-arm-bsp/wic/efi-disk-no-swap.wks.in
ci/corstone1000-common.yml +17 -11
index 5720b783..50327694 100644
@@ -9,27 +9,33 @@ local_conf_header:
   extrapackages: |
     # Intentionally blank to prevent perf from being added to the image in base.yml
 
+  firmwarebuild: |
+    # Only needed as kas doesn't add it automatically unless you have 2 targets in seperate configs
+    BBMULTICONFIG ?= "firmware"
+
   distrosetup: |
     DISTRO_FEATURES = "usbhost ipv4"
 
   initramfsetup: |
     # Telling the build system which image is responsible of the generation of the initramfs rootfs
-    INITRAMFS_IMAGE_BUNDLE = "1"
-    INITRAMFS_IMAGE ?= "core-image-minimal"
-    IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
-    IMAGE_NAME_SUFFIX = ""
+    INITRAMFS_IMAGE_BUNDLE:firmware = "1"
+    INITRAMFS_IMAGE:firmware ?= "core-image-minimal"
+    IMAGE_FSTYPES:firmware:pn-core-image-minimal = "${INITRAMFS_FSTYPES}"
+    IMAGE_NAME_SUFFIX:firmware = ""
 
     # enable mdev/busybox for init
-    INIT_MANAGER = "mdev-busybox"
-    VIRTUAL-RUNTIME_init_manager = "busybox"
+    INIT_MANAGER:firmware = "mdev-busybox"
+    VIRTUAL-RUNTIME_init_manager:firmware = "busybox"
 
     # prevent the kernel image from being included in the intramfs rootfs
-    PACKAGE_EXCLUDE += "kernel-image-*"
-    # Don't include kernel binary in rootfs /boot path
-    RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = ""
+    PACKAGE_EXCLUDE:firmware += "kernel-image-*"
 
     # Disable openssl in kmod to shrink the initramfs size
-    PACKAGECONFIG:remove:pn-kmod = "openssl"
+    PACKAGECONFIG:remove:firmware:pn-kmod = "openssl"
+
+  imageextras: |
+    # Don't include kernel binary in rootfs /boot path
+    RRECOMMENDS:${KERNEL_PACKAGE_NAME}-base = ""
 
     # all optee packages
     IMAGE_INSTALL += "optee-client"
@@ -38,5 +44,5 @@ local_conf_header:
     IMAGE_INSTALL += "packagegroup-ts-tests-psa"
 
 target:
-  - corstone1000-flash-firmware-image
+  - core-image-minimal
   - perf
ci/corstone1000-fvp.yml +0 -5
index 25f8edf8..c4e57379 100644
@@ -4,9 +4,4 @@ header:
     - ci/corstone1000-common.yml
     - ci/fvp.yml
 
-local_conf_header:
-    fvp-config: |
-        # Remove Dropbear SSH as it will not fit into the corstone1000 image.
-        IMAGE_FEATURES:remove = " ssh-server-dropbear"
-
 machine: corstone1000-fvp
meta-arm-bsp/conf/machine/corstone1000-fvp.conf +2 -1
index 9c070b3d..b15c0faa 100644
@@ -35,7 +35,7 @@ FVP_CONFIG[se.nvm.update_raw_image] ?= "0"
 FVP_CONFIG[se.cryptocell.USER_OTP_FILTERING_DISABLE] ?= "1"
 
 # Boot image
-FVP_DATA ?= "board.flash0=${IMAGE_NAME}.wic@0x68000000"
+FVP_DATA ?= "board.flash0=corstone1000-flash-firmware-image-${MACHINE}.wic@0x68000000"
 
 # External system (cortex-M3)
 FVP_CONFIG[extsys_harness0.extsys_flashloader.fname] ?= "es_flashfw.bin"
@@ -53,6 +53,7 @@ FVP_CONFIG[board.msd_mmc.diagnostics] ?= "2"
 FVP_CONFIG[board.msd_mmc.p_max_block_count] ?= "0xFFFF"
 FVP_CONFIG[board.msd_config.pl180_fifo_depth] ?= "16"
 FVP_CONFIG[board.msd_mmc.support_unpadded_images] ?= "true"
+FVP_CONFIG[board.msd_mmc.p_mmc_file] ?= "${IMAGE_NAME}.wic"
 
 # MMC2 card configuration
 FVP_CONFIG[board.msd_mmc_2.card_type] ?= "SDHC"
meta-arm-bsp/conf/machine/include/corstone1000.inc +11 -2
index 373dd04c..a88f19c4 100644
@@ -35,7 +35,8 @@ IMAGE_CMD:wic[vardeps] += "GRUB_LINUX_APPEND"
 # Linux kernel
 PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
 PREFERRED_VERSION_linux-yocto ?= "6.6.%"
-KERNEL_IMAGETYPE = "Image.gz"
+KERNEL_IMAGETYPE = "Image"
+KERNEL_IMAGETYPE:firmware = "Image.gz"
 # add FF-A support in the kernel
 MACHINE_FEATURES += "arm-ffa"
 # enable this feature for kernel debugging
@@ -44,7 +45,15 @@ MACHINE_FEATURES += "arm-ffa"
 # login terminal serial port settings
 SERIAL_CONSOLES ?= "115200;ttyAMA0"
 
-WKS_FILE ?= "corstone1000-flash-firmware.wks.in"
+IMAGE_FSTYPES += "wic"
+# Need to clear the suffix so TESTIMAGE_AUTO works
+IMAGE_NAME_SUFFIX = ""
+WKS_FILE ?= "efi-disk-no-swap.wks.in"
+WKS_FILE:firmware ?= "corstone1000-flash-firmware.wks.in"
 
 # making sure EXTRA_IMAGEDEPENDS will be used while creating the image
 WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}"
+
+# If not build under the firmware multiconf we need to build the actual firmware
+EXTRA_IMAGEDEPENDS = "${@bb.utils.contains('DISTROOVERRIDES', 'firmware', \
+                        '', 'firmware-deploy-image', d)}"
meta-arm-bsp/recipes-bsp/images/corstone1000-firmware-deploy-image.inc new file +11 -0
new file mode 100644
index 00000000..2d192745
@@ -0,0 +1,11 @@
+COMPATIBLE_MACHINE = "corstone1000"
+
+FIRMWARE_BINARIES = "corstone1000-flash-firmware-image-${MACHINE}.wic \
+                     bl1.bin \
+                     es_flashfw.bin \
+                     corstone1000-flash-firmware-image-${MACHINE}.wic.uefi.capsule \
+                     corstone1000_capsule_cert.crt \
+                     corstone1000_capsule_key.key \
+                    "
+
+do_deploy[mcdepends] = "mc::firmware:corstone1000-flash-firmware-image:do_image_complete"
meta-arm-bsp/recipes-bsp/images/firmware-deploy-image.bbappend new file +4 -0
new file mode 100644
index 00000000..888db54c
@@ -0,0 +1,4 @@
+MACHINE_DEPLOY_FIRMWARE_REQUIRE ?= ""
+MACHINE_DEPLOY_FIRMWARE_REQUIRE:corstone1000 = "corstone1000-firmware-deploy-image.inc"
+
+require ${MACHINE_DEPLOY_FIRMWARE_REQUIRE}
meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig +33 -0
index 8abcaed4..d67e9484 100644
@@ -89,3 +89,36 @@ CONFIG_LIBCRC32C=y
 # CONFIG_SECTION_MISMATCH_WARN_ONLY is not set
 CONFIG_DEBUG_FS=y
 CONFIG_PANIC_TIMEOUT=5
+CONFIG_REGULATOR=y
+# CONFIG_REGULATOR_DEBUG is not set
+CONFIG_REGULATOR_FIXED_VOLTAGE=y
+# CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set
+# CONFIG_REGULATOR_USERSPACE_CONSUMER is not set
+# CONFIG_REGULATOR_GPIO is not set
+# CONFIG_REGULATOR_VCTRL is not set
+# CONFIG_REGULATOR_VEXPRESS is not set
+CONFIG_MMC=y
+# CONFIG_PWRSEQ_EMMC is not set
+CONFIG_PWRSEQ_SIMPLE=y
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_MINORS=8
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+# CONFIG_MMC_DEBUG is not set
+CONFIG_MMC_ARMMMCI=y
+# CONFIG_MMC_STM32_SDMMC is not set
+# CONFIG_MMC_SDHCI is not set
+# CONFIG_MMC_DW is not set
+# CONFIG_MMC_VUB300 is not set
+# CONFIG_MMC_USHC is not set
+# CONFIG_MMC_USDHI6ROL0 is not set
+# CONFIG_MMC_CQHCI is not set
+# CONFIG_MMC_HSQ is not set
+# CONFIG_MMC_MTK is not set
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT4_FS=y
+# CONFIG_EXT4_FS_POSIX_ACL is not set
+# CONFIG_EXT4_FS_SECURITY is not set
+# CONFIG_EXT4_DEBUG is not set
meta-arm-bsp/wic/corstone1000-flash-firmware.wks.in +1 -1
index 71ab20f2..88559dee 100644
@@ -1,4 +1,4 @@
-# WIC partitioning for corstone1000
+# WIC partitioning for corstone1000 internal flash
 # Layout and maximum sizes (to be defined):
 #
 
meta-arm-bsp/wic/efi-disk-no-swap.wks.in new file +10 -0
new file mode 100644
index 00000000..61902dfd
@@ -0,0 +1,10 @@
+# short-description: Create an EFI disk image without a swap partition
+# long-description: Creates a partitioned EFI disk image that the user
+# can directly dd to boot media.  This image will not contain a swap
+# partition but will contain custom machine specific grub arguments.
+
+part /boot --source bootimg-efi --sourceparams="loader=${EFI_PROVIDER}" --label boot --active --align 1024 --use-uuid
+
+part / --source rootfs --fstype=ext4 --label root --align 1024 --use-uuid
+
+bootloader --ptable gpt --timeout=1 --append="${GRUB_LINUX_APPEND}"
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/4 bsp: Restore the ability to build firmware only

In reply to [email protected]

From: Drew Reed <[email protected]>

To allow us to continue to ship Corstone-1000 releases that only include the firmware with the built in Linux image we need a way to build it outside of the multiconfig builds.

---
 ci/corstone1000-firmware-only.yml             | 25 +++++++++++++++++++
 .../conf/machine/include/corstone1000.inc     |  7 +++---
 2 files changed, 29 insertions(+), 3 deletions(-)
 create mode 100644 ci/corstone1000-firmware-only.yml
ci/corstone1000-firmware-only.yml new file +25 -0
new file mode 100644
index 00000000..9cc4299a
@@ -0,0 +1,25 @@
+---
+header:
+  version: 14
+
+local_conf_header:
+  rescuebuild: |
+    # Need to ensure the rescue linux options are selected
+    OVERRIDES .= ":firmware"
+
+    # Need to ensure we build with a small libc
+    TCLIBC="musl"
+
+  mass-storage: |
+    # Ensure the Mass Storage device is absent
+    FVP_CONFIG[board.msd_mmc.p_mmc_file] = "invalid.dat"
+
+  test-configuration: |
+    TEST_SUITES = "_qemutiny ping"
+    # Remove Dropbear SSH as it will not fit into the corstone1000 image.
+    IMAGE_FEATURES:remove = "ssh-server-dropbear"
+    CORE_IMAGE_EXTRA_INSTALL:remove = "ssh-pregen-hostkeys"
+
+target:
+  - corstone1000-flash-firmware-image
+  - perf
meta-arm-bsp/conf/machine/include/corstone1000.inc +4 -3
index a88f19c4..8d793426 100644
@@ -54,6 +54,7 @@ WKS_FILE:firmware ?= "corstone1000-flash-firmware.wks.in"
 # making sure EXTRA_IMAGEDEPENDS will be used while creating the image
 WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}"
 
-# If not build under the firmware multiconf we need to build the actual firmware
-EXTRA_IMAGEDEPENDS = "${@bb.utils.contains('DISTROOVERRIDES', 'firmware', \
-                        '', 'firmware-deploy-image', d)}"
+# If not building under the firmware multiconf we need to build the actual firmware
+FIRMWARE_DEPLOYEMENT ?= "firmware-deploy-image"
+FIRMWARE_DEPLOYEMENT:firmware ?= ""
+EXTRA_IMAGEDEPENDS += "${FIRMWARE_DEPLOYEMENT}"
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/4 ci: Add back testing of firmware only builds

In reply to [email protected]

From: Drew Reed <[email protected]>

---
 .gitlab-ci.yml | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
.gitlab-ci.yml +7 -3
index e1b8dd24..15cf4ecd 100644
@@ -123,14 +123,18 @@ corstone1000-fvp:
   extends: .build
   parallel:
     matrix:
-      - TESTING: [testimage, tftf]
+      - FIRMWARE: corstone1000-firmware-only
+        TESTING: [testimage, tftf]
+      - FIRMWARE: none
+        TESTING: testimage
 
 corstone1000-mps3:
   extends: .build
   parallel:
     matrix:
-      - TESTING: [none, tftf]
-
+      - FIRMWARE: corstone1000-firmware-only
+        TESTING: [none, tftf]
+      - FIRMWARE: none
 
 fvp-base:
   extends: .build
Signature · 1 line
2.43.0