payloads: add iPXE 'payload' build

We already have the ability to add a pxe rom to cbfs, but it needs to be
configured and built separately.

This moves the existing Kconfig options for PXE from device/Kconfig and
the top level Makefile.inc to payloads, and adds the option to download
and build iPXE as part of the coreboot build process.

This configures the serial output of iPXE to match coreboot's serial
port configuration by editing the .h files. iPXE doesn't give any
real build-time method of setting these configuration options.

Change-Id: I3d77b2c6845b7f5f644440f6910c3b4533a0d415
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://review.coreboot.org/14085
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
This commit is contained in:
Martin Roth 2016-03-13 13:00:43 -06:00
parent 84129b8c68
commit 888a98b872
7 changed files with 179 additions and 35 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ payloads/external/GRUB2/grub2/
payloads/external/SeaBIOS/seabios/
payloads/external/U-Boot/u-boot/
payloads/external/Memtest86Plus/memtest86plus/
payloads/external/iPXE/ipxe/
util/crossgcc/acpica-unix-*/
util/crossgcc/binutils-*/
util/crossgcc/build-*BINUTILS/

View File

@ -829,10 +829,6 @@ cbfs-files-$(CONFIG_SEABIOS_VGA_COREBOOT) += vgaroms/seavgabios.bin
vgaroms/seavgabios.bin-file := $(CONFIG_PAYLOAD_VGABIOS_FILE)
vgaroms/seavgabios.bin-type := raw
cbfs-files-$(CONFIG_PXE_ROM) += pci$(CONFIG_PXE_ROM_ID).rom
pci$(CONFIG_PXE_ROM_ID).rom-file := $(CONFIG_PXE_ROM_FILE)
pci$(CONFIG_PXE_ROM_ID).rom-type := raw
cbfs-files-$(CONFIG_INCLUDE_CONFIG_FILE) += config
config-file := $(DOTCONFIG):defconfig
config-type := raw

View File

@ -23,7 +23,8 @@ payloads/libpayload \
payloads/external/depthcharge \
payloads/external/SeaBIOS \
payloads/external/U-Boot \
payloads/external/Memtest86Plus
payloads/external/Memtest86Plus \
payloads/external/iPXE
payloads/coreinfo/build/coreinfo.elf coreinfo:
$(MAKE) -C payloads/coreinfo defaultbuild

View File

@ -112,3 +112,31 @@ payloads/external/Memtest86Plus/memtest86plus/memtest: $(top)/$(DOTCONFIG)
AS="$(AS_x86_32)" \
$(MEMTEST_SERIAL_OPTIONS) \
MFLAGS= MAKEFLAGS=
PXE_ROM_PCI_ID:=$(subst $(comma),,$(CONFIG_PXE_ROM_ID))
ifeq ($(CONFIG_PXE_ROM),y)
PXE_ROM_FILE:=$(CONFIG_PXE_ROM_FILE)
endif
ifeq ($(CONFIG_BUILD_IPXE),y)
PXE_ROM_FILE:=payloads/external/iPXE/ipxe/ipxe.rom
endif
ifeq ($(CONFIG_CONSOLE_SERIAL)$(CONFIG_DRIVERS_UART_8250IO),yy)
IPXE_UART=COM$(call int-add,$(CONFIG_UART_FOR_CONSOLE) 1)
endif
cbfs-files-$(CONFIG_PXE_ROM)$(CONFIG_BUILD_IPXE) += pci$(CONFIG_PXE_ROM_ID).rom
pci$(CONFIG_PXE_ROM_ID).rom-file := $(PXE_ROM_FILE)
pci$(CONFIG_PXE_ROM_ID).rom-type := raw
payloads/external/iPXE/ipxe/ipxe.rom ipxe: $(top)/$(DOTCONFIG)
$(MAKE) -C payloads/external/iPXE all \
CROSS_COMPILE="$(CROSS_COMPILE_$(ARCH-ramstage-y))" \
PXE_ROM_PCI_ID=$(PXE_ROM_PCI_ID) \
CONFIG_IPXE_MASTER=$(CONFIG_IPXE_MASTER) \
CONFIG_IPXE_STABLE=$(CONFIG_IPXE_STABLE) \
CONSOLE_SERIAL=$(CONFIG_CONSOLE_SERIAL)$(CONFIG_DRIVERS_UART_8250IO) \
IPXE_UART=$(IPXE_UART) \
CONFIG_TTYS0_BAUD=$(CONFIG_TTYS0_BAUD) \
MFLAGS= MAKEFLAGS=

74
payloads/external/iPXE/Kconfig vendored Normal file
View File

@ -0,0 +1,74 @@
##
## This file is part of the coreboot project.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
choice
prompt "Add a PXE ROM"
default PXE_ROM
depends on ARCH_X86
optional
config PXE_ROM
bool "Add an existing PXE ROM image"
help
Select this option if you have a PXE ROM image that you would
like to add to your ROM.
config BUILD_IPXE
bool "Build and add an iPXE ROM"
help
Select this option to fetch and build a ROM from the iPXE project.
endchoice
choice
prompt "iPXE version"
default IPXE_STABLE
depends on BUILD_IPXE
config IPXE_STABLE
bool "2016.2"
help
iPXE uses a rolling release with no stable version, for
reproducibility, use the last commit of a given month as the
'stable' version.
This is iPXE from the end of February, 2016.
config IPXE_MASTER
bool "master"
help
Newest iPXE version.
endchoice
config PXE_ROM_FILE
string "PXE ROM filename"
depends on PXE_ROM
default "pxe.rom"
help
The path and filename of the file to use as PXE ROM.
config PXE_ROM_ID
string "network card PCI IDs"
depends on PXE_ROM || BUILD_IPXE
default "10ec,8168"
help
The comma-separated PCI vendor and device ID that would associate
your PXE ROM to your network card.
Example: 10ec,8168
In the above example 10ec is the PCI vendor ID (in hex, but without
the "0x" prefix) and 8168 specifies the PCI device ID of the
network card (also in hex, without "0x" prefix).
Under GNU/Linux you can run `lspci -nn` to list the IDs of your PCI devices.

74
payloads/external/iPXE/Makefile vendored Normal file
View File

@ -0,0 +1,74 @@
##
## This file is part of the coreboot project.
##
## Copyright (C) 2016 Google Inc.
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; version 2 of the License.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
# 2016.2 - Last commit of February 2016
# When updating, change the name both here and in payloads/external/iPXE/Kconfig
STABLE_COMMIT_ID=99b5216b1c71dba22dab734e0945887525493cde
TAG-$(CONFIG_IPXE_MASTER)=origin/master
TAG-$(CONFIG_IPXE_STABLE)=$(STABLE_COMMIT_ID)
project_name=iPXE
project_dir=ipxe
project_git_repo=git://git.ipxe.org/ipxe.git
all: build
$(project_dir):
echo " Cloning $(project_name) from Git"
git clone $(project_git_repo) $(project_dir)
fetch: $(project_dir)
cd $(project_dir); \
git show $(TAG-y) >/dev/null 2>&1 ; \
if [ $$? -ne 0 ] || [ "$(TAG-y)" = "origin/master" ]; then \
echo " Fetching new commits from the $(project_name) repo"; \
git fetch; \
fi
checkout: fetch
echo " Checking out $(project_name) revision $(TAG-y)"
cd $(project_dir); \
git checkout master; \
git branch -D coreboot 2>/dev/null; \
git checkout -b coreboot $(TAG-y)
config: checkout
ifeq ($(CONSOLE_SERIAL),yy)
cp "$(project_dir)/src/config/console.h" "$(project_dir)/src/config/console.h.cb"
cp "$(project_dir)/src/config/serial.h" "$(project_dir)/src/config/serial.h.cb"
sed 's|//#define\s*CONSOLE_SERIAL.*|#define CONSOLE_SERIAL|' "$(project_dir)/src/config/console.h" > "$(project_dir)/src/config/console.h.tmp"
mv "$(project_dir)/src/config/console.h.tmp" "$(project_dir)/src/config/console.h"
sed 's|#define\s*COMCONSOLE.*|#define COMCONSOLE $(IPXE_UART)|' "$(project_dir)/src/config/serial.h" > "$(project_dir)/src/config/serial.h.tmp"
sed 's|#define\s*COMSPEED.*|#define COMSPEED $(CONFIG_TTYS0_BAUD)|' "$(project_dir)/src/config/serial.h.tmp" > "$(project_dir)/src/config/serial.h"
endif
build: config
echo " MAKE $(project_name) $(TAG-y)"
$(MAKE) -C $(project_dir)/src bin/$(PXE_ROM_PCI_ID).rom
cp $(project_dir)/src/bin/$(PXE_ROM_PCI_ID).rom $(project_dir)/ipxe.rom
ifeq ($(CONSOLE_SERIAL),yy)
cp "$(project_dir)/src/config/console.h.cb" "$(project_dir)/src/config/console.h"
cp "$(project_dir)/src/config/serial.h.cb" "$(project_dir)/src/config/serial.h"
endif
clean:
test -d $(project_dir) && $(MAKE) -C $(project_dir)/src veryclean || exit 0
rm -f $(project_dir)/ipxe.rom
distclean:
rm -rf $(project_dir)
.PHONY: all fetch config build clean distclean

View File

@ -351,36 +351,6 @@ config MBI_FILE
help
The path and filename of the file to use as VGA BIOS.
config PXE_ROM
bool "Add a PXE ROM image"
depends on ARCH_X86
help
Select this option if you have a PXE ROM image that you would
like to add to your ROM.
config PXE_ROM_FILE
string "PXE ROM filename"
depends on PXE_ROM
default "pxe.rom"
help
The path and filename of the file to use as PXE ROM.
config PXE_ROM_ID
string "network card PCI IDs"
depends on PXE_ROM
default "10ec,8168"
help
The comma-separated PCI vendor and device ID that would associate
your PXE ROM to your network card.
Example: 10ec,8168
In the above example 10ec is the PCI vendor ID (in hex, but without
the "0x" prefix) and 8168 specifies the PCI device ID of the
network card (also in hex, without "0x" prefix).
Under GNU/Linux you can run `lspci -nn` to list the IDs of your PCI devices.
config SOFTWARE_I2C
bool "Enable I2C controller emulation in software"
default n