From 74849cd983f5b2d74bb19cd1a6d4bf9b9206b5f9 Mon Sep 17 00:00:00 2001 From: Mingqiang Chi Date: Mon, 10 Dec 2018 19:32:42 +0800 Subject: [PATCH] modulization:move out efi dir from hypervisor move acrn-hypervisor/hypervisor/bsp/uefi/efi to arcn-hypervisor/efi-stub move acrn-hypervisor/hypervisor/bsp/uefi/clearlinux to acrn-hypervisor/efi-stub/clearlinux Changes to be committed: modified: Makefile modified: doc/getting-started/apl-nuc.rst renamed: hypervisor/bsp/uefi/efi/Makefile -> efi-stub/Makefile renamed: hypervisor/bsp/uefi/efi/boot.c -> efi-stub/boot.c renamed: hypervisor/bsp/uefi/efi/boot.h -> efi-stub/boot.h renamed: hypervisor/bsp/uefi/clearlinux/acrn.conf -> efi-stub/clearlinux/acrn.conf renamed: hypervisor/bsp/uefi/efi/efilinux.h -> efi-stub/efilinux.h renamed: hypervisor/bsp/uefi/efi/malloc.c -> efi-stub/malloc.c renamed: hypervisor/bsp/uefi/efi/multiboot.h -> efi-stub/multiboot.h renamed: hypervisor/bsp/uefi/efi/pe.c -> efi-stub/pe.c renamed: hypervisor/bsp/uefi/efi/stdlib.h -> efi-stub/stdlib.h modified: hypervisor/Makefile Tracked-On: #1842 Signed-off-by: Mingqiang Chi Acked-by: Anthony Xu --- Makefile | 11 +++++++++++ doc/getting-started/apl-nuc.rst | 6 +++--- {hypervisor/bsp/uefi/efi => efi-stub}/Makefile | 7 +++---- {hypervisor/bsp/uefi/efi => efi-stub}/boot.c | 0 {hypervisor/bsp/uefi/efi => efi-stub}/boot.h | 0 .../bsp/uefi => efi-stub}/clearlinux/acrn.conf | 0 {hypervisor/bsp/uefi/efi => efi-stub}/efilinux.h | 0 {hypervisor/bsp/uefi/efi => efi-stub}/malloc.c | 0 {hypervisor/bsp/uefi/efi => efi-stub}/multiboot.h | 0 {hypervisor/bsp/uefi/efi => efi-stub}/pe.c | 0 {hypervisor/bsp/uefi/efi => efi-stub}/stdlib.h | 0 hypervisor/Makefile | 13 +------------ 12 files changed, 18 insertions(+), 19 deletions(-) rename {hypervisor/bsp/uefi/efi => efi-stub}/Makefile (94%) rename {hypervisor/bsp/uefi/efi => efi-stub}/boot.c (100%) rename {hypervisor/bsp/uefi/efi => efi-stub}/boot.h (100%) rename {hypervisor/bsp/uefi => efi-stub}/clearlinux/acrn.conf (100%) rename {hypervisor/bsp/uefi/efi => efi-stub}/efilinux.h (100%) rename {hypervisor/bsp/uefi/efi => efi-stub}/malloc.c (100%) rename {hypervisor/bsp/uefi/efi => efi-stub}/multiboot.h (100%) rename {hypervisor/bsp/uefi/efi => efi-stub}/pe.c (100%) rename {hypervisor/bsp/uefi/efi => efi-stub}/stdlib.h (100%) diff --git a/Makefile b/Makefile index d07e19c2a..e7b7ffa87 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ RELEASE ?= 0 O ?= build ROOT_OUT := $(shell mkdir -p $(O);cd $(O);pwd) HV_OUT := $(ROOT_OUT)/hypervisor +EFI_OUT := $(ROOT_OUT)/efi-stub DM_OUT := $(ROOT_OUT)/devicemodel TOOLS_OUT := $(ROOT_OUT)/tools DOC_OUT := $(ROOT_OUT)/doc @@ -46,6 +47,10 @@ all: hypervisor devicemodel tools hypervisor: make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) clean make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) +ifeq ($(PLATFORM),uefi) + echo "building hypervisor as EFI executable..." + make -C $(T)/efi-stub HV_OBJDIR=$(HV_OUT) EFI_OBJDIR=$(EFI_OUT) +endif sbl-hypervisor: @mkdir -p $(HV_OUT)-sbl @@ -73,7 +78,13 @@ clean: install: hypervisor-install devicemodel-install tools-install hypervisor-install: +ifeq ($(PLATFORM),sbl) make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) install +endif +ifeq ($(PLATFORM),uefi) + make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) + make -C $(T)/efi-stub HV_OBJDIR=$(HV_OUT) EFI_OBJDIR=$(EFI_OUT) all install +endif sbl-hypervisor-install: make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) install diff --git a/doc/getting-started/apl-nuc.rst b/doc/getting-started/apl-nuc.rst index 2b7fbfc1d..fb41b1220 100644 --- a/doc/getting-started/apl-nuc.rst +++ b/doc/getting-started/apl-nuc.rst @@ -205,11 +205,11 @@ partition. Follow these steps: A starter acrn.conf configuration file is included in the Clear Linux release and is also available in the acrn-hypervisor/hypervisor GitHub repo as `acrn.conf - `__ + `__ as shown here: - .. literalinclude:: ../../hypervisor/bsp/uefi/clearlinux/acrn.conf - :caption: hypervisor/bsp/uefi/clearlinux/acrn.conf + .. literalinclude:: ../../efi-stub/clearlinux/acrn.conf + :caption: efi-stub/clearlinux/acrn.conf On the platform, copy the ``acrn.conf`` file to the EFI partition we mounted earlier: diff --git a/hypervisor/bsp/uefi/efi/Makefile b/efi-stub/Makefile similarity index 94% rename from hypervisor/bsp/uefi/efi/Makefile rename to efi-stub/Makefile index 66a460488..f5390ca7e 100644 --- a/hypervisor/bsp/uefi/efi/Makefile +++ b/efi-stub/Makefile @@ -32,7 +32,6 @@ HV_OBJDIR:=build HV_FILE:=acrn -EFI_OBJDIR:=$(HV_OBJDIR)/bsp/uefi/efi C_SRCS = boot.c pe.c malloc.c ACRN_OBJS := $(patsubst %.c,$(EFI_OBJDIR)/%.o,$(C_SRCS)) INCLUDE_PATH += $(HV_OBJDIR)/include @@ -60,8 +59,8 @@ LDSCRIPT := $(GNUEFI_DIR)/elf_$(ARCH)_efi.lds INCDIR := $(SYSROOT)/usr/include -CFLAGS=-I. -I.. -I../../../include/arch/x86/guest -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \ - -I../../../include/public -I../../../include/lib \ +CFLAGS=-I. -I.. -I../hypervisor/include/arch/x86/guest -I$(INCDIR)/efi -I$(INCDIR)/efi/$(ARCH) \ + -I../hypervisor/include/public -I../hypervisor/include/lib \ -DEFI_FUNCTION_WRAPPER -fPIC -fshort-wchar -ffreestanding \ -Wall -I../fs/ -D$(ARCH) -O2 \ -include config.h @@ -82,7 +81,7 @@ LDFLAGS=-T $(LDSCRIPT) -Bsymbolic -shared -nostdlib -znocombreloc \ EFIBIN=$(HV_OBJDIR)/$(HV_FILE).efi BOOT=$(EFI_OBJDIR)/boot.efi -CONF_FILE=$(CURDIR)/../clearlinux/acrn.conf +CONF_FILE=$(CURDIR)/clearlinux/acrn.conf all: $(EFIBIN) $(OBJCOPY) --add-section .hv="$(HV_OBJDIR)/$(HV_FILE).bin" --change-section-vma .hv=0x6e000 --set-section-flags .hv=alloc,data,contents,load --section-alignment 0x1000 $(EFI_OBJDIR)/boot.efi $(EFIBIN) diff --git a/hypervisor/bsp/uefi/efi/boot.c b/efi-stub/boot.c similarity index 100% rename from hypervisor/bsp/uefi/efi/boot.c rename to efi-stub/boot.c diff --git a/hypervisor/bsp/uefi/efi/boot.h b/efi-stub/boot.h similarity index 100% rename from hypervisor/bsp/uefi/efi/boot.h rename to efi-stub/boot.h diff --git a/hypervisor/bsp/uefi/clearlinux/acrn.conf b/efi-stub/clearlinux/acrn.conf similarity index 100% rename from hypervisor/bsp/uefi/clearlinux/acrn.conf rename to efi-stub/clearlinux/acrn.conf diff --git a/hypervisor/bsp/uefi/efi/efilinux.h b/efi-stub/efilinux.h similarity index 100% rename from hypervisor/bsp/uefi/efi/efilinux.h rename to efi-stub/efilinux.h diff --git a/hypervisor/bsp/uefi/efi/malloc.c b/efi-stub/malloc.c similarity index 100% rename from hypervisor/bsp/uefi/efi/malloc.c rename to efi-stub/malloc.c diff --git a/hypervisor/bsp/uefi/efi/multiboot.h b/efi-stub/multiboot.h similarity index 100% rename from hypervisor/bsp/uefi/efi/multiboot.h rename to efi-stub/multiboot.h diff --git a/hypervisor/bsp/uefi/efi/pe.c b/efi-stub/pe.c similarity index 100% rename from hypervisor/bsp/uefi/efi/pe.c rename to efi-stub/pe.c diff --git a/hypervisor/bsp/uefi/efi/stdlib.h b/efi-stub/stdlib.h similarity index 100% rename from hypervisor/bsp/uefi/efi/stdlib.h rename to efi-stub/stdlib.h diff --git a/hypervisor/Makefile b/hypervisor/Makefile index c6f2fe344..c9e88bac5 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -276,19 +276,8 @@ endif .PHONY: all all: lib $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin -ifeq ($(CONFIG_PLATFORM_UEFI),y) -all: efi -.PHONY: efi -efi: $(HV_OBJDIR)/$(HV_FILE).bin - echo "building hypervisor as EFI executable..." - make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR) - -install: efi - make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR) install -endif - ifeq ($(CONFIG_PLATFORM_SBL),y) -install: $(HV_OBJDIR)/$(HV_FILE).32.out +install: lib $(HV_OBJDIR)/$(HV_FILE).32.out install -D $(HV_OBJDIR)/$(HV_FILE).32.out $(DESTDIR)/usr/lib/acrn/$(HV_FILE).sbl endif