Allow to use utk.

Based on branch 'ganshun/use-utk' with the following changes

Makefile:
 - Added missing ./dxe/linuxboot.ffs while resolving conflict.
 - Copying utk from $GOPATH
 - Make utk optional

Signed-off-by: Julien Viard de Galbert <julien.viard-de-galbert@itrenew.com>
This commit is contained in:
Julien Viard de Galbert 2019-01-08 15:24:32 +01:00
parent c2b56f1179
commit f5dfd39ac7
2 changed files with 45 additions and 3 deletions

View File

@ -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,19 @@ $(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/linuxboot.ffs $(BUILD)/Linux.ffs $(BUILD)/Initrd.ffs
$< \
$(ROM) \
remove_dxes_except boards/$(BOARD)/image-files.txt \
insert_dxe ./dxe/linuxboot.ffs \
insert_dxe $(BUILD)/Linux.ffs \
insert_dxe $(BUILD)/Initrd.ffs \
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 $@