Patrick Georgi | 8480c0b | 2020-05-08 22:50:46 +0200 | [diff] [blame] | 1 | ## SPDX-License-Identifier: GPL-2.0-only |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 2 | |
Michał Żygowski | 8a47a14 | 2022-02-23 11:15:28 +0100 | [diff] [blame] | 3 | # 2022.1 - Last commit of January 2022 |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 4 | # When updating, change the name both here and in payloads/external/iPXE/Kconfig |
Michał Żygowski | 8a47a14 | 2022-02-23 11:15:28 +0100 | [diff] [blame] | 5 | STABLE_COMMIT_ID=6ba671acd922ee046b257c5119b8a0f64d275473 |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 6 | |
| 7 | TAG-$(CONFIG_IPXE_MASTER)=origin/master |
| 8 | TAG-$(CONFIG_IPXE_STABLE)=$(STABLE_COMMIT_ID) |
| 9 | |
| 10 | project_name=iPXE |
| 11 | project_dir=ipxe |
Jonathan Neuschäfer | b02e341 | 2016-12-27 16:31:30 +0100 | [diff] [blame] | 12 | project_git_repo=https://git.ipxe.org/ipxe.git |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 13 | |
| 14 | all: build |
| 15 | |
| 16 | $(project_dir): |
| 17 | echo " Cloning $(project_name) from Git" |
| 18 | git clone $(project_git_repo) $(project_dir) |
| 19 | |
| 20 | fetch: $(project_dir) |
| 21 | cd $(project_dir); \ |
| 22 | git show $(TAG-y) >/dev/null 2>&1 ; \ |
| 23 | if [ $$? -ne 0 ] || [ "$(TAG-y)" = "origin/master" ]; then \ |
| 24 | echo " Fetching new commits from the $(project_name) repo"; \ |
| 25 | git fetch; \ |
| 26 | fi |
| 27 | |
| 28 | checkout: fetch |
| 29 | echo " Checking out $(project_name) revision $(TAG-y)" |
| 30 | cd $(project_dir); \ |
| 31 | git checkout master; \ |
| 32 | git branch -D coreboot 2>/dev/null; \ |
| 33 | git checkout -b coreboot $(TAG-y) |
| 34 | |
| 35 | config: checkout |
| 36 | ifeq ($(CONSOLE_SERIAL),yy) |
| 37 | cp "$(project_dir)/src/config/console.h" "$(project_dir)/src/config/console.h.cb" |
| 38 | cp "$(project_dir)/src/config/serial.h" "$(project_dir)/src/config/serial.h.cb" |
Felix Singer | 0fcdfcd | 2023-11-04 01:39:44 +0000 | [diff] [blame] | 39 | sed -i'' 's|//#define\s*CONSOLE_SERIAL.*|#define CONSOLE_SERIAL|' "$(project_dir)/src/config/console.h" |
| 40 | sed -i'' 's|#define\s*COMCONSOLE.*|#define COMCONSOLE $(IPXE_UART)|' "$(project_dir)/src/config/serial.h" |
| 41 | sed -i'' 's|#define\s*COMSPEED.*|#define COMSPEED $(CONFIG_TTYS0_BAUD)|' "$(project_dir)/src/config/serial.h" |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 42 | endif |
Felix Singer | 238ff1e | 2023-11-05 02:09:34 +0000 | [diff] [blame] | 43 | ifneq ($(filter y,$(CONFIG_HAS_SCRIPT) $(CONFIG_IPXE_NO_PROMPT)),) |
Patrick Rudolph | 23cb12b | 2017-07-25 19:36:25 +0200 | [diff] [blame] | 44 | cp "$(project_dir)/src/config/general.h" "$(project_dir)/src/config/general.h.cb" |
| 45 | endif |
| 46 | ifeq ($(CONFIG_HAS_SCRIPT),y) |
Felix Singer | 0fcdfcd | 2023-11-04 01:39:44 +0000 | [diff] [blame] | 47 | sed -i'' 's|//#define\s*IMAGE_SCRIPT.*|#define IMAGE_SCRIPT|' "$(project_dir)/src/config/general.h" |
Patrick Rudolph | 23cb12b | 2017-07-25 19:36:25 +0200 | [diff] [blame] | 48 | endif |
Felix Singer | 238ff1e | 2023-11-05 02:09:34 +0000 | [diff] [blame] | 49 | ifeq ($(CONFIG_IPXE_NO_PROMPT),y) |
Felix Singer | 0fcdfcd | 2023-11-04 01:39:44 +0000 | [diff] [blame] | 50 | sed -i'' 's|#define\s*BANNER_TIMEOUT.*|#define BANNER_TIMEOUT 0|' "$(project_dir)/src/config/general.h" |
Patrick Rudolph | 23cb12b | 2017-07-25 19:36:25 +0200 | [diff] [blame] | 51 | endif |
Felix Singer | 238ff1e | 2023-11-05 02:09:34 +0000 | [diff] [blame] | 52 | ifeq ($(CONFIG_IPXE_HAS_HTTPS),y) |
Felix Singer | 0fcdfcd | 2023-11-04 01:39:44 +0000 | [diff] [blame] | 53 | sed -i'' 's|.*DOWNLOAD_PROTO_HTTPS|#define DOWNLOAD_PROTO_HTTPS|g' "$(project_dir)/src/config/general.h" |
Felix Singer | c7f4736 | 2019-01-25 03:44:20 +0100 | [diff] [blame] | 54 | endif |
Maciej Pijanowski | 0306cc2 | 2023-12-21 21:38:03 +0100 | [diff] [blame^] | 55 | ifeq ($(CONFIG_PXE_TRUST_CMD),y) |
| 56 | sed -i'' 's|.*IMAGE_TRUST_CMD|#define IMAGE_TRUST_CMD|g' "$(project_dir)/src/config/general.h" |
| 57 | endif |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 58 | |
Patrick Rudolph | 23cb12b | 2017-07-25 19:36:25 +0200 | [diff] [blame] | 59 | build: config $(CONFIG_SCRIPT) |
| 60 | ifeq ($(CONFIG_HAS_SCRIPT),y) |
| 61 | echo " MAKE $(project_name) $(TAG-y) EMBED=$(CONFIG_SCRIPT)" |
| 62 | $(MAKE) -C $(project_dir)/src bin/$(PXE_ROM_PCI_ID).rom EMBED=$(CONFIG_SCRIPT) |
| 63 | else |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 64 | echo " MAKE $(project_name) $(TAG-y)" |
| 65 | $(MAKE) -C $(project_dir)/src bin/$(PXE_ROM_PCI_ID).rom |
Patrick Rudolph | 23cb12b | 2017-07-25 19:36:25 +0200 | [diff] [blame] | 66 | endif |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 67 | cp $(project_dir)/src/bin/$(PXE_ROM_PCI_ID).rom $(project_dir)/ipxe.rom |
| 68 | ifeq ($(CONSOLE_SERIAL),yy) |
| 69 | cp "$(project_dir)/src/config/console.h.cb" "$(project_dir)/src/config/console.h" |
| 70 | cp "$(project_dir)/src/config/serial.h.cb" "$(project_dir)/src/config/serial.h" |
| 71 | endif |
Felix Singer | 238ff1e | 2023-11-05 02:09:34 +0000 | [diff] [blame] | 72 | ifneq ($(filter y,$(CONFIG_HAS_SCRIPT) $(CONFIG_IPXE_NO_PROMPT)),) |
Patrick Rudolph | 23cb12b | 2017-07-25 19:36:25 +0200 | [diff] [blame] | 73 | cp "$(project_dir)/src/config/general.h.cb" "$(project_dir)/src/config/general.h" |
| 74 | endif |
Martin Roth | 888a98b | 2016-03-13 13:00:43 -0600 | [diff] [blame] | 75 | |
| 76 | clean: |
| 77 | test -d $(project_dir) && $(MAKE) -C $(project_dir)/src veryclean || exit 0 |
| 78 | rm -f $(project_dir)/ipxe.rom |
| 79 | |
| 80 | distclean: |
| 81 | rm -rf $(project_dir) |
| 82 | |
| 83 | .PHONY: all fetch config build clean distclean |