blob: 8e079369d1ed663921d477b39b2e02e70c5bb53f [file] [log] [blame]
Martin Roth888a98b2016-03-13 13:00:43 -06001##
2## This file is part of the coreboot project.
3##
4## Copyright (C) 2016 Google Inc.
5##
6## This program is free software; you can redistribute it and/or modify
7## it under the terms of the GNU General Public License as published by
8## the Free Software Foundation; version 2 of the License.
9##
10## This program is distributed in the hope that it will be useful,
11## but WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13## GNU General Public License for more details.
14##
15
Martin Roth994d8b42016-08-18 18:56:45 -060016# 2016.7 - Last commit of July 2016
Martin Roth888a98b2016-03-13 13:00:43 -060017# When updating, change the name both here and in payloads/external/iPXE/Kconfig
Martin Roth994d8b42016-08-18 18:56:45 -060018STABLE_COMMIT_ID=2afd66eb55996500499eb3bcc39c66ff042679c8
Martin Roth888a98b2016-03-13 13:00:43 -060019
20TAG-$(CONFIG_IPXE_MASTER)=origin/master
21TAG-$(CONFIG_IPXE_STABLE)=$(STABLE_COMMIT_ID)
22
23project_name=iPXE
24project_dir=ipxe
25project_git_repo=git://git.ipxe.org/ipxe.git
26
27all: build
28
29$(project_dir):
30 echo " Cloning $(project_name) from Git"
31 git clone $(project_git_repo) $(project_dir)
32
33fetch: $(project_dir)
34 cd $(project_dir); \
35 git show $(TAG-y) >/dev/null 2>&1 ; \
36 if [ $$? -ne 0 ] || [ "$(TAG-y)" = "origin/master" ]; then \
37 echo " Fetching new commits from the $(project_name) repo"; \
38 git fetch; \
39 fi
40
41checkout: fetch
42 echo " Checking out $(project_name) revision $(TAG-y)"
43 cd $(project_dir); \
44 git checkout master; \
45 git branch -D coreboot 2>/dev/null; \
46 git checkout -b coreboot $(TAG-y)
47
48config: checkout
49ifeq ($(CONSOLE_SERIAL),yy)
50 cp "$(project_dir)/src/config/console.h" "$(project_dir)/src/config/console.h.cb"
51 cp "$(project_dir)/src/config/serial.h" "$(project_dir)/src/config/serial.h.cb"
52 sed 's|//#define\s*CONSOLE_SERIAL.*|#define CONSOLE_SERIAL|' "$(project_dir)/src/config/console.h" > "$(project_dir)/src/config/console.h.tmp"
53 mv "$(project_dir)/src/config/console.h.tmp" "$(project_dir)/src/config/console.h"
54 sed 's|#define\s*COMCONSOLE.*|#define COMCONSOLE $(IPXE_UART)|' "$(project_dir)/src/config/serial.h" > "$(project_dir)/src/config/serial.h.tmp"
55 sed 's|#define\s*COMSPEED.*|#define COMSPEED $(CONFIG_TTYS0_BAUD)|' "$(project_dir)/src/config/serial.h.tmp" > "$(project_dir)/src/config/serial.h"
56endif
57
58build: config
59 echo " MAKE $(project_name) $(TAG-y)"
60 $(MAKE) -C $(project_dir)/src bin/$(PXE_ROM_PCI_ID).rom
61 cp $(project_dir)/src/bin/$(PXE_ROM_PCI_ID).rom $(project_dir)/ipxe.rom
62ifeq ($(CONSOLE_SERIAL),yy)
63 cp "$(project_dir)/src/config/console.h.cb" "$(project_dir)/src/config/console.h"
64 cp "$(project_dir)/src/config/serial.h.cb" "$(project_dir)/src/config/serial.h"
65endif
66
67clean:
68 test -d $(project_dir) && $(MAKE) -C $(project_dir)/src veryclean || exit 0
69 rm -f $(project_dir)/ipxe.rom
70
71distclean:
72 rm -rf $(project_dir)
73
74.PHONY: all fetch config build clean distclean