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 | # |
| 41 | # EDK II has the following build options relevant to coreboot: |
| 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 | 14d67b3 | 2022-02-09 08:27:29 +0000 | [diff] [blame] | 70 | # FOLLOW_BGRT_SPEC = FALSE |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 71 | ifeq ($(CONFIG_EDK2_FOLLOW_BGRT_SPEC),y) |
Sean Rhodes | 14d67b3 | 2022-02-09 08:27:29 +0000 | [diff] [blame] | 72 | BUILD_STR += -D FOLLOW_BGRT_SPEC=TRUE |
| 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 |
Sean Rhodes | 02f2b19 | 2022-07-08 16:29:54 +0100 | [diff] [blame] | 114 | |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 115 | # |
Angel Pons | 7127013 | 2022-07-26 11:31:39 +0200 | [diff] [blame] | 116 | # EDKII has the below PCDs that are relevant to coreboot: |
Sean Rhodes | 6790249 | 2022-07-12 08:24:18 +0100 | [diff] [blame] | 117 | # |
| 118 | # Allows EDKII to use the full framebuffer |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 119 | ifeq ($(CONFIG_EDK2_FULL_SCREEN_SETUP),y) |
Sean Rhodes | 6790249 | 2022-07-12 08:24:18 +0100 | [diff] [blame] | 120 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow=0 |
| 121 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn=0 |
| 122 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutRow=0 |
| 123 | BUILD_STR += --pcd gEfiMdeModulePkgTokenSpaceGuid.PcdSetupConOutColumn=0 |
Sean Rhodes | c14bbbc | 2022-07-26 16:50:00 +0100 | [diff] [blame] | 124 | endif |
Matt DeVillier | 6725898 | 2021-10-28 16:46:17 -0500 | [diff] [blame] | 125 | |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 126 | bootloader = $(word 8,$(subst /, ,$(BUILD_STR))) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 127 | |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 128 | ifneq ($(CONFIG_EDK2_CUSTOM_BUILD_PARAMS),) |
| 129 | BUILD_STR += $(CONFIG_EDK2_CUSTOM_BUILD_PARAMS) |
Michał Żygowski | ba08c49 | 2022-02-23 16:55:24 +0100 | [diff] [blame] | 130 | endif |
Michał Żygowski | ba08c49 | 2022-02-23 16:55:24 +0100 | [diff] [blame] | 131 | |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 132 | all: UefiPayloadPkg |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 133 | |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 134 | $(WORKSPACE): |
Sean Rhodes | bbec712 | 2022-08-02 09:32:17 +0100 | [diff] [blame] | 135 | mkdir $(WORKSPACE) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 136 | |
Michał Żygowski | 82d814a | 2022-10-26 11:32:54 +0200 | [diff] [blame] | 137 | $(EDK2_PLATFORMS_PATH): $(WORKSPACE) |
| 138 | if [ ! -d "$(EDK2_PLATFORMS_PATH)" ]; then \ |
| 139 | git clone --recurse-submodules $(CONFIG_EDK2_PLATFORMS_REPOSITORY) $(EDK2_PLATFORMS_PATH) -j5; \ |
| 140 | fi |
| 141 | cd $(EDK2_PLATFORMS_PATH); \ |
| 142 | if ! git rev-parse --verify -q $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) >/dev/null; then \ |
| 143 | echo " $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) is not a valid git reference"; \ |
| 144 | exit 1; \ |
| 145 | fi; \ |
| 146 | if git status --ignore-submodules=dirty | grep -q "nothing to commit, working tree clean"; then \ |
| 147 | echo " Checking out edk2-platforms revision $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV)"; \ |
| 148 | git checkout --detach $(CONFIG_EDK2_PLATFORMS_TAG_OR_REV) -f; \ |
| 149 | else \ |
| 150 | echo " Working directory not clean; will not overwrite"; \ |
| 151 | fi; \ |
| 152 | git submodule update --init --checkout |
| 153 | |
Sean Rhodes | 461d1c8 | 2022-08-02 09:41:32 +0100 | [diff] [blame] | 154 | $(EDK2_PATH): $(WORKSPACE) |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 155 | if [ ! -d "$(EDK2_PATH)" ]; then \ |
Sean Rhodes | f2a9a3f | 2022-08-02 09:36:40 +0100 | [diff] [blame] | 156 | git clone --recurse-submodules $(CONFIG_EDK2_REPOSITORY) $(EDK2_PATH) -j5; \ |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 157 | fi |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 158 | cd $(EDK2_PATH); \ |
Sean Rhodes | b02cc14 | 2022-08-02 07:56:54 +0100 | [diff] [blame] | 159 | git checkout MdeModulePkg/Logo/Logo.bmp > /dev/null 2>&1 || true; \ |
Sean Rhodes | ba67276 | 2022-05-18 23:00:57 +0100 | [diff] [blame] | 160 | if [ -e UefiPayloadPkg/ShimLayer/UniversalPayload.o ]; then \ |
| 161 | rm UefiPayloadPkg/ShimLayer/UniversalPayload.o; \ |
| 162 | fi; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 163 | echo " Fetching new commits from $(CONFIG_EDK2_REPOSITORY)"; \ |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 164 | git fetch origin 2>/dev/null; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 165 | if ! git rev-parse --verify -q $(CONFIG_EDK2_TAG_OR_REV) >/dev/null; then \ |
| 166 | echo " $(CONFIG_EDK2_TAG_OR_REV) is not a valid git reference"; \ |
Matt DeVillier | 38b6ccf | 2019-02-20 23:46:15 -0600 | [diff] [blame] | 167 | exit 1; \ |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 168 | fi; \ |
Nicholas Chin | c217f31 | 2022-05-23 13:12:28 -0600 | [diff] [blame] | 169 | if git status --ignore-submodules=dirty | grep -q clean; then \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 170 | echo " Checking out $(project_name) revision $(CONFIG_EDK2_TAG_OR_REV)"; \ |
| 171 | git checkout --detach $(CONFIG_EDK2_TAG_OR_REV) -f; \ |
Matt DeVillier | 38b6ccf | 2019-02-20 23:46:15 -0600 | [diff] [blame] | 172 | else \ |
| 173 | echo " Working directory not clean; will not overwrite"; \ |
Matt DeVillier | ae48b42 | 2020-04-21 23:54:42 -0500 | [diff] [blame] | 174 | fi; \ |
Sean Rhodes | 0884f210 | 2022-02-04 07:41:16 +0000 | [diff] [blame] | 175 | git submodule update --init --checkout |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 176 | |
Sean Rhodes | 461d1c8 | 2022-08-02 09:41:32 +0100 | [diff] [blame] | 177 | logo: $(EDK2_PATH) |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 178 | case "$(CONFIG_EDK2_BOOTSPLASH_FILE)" in \ |
Matt DeVillier | 845222f | 2022-07-25 23:18:47 -0500 | [diff] [blame] | 179 | "") ;; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 180 | /*) convert -background None $(CONFIG_EDK2_BOOTSPLASH_FILE) \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 181 | BMP3:$(EDK2_PATH)/MdeModulePkg/Logo/Logo.bmp;; \ |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 182 | *) convert -background None $(top)/$(CONFIG_EDK2_BOOTSPLASH_FILE) \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 183 | BMP3:$(EDK2_PATH)/MdeModulePkg/Logo/Logo.bmp;; \ |
Sean Rhodes | 108e537 | 2022-07-15 13:58:52 +0100 | [diff] [blame] | 184 | esac \ |
| 185 | |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 186 | checktools: |
Sean Rhodes | 108e537 | 2022-07-15 13:58:52 +0100 | [diff] [blame] | 187 | echo -n "EDK2: Checking uuid-dev:" |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 188 | echo "#include <uuid/uuid.h>" > libtest.c |
| 189 | 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] | 190 | $(HOSTCC) $(HOSTCCFLAGS) libtest.c -o libtest >/dev/null 2>&1 && echo " Found!" || \ |
| 191 | ( echo " Not found!"; \ |
| 192 | echo "ERROR: please_install uuid-dev (libuuid-devel)"; exit 1 ) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 193 | rm -rf libtest.c libtest |
Sean Rhodes | 108e537 | 2022-07-15 13:58:52 +0100 | [diff] [blame] | 194 | echo -n "EDK2: Checking nasm:" |
| 195 | type nasm > /dev/null 2>&1 && echo " Found!" || \ |
| 196 | ( echo " Not found!"; echo "ERROR: Please install nasm."; exit 1 ) |
| 197 | echo -n "EDK2: Checking imagemagick:" |
| 198 | -convert -size 1x1 xc: test.png &> /dev/null; |
| 199 | if [ -f test.png ]; then \ |
| 200 | rm test.png && echo " Found!"; \ |
| 201 | else \ |
| 202 | echo " Not found!"; \ |
| 203 | echo "ERROR: Please install imagemagick"; \ |
| 204 | exit 1; \ |
| 205 | fi |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 206 | |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 207 | print: |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 208 | echo " ##### $(project_name) Build Summary #####" |
Sean Rhodes | 38c99b5 | 2022-07-13 10:11:44 +0100 | [diff] [blame] | 209 | echo " Repository: $(CONFIG_EDK2_REPOSITORY)" |
| 210 | echo " Branch: $(CONFIG_EDK2_TAG_OR_REV)" |
Michał Żygowski | 82d814a | 2022-10-26 11:32:54 +0200 | [diff] [blame] | 211 | echo " Packages path: $(PACKAGES_PATH)" |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 212 | echo " $(BUILD_STR)" | \ |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 213 | sed -e 's/--/-/g' -e 's/-/\n /g' | sort | sed \ |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 214 | -e 's/a /Architecture: /g' \ |
| 215 | -e 's/b /Release: /g' \ |
| 216 | -e 's/D /Option: /g' \ |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 217 | -e 's/pcd /Pcd: /g' \ |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 218 | -e 's/p /Payload: /g' \ |
| 219 | -e 's/q /Build: Quiet/' \ |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 220 | -e 's/s /Build: Silent/' \ |
Sean Rhodes | 7ea7986 | 2022-06-16 21:32:33 +0100 | [diff] [blame] | 221 | -e 's/t /Toolchain: /' |
Sean Rhodes | 175445b | 2022-08-02 07:53:03 +0100 | [diff] [blame] | 222 | |
Michał Żygowski | 82d814a | 2022-10-26 11:32:54 +0200 | [diff] [blame] | 223 | prep: $(EDK2_PATH) $(EDK2_PLATFORMS_PATH) clean checktools logo |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 224 | cd $(WORKSPACE); \ |
Sean Rhodes | 724c0cd | 2022-08-02 09:07:15 +0100 | [diff] [blame] | 225 | source $(EDK2_PATH)/edksetup.sh; \ |
| 226 | unset CC; $(MAKE) -C $(EDK2_PATH)/BaseTools 2>&1; \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 227 | grep -q "COREBOOT" $(EDK2_PATH)/Conf/tools_def.txt; \ |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 228 | if [ $$? -ne 0 ]; then \ |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 229 | cat ../tools_def.txt >> $(EDK2_PATH)/Conf/tools_def.txt; \ |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 230 | fi; \ |
Sean Rhodes | 724c0cd | 2022-08-02 09:07:15 +0100 | [diff] [blame] | 231 | |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 232 | $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/FV/UEFIPAYLOAD.fd: \ |
| 233 | prep print |
Sean Rhodes | 724c0cd | 2022-08-02 09:07:15 +0100 | [diff] [blame] | 234 | cd $(WORKSPACE); \ |
| 235 | source $(EDK2_PATH)/edksetup.sh; \ |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 236 | echo -n "EDK2: Building... "; \ |
Sean Rhodes | 234c42f | 2022-08-02 10:00:56 +0100 | [diff] [blame] | 237 | build -a IA32 -a X64 -b $(RELEASE_STR) $(BUILD_STR) \ |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 238 | -y $(WORKSPACE)/Build/UefiPayloadPkgX64/UEFIPAYLOAD.txt; \ |
| 239 | if [ ! -f $@ ]; then \ |
| 240 | echo "Failed!"; \ |
| 241 | exit 1; \ |
| 242 | fi |
| 243 | echo "Success!"; \ |
| 244 | |
Sean Rhodes | 716bd48 | 2022-10-06 21:33:46 +0100 | [diff] [blame] | 245 | $(WORKSPACE)/Build/UefiPayloadPkgX64/UniversalPayload.elf: \ |
| 246 | prep print |
| 247 | cd $(WORKSPACE); \ |
| 248 | source $(EDK2_PATH)/edksetup.sh; \ |
| 249 | echo -n "EDK2: Building... "; \ |
| 250 | $(EDK2_PATH)/UefiPayloadPkg/UniversalPayloadBuild.sh -a IA32 -a X64 -b $(RELEASE_STR) $(BUILD_STR) |
| 251 | if [ ! -f $@ ]; then \ |
| 252 | echo "Failed!"; \ |
| 253 | exit 1; \ |
| 254 | fi |
| 255 | echo "Success!"; \ |
| 256 | |
Sean Rhodes | ba67276 | 2022-05-18 23:00:57 +0100 | [diff] [blame] | 257 | $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/IA32/UefiPayloadPkg/ShimLayer/ShimLayer/DEBUG/ShimLayer.dll: \ |
| 258 | $(WORKSPACE)/Build/UefiPayloadPkgX64/UniversalPayload.elf prep |
| 259 | cd $(WORKSPACE)/Build/UefiPayloadPkgX64 && \ |
| 260 | $(OBJCOPY) -I binary UniversalPayload.elf -O elf32-i386 -B i386 \ |
| 261 | $(EDK2_PATH)/UefiPayloadPkg/ShimLayer/UniversalPayload.o; \ |
| 262 | cd $(WORKSPACE) && \ |
| 263 | source $(EDK2_PATH)/edksetup.sh; \ |
| 264 | build -p UefiPayloadPkg/UefiPayloadPkg.dsc -b $(RELEASE_STR) -a IA32 -a X64 \ |
| 265 | -m UefiPayloadPkg/ShimLayer/ShimLayer.inf \ |
| 266 | -t COREBOOT -D BOOTLOADER=COREBOOT -D SHIMLAYER=TRUE \ |
| 267 | -y $(WORKSPACE)/Build/UefiPayloadPkgX64/ShimLayer.txt |
| 268 | |
Sean Rhodes | 306550d | 2022-08-02 09:12:13 +0100 | [diff] [blame] | 269 | UefiPayloadPkg: $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/FV/UEFIPAYLOAD.fd |
| 270 | mv $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/FV/UEFIPAYLOAD.fd \ |
| 271 | ../../../build/UEFIPAYLOAD.fd |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 272 | |
Sean Rhodes | 27c8bf0 | 2022-07-17 19:01:29 +0100 | [diff] [blame] | 273 | UniversalPayload: $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/IA32/UefiPayloadPkg/ShimLayer/ShimLayer/DEBUG/ShimLayer.dll |
| 274 | mv $(WORKSPACE)/Build/UefiPayloadPkgX64/$(RELEASE_STR)_COREBOOT/IA32/UefiPayloadPkg/ShimLayer/ShimLayer/DEBUG/ShimLayer.dll \ |
| 275 | ../../../build/ShimmedUniversalPayload.elf |
| 276 | |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 277 | clean: |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 278 | 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] | 279 | |
| 280 | distclean: |
Sean Rhodes | 403d220 | 2022-08-02 08:54:12 +0100 | [diff] [blame] | 281 | rm -rf $(WORKSPACE) |
Martin Roth | 4769cc3 | 2016-06-02 16:42:29 -0600 | [diff] [blame] | 282 | |
Sean Rhodes | 27c8bf0 | 2022-07-17 19:01:29 +0100 | [diff] [blame] | 283 | .PHONY: $(EDK2_PATH) checktools logo UefiPayloadPkg UniversalPayload clean distclean |