Skip to contentSkip to conversation

Corstone-1000 Configuration changes

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

lore
Share & tools
lore
#0 lore raw

cover Corstone-1000 Configuration changes

From: Drew Reed <[email protected]>

Move a large number of image and recipe specific items out of the machine configuration to make it easier to modify the settings when building with different images.
In addition Corstone-1000 now uses the poky distrobution for building the initramfs image stored in flash.

Drew Reed (4):
bsp: Move Corstone-1000 U-Boot configuration entries
bsp: Move machine settings
bsp,ci: Switch to poky distro
bsp: Rename corstone1000-image

 ci/corstone1000-common.yml                    | 33 ++++++++-
 .../conf/machine/include/corstone1000.inc     | 72 ++++++-------------
 ...b => corstone1000-flash-firmware-image.bb} | 30 ++++++--
 .../images/corstone1000-initramfs-image.bb    | 25 -------
 ...-firmware-image-capsule-update-image.json} |  0
 .../u-boot/u-boot-corstone1000.inc            | 12 +++-
 ...wks => corstone1000-flash-firmware.wks.in} |  0
 7 files changed, 85 insertions(+), 87 deletions(-)
 rename meta-arm-bsp/recipes-bsp/images/{corstone1000-image.bb => corstone1000-flash-firmware-image.bb} (56%)
 delete mode 100644 meta-arm-bsp/recipes-bsp/images/corstone1000-initramfs-image.bb
 rename meta-arm-bsp/recipes-bsp/images/files/{corstone1000-image-capsule-update-image.json => corstone1000-flash-firmware-image-capsule-update-image.json} (100%)
 rename meta-arm-bsp/wic/{corstone1000-image.corstone1000.wks => corstone1000-flash-firmware.wks.in} (100%)

--
2.43.0

#1 lore raw

PATCH 1/4 bsp: Move Corstone-1000 U-Boot configuration entries

From: Drew Reed <[email protected]>

Moved the U-Boot configuration items from the machine definition to the Corstone-1000 specific U-Boot append file as it makes it easier to the U-Boot configuration for a machine in one place and to make it more consistant with other platforms.

---
 meta-arm-bsp/conf/machine/include/corstone1000.inc   | 11 -----------
 .../recipes-bsp/images/corstone1000-image.bb         |  5 +++++
 .../recipes-bsp/u-boot/u-boot-corstone1000.inc       | 12 ++++++++++--
 3 files changed, 15 insertions(+), 13 deletions(-)
meta-arm-bsp/conf/machine/include/corstone1000.inc +0 -11
index 06b630a5..a1e67c21 100644
@@ -20,22 +20,11 @@ TFA_BL2_RE_IMAGE_LOAD_ADDRESS = "0x62353000"
 TFA_BL2_RE_SIGN_BIN_SIZE = "0x2d000"
 TFA_FIP_RE_IMAGE_LOAD_ADDRESS = "0x68130000"
 TFA_FIP_RE_SIGN_BIN_SIZE = "0x00200000"
-RE_LAYOUT_WRAPPER_VERSION = "0.0.7"
-TFM_SIGN_PRIVATE_KEY = "${libdir}/tfm-scripts/root-RSA-3072_1.pem"
-RE_IMAGE_OFFSET = "0x1000"
 
 # u-boot
 PREFERRED_VERSION_u-boot ?= "2023.07%"
 EXTRA_IMAGEDEPENDS += "u-boot"
 
-UBOOT_CONFIG ??= "EFI"
-UBOOT_CONFIG[EFI] = "corstone1000_defconfig"
-UBOOT_ENTRYPOINT  = "0x80000000"
-UBOOT_LOADADDRESS = "0x80000000"
-UBOOT_BOOTARGS = "earlycon=pl011,0x1a510000 console=ttyAMA0 loglevel=9"
-UBOOT_ARCH = "arm"
-UBOOT_EXTLINUX = "0"
-
 #optee
 PREFERRED_VERSION_optee-os ?= "4.1.%"
 EXTRA_IMAGEDEPENDS += "optee-os"
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +5 -0
index 714a57cb..e7d00596 100644
@@ -17,6 +17,11 @@ UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.${CAPSULE_IMGTYPE}"
 UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json"
 CAPSULE_IMGTYPE = "wic"
 
+# TF-X settings for signing host images
+RE_LAYOUT_WRAPPER_VERSION = "0.0.7"
+TFM_SIGN_PRIVATE_KEY = "${libdir}/tfm-scripts/root-RSA-3072_1.pem"
+RE_IMAGE_OFFSET = "0x1000"
+
 do_sign_images() {
     # Sign TF-A BL2
     sign_host_image ${RECIPE_SYSROOT}/firmware/${TFA_BL2_BINARY} \
meta-arm-bsp/recipes-bsp/u-boot/u-boot-corstone1000.inc +10 -2
index cf0640a3..2585ff25 100644
@@ -1,10 +1,18 @@
 # Corstone1000 specific U-boot support
 
-DEPENDS:append = " gnutls-native openssl-native efitools-native"
+DEPENDS:append = " openssl-native efitools-native"
 CORSTONE1000_DEVICE_TREE:corstone1000-mps3 = "corstone1000-mps3"
 CORSTONE1000_DEVICE_TREE:corstone1000-fvp = "corstone1000-fvp"
 EXTRA_OEMAKE:append = ' DEVICE_TREE=${CORSTONE1000_DEVICE_TREE}'
 
+UBOOT_CONFIG ??= "EFI"
+UBOOT_CONFIG[EFI] = "corstone1000_defconfig"
+UBOOT_ENTRYPOINT  = "0x80000000"
+UBOOT_LOADADDRESS = "0x80000000"
+UBOOT_BOOTARGS = "${LINUX_KERNEL_ARGS} loglevel=9"
+UBOOT_ARCH = "arm"
+UBOOT_EXTLINUX = "0"
+
 SYSROOT_DIRS:append = " /boot"
 
 SRC_URI:append = " \
@@ -52,7 +60,7 @@ SRC_URI:append = " \
     file://0042-corstone1000-enable-virtio-net-support.patch		  \
     "
 
-do_configure:append(){
+do_configure:append() {
     openssl req -x509 -sha256 -newkey rsa:2048 -subj /CN=CRT/ -keyout ${B}/CRT.key -out ${B}/CRT.crt -nodes -days 365
     cert-to-efi-sig-list ${B}/CRT.crt ${B}/corstone1000_defconfig/CRT.esl
 }
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/4 bsp: Move machine settings

In reply to [email protected]

From: Drew Reed <[email protected]>

Moves a number of setting from the machine definition to the actual recipes they apply too.
Added image configuration and dependancies to the flash image definition file.
Reordered the settings in the machine definition to group them by component that are related to.

---
 .../conf/machine/include/corstone1000.inc     | 63 +++++++++----------
 .../recipes-bsp/images/corstone1000-image.bb  | 27 ++++++--
 2 files changed, 49 insertions(+), 41 deletions(-)
meta-arm-bsp/conf/machine/include/corstone1000.inc +28 -35
index a1e67c21..64e166af 100644
@@ -2,70 +2,63 @@ require conf/machine/include/arm/armv8a/tune-cortexa35.inc
 
 MACHINEOVERRIDES =. "corstone1000:"
 
+# TF-M
+PREFERRED_VERSION_trusted-firmware-m ?= "1.8.%"
+
 # TF-A
 TFA_PLATFORM = "corstone1000"
-EXTRA_IMAGEDEPENDS += "trusted-firmware-a"
 PREFERRED_VERSION_trusted-firmware-a ?= "2.9.%"
 PREFERRED_VERSION_tf-a-tests ?= "2.8.%"
 
 TFA_BL2_BINARY = "bl2-corstone1000.bin"
 TFA_FIP_BINARY = "fip-corstone1000.bin"
 
-# TF-M
-EXTRA_IMAGEDEPENDS += "trusted-firmware-m"
-PREFERRED_VERSION_trusted-firmware-m ?= "1.8.%"
-
-# TF-M settings for signing host images
-TFA_BL2_RE_IMAGE_LOAD_ADDRESS = "0x62353000"
-TFA_BL2_RE_SIGN_BIN_SIZE = "0x2d000"
-TFA_FIP_RE_IMAGE_LOAD_ADDRESS = "0x68130000"
-TFA_FIP_RE_SIGN_BIN_SIZE = "0x00200000"
-
-# u-boot
-PREFERRED_VERSION_u-boot ?= "2023.07%"
-EXTRA_IMAGEDEPENDS += "u-boot"
-
-#optee
+# optee
 PREFERRED_VERSION_optee-os ?= "4.1.%"
-EXTRA_IMAGEDEPENDS += "optee-os"
-OPTEE_ARCH = "arm64"
-OPTEE_BINARY = "tee-pager_v2.bin"
 
-# Include smm-gateway and se-proxy SPs into optee-os binary
-MACHINE_FEATURES += "ts-smm-gateway ts-se-proxy"
+# Trusted Services
 TS_PLATFORM = "arm/corstone1000"
 TS_SP_SE_PROXY_CONFIG = "corstone1000"
+# Include smm-gateway and se-proxy SPs into optee-os binary
+MACHINE_FEATURES += "ts-smm-gateway ts-se-proxy"
 
-# External System(Cortex-M3)
-EXTRA_IMAGEDEPENDS += "external-system"
+# u-boot
+PREFERRED_VERSION_u-boot ?= "2023.07%"
+MACHINE_FEATURES += "efi"
+EFI_PROVIDER ?= "grub-efi"
+
+# Grub
+LINUX_KERNEL_ARGS ?= "earlycon=pl011,0x1a510000 console=ttyAMA0,115200"
+GRUB_LINUX_APPEND ?= "${LINUX_KERNEL_ARGS}"
+IMAGE_CMD:wic[vardeps] += "GRUB_LINUX_APPEND"
 
 # Linux kernel
 PREFERRED_PROVIDER_virtual/kernel:forcevariable = "linux-yocto"
 PREFERRED_VERSION_linux-yocto = "6.6.%"
 KERNEL_IMAGETYPE = "Image.gz"
-
-INITRAMFS_IMAGE_BUNDLE ?= "1"
-
-#telling the build system which image is responsible of the generation of the initramfs rootfs
-INITRAMFS_IMAGE = "corstone1000-initramfs-image"
-IMAGE_NAME_SUFFIX = ""
-
 # add FF-A support in the kernel
 MACHINE_FEATURES += "arm-ffa"
-
-# prevent the kernel image from being included in the intramfs rootfs
-PACKAGE_EXCLUDE = "kernel-image-*"
-
 # enable this feature for kernel debugging
 # MACHINE_FEATURES += "corstone1000_kernel_debug"
+# Telling the build system which image is responsible of the generation of the initramfs rootfs
+INITRAMFS_IMAGE_BUNDLE = "1"
+INITRAMFS_IMAGE ?= "corstone1000-initramfs-image"
+IMAGE_NAME_SUFFIX = ""
 
 # login terminal serial port settings
 SERIAL_CONSOLES ?= "115200;ttyAMA0"
 
+WKS_FILE ?= "corstone1000-image.corstone1000.wks"
+
 # making sure EXTRA_IMAGEDEPENDS will be used while creating the image
 WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}"
 
-WKS_FILE ?= "corstone1000-image.corstone1000.wks"
+# 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 = ""
 
+# Disable python usage in opkg-utils since it won't build with tiny config
+PACKAGECONFIG:remove:pn-opkg-utils = "python"
 # Disable openssl in kmod to shink the initramfs size
 PACKAGECONFIG:remove:pn-kmod = "openssl"
meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +21 -6
index e7d00596..73fc1766 100644
@@ -5,19 +5,35 @@ LICENSE = "MIT"
 
 COMPATIBLE_MACHINE = "corstone1000"
 
+# IMAGE_FSTYPES must be set before 'inherit image'
+# https://docs.yoctoproject.org/ref-manual/variables.html#term-IMAGE_FSTYPES
+IMAGE_FSTYPES = "wic uefi_capsule"
+
 inherit image
 inherit tfm_sign_image
-inherit  uefi_capsule
+inherit uefi_capsule
 
-PACKAGE_INSTALL = ""
+DEPENDS += "external-system \
+            trusted-firmware-a \
+            trusted-firmware-m \
+"
 
-IMAGE_FSTYPES += "wic uefi_capsule"
+IMAGE_FEATURES = ""
+IMAGE_LINGUAS = ""
+
+PACKAGE_INSTALL = ""
 
-UEFI_FIRMWARE_BINARY = "${PN}-${MACHINE}.${CAPSULE_IMGTYPE}"
+UEFI_FIRMWARE_BINARY = "${IMAGE_LINK_NAME}.${CAPSULE_IMGTYPE}"
 UEFI_CAPSULE_CONFIG = "${THISDIR}/files/${PN}-capsule-update-image.json"
 CAPSULE_IMGTYPE = "wic"
 
-# TF-X settings for signing host images
+# TF-A settings for signing host images
+TFA_BL2_BINARY = "bl2-corstone1000.bin"
+TFA_FIP_BINARY = "fip-corstone1000.bin"
+TFA_BL2_RE_IMAGE_LOAD_ADDRESS = "0x62353000"
+TFA_BL2_RE_SIGN_BIN_SIZE = "0x2d000"
+TFA_FIP_RE_IMAGE_LOAD_ADDRESS = "0x68130000"
+TFA_FIP_RE_SIGN_BIN_SIZE = "0x00200000"
 RE_LAYOUT_WRAPPER_VERSION = "0.0.7"
 TFM_SIGN_PRIVATE_KEY = "${libdir}/tfm-scripts/root-RSA-3072_1.pem"
 RE_IMAGE_OFFSET = "0x1000"
@@ -38,6 +54,5 @@ do_sign_images() {
         ${TFA_FIP_RE_IMAGE_LOAD_ADDRESS} ${TFA_FIP_RE_SIGN_BIN_SIZE}
 }
 do_sign_images[depends] = "\
-    trusted-firmware-a:do_populate_sysroot \
     fiptool-native:do_populate_sysroot \
     "
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/4 bsp,ci: Switch to poky distro

In reply to [email protected]

From: Drew Reed <[email protected]>

We can now use the standard poky distro configured to be small by switching distrobution and using the standard minimal image from poky.
To do this we also remove and image configuration options from the machine config and apply them in the kas files.

---
 ci/corstone1000-common.yml                    | 31 +++++++++++++++++--
 .../conf/machine/include/corstone1000.inc     | 18 ++---------
 .../images/corstone1000-initramfs-image.bb    | 25 ---------------
 3 files changed, 31 insertions(+), 43 deletions(-)
 delete mode 100644 meta-arm-bsp/recipes-bsp/images/corstone1000-initramfs-image.bb
ci/corstone1000-common.yml +29 -2
index 09472285..42cf4c95 100644
@@ -3,13 +3,40 @@ header:
   includes:
     - ci/base.yml
     - ci/meta-openembedded.yml
-    - ci/poky-tiny.yml
     - ci/meta-secure-core.yml
 
 local_conf_header:
-    extrapackages: |
+  extrapackages: |
     # Intentionally blank to prevent perf from being added to the image in base.yml
 
+  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 = ""
+
+    # enable mdev/busybox for init
+    INIT_MANAGER = "mdev-busybox"
+    VIRTUAL-RUNTIME_init_manager = "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 = ""
+
+    # Disable openssl in kmod to shrink the initramfs size
+    PACKAGECONFIG:remove:pn-kmod = "openssl"
+
+    # all optee packages
+    IMAGE_INSTALL += "optee-client"
+
+    # TS PSA API tests commands for crypto, its, ps and iat
+    IMAGE_INSTALL += "packagegroup-ts-tests-psa"
+
 target:
   - corstone1000-image
   - perf
meta-arm-bsp/conf/machine/include/corstone1000.inc +2 -16
index 64e166af..4d33b575 100644
@@ -33,17 +33,13 @@ GRUB_LINUX_APPEND ?= "${LINUX_KERNEL_ARGS}"
 IMAGE_CMD:wic[vardeps] += "GRUB_LINUX_APPEND"
 
 # Linux kernel
-PREFERRED_PROVIDER_virtual/kernel:forcevariable = "linux-yocto"
-PREFERRED_VERSION_linux-yocto = "6.6.%"
+PREFERRED_PROVIDER_virtual/kernel ?= "linux-yocto"
+PREFERRED_VERSION_linux-yocto ?= "6.6.%"
 KERNEL_IMAGETYPE = "Image.gz"
 # add FF-A support in the kernel
 MACHINE_FEATURES += "arm-ffa"
 # enable this feature for kernel debugging
 # MACHINE_FEATURES += "corstone1000_kernel_debug"
-# Telling the build system which image is responsible of the generation of the initramfs rootfs
-INITRAMFS_IMAGE_BUNDLE = "1"
-INITRAMFS_IMAGE ?= "corstone1000-initramfs-image"
-IMAGE_NAME_SUFFIX = ""
 
 # login terminal serial port settings
 SERIAL_CONSOLES ?= "115200;ttyAMA0"
@@ -52,13 +48,3 @@ WKS_FILE ?= "corstone1000-image.corstone1000.wks"
 
 # making sure EXTRA_IMAGEDEPENDS will be used while creating the image
 WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}"
-
-# 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 = ""
-
-# Disable python usage in opkg-utils since it won't build with tiny config
-PACKAGECONFIG:remove:pn-opkg-utils = "python"
-# Disable openssl in kmod to shink the initramfs size
-PACKAGECONFIG:remove:pn-kmod = "openssl"
meta-arm-bsp/recipes-bsp/images/corstone1000-initramfs-image.bb deleted +0 -25
deleted file mode 100644
index cac3b73c..00000000
@@ -1,25 +0,0 @@
-SUMARY = "Corstone1000 platform Initramfs Image"
-DESCRIPTION = "This is the main Linux image which includes an initramfs kernel/rootfs bundle."
-
-LICENSE = "MIT"
-
-COMPATIBLE_MACHINE = "corstone1000"
-
-IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
-
-inherit core-image
-
-# By default all basic packages required for a bootable system are installed
-# by core-image . These packages are: packagegroup-core-boot and
-# packagegroup-base-extended
-
-inherit image-buildinfo
-
-#package management is not supported in corstone1000
-IMAGE_FEATURES:remove = "package-management"
-
-# all optee packages
-IMAGE_INSTALL += "optee-client"
-
-# TS PSA API tests commands for crypto, its, ps and iat
-IMAGE_INSTALL += "packagegroup-ts-tests-psa"
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/4 bsp: Rename corstone1000-image

In reply to [email protected]

From: Drew Reed <[email protected]>

As we intend to build 2 Corstone-1000 disk images, one for the firmware in flash and an external mass storage image the existing corstone1000-image.bb file has been renamed to corstone1000-flash-firmware-image.bb to make it clear what it's for. The wks file for specifing the image layout has also been renamed to make its purpose clearer.

---
 ci/corstone1000-common.yml                                      | 2 +-
 meta-arm-bsp/conf/machine/include/corstone1000.inc              | 2 +-
 ...rstone1000-image.bb => corstone1000-flash-firmware-image.bb} | 0
 ...corstone1000-flash-firmware-image-capsule-update-image.json} | 0
 ...mage.corstone1000.wks => corstone1000-flash-firmware.wks.in} | 0
 5 files changed, 2 insertions(+), 2 deletions(-)
 rename meta-arm-bsp/recipes-bsp/images/{corstone1000-image.bb => corstone1000-flash-firmware-image.bb} (100%)
 rename meta-arm-bsp/recipes-bsp/images/files/{corstone1000-image-capsule-update-image.json => corstone1000-flash-firmware-image-capsule-update-image.json} (100%)
 rename meta-arm-bsp/wic/{corstone1000-image.corstone1000.wks => corstone1000-flash-firmware.wks.in} (100%)
ci/corstone1000-common.yml +1 -1
index 42cf4c95..5720b783 100644
@@ -38,5 +38,5 @@ local_conf_header:
     IMAGE_INSTALL += "packagegroup-ts-tests-psa"
 
 target:
-  - corstone1000-image
+  - corstone1000-flash-firmware-image
   - perf
meta-arm-bsp/conf/machine/include/corstone1000.inc +1 -1
index 4d33b575..373dd04c 100644
@@ -44,7 +44,7 @@ MACHINE_FEATURES += "arm-ffa"
 # login terminal serial port settings
 SERIAL_CONSOLES ?= "115200;ttyAMA0"
 
-WKS_FILE ?= "corstone1000-image.corstone1000.wks"
+WKS_FILE ?= "corstone1000-flash-firmware.wks.in"
 
 # making sure EXTRA_IMAGEDEPENDS will be used while creating the image
 WKS_FILE_DEPENDS:append = " ${EXTRA_IMAGEDEPENDS}"
meta-arm-bsp/recipes-bsp/images/corstone1000-flash-firmware-image.bb renamed from meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb +0 -0
similarity index 100%
rename from meta-arm-bsp/recipes-bsp/images/corstone1000-image.bb
rename to meta-arm-bsp/recipes-bsp/images/corstone1000-flash-firmware-image.bb
meta-arm-bsp/recipes-bsp/images/files/corstone1000-flash-firmware-image-capsule-update-image.json renamed from meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.json +0 -0
similarity index 100%
rename from meta-arm-bsp/recipes-bsp/images/files/corstone1000-image-capsule-update-image.json
rename to meta-arm-bsp/recipes-bsp/images/files/corstone1000-flash-firmware-image-capsule-update-image.json
meta-arm-bsp/wic/corstone1000-flash-firmware.wks.in renamed from meta-arm-bsp/wic/corstone1000-image.corstone1000.wks +0 -0
similarity index 100%
rename from meta-arm-bsp/wic/corstone1000-image.corstone1000.wks
rename to meta-arm-bsp/wic/corstone1000-flash-firmware.wks.in
Signature · 1 line
2.43.0