Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # Following variables defines how the NS_USER (Non Secure User - Client |
| 3 | # Application), NS_KERNEL (Non Secure Kernel), S_KERNEL (Secure Kernel) and |
| 4 | # S_USER (Secure User - TA) are compiled |
| 5 | ################################################################################ |
Pascal Brand | efe5659 | 2016-03-03 10:46:52 +0100 | [diff] [blame] | 6 | COMPILE_NS_USER ?= 64 |
| 7 | override COMPILE_NS_KERNEL := 64 |
Pascal Brand | 6044eb5 | 2016-02-23 15:48:31 +0100 | [diff] [blame] | 8 | COMPILE_S_USER ?= 64 |
| 9 | COMPILE_S_KERNEL ?= 64 |
| 10 | |
Etienne Carriere | 3768a2b | 2019-05-14 17:13:19 +0200 | [diff] [blame] | 11 | OPTEE_OS_PLATFORM = vexpress-fvp |
| 12 | |
Victor Chong | 7a71651 | 2017-09-11 15:18:44 +0100 | [diff] [blame] | 13 | include common.mk |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 14 | |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 15 | ################################################################################ |
| 16 | # Variables used for TPM configuration. |
| 17 | ################################################################################ |
| 18 | BR2_ROOTFS_OVERLAY = $(ROOT)/build/br-ext/board/fvp/overlay |
| 19 | BR2_PACKAGE_FTPM_OPTEE_EXT_SITE ?= $(CURDIR)/br-ext/package/ftpm_optee_ext |
| 20 | BR2_PACKAGE_FTPM_OPTEE_PACKAGE_SITE ?= $(ROOT)/ms-tpm-20-ref |
| 21 | |
| 22 | # The fTPM implementation is based on ARM32 architecture whereas the rest of the |
| 23 | # system is built to run on 64-bit mode (COMPILE_S_USER = 64). Therefore set |
| 24 | # BR2_PACKAGE_FTPM_OPTEE_EXT_SDK manually to the arm32 OPTEE toolkit rather than |
| 25 | # relying on OPTEE_OS_TA_DEV_KIT_DIR variable. |
| 26 | BR2_PACKAGE_FTPM_OPTEE_EXT_SDK ?= $(OPTEE_OS_PATH)/out/arm/export-ta_arm32 |
| 27 | |
| 28 | BR2_PACKAGE_LINUX_FTPM_MOD_EXT_SITE ?= $(CURDIR)/br-ext/package/linux_ftpm_mod_ext |
| 29 | BR2_PACKAGE_LINUX_FTPM_MOD_EXT_PATH ?= $(LINUX_PATH) |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 30 | |
| 31 | ################################################################################ |
| 32 | # Paths to git projects and various binaries |
| 33 | ################################################################################ |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 34 | MEASURED_BOOT ?= n |
Victor Chong | df54b11 | 2019-08-11 15:58:12 +0100 | [diff] [blame] | 35 | TF_A_PATH ?= $(ROOT)/trusted-firmware-a |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 36 | ifeq ($(MEASURED_BOOT),y) |
| 37 | # Prefer release mode for TF-A if using Measured Boot, debug may exhaust memory. |
| 38 | TF_A_BUILD ?= release |
| 39 | endif |
Victor Chong | eca7cfd | 2019-11-08 09:18:05 +0000 | [diff] [blame] | 40 | ifeq ($(DEBUG),1) |
| 41 | TF_A_BUILD ?= debug |
| 42 | else |
| 43 | TF_A_BUILD ?= release |
| 44 | endif |
Pascal Brand | d6536da | 2015-09-01 10:38:43 +0200 | [diff] [blame] | 45 | EDK2_PATH ?= $(ROOT)/edk2 |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 46 | EDK2_PLATFORMS_PATH ?= $(ROOT)/edk2-platforms |
Victor Chong | d79d667 | 2019-11-08 09:50:30 +0000 | [diff] [blame] | 47 | EDK2_TOOLCHAIN ?= GCC49 |
| 48 | EDK2_ARCH ?= AARCH64 |
Victor Chong | eca7cfd | 2019-11-08 09:18:05 +0000 | [diff] [blame] | 49 | ifeq ($(DEBUG),1) |
| 50 | EDK2_BUILD ?= DEBUG |
| 51 | else |
| 52 | EDK2_BUILD ?= RELEASE |
| 53 | endif |
Victor Chong | d79d667 | 2019-11-08 09:50:30 +0000 | [diff] [blame] | 54 | EDK2_BIN ?= $(EDK2_PLATFORMS_PATH)/Build/ArmVExpress-FVP-AArch64/$(EDK2_BUILD)_$(EDK2_TOOLCHAIN)/FV/FVP_$(EDK2_ARCH)_EFI.fd |
Balint Dobszay | c394dcd | 2022-05-23 18:32:57 +0200 | [diff] [blame] | 55 | FVP_USE_BASE_PLAT ?= n |
| 56 | ifeq ($(FVP_USE_BASE_PLAT),y) |
| 57 | FVP_PATH ?= $(ROOT)/Base_RevC_AEMvA_pkg/models/Linux64_GCC-9.3 |
| 58 | FVP_BIN ?= FVP_Base_RevC-2xAEMvA |
| 59 | FVP_LINUX_DTB ?= $(LINUX_PATH)/arch/arm64/boot/dts/arm/fvp-base-revc.dtb |
| 60 | else |
Balint Dobszay | 5e18857 | 2022-06-07 13:10:34 +0200 | [diff] [blame] | 61 | FVP_PATH ?= $(ROOT)/Foundation_Platformpkg/models/Linux64_GCC-9.3 |
| 62 | FVP_BIN ?= Foundation_Platform |
Balint Dobszay | c394dcd | 2022-05-23 18:32:57 +0200 | [diff] [blame] | 63 | FVP_LINUX_DTB ?= $(LINUX_PATH)/arch/arm64/boot/dts/arm/foundation-v8-gicv3-psci.dtb |
| 64 | endif |
Balint Dobszay | 5e18857 | 2022-06-07 13:10:34 +0200 | [diff] [blame] | 65 | ifeq ($(wildcard $(FVP_PATH)),) |
| 66 | $(error $(FVP_PATH) does not exist) |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 67 | endif |
Joakim Bech | 277ddad | 2017-11-15 09:33:21 +0100 | [diff] [blame] | 68 | GRUB_PATH ?= $(ROOT)/grub |
| 69 | GRUB_CONFIG_PATH ?= $(BUILD_PATH)/fvp/grub |
| 70 | OUT_PATH ?= $(ROOT)/out |
| 71 | GRUB_BIN ?= $(OUT_PATH)/bootaa64.efi |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 72 | BOOT_IMG ?= $(OUT_PATH)/boot-fat.uefi.img |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 73 | FTPM_PATH ?= $(ROOT)/ms-tpm-20-ref/Samples/ARM32-FirmwareTPM/optee_ta |
| 74 | |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 75 | ifeq ($(MEASURED_BOOT),y) |
Balint Dobszay | 35e6099 | 2022-06-10 16:19:10 +0200 | [diff] [blame] | 76 | # By default enable FTPM for backwards compatibility. |
| 77 | MEASURED_BOOT_FTPM ?= y |
| 78 | else |
| 79 | $(call force,MEASURED_BOOT_FTPM,n,requires MEASURED_BOOT enabled) |
| 80 | endif |
| 81 | |
| 82 | # Build ancillary components to access fTPM if Measured Boot is enabled. |
| 83 | ifeq ($(MEASURED_BOOT_FTPM),y) |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 84 | DEFCONFIG_FTPM ?= --br-defconfig build/br-ext/configs/ftpm_optee |
| 85 | DEFCONFIG_TPM_MODULE ?= --br-defconfig build/br-ext/configs/linux_ftpm |
| 86 | DEFCONFIG_TSS ?= --br-defconfig build/br-ext/configs/tss |
| 87 | endif |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 88 | |
| 89 | ################################################################################ |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 90 | # Targets |
| 91 | ################################################################################ |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 92 | all: arm-tf optee-os ftpm boot-img linux edk2 |
Jens Wiklander | 41a0dfe | 2018-02-05 22:55:02 +0100 | [diff] [blame] | 93 | clean: arm-tf-clean boot-img-clean buildroot-clean edk2-clean grub-clean \ |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 94 | ftpm-clean optee-os-clean |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 95 | |
Victor Chong | 7a71651 | 2017-09-11 15:18:44 +0100 | [diff] [blame] | 96 | include toolchain.mk |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 97 | |
| 98 | ################################################################################ |
Joakim Bech | 277ddad | 2017-11-15 09:33:21 +0100 | [diff] [blame] | 99 | # Folders |
| 100 | ################################################################################ |
| 101 | $(OUT_PATH): |
| 102 | mkdir -p $@ |
| 103 | |
| 104 | ################################################################################ |
Balint Dobszay | 276212d | 2022-05-24 18:45:34 +0200 | [diff] [blame] | 105 | # Shared folder |
| 106 | ################################################################################ |
| 107 | # Enable accessing the host directory FVP_VIRTFS_HOST_DIR from the FVP. |
| 108 | # The shared folder can be mounted in the following ways: |
| 109 | # - Run 'mount -t 9p -o trans=virtio,version=9p2000.L FM <mount point>' or, |
| 110 | # - enable FVP_VIRTFS_AUTOMOUNT. |
| 111 | # The latter will use the Buildroot post-build script to add an entry to the |
| 112 | # target's /etc/fstab, mounting the shared directory to FVP_VIRTFS_MOUNTPOINT |
| 113 | # on the FVP. |
| 114 | # Note: the post-build script can only append to fstab. If FVP_VIRTFS_AUTOMOUNT |
| 115 | # is changed from "y" to "n", run 'rm -r ../out-br/build/skeleton-init-sysv' so |
| 116 | # the target's fstab will be replaced with the unmodified original again. |
| 117 | FVP_VIRTFS_ENABLE ?= n |
| 118 | FVP_VIRTFS_HOST_DIR ?= $(ROOT) |
| 119 | FVP_VIRTFS_AUTOMOUNT ?= n |
| 120 | FVP_VIRTFS_MOUNTPOINT ?= /mnt/host |
| 121 | |
| 122 | ifeq ($(FVP_VIRTFS_AUTOMOUNT),y) |
| 123 | $(call force,FVP_VIRTFS_ENABLE,y,required by FVP_VIRTFS_AUTOMOUNT) |
| 124 | endif |
| 125 | |
| 126 | ifneq ($(FVP_USE_BASE_PLAT),y) |
| 127 | $(call force,FVP_VIRTFS_ENABLE,n,only supported on FVP Base Platform) |
| 128 | endif |
| 129 | |
| 130 | BR2_ROOTFS_POST_BUILD_SCRIPT = $(ROOT)/build/br-ext/board/fvp/post-build.sh |
| 131 | BR2_ROOTFS_POST_SCRIPT_ARGS = "$(FVP_VIRTFS_AUTOMOUNT) $(FVP_VIRTFS_MOUNTPOINT)" |
| 132 | |
| 133 | ################################################################################ |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 134 | # ARM Trusted Firmware |
| 135 | ################################################################################ |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 136 | TF_A_EXPORTS ?= \ |
Joakim Bech | 69a8a37 | 2016-04-26 11:05:04 +0200 | [diff] [blame] | 137 | CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)" |
Pascal Brand | b130ea2 | 2015-10-13 13:18:36 +0200 | [diff] [blame] | 138 | |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 139 | TF_A_FLAGS ?= \ |
Jens Wiklander | 0b3eb33 | 2017-09-01 09:32:34 +0200 | [diff] [blame] | 140 | BL32=$(OPTEE_OS_HEADER_V2_BIN) \ |
| 141 | BL32_EXTRA1=$(OPTEE_OS_PAGER_V2_BIN) \ |
| 142 | BL32_EXTRA2=$(OPTEE_OS_PAGEABLE_V2_BIN) \ |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 143 | BL33=$(EDK2_BIN) \ |
Jens Wiklander | 6d92394 | 2016-01-08 15:33:03 +0100 | [diff] [blame] | 144 | ARM_TSP_RAM_LOCATION=tdram \ |
Jerome Forissier | 0c76195 | 2018-11-09 11:09:26 +0100 | [diff] [blame] | 145 | FVP_USE_GIC_DRIVER=FVP_GICV3 \ |
Pascal Brand | b130ea2 | 2015-10-13 13:18:36 +0200 | [diff] [blame] | 146 | PLAT=fvp \ |
| 147 | SPD=opteed |
| 148 | |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 149 | ifneq ($(MEASURED_BOOT),y) |
Gyorgy | 0980530 | 2022-11-30 12:36:17 +0000 | [diff] [blame] | 150 | TF_A_FLAGS += DEBUG=$(DEBUG) \ |
| 151 | MEASURED_BOOT=0 |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 152 | else |
| 153 | TF_A_FLAGS += DEBUG=0 \ |
| 154 | MBEDTLS_DIR=$(ROOT)/mbedtls \ |
| 155 | ARM_ROTPK_LOCATION=devel_rsa \ |
| 156 | GENERATE_COT=1 \ |
| 157 | MEASURED_BOOT=1 \ |
| 158 | ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem \ |
| 159 | TPM_HASH_ALG=sha256 \ |
| 160 | TRUSTED_BOARD_BOOT=1 \ |
| 161 | EVENT_LOG_LEVEL=20 |
| 162 | endif |
| 163 | |
Pascal Brand | b130ea2 | 2015-10-13 13:18:36 +0200 | [diff] [blame] | 164 | arm-tf: optee-os edk2 |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 165 | $(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) all fip |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 166 | |
| 167 | arm-tf-clean: |
Victor Chong | 371d7c2 | 2019-08-08 17:17:14 +0100 | [diff] [blame] | 168 | $(TF_A_EXPORTS) $(MAKE) -C $(TF_A_PATH) $(TF_A_FLAGS) clean |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 169 | |
| 170 | ################################################################################ |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 171 | # EDK2 / Tianocore |
| 172 | ################################################################################ |
Joakim Bech | c94e95a | 2017-11-25 11:06:50 +0100 | [diff] [blame] | 173 | define edk2-env |
| 174 | export WORKSPACE=$(EDK2_PLATFORMS_PATH) |
| 175 | endef |
| 176 | |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 177 | define edk2-call |
Victor Chong | d79d667 | 2019-11-08 09:50:30 +0000 | [diff] [blame] | 178 | $(EDK2_TOOLCHAIN)_$(EDK2_ARCH)_PREFIX=$(AARCH64_CROSS_COMPILE) \ |
| 179 | build -n `getconf _NPROCESSORS_ONLN` -a $(EDK2_ARCH) \ |
| 180 | -t $(EDK2_TOOLCHAIN) -p Platform/ARM/VExpressPkg/ArmVExpress-FVP-AArch64.dsc -b $(EDK2_BUILD) |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 181 | endef |
| 182 | |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 183 | edk2: edk2-common |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 184 | |
Pascal Brand | 9a0f50f | 2015-09-08 15:34:17 +0200 | [diff] [blame] | 185 | edk2-clean: edk2-clean-common |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 186 | |
| 187 | ################################################################################ |
| 188 | # Linux kernel |
| 189 | ################################################################################ |
Jerome Forissier | e100238 | 2015-11-26 11:36:00 +0100 | [diff] [blame] | 190 | LINUX_DEFCONFIG_COMMON_ARCH := arm64 |
Balint Dobszay | 3730e01 | 2023-06-02 11:40:41 +0200 | [diff] [blame] | 191 | LINUX_DEFCONFIG_COMMON_FILES ?= \ |
Jerome Forissier | e100238 | 2015-11-26 11:36:00 +0100 | [diff] [blame] | 192 | $(LINUX_PATH)/arch/arm64/configs/defconfig \ |
| 193 | $(CURDIR)/kconfigs/fvp.conf |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 194 | |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 195 | .PHONY: linux-ftpm-module |
| 196 | linux-ftpm-module: linux |
Balint Dobszay | 35e6099 | 2022-06-10 16:19:10 +0200 | [diff] [blame] | 197 | ifeq ($(MEASURED_BOOT_FTPM),y) |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 198 | linux-ftpm-module: |
| 199 | $(MAKE) -C $(LINUX_PATH) $(LINUX_COMMON_FLAGS) M=drivers/char/tpm \ |
| 200 | modules_install INSTALL_MOD_PATH=$(LINUX_PATH) |
| 201 | endif |
| 202 | |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 203 | linux-defconfig: $(LINUX_PATH)/.config |
| 204 | |
Pascal Brand | e3d8598 | 2015-09-10 17:20:42 +0200 | [diff] [blame] | 205 | LINUX_COMMON_FLAGS += ARCH=arm64 |
| 206 | |
| 207 | linux: linux-common |
| 208 | |
| 209 | linux-defconfig-clean: linux-defconfig-clean-common |
| 210 | |
| 211 | LINUX_CLEAN_COMMON_FLAGS += ARCH=arm64 |
| 212 | |
| 213 | linux-clean: linux-clean-common |
| 214 | |
| 215 | LINUX_CLEANER_COMMON_FLAGS += ARCH=arm64 |
| 216 | |
| 217 | linux-cleaner: linux-cleaner-common |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 218 | |
| 219 | ################################################################################ |
| 220 | # OP-TEE |
| 221 | ################################################################################ |
Etienne Carriere | 3768a2b | 2019-05-14 17:13:19 +0200 | [diff] [blame] | 222 | OPTEE_OS_COMMON_FLAGS += CFG_ARM_GICV3=y |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 223 | |
| 224 | ifeq ($(MEASURED_BOOT),y) |
| 225 | OPTEE_OS_COMMON_FLAGS += CFG_DT=y CFG_CORE_TPM_EVENT_LOG=y |
| 226 | endif |
| 227 | |
Jerome Forissier | ae45fbf | 2015-09-04 09:40:17 +0200 | [diff] [blame] | 228 | optee-os: optee-os-common |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 229 | |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 230 | optee-os-clean: ftpm-clean optee-os-clean-common |
| 231 | |
| 232 | ################################################################################ |
| 233 | # Buildroot |
| 234 | ################################################################################ |
| 235 | |
| 236 | buildroot: linux-ftpm-module |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 237 | |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 238 | ################################################################################ |
Joakim Bech | 277ddad | 2017-11-15 09:33:21 +0100 | [diff] [blame] | 239 | # grub |
| 240 | ################################################################################ |
| 241 | grub-flags := CC="$(CCACHE)gcc" \ |
| 242 | TARGET_CC="$(AARCH64_CROSS_COMPILE)gcc" \ |
| 243 | TARGET_OBJCOPY="$(AARCH64_CROSS_COMPILE)objcopy" \ |
| 244 | TARGET_NM="$(AARCH64_CROSS_COMPILE)nm" \ |
| 245 | TARGET_RANLIB="$(AARCH64_CROSS_COMPILE)ranlib" \ |
Jens Wiklander | 3b5d8f0 | 2018-06-27 09:16:24 +0200 | [diff] [blame] | 246 | TARGET_STRIP="$(AARCH64_CROSS_COMPILE)strip" \ |
| 247 | --disable-werror |
Joakim Bech | 277ddad | 2017-11-15 09:33:21 +0100 | [diff] [blame] | 248 | |
| 249 | GRUB_MODULES += boot chain configfile echo efinet eval ext2 fat font gettext \ |
| 250 | gfxterm gzio help linux loadenv lsefi normal part_gpt \ |
| 251 | part_msdos read regexp search search_fs_file search_fs_uuid \ |
| 252 | search_label terminal terminfo test tftp time |
| 253 | |
| 254 | $(GRUB_PATH)/configure: $(GRUB_PATH)/configure.ac |
| 255 | cd $(GRUB_PATH) && ./autogen.sh |
| 256 | |
| 257 | $(GRUB_PATH)/Makefile: $(GRUB_PATH)/configure |
| 258 | cd $(GRUB_PATH) && ./configure --target=aarch64 --enable-boot-time $(grub-flags) |
| 259 | |
| 260 | .PHONY: grub |
| 261 | grub: $(GRUB_PATH)/Makefile | $(OUT_PATH) |
| 262 | $(MAKE) -C $(GRUB_PATH) && \ |
| 263 | cd $(GRUB_PATH) && ./grub-mkimage \ |
| 264 | --output=$(GRUB_BIN) \ |
| 265 | --config=$(GRUB_CONFIG_PATH)/grub.cfg \ |
| 266 | --format=arm64-efi \ |
| 267 | --directory=grub-core \ |
| 268 | --prefix=/boot/grub \ |
| 269 | $(GRUB_MODULES) |
| 270 | |
| 271 | .PHONY: grub-clean |
| 272 | grub-clean: |
| 273 | @if [ -e $(GRUB_PATH)/Makefile ]; then $(MAKE) -C $(GRUB_PATH) clean; fi |
| 274 | @rm -f $(GRUB_BIN) |
| 275 | @rm -f $(GRUB_PATH)/configure |
| 276 | |
| 277 | |
| 278 | ################################################################################ |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 279 | # Boot Image |
| 280 | ################################################################################ |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 281 | |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 282 | .PHONY: boot-img |
Javier Almansa Sobrino | cf56848 | 2020-02-26 11:51:45 +0000 | [diff] [blame] | 283 | boot-img: grub buildroot |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 284 | rm -f $(BOOT_IMG) |
| 285 | mformat -i $(BOOT_IMG) -n 64 -h 255 -T 131072 -v "BOOT IMG" -C :: |
| 286 | mcopy -i $(BOOT_IMG) $(LINUX_PATH)/arch/arm64/boot/Image :: |
Balint Dobszay | c394dcd | 2022-05-23 18:32:57 +0200 | [diff] [blame] | 287 | mcopy -i $(BOOT_IMG) $(FVP_LINUX_DTB) ::/fvp.dtb |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 288 | mmd -i $(BOOT_IMG) ::/EFI |
| 289 | mmd -i $(BOOT_IMG) ::/EFI/BOOT |
Jens Wiklander | 41a0dfe | 2018-02-05 22:55:02 +0100 | [diff] [blame] | 290 | mcopy -i $(BOOT_IMG) $(ROOT)/out-br/images/rootfs.cpio.gz ::/initrd.img |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 291 | mcopy -i $(BOOT_IMG) $(GRUB_BIN) ::/EFI/BOOT/bootaa64.efi |
| 292 | mcopy -i $(BOOT_IMG) $(GRUB_CONFIG_PATH)/grub.cfg ::/EFI/BOOT/grub.cfg |
| 293 | |
| 294 | .PHONY: boot-img-clean |
| 295 | boot-img-clean: |
| 296 | rm -f $(BOOT_IMG) |
| 297 | |
| 298 | ################################################################################ |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 299 | # Run targets |
| 300 | ################################################################################ |
| 301 | # This target enforces updating root fs etc |
Pascal Brand | 1527169 | 2015-09-08 10:42:22 +0200 | [diff] [blame] | 302 | run: all |
Pascal Brand | 1527169 | 2015-09-08 10:42:22 +0200 | [diff] [blame] | 303 | $(MAKE) run-only |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 304 | |
Balint Dobszay | c394dcd | 2022-05-23 18:32:57 +0200 | [diff] [blame] | 305 | ifeq ($(FVP_USE_BASE_PLAT),y) |
| 306 | FVP_ARGS ?= \ |
| 307 | -C bp.ve_sysregs.exit_on_shutdown=1 \ |
| 308 | -C cache_state_modelled=0 \ |
| 309 | -C pctl.startup=0.0.0.0 \ |
| 310 | -C cluster0.NUM_CORES=4 \ |
| 311 | -C cluster1.NUM_CORES=4 \ |
Balint Dobszay | 4791acb | 2023-04-24 13:39:19 +0200 | [diff] [blame] | 312 | -C cluster0.cpu0.enable_crc32=1 \ |
| 313 | -C cluster0.cpu1.enable_crc32=1 \ |
| 314 | -C cluster0.cpu2.enable_crc32=1 \ |
| 315 | -C cluster0.cpu3.enable_crc32=1 \ |
| 316 | -C cluster1.cpu0.enable_crc32=1 \ |
| 317 | -C cluster1.cpu1.enable_crc32=1 \ |
| 318 | -C cluster1.cpu2.enable_crc32=1 \ |
| 319 | -C cluster1.cpu3.enable_crc32=1 \ |
Balint Dobszay | c394dcd | 2022-05-23 18:32:57 +0200 | [diff] [blame] | 320 | -C bp.secure_memory=1 \ |
| 321 | -C bp.secureflashloader.fname=$(TF_A_PATH)/build/fvp/$(TF_A_BUILD)/bl1.bin \ |
| 322 | -C bp.flashloader0.fname=$(TF_A_PATH)/build/fvp/$(TF_A_BUILD)/fip.bin \ |
| 323 | -C bp.virtioblockdevice.image_path=$(BOOT_IMG) |
Balint Dobszay | 276212d | 2022-05-24 18:45:34 +0200 | [diff] [blame] | 324 | ifeq ($(FVP_VIRTFS_ENABLE),y) |
| 325 | FVP_ARGS += -C bp.virtiop9device.root_path=$(FVP_VIRTFS_HOST_DIR) |
| 326 | endif |
Balint Dobszay | c394dcd | 2022-05-23 18:32:57 +0200 | [diff] [blame] | 327 | else |
Balint Dobszay | 5e18857 | 2022-06-07 13:10:34 +0200 | [diff] [blame] | 328 | FVP_ARGS ?= \ |
Jens Wiklander | edaa02b | 2017-03-28 17:41:11 +0200 | [diff] [blame] | 329 | --arm-v8.0 \ |
Joakim Bech | 427dd63 | 2015-05-04 15:52:33 +0200 | [diff] [blame] | 330 | --cores=4 \ |
| 331 | --secure-memory \ |
| 332 | --visualization \ |
| 333 | --gicv3 \ |
Victor Chong | eca7cfd | 2019-11-08 09:18:05 +0000 | [diff] [blame] | 334 | --data="$(TF_A_PATH)/build/fvp/$(TF_A_BUILD)/bl1.bin"@0x0 \ |
| 335 | --data="$(TF_A_PATH)/build/fvp/$(TF_A_BUILD)/fip.bin"@0x8000000 \ |
Joakim Bech | ab62261 | 2017-11-15 10:45:28 +0100 | [diff] [blame] | 336 | --block-device=$(BOOT_IMG) |
Balint Dobszay | c394dcd | 2022-05-23 18:32:57 +0200 | [diff] [blame] | 337 | endif |
Balint Dobszay | 5e18857 | 2022-06-07 13:10:34 +0200 | [diff] [blame] | 338 | |
| 339 | run-only: |
Gabor Toth | de2f893 | 2023-03-09 12:12:46 +0100 | [diff] [blame] | 340 | $(FVP_PATH)/$(FVP_BIN) $(FVP_ARGS) $(FVP_EXTRA_ARGS) |