From ad562cec28c20854120f52028eac4135be0c5750 Mon Sep 17 00:00:00 2001 From: Michalis Pappas Date: Thu, 10 Aug 2023 11:10:52 +0200 Subject: [PATCH] plat/common: Generate an arm64 linux image when LXBOOT is enabled Update Linker.uk to generate a raw binary image prepended with the arm64 linux boot header when LXBOOT is enabled on arm64. Signed-off-by: Michalis Pappas Reviewed-by: Sergiu Moga Approved-by: Razvan Deaconescu Tested-by: Unikraft CI GitHub-Closes: #988 --- plat/common/Makefile.rules | 5 +++++ plat/kvm/Linker.uk | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/plat/common/Makefile.rules b/plat/common/Makefile.rules index 2eda112ce..f89fdeae0 100644 --- a/plat/common/Makefile.rules +++ b/plat/common/Makefile.rules @@ -17,3 +17,8 @@ endef define build_efi = @$(SCRIPTS_DIR)/mkefi.py $(1) endef + +define build_linux = + $(call build_cmd,OBJCOPY,,$(1).bin, $(OBJCOPY) -O binary $(1)) + $(call build_cmd,MKLINUX,,$(1).img, $(SCRIPTS_DIR)/mklinux.py $(1) $(2)) +endef diff --git a/plat/kvm/Linker.uk b/plat/kvm/Linker.uk index 97c2413c4..1ce85ee39 100644 --- a/plat/kvm/Linker.uk +++ b/plat/kvm/Linker.uk @@ -10,6 +10,9 @@ KVM_LDFLAGS-y += -Wl,--entry=uk_efi_entry64 KVM_LDFLAGS-y += -Wl,-m,elf_x86_64 endif else ifeq (arm64,$(CONFIG_UK_ARCH)) +ifeq ($(CONFIG_KVM_BOOT_PROTO_LXBOOT),y) +LINUX_HDR_ARM64 := y +endif ifeq ($(CONFIG_KVM_BOOT_PROTO_EFI_STUB),y) KVM_LDFLAGS-y += -Wl,--entry=uk_efi_entry64 KVM_LDFLAGS-y += -Wl,-m,aarch64elf @@ -77,6 +80,9 @@ endif ifeq ($(CONFIG_KVM_BOOT_PROTO_EFI_STUB),y) $(call build_efi,$@) endif +ifeq ($(LINUX_HDR_ARM64),y) + $(call build_linux,$@,$<) +endif $(KVM_IMAGE).sym: $(KVM_DEBUG_IMAGE) $(call build_cmd,NM,,$@, $(NM) -n $< > $@) -- 2.39.5