Patrick Georgi | 8480c0b | 2020-05-08 22:50:46 +0200 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 2 | |
| 3 | # force the shell to bash - the edksetup.sh script doesn't work with dash |
| 4 | export SHELL := env bash |
| 5 | |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 6 | project_name = edk2 |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 7 | export WORKSPACE := $(CURDIR)/workspace |
| 8 | export EDK2_PATH := $(WORKSPACE)/$(word 3,$(subst /, ,$(CONFIG_EDK2_REPOSITORY))) |
Michał Żygowski | 82d814a | 2022-10-26 11:32:54 +0200 | [diff] [blame] | 9 | |
| 10 | ifeq ($(CONFIG_EDK2_USE_EDK2_PLATFORMS),y) |
| 11 | export EDK2_PLATFORMS_PATH := $(WORKSPACE)/edk2-platforms |
| 12 | export PACKAGES_PATH := $(EDK2_PATH):\ |
| 13 | $(EDK2_PLATFORMS_PATH)/Platform/Intel:\ |
| 14 | $(EDK2_PLATFORMS_PATH)/Silicon/Intel:\ |
| 15 | $(EDK2_PLATFORMS_PATH)/Features/Intel:\ |
| 16 | $(EDK2_PLATFORMS_PATH)/Features/Intel/Debugging:\ |
| 17 | $(EDK2_PLATFORMS_PATH)/Features/Intel/Network:\ |
| 18 | $(EDK2_PLATFORMS_PATH)/Features/Intel/OutOfBandManagement:\ |
| 19 | $(EDK2_PLATFORMS_PATH)/Features/Intel/PowerManagement:\ |
| 20 | $(EDK2_PLATFORMS_PATH)/Features/Intel/SystemInformation:\ |
| 21 | $(EDK2_PLATFORMS_PATH)/Features/Intel/UserInterface |
| 22 | else |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 23 | export PACKAGES_PATH := $(EDK2_PATH) |
Michał Żygowski | 82d814a | 2022-10-26 11:32:54 +0200 | [diff] [blame] | 24 | endif |
Matt DeVillier | 38b6ccf | 2019-02-20 23:46:15 -0600 | [diff] [blame] | 25 | |
Sean Rhodes | a52d26f | 2022-10-24 09:53:45 +0100 | [diff] [blame] | 26 | OBJCOPY = $(GCC_PREFIX)objcopy |
| 27 | |
Sean Rhodes | a46fd86 | 2022-10-06 21:32:43 +0100 | [diff] [blame] | 28 | ifeq ($(CONFIG_EDK2_UEFIPAYLOAD),y) |
Sean Rhodes | 234c42f | 2022-08-02 10:00:56 +0100 | [diff] [blame] | 29 | BUILD_STR = -p UefiPayloadPkg/UefiPayloadPkg.dsc |
Sean Rhodes | a46fd86 | 2022-10-06 21:32:43 +0100 | [diff] [blame] | 30 | endif |
Sean Rhodes | 234c42f | 2022-08-02 10:00:56 +0100 | [diff] [blame] | 31 | BUILD_STR += -t COREBOOT |
| 32 | BUILD_STR += -D BOOTLOADER=COREBOOT |
Benjamin Doron | 21af6b4 | 2023-05-12 01:23:11 -0400 | [diff] [blame] | 33 | ifneq ($(V),1) |
Sean Rhodes | 3c16616 | 2022-10-06 21:29:26 +0100 | [diff] [blame] | 34 | BUILD_STR += -q |
| 35 | ifeq ($(CONFIG_EDK2_UEFIPAYLOAD),y) |
| 36 | BUILD_STR += -s |
| 37 | endif |
Sean Rhodes | 0d6dc48 | 2022-09-16 09:18:38 +0100 | [diff] [blame] | 38 | endif |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 39 | |
| 40 | # |
Sean Rhodes | 9031877 | 2023-09-20 21:24:24 +0100 | [diff] [blame] | 41 | # EDK II (edk2/master) has the following build options relevant to coreboot: |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 42 | # |
| 43 | # |
| 44 | # OPTION = DEFAULT_VALUE |
| 45 | # |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 46 | # BOOTSPLASH_IMAGE = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 47 | ifneq ($(CONFIG_EDK2_BOOTSPLASH_FILE),) |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 48 | BUILD_STR += -D BOOTSPLASH_IMAGE=TRUE |
| 49 | endif |
Sean Rhodes | c8decce | 2022-02-09 08:25:39 +0000 | [diff] [blame] | 50 | # BOOT_MANAGER_ESCAPE = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 51 | ifeq ($(CONFIG_EDK2_BOOT_MANAGER_ESCAPE),y) |
Sean Rhodes | c8decce | 2022-02-09 08:25:39 +0000 | [diff] [blame] | 52 | BUILD_STR += -D BOOT_MANAGER_ESCAPE=TRUE |
| 53 | endif |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 54 | # BUILD_TARGETS = DEBUG |
Sean Rhodes | 147c957 | 2022-08-02 08:59:48 +0100 | [diff] [blame] | 55 | ifeq ($(CONFIG_EDK2_DEBUG),y) |
| 56 | RELEASE_STR = DEBUG |
| 57 | else |
| 58 | RELEASE_STR = RELEASE |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 59 | endif |
Sean Rhodes | 7bbc9a5 | 2022-07-18 11:31:00 +0100 | [diff] [blame] | 60 | # CPU_TIMER_LIB_ENABLE = TRUE |
| 61 | ifneq ($(CONFIG_EDK2_CPU_TIMER_LIB),y) |
| 62 | BUILD_STR += -D CPU_TIMER_LIB_ENABLE=FALSE |
| 63 | else |
| 64 | BUILD_STR += --pcd gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency=$(CONFIG_CPU_XTAL_HZ) |
| 65 | endif |
Sean Rhodes | 8e10a48 | 2022-07-04 17:01:09 +0100 | [diff] [blame] | 66 | # DISABLE_SERIAL_TERMINAL = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 67 | ifneq ($(CONFIG_EDK2_SERIAL_SUPPORT),y) |
Sean Rhodes | 8e10a48 | 2022-07-04 17:01:09 +0100 | [diff] [blame] | 68 | BUILD_STR += -D DISABLE_SERIAL_TERMINAL=TRUE |
| 69 | endif |
Sean Rhodes | 61f0a08 | 2023-04-03 16:30:24 +0100 | [diff] [blame] | 70 | # MAX_VARIABLE_SIZE = 0x10000 |
| 71 | ifeq ($(CONFIG_SMMSTORE_V2),y) |
| 72 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize=0x8000 |
| 73 | endif |
Sean Rhodes | 5a26d81 | 2022-07-04 21:44:32 +0100 | [diff] [blame] | 74 | # PCIE_BASE_ADDRESS = 0 |
| 75 | ifneq ($(CONFIG_ECAM_MMCONF_LENGTH),) |
| 76 | BUILD_STR += --pcd gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress=$(CONFIG_ECAM_MMCONF_BASE_ADDRESS) |
| 77 | endif |
| 78 | # PCIE_BASE_LENGTH = 0 |
| 79 | ifneq ($(CONFIG_ECAM_MMCONF_LENGTH),) |
| 80 | BUILD_STR += --pcd gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseSize=$(CONFIG_ECAM_MMCONF_LENGTH) |
| 81 | endif |
Sean Rhodes | 3f3a3ee | 2022-02-10 09:21:50 +0000 | [diff] [blame] | 82 | # PRIORITIZE_INTERNAL = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 83 | ifeq ($(CONFIG_EDK2_PRIORITIZE_INTERNAL),y) |
Sean Rhodes | 3f3a3ee | 2022-02-10 09:21:50 +0000 | [diff] [blame] | 84 | BUILD_STR += -D PRIORITIZE_INTERNAL=TRUE |
| 85 | endif |
Sean Rhodes | 4600c25 | 2022-02-09 08:31:24 +0000 | [diff] [blame] | 86 | # PS2_KEYBOARD_ENABLE = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 87 | ifeq ($(CONFIG_EDK2_PS2_SUPPORT),y) |
Sean Rhodes | 4600c25 | 2022-02-09 08:31:24 +0000 | [diff] [blame] | 88 | BUILD_STR += -D PS2_KEYBOARD_ENABLE=TRUE |
| 89 | endif |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 90 | # PLATFORM_BOOT_TIMEOUT = 3 |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 91 | ifneq ($(CONFIG_EDK2_BOOT_TIMEOUT),) |
| 92 | BUILD_STR += -D PLATFORM_BOOT_TIMEOUT=$(CONFIG_EDK2_BOOT_TIMEOUT) |
Sean Rhodes | 4600c25 | 2022-02-09 08:31:24 +0000 | [diff] [blame] | 93 | endif |
| 94 | # SIO_BUS_ENABLE = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 95 | ifeq ($(CONFIG_EDK2_PS2_SUPPORT),y) |
Sean Rhodes | 4600c25 | 2022-02-09 08:31:24 +0000 | [diff] [blame] | 96 | BUILD_STR += -D SIO_BUS_ENABLE=TRUE |
| 97 | endif |
Sean Rhodes | f33ddb3 | 2022-02-09 08:30:07 +0000 | [diff] [blame] | 98 | # SHELL_TYPE = BUILD_SHELL |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 99 | ifneq ($(CONFIG_EDK2_HAVE_EFI_SHELL),y) |
Sean Rhodes | f33ddb3 | 2022-02-09 08:30:07 +0000 | [diff] [blame] | 100 | BUILD_STR += -D SHELL_TYPE=NONE |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 101 | endif |
| 102 | # USE_CBMEM_FOR_CONSOLE = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 103 | ifeq ($(CONFIG_EDK2_CBMEM_LOGGING),y) |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 104 | BUILD_STR += -D USE_CBMEM_FOR_CONSOLE=TRUE |
| 105 | endif |
Sean Rhodes | 4a9be9f | 2022-02-13 21:19:19 +0000 | [diff] [blame] | 106 | # SD_MMC_TIMEOUT = 1000000 |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 107 | ifneq ($(CONFIG_EDK2_SD_MMC_TIMEOUT),) |
| 108 | BUILD_STR += -D SD_MMC_TIMEOUT=$(shell echo $$(( $(CONFIG_EDK2_SD_MMC_TIMEOUT) * 1000)) ) |
Sean Rhodes | 4a9be9f | 2022-02-13 21:19:19 +0000 | [diff] [blame] | 109 | endif |
Matt DeVillier | a38e248 | 2023-04-30 15:10:57 -0500 | [diff] [blame] | 110 | # EDK2_SECURE_BOOT_SUPPORT = FALSE |
| 111 | ifeq ($(CONFIG_EDK2_SECURE_BOOT_SUPPORT), y) |
| 112 | BUILD_STR += -D SECURE_BOOT_ENABLE=TRUE |
| 113 | endif |
Lean Sheng Tan | 829b228 | 2023-05-03 15:27:21 +0200 | [diff] [blame] | 114 | # PCIEXP_SUPPORT_RESIZABLE_BARS = FALSE |
| 115 | ifeq ($(CONFIG_PCIEXP_SUPPORT_RESIZABLE_BARS), y) |
| 116 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdPcieResizableBarSupport=TRUE |
| 117 | endif |
Sean Rhodes | 9031877 | 2023-09-20 21:24:24 +0100 | [diff] [blame] | 118 | |
| 119 | # |
| 120 | # The MrChromebox repository has the following addition options: |
| 121 | # |
| 122 | ifeq ($(CONFIG_EDK2_REPO_MRCHROMEBOX),y) |
| 123 | |
| 124 | # FOLLOW_BGRT_SPEC = FALSE |
| 125 | ifeq ($(CONFIG_EDK2_FOLLOW_BGRT_SPEC),y) |
| 126 | BUILD_STR += -D FOLLOW_BGRT_SPEC=TRUE |
| 127 | endif |
Matt DeVillier | 64262a6 | 2022-08-18 18:05:54 -0500 | [diff] [blame] | 128 | # GOP_DRIVER = FALSE |
| 129 | ifeq ($(CONFIG_EDK2_GOP_DRIVER), y) |
| 130 | BUILD_STR += -D USE_PLATFORM_GOP=TRUE |
| 131 | endif |
Sean Rhodes | 9031877 | 2023-09-20 21:24:24 +0100 | [diff] [blame] | 132 | # PRIORITIZE_INTERNAL = FALSE |
| 133 | ifeq ($(CONFIG_EDK2_PRIORITIZE_INTERNAL),y) |
| 134 | BUILD_STR += -D PRIORITIZE_INTERNAL=TRUE |
| 135 | endif |
| 136 | # TPM_ENABLE = TRUE |
Matt DeVillier | fd42148 | 2023-09-20 11:27:20 -0500 | [diff] [blame^] | 137 | ifeq ($(CONFIG_EDK2_DISABLE_TPM),y) |
Sean Rhodes | 9031877 | 2023-09-20 21:24:24 +0100 | [diff] [blame] | 138 | BUILD_STR += -D TPM_ENABLE=FALSE |
| 139 | endif |
| 140 | |
| 141 | endif |
Sean Rhodes | 02f2b19 | 2022-07-08 16:29:54 +0100 | [diff] [blame] | 142 | |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 143 | # |
Angel Pons | 7127013 | 2022-07-26 11:31:39 +0200 | [diff] [blame] | 144 | # EDKII has the below PCDs that are relevant to coreboot: |
Sean Rhodes | 6790249 | 2022-07-12 08:24:18 +0100 | [diff] [blame] | 145 | # |
| 146 | # Allows EDKII to use the full framebuffer |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 147 | ifeq ($(CONFIG_EDK2_FULL_SCREEN_SETUP),y) |
Sean Rhodes | 6790249 | 2022-07-12 08:24:18 +0100 | [diff] [blame] | 148 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow=0 |
| 149 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn=0 |
| 150 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow=0 |
| 151 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn=0 |
Sean Rhodes | c14bbbc | 2022-07-26 16:50:00 +0100 | [diff] [blame] | 152 | endif |
Matt DeVillier | 6725898 | 2021-10-28 16:46:17 -0500 | [diff] [blame] | 153 | |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 154 | bootloader = $(word 8,$(subst /, ,$(BUILD_STR))) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 155 | |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 156 | ifneq ($(CONFIG_EDK2_CUSTOM_BUILD_PARAMS),) |
| 157 | BUILD_STR += $(CONFIG_EDK2_CUSTOM_BUILD_PARAMS) |
Michał Żygowski | ba08c49 | 2022-02-23 16:55:24 +0100 | [diff] [blame] | 158 | endif |
Michał Żygowski | ba08c49 | 2022-02-23 16:55:24 +0100 | [diff] [blame] | 159 | |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 160 | all: UefiPayloadPkg |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 161 | |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 162 | $(WORKSPACE): |
Sean Rhodes | bbec712 | 2022-08-02 09:32:17 +0100 | [diff] [blame] | 163 | mkdir $(WORKSPACE) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 164 | |
Michał Żygowski | 82d814a | 2022-10-26 11:32:54 +0200 | [diff] [blame] | 165 | $(EDK2_PLATFORMS_PATH): $(WORKSPACE) |
| 166 | if [ ! -d "$(EDK2_PLATFORMS_PATH)" ]; then \ |
| 167 | git clone --recurse-submodules $(CONFIG_EDK2_PLATFORMS_REPOSITORY) $(EDK2_PLATFORMS_PATH) -j5; \ |
| 168 | fi |
| 169 | cd $(EDK2_PLATFORMS_PATH); \ |
| 170 | if ! git rev-parse --verify -q $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) >/dev/null; then \ |
| 171 | echo " $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) is not a valid git reference"; \ |
| 172 | exit 1; \ |
| 173 | fi; \ |
| 174 | if git status --ignore-submodules=dirty | grep -q "nothing to commit, working tree clean"; then \ |
| 175 | echo " Checking out edk2-platforms revision $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV)"; \ |
| 176 | git checkout --detach $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) -f; \ |
| 177 | else \ |
| 178 | echo " Working directory not clean; will not overwrite"; \ |
| 179 | fi; \ |
| 180 | git submodule update --init --checkout |
| 181 | |
Sean Rhodes | 461d1c8 | 2022-08-02 09:41:32 +0100 | [diff] [blame] | 182 | $(EDK2_PATH): $(WORKSPACE) |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 183 | if [ ! -d "$(EDK2_PATH)" ]; then \ |
Sean Rhodes | f2a9a3f | 2022-08-02 09:36:40 +0100 | [diff] [blame] | 184 | git clone --recurse-submodules $(CONFIG_EDK2_REPOSITORY) $(EDK2_PATH) -j5; \ |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 185 | fi |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 186 | cd $(EDK2_PATH); \ |
Sean Rhodes | b02cc14 | 2022-08-02 07:56:54 +0100 | [diff] [blame] | 187 | git checkout MdeModulePkg/Logo/Logo.bmp > /dev/null 2>&1 || true; \ |
Sean Rhodes | ba67276 | 2022-05-18 23:00:57 +0100 | [diff] [blame] | 188 | if [ -e UefiPayloadPkg/ShimLayer/UniversalPayload.o ]; then \ |
| 189 | rm UefiPayloadPkg/ShimLayer/UniversalPayload.o; \ |
| 190 | fi; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 191 | echo " Fetching new commits from $(CONFIG_EDK2_REPOSITORY)"; \ |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 192 | git fetch origin 2>/dev/null; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 193 | if ! git rev-parse --verify -q $(CONFIG_EDK2_TAG_OR_REV) >/dev/null; then \ |
| 194 | echo " $(CONFIG_EDK2_TAG_OR_REV) is not a valid git reference"; \ |
Matt DeVillier | 38b6ccf | 2019-02-20 23:46:15 -0600 | [diff] [blame] | 195 | exit 1; \ |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 196 | fi; \ |
Matt DeVillier | 598a4b4 | 2023-09-20 10:55:10 -0500 | [diff] [blame] | 197 | if git status --ignore-submodules=dirty | grep -q -e clean -e "nothing added"; then \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 198 | echo " Checking out $(project_name) revision $(CONFIG_EDK2_TAG_OR_REV)"; \ |
| 199 | git checkout --detach $(CONFIG_EDK2_TAG_OR_REV) -f; \ |
Matt DeVillier | 598a4b4 | 2023-09-20 10:55:10 -0500 | [diff] [blame] | 200 | git submodule update --checkout --recursive; \ |
Matt DeVillier | 38b6ccf | 2019-02-20 23:46:15 -0600 | [diff] [blame] | 201 | else \ |
| 202 | echo " Working directory not clean; will not overwrite"; \ |
Matt DeVillier | ae48b42 | 2020-04-21 23:54:42 -0500 | [diff] [blame] | 203 | fi; \ |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 204 | git submodule update --init --checkout |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 205 | |
Sean Rhodes | 461d1c8 | 2022-08-02 09:41:32 +0100 | [diff] [blame] | 206 | logo: $(EDK2_PATH) |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 207 | case "$(CONFIG_EDK2_BOOTSPLASH_FILE)" in \ |
Matt DeVillier | 845222f | 2022-07-25 23:18:47 -0500 | [diff] [blame] | 208 | "") ;; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 209 | /*) convert -background None $(CONFIG_EDK2_BOOTSPLASH_FILE) \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 210 | BMP3:$(EDK2_PATH)/MdeModulePkg/Logo/Logo.bmp;; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 211 | *) convert -background None $(top)/$(CONFIG_EDK2_BOOTSPLASH_FILE) \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 212 | BMP3:$(EDK2_PATH)/MdeModulePkg/Logo/Logo.bmp;; \ |
Sean Rhodes | 108e537 | 2022-07-15 13:58:52 +0100 | [diff] [blame] | 213 | esac \ |
| 214 | |
Matt DeVillier | 64262a6 | 2022-08-18 18:05:54 -0500 | [diff] [blame] | 215 | gop_driver: |
| 216 | if [ -n "$(CONFIG_EDK2_GOP_DRIVER)" ]; then \ |
| 217 | echo "Using GOP driver $(CONFIG_EDK2_GOP_FILE)"; \ |
| 218 | cp $(top)/$(CONFIG_EDK2_GOP_FILE) $(EDK2_PATH)/UefiPayloadPkg/IntelGopDriver.efi; \ |
| 219 | cp $(top)/$(CONFIG_INTEL_GMA_VBT_FILE) $(EDK2_PATH)/UefiPayloadPkg/vbt.bin; \ |
| 220 | fi; \ |
| 221 | |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 222 | checktools: |
Sean Rhodes | 108e537 | 2022-07-15 13:58:52 +0100 | [diff] [blame] | 223 | echo -n "EDK2: Checking uuid-dev:" |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 224 | echo "#include <uuid/uuid.h>" > libtest.c |
| 225 | echo "int main(int argc, char **argv) { (void) argc; (void) argv; return 0; }" >> libtest.c |
Sean Rhodes | 108e537 | 2022-07-15 13:58:52 +0100 | [diff] [blame] | 226 | $(HOSTCC) $(HOSTCCFLAGS) libtest.c -o libtest >/dev/null 2>&1 && echo " Found!" || \ |
| 227 | ( echo " Not found!"; \ |
| 228 | echo "ERROR: please_install uuid-dev (libuuid-devel)"; exit 1 ) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 229 | rm -rf libtest.c libtest |
Sean Rhodes | 108e537 | 2022-07-15 13:58:52 +0100 | [diff] [blame] | 230 | echo -n "EDK2: Checking nasm:" |
| 231 | type nasm > /dev/null 2>&1 && echo " Found!" || \ |
| 232 | ( echo " Not found!"; echo "ERROR: Please install nasm."; exit 1 ) |
| 233 | echo -n "EDK2: Checking imagemagick:" |
| 234 | -convert -size 1x1 xc: test.png &> /dev/null; |
| 235 | if [ -f test.png ]; then \ |
| 236 | rm test.png && echo " Found!"; \ |
| 237 | else \ |
| 238 | echo " Not found!"; \ |
| 239 | echo "ERROR: Please install imagemagick"; \ |
| 240 | exit 1; \ |
| 241 | fi |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 242 | |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 243 | print: |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 244 | echo " ##### $(project_name) Build Summary #####" |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 245 | echo " Repository: $(CONFIG_EDK2_REPOSITORY)" |
| 246 | echo " Branch: $(CONFIG_EDK2_TAG_OR_REV)" |
Michał Żygowski | 82d814a | 2022-10-26 11:32:54 +0200 | [diff] [blame] | 247 | echo " Packages path: $(PACKAGES_PATH)" |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 248 | echo " $(BUILD_STR)" | \ |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 249 | sed -e 's/--/-/g' -e 's/-/\n /g' | sort | sed \ |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 250 | -e 's/a /Architecture: /g' \ |
| 251 | -e 's/b /Release: /g' \ |
| 252 | -e 's/D /Option: /g' \ |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 253 | -e 's/pcd /Pcd: /g' \ |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 254 | -e 's/p /Payload: /g' \ |
| 255 | -e 's/q /Build: Quiet/' \ |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 256 | -e 's/s /Build: Silent/' \ |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 257 | -e 's/t /Toolchain: /' |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 258 | |
Matt DeVillier | 64262a6 | 2022-08-18 18:05:54 -0500 | [diff] [blame] | 259 | prep: $(EDK2_PATH) $(EDK2_PLATFORMS_PATH) clean checktools logo gop_driver |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 260 | cd $(WORKSPACE); \ |
Sean Rhodes | 724c0cd | 2022-08-02 09:07:15 +0100 | [diff] [blame] | 261 | source $(EDK2_PATH)/edksetup.sh; \ |
| 262 | unset CC; $(MAKE) -C $(EDK2_PATH)/BaseTools 2>&1; \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 263 | grep -q "COREBOOT" $(EDK2_PATH)/Conf/tools_def.txt; \ |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 264 | if [ $$? -ne 0 ]; then \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 265 | cat ../tools_def.txt >> $(EDK2_PATH)/Conf/tools_def.txt; \ |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 266 | fi; \ |
Sean Rhodes | 724c0cd | 2022-08-02 09:07:15 +0100 | [diff] [blame] | 267 | |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 268 | $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/FV/UEFIPAYLOAD.fd: \ |
| 269 | prep print |
Sean Rhodes | 724c0cd | 2022-08-02 09:07:15 +0100 | [diff] [blame] | 270 | cd $(WORKSPACE); \ |
| 271 | source $(EDK2_PATH)/edksetup.sh; \ |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 272 | echo -n "EDK2: Building... "; \ |
Sean Rhodes | 234c42f | 2022-08-02 10:00:56 +0100 | [diff] [blame] | 273 | build -a IA32 -a X64 -b $(RELEASE_STR) $(BUILD_STR) \ |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 274 | -y $(WORKSPACE)/Build/UefiPayloadPkgX64/UEFIPAYLOAD.txt; \ |
| 275 | if [ ! -f $@ ]; then \ |
| 276 | echo "Failed!"; \ |
| 277 | exit 1; \ |
| 278 | fi |
| 279 | echo "Success!"; \ |
| 280 | |
Sean Rhodes | 716bd48 | 2022-10-06 21:33:46 +0100 | [diff] [blame] | 281 | $(WORKSPACE)/Build/UefiPayloadPkgX64/UniversalPayload.elf: \ |
| 282 | prep print |
| 283 | cd $(WORKSPACE); \ |
| 284 | source $(EDK2_PATH)/edksetup.sh; \ |
| 285 | echo -n "EDK2: Building... "; \ |
Sean Rhodes | 97c57fd | 2023-03-10 21:56:08 +0000 | [diff] [blame] | 286 | $(EDK2_PATH)/UefiPayloadPkg/UniversalPayloadBuild.sh -a IA32 -b $(RELEASE_STR) $(BUILD_STR) |
Sean Rhodes | 716bd48 | 2022-10-06 21:33:46 +0100 | [diff] [blame] | 287 | if [ ! -f $@ ]; then \ |
| 288 | echo "Failed!"; \ |
| 289 | exit 1; \ |
| 290 | fi |
| 291 | echo "Success!"; \ |
| 292 | |
Sean Rhodes | ba67276 | 2022-05-18 23:00:57 +0100 | [diff] [blame] | 293 | $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/IA32/UefiPayloadPkg/ShimLayer/ShimLayer/DEBUG/ShimLayer.dll: \ |
| 294 | $(WORKSPACE)/Build/UefiPayloadPkgX64/UniversalPayload.elf prep |
| 295 | cd $(WORKSPACE)/Build/UefiPayloadPkgX64 && \ |
| 296 | $(OBJCOPY) -I binary UniversalPayload.elf -O elf32-i386 -B i386 \ |
| 297 | $(EDK2_PATH)/UefiPayloadPkg/ShimLayer/UniversalPayload.o; \ |
| 298 | cd $(WORKSPACE) && \ |
| 299 | source $(EDK2_PATH)/edksetup.sh; \ |
| 300 | build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b $(RELEASE_STR) -a IA32 -a X64 \ |
| 301 | -m UefiPayloadPkg/ShimLayer/ShimLayer.inf \ |
| 302 | -t COREBOOT -D BOOTLOADER=COREBOOT -D SHIMLAYER=TRUE \ |
| 303 | -y $(WORKSPACE)/Build/UefiPayloadPkgX64/ShimLayer.txt |
| 304 | |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 305 | UefiPayloadPkg: $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/FV/UEFIPAYLOAD.fd |
| 306 | mv $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/FV/UEFIPAYLOAD.fd \ |
| 307 | ../../../build/UEFIPAYLOAD.fd |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 308 | |
Sean Rhodes | 27c8bf0 | 2022-07-17 19:01:29 +0100 | [diff] [blame] | 309 | UniversalPayload: $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/IA32/UefiPayloadPkg/ShimLayer/ShimLayer/DEBUG/ShimLayer.dll |
| 310 | mv $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/IA32/UefiPayloadPkg/ShimLayer/ShimLayer/DEBUG/ShimLayer.dll \ |
| 311 | ../../../build/ShimmedUniversalPayload.elf |
| 312 | |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 313 | clean: |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 314 | test -d $(WORKSPACE) && (cd $(WORKSPACE); rm -rf Build; rm -f Conf/tools_def.txt) || exit 0 |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 315 | |
| 316 | distclean: |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 317 | rm -rf $(WORKSPACE) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 318 | |
Sean Rhodes | 27c8bf0 | 2022-07-17 19:01:29 +0100 | [diff] [blame] | 319 | .PHONY: $(EDK2_PATH) checktools logo UefiPayloadPkg UniversalPayload clean distclean |