Merge pull request #39 from JulienVdG/use-utk

Use fiano utk
This commit is contained in:
Julien Viard de Galbert 2020-02-07 15:54:29 +01:00 committed by GitHub
commit 10be0dc265
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 60 additions and 6 deletions

View File

@ -3,7 +3,7 @@
#
# This requires the vendor firmware image, a Linux kernel and an initrd.cpio.xz file.
#
#
#
all: linuxboot
-include .config
@ -36,6 +36,10 @@ include boards/$(BOARD)/Makefile.board
# If they don't define a vendor ROM file
ROM ?= boards/$(BOARD)/$(BOARD).rom
ifdef USE_UTK
include Makefile.utk
endif
linuxboot: $(BUILD)/linuxboot.rom
# Create a .config file based on the current parameters
@ -64,7 +68,6 @@ edk2.force: edk2/.git
edk2/.git:
git clone --depth 1 --branch UDK2018 https://github.com/linuxboot/edk2
$(BUILD)/Linux.ffs: $(KERNEL)
$(BUILD)/Initrd.ffs: $(INITRD)
@ -133,8 +136,18 @@ $(dxe-files): $(BUILD)/$(BOARD).txt
dxe/%.ffs:
$(MAKE) -C dxe $(notdir $@)
ifndef USE_UTK
$(BUILD)/linuxboot.rom: $(FVS)
else
$(BUILD)/linuxboot.rom: bin/utk $(DXE_FFS)
$< \
$(ROM) \
remove_dxes_except boards/$(BOARD)/image-files.txt \
$(foreach ffs,$(DXE_FFS), insert_dxe $(ffs)) \
$(UTK_EXTRA_OPS) \
save $@
endif
clean:
$(RM) $(BUILD)/{*.ffs,*.rom,*.vol,*.tmp}
$(RM) ./bin/utk

28
Makefile.utk Normal file
View File

@ -0,0 +1,28 @@
#
# Rules for using UTK to manipulate the flash image
#
# Check go version. We need go 1.11 or newer
GOVERSION:=$(shell go version | grep ^go | cut -d ' ' -f 3 | cut -c 3-)
GOMAJOR:=$(shell echo $(GOVERSION) | cut -d '.' -f 1)
GOMINOR:=$(shell echo $(GOVERSION) | cut -d '.' -f 2)
GOVERSIONREQ:=1.11
GOMAJORREQ:=1
GOMINORREQ:=11
$(shell \
if [ "$(GOMAJOR)" -lt "$(GOMAJORREQ)" ]; then \
echo >&2 "Go version $(GOVERSION) too old, please install go $(GOVERSIONREQ) or newer"; \
exit 1; \
elif [ "$(GOMAJOR)" -eq "$(GOMAJORREQ)" ]; then \
if [ "$(GOMINOR)" -lt "$(GOMINORREQ)" ]; then \
echo >&2 "Go version $(GOVERSION) too old, please install go $(GOVERSIONREQ) or newer"; \
exit 1; \
fi; \
fi; \
)
bin/utk:
go get github.com/linuxboot/fiano/cmds/utk
cp $(GOPATH)/bin/utk $@

View File

@ -36,11 +36,14 @@ $(BUILD)/rom/0x00f00000.fv \
# Replace the DxeCore and SmmCore with our own
# and add in the Linux kernel / initrd
DXE_FFS := \
./dxe/linuxboot.ffs \
$(BUILD)/Linux.ffs \
$(BUILD)/Initrd.ffs \
$(BUILD)/dxe.vol: \
$(dxe-files) \
./dxe/linuxboot.ffs \
$(BUILD)/Linux.ffs \
$(BUILD)/Initrd.ffs \
$(DXE_FFS) \
#
# Compact the NVRAM region. this isn't required, but makes for cleaner images.
@ -61,3 +64,10 @@ $(BUILD)/nvram1.ffs: $(NVRAM1_FFS)
$(BUILD)/nvram2.ffs: $(NVRAM2_FFS)
./bin/nvram-compact < $< > $@
#
# UTK Compact the NVRAM region
#
nvram-nvar-keep := boards/$(BOARD)/nvar-keep.txt
UTK_EXTRA_OPS := invalidate_nvar_except $(nvram-nvar-keep) nvram-compact

View File

@ -0,0 +1,3 @@
StdDefaults
CpuS3Resume
Setup