diff mbox series

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

Message ID 20240220154741.66754-3-drew.reed@arm.com
State New
Headers show
Series Enable Corstone-1000 multiconfig builds | expand

Commit Message

drew.reed@arm.com Feb. 20, 2024, 3:47 p.m. UTC
From: Drew Reed <Drew.Reed@arm.com>

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.

Signed-off-by: Drew Reed <Drew.Reed@arm.com>
---
 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
diff mbox series

Patch

diff --git a/ci/corstone1000-common.yml b/ci/corstone1000-common.yml
index 5720b783..50327694 100644
--- a/ci/corstone1000-common.yml
+++ b/ci/corstone1000-common.yml
@@ -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
diff --git a/ci/corstone1000-fvp.yml b/ci/corstone1000-fvp.yml
index 25f8edf8..c4e57379 100644
--- a/ci/corstone1000-fvp.yml
+++ b/ci/corstone1000-fvp.yml
@@ -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
diff --git a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
index 9c070b3d..b15c0faa 100644
--- a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
+++ b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
@@ -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"
diff --git a/meta-arm-bsp/conf/machine/include/corstone1000.inc b/meta-arm-bsp/conf/machine/include/corstone1000.inc
index 373dd04c..a88f19c4 100644
--- a/meta-arm-bsp/conf/machine/include/corstone1000.inc
+++ b/meta-arm-bsp/conf/machine/include/corstone1000.inc
@@ -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)}"
diff --git a/meta-arm-bsp/recipes-bsp/images/corstone1000-firmware-deploy-image.inc b/meta-arm-bsp/recipes-bsp/images/corstone1000-firmware-deploy-image.inc
new file mode 100644
index 00000000..2d192745
--- /dev/null
+++ b/meta-arm-bsp/recipes-bsp/images/corstone1000-firmware-deploy-image.inc
@@ -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"
diff --git a/meta-arm-bsp/recipes-bsp/images/firmware-deploy-image.bbappend b/meta-arm-bsp/recipes-bsp/images/firmware-deploy-image.bbappend
new file mode 100644
index 00000000..888db54c
--- /dev/null
+++ b/meta-arm-bsp/recipes-bsp/images/firmware-deploy-image.bbappend
@@ -0,0 +1,4 @@ 
+MACHINE_DEPLOY_FIRMWARE_REQUIRE ?= ""
+MACHINE_DEPLOY_FIRMWARE_REQUIRE:corstone1000 = "corstone1000-firmware-deploy-image.inc"
+
+require ${MACHINE_DEPLOY_FIRMWARE_REQUIRE}
diff --git a/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig b/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig
index 8abcaed4..d67e9484 100644
--- a/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig
+++ b/meta-arm-bsp/recipes-kernel/linux/files/corstone1000/defconfig
@@ -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
diff --git a/meta-arm-bsp/wic/corstone1000-flash-firmware.wks.in b/meta-arm-bsp/wic/corstone1000-flash-firmware.wks.in
index 71ab20f2..88559dee 100644
--- a/meta-arm-bsp/wic/corstone1000-flash-firmware.wks.in
+++ b/meta-arm-bsp/wic/corstone1000-flash-firmware.wks.in
@@ -1,4 +1,4 @@ 
-# WIC partitioning for corstone1000
+# WIC partitioning for corstone1000 internal flash
 # Layout and maximum sizes (to be defined):
 #
 
diff --git a/meta-arm-bsp/wic/efi-disk-no-swap.wks.in b/meta-arm-bsp/wic/efi-disk-no-swap.wks.in
new file mode 100644
index 00000000..61902dfd
--- /dev/null
+++ b/meta-arm-bsp/wic/efi-disk-no-swap.wks.in
@@ -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}"