Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fix for building Linux host version with latest gnuefi lib #3

Open
wants to merge 178 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
af11ec9
Initial commit
jeremy-compostella Jul 25, 2016
1398168
Revert "Initial commit"
jeremy-compostella Aug 19, 2016
2e3d0df
Initial commit
jeremy-compostella Sep 2, 2016
d536202
drivers/lpmemmap: add Libpayload memory map driver
jeremy-compostella Sep 12, 2016
19c5d9d
drivers/acpi: add ACPI driver
jeremy-compostella Sep 12, 2016
6491061
drivers/cf9: add cf9 driver
jeremy-compostella Sep 13, 2016
82e19a4
drivers/lprtc: add lprtc driver
jeremy-compostella Sep 15, 2016
ee42d49
01.01
jeremy-compostella Sep 12, 2016
f40bba6
build: create directory prio to use it
Sep 21, 2016
5b8020a
drivers/cf9: wait long enough before exiting cf9_reset_system()
jeremy-compostella Sep 25, 2016
5bc79f7
ewdrv: rename driver interface free() callback to exit()
jeremy-compostella Sep 25, 2016
9529360
ewdrv: exit previously initialized drivers in case of failure
jeremy-compostella Sep 25, 2016
59932fa
drivers/acpi: ACPI table data structure should be packed
jeremy-compostella Sep 25, 2016
176bc3a
remove SdHostIo.h duplicate
jeremy-compostella Sep 26, 2016
6eeb8ca
01.02
jeremy-compostella Sep 25, 2016
778ddd7
drivers/acpi: keep looking for another RSDP table
jeremy-compostella Sep 29, 2016
7fd4bbb
drivers/lifecycle: add lifecycle driver
jeremy-compostella Sep 28, 2016
2173699
01.03
jeremy-compostella Sep 28, 2016
6e522af
drivers/lifecycle: fix typo
jeremy-compostella Oct 6, 2016
923b348
update doc and licence
jeremy-compostella Oct 6, 2016
917474f
01.04
jeremy-compostella Oct 6, 2016
e18d1ad
Fix memory leak in dwc_xdci_core_init when core_handle is NULL
Nov 7, 2016
ad0862a
Merge pull request #1 from ColinIanKing/master
jeremy-compostella Nov 10, 2016
6405dc3
Merge abt/sandbox/jcompost/efiwrapper-pr3 into android/master
jeremy-compostella Nov 10, 2016
7ce46b5
drivers/lpmemmap: fix GetMemoryMap() Boot Service
jeremy-compostella Nov 10, 2016
9c387f9
drivers/lpmemmap: sanity check the e820 memory map
jeremy-compostella Nov 21, 2016
cae5163
drivers/lpmemmap: insert EfiLoaderCode and EfiLoadData regions
jeremy-compostella Nov 21, 2016
7618906
01.05
jeremy-compostella Nov 19, 2016
2c42a97
libefiwrapper: ewacpi module
jeremy-compostella Oct 11, 2016
9a768c6
libefiwrapper: ewarg module
jeremy-compostella Nov 16, 2016
b421c31
libefiwrapper: make smbios module more generic
jeremy-compostella Nov 16, 2016
4cf54e0
drivers/abl: add Automotive BootLoader driver
jeremy-compostella Nov 16, 2016
a6b0265
01.06
jeremy-compostella Nov 19, 2016
16fb26f
libefiwrapper: fix double free in smbios module
GraspEmpty Dec 1, 2016
fbac380
driver/abl: support reboot target being saved in nvram
jwu55 Nov 8, 2016
5320cd6
libefiwrapper: print error information when efiwrapper_free fails
jeremy-compostella Nov 24, 2016
7dd82c5
libefiwrapper: fix conf_table_free() misuse of guidcmp()
jeremy-compostella Nov 24, 2016
0c0f780
libefiwrapper: support and use internally str16cmp function
jeremy-compostella Dec 8, 2016
8e0e2e2
libefiwrapper: support CreateEvent, SignalEvent and CloseEvent
jeremy-compostella Dec 8, 2016
a3a6f35
libefiwrapper: support OpenProtocol when alike HandleProtocol
jeremy-compostella Dec 8, 2016
999cd56
libefiwrapper: coding style clean-up
jeremy-compostella Dec 8, 2016
5142f6a
libefiwrapper: support basic SDIO protocol
jeremy-compostella Dec 8, 2016
0985cec
libefiwrapper: provide basic ewlib
jeremy-compostella Dec 15, 2016
9bd766c
host: initial commit
jeremy-compostella Dec 8, 2016
88e6ce9
host: support eMMC emulation
jeremy-compostella Dec 8, 2016
5f68a44
host: support TCP4 protocol
jeremy-compostella Dec 8, 2016
8368e6f
host: support File System Protocol
jeremy-compostella Dec 9, 2016
a1f344f
host: support GOP protocol
jeremy-compostella Dec 12, 2016
972b332
01.07
jeremy-compostella Nov 24, 2016
884aa20
libefiwrapper/ewlib: provide min and max macros
jeremy-compostella Dec 20, 2016
a0c944c
libefiwrapper/bs: coding style clean-up
jeremy-compostella Dec 21, 2016
cc97e76
host: support PE/COFF EFI binary image loading
jeremy-compostella Dec 21, 2016
6aefa62
01.08
jeremy-compostella Dec 21, 2016
ca4d0e0
Add interface for sending CAN message
beckwen Dec 26, 2016
02bef45
Handle warm reset type in ioc_uart driver
jwu55 Jan 11, 2017
a3b3da6
Add size check for array 'ep_handles'
GraspEmpty Jan 20, 2017
d82e290
implement fastboot flash ioc firmware in efi driver
bhe4 Jan 3, 2017
c9e046e
Don't use clang as the default compiler
qshi5 Dec 7, 2016
b23b283
Slow down EMMC freq for stability.
Apr 6, 2017
1edb5a1
host: auto-detect disk size when image file already exist
jeremy-compostella Feb 15, 2017
45d6e50
host: Adding makefile for building outside of Android build system
Apr 11, 2017
89baefc
libefiwrapper: fix undeclared identifier errors in smbios.c for x86_64
Apr 11, 2017
6764c93
host: cleanup, remove unused variables
Apr 11, 2017
3a81825
host/gop.c: fix typo, checking ret instead of pret
Apr 11, 2017
1a80bdc
host: adding time driver based on gmtime() function
Apr 12, 2017
1054ee5
host: call notify function for wait event when waiting for it
Apr 13, 2017
e2eb98e
host: adding terminal keyboard WaitForKey event
Apr 13, 2017
4d7c641
host: fix potential deadlock in event.c
Apr 14, 2017
7b670af
Merge abt/sandbox/xihuache/efipull01 into my_branch
xihua-chen May 3, 2017
8c5e33a
01.09
xihua-chen May 3, 2017
1e12ee6
Merge android/n/mr1/master into my_branch
xihua-chen May 5, 2017
ef5adf6
Revert "Slow down EMMC freq for stability."
zhouji3x May 12, 2017
234985a
Merge android/n/mr1/master into android/master
qichen5x May 19, 2017
910e377
Clean efiwrapper debug print in ABL case for quick boot
zhimincx May 26, 2017
de4bfe8
Clean efiwrapper debug print in ABL case for quick boot
zhimincx May 25, 2017
7da1999
host: add missing stdarg.h include
jeremy-compostella May 31, 2017
ba045c5
Merge android/n/mr1/master into android/master
qichen5x Jun 5, 2017
a1f00d5
Fix interrupt error when writing data to RPMB
beckwen Jun 5, 2017
fc401d7
01.0A
xihua-chen Jun 28, 2017
5c02d32
Add HECI Driver in Osloader
zhouji3x Jun 13, 2017
6a9b2d5
Encountering error when read and write multiblock
beckwen Jun 27, 2017
aae1bdf
Make optimization for sd host driver
beckwen Jul 4, 2017
1250e8d
Restore cf9 driver
beckwen Aug 4, 2017
ce95f10
Efiwrapper driver support for iclake/kabylake
zhouji3x Sep 5, 2017
d8d6c60
Efiwrapper: add default hardware configuration
zhouji3x Sep 13, 2017
ed31380
select hardware configuration according to target board
zhouji3x Sep 14, 2017
f0eda97
Avoid build serial fail blocking efiwrapper init
GraspEmpty Oct 9, 2017
1533c90
efiwrapper: read ICL uart base address from pci configuration
zhouji3x Oct 16, 2017
15c85a7
01.0B
xihua-chen Nov 6, 2017
17dfa06
efiwrapper: increase emmc wait timeout value
zhouji3x Oct 30, 2017
0c0fb13
Efiwrapper: enable EMMC tuning
zhouji3x Oct 30, 2017
3516111
Add boot media identify interface in efiwrapper
GraspEmpty Nov 9, 2017
e1cd8b8
efiwrapper: read Kabylake uart base address from pci configuration
zhouji3x Nov 8, 2017
235cc3f
Enable UFS boot on icl_presi
beckwen Oct 10, 2017
c7bc32e
01.0C
xihua-chen Dec 1, 2017
2337709
efiwrapper: Add capsule_store for FW update in fastboot.
zhimincx Nov 1, 2017
576ec6a
Fastboot to support IOC CBC FW
haoyu-tang Nov 23, 2017
d6a5a81
Enable writing interface for UFS
beckwen Dec 5, 2017
b087b29
Boot: abl: fix critical about strcpy cannot see buf size
yayongdx Dec 15, 2017
7b338d4
efiwrapper: support EC UART on icelake
zhouji3x Dec 6, 2017
3c48387
Efiwrapper: configure real diskbus in media's device path
zhimincx Dec 21, 2017
a3e2621
Implement the function of AllocatePages and FreePages
beckwen Jan 3, 2018
04e03d8
Boot: abl: replace function strncpy with strlcpy to fix KW issue
yayongdx Jan 8, 2018
05f425d
[efiwrapper] set type of storage device path
zhouji3x Jan 9, 2018
366022c
Use the correct function for freeing the memory
beckwen Jan 16, 2018
22fd832
efiwrapper: Enable fastboot trigger FW update on Icelake-SBL
zhimincx Dec 28, 2017
408c18d
[efiwrapper] support build 64 bit osloader
zhouji3x Jan 17, 2018
a48e61b
Capsule message operation adjustment for fastboot fw-update
zhimincx Jan 29, 2018
7bf5afd
[efiwrapper] Support virtual media
jwu55 Jan 13, 2018
5b5f0ea
Find serial UART base address by VID and DID
zhimincx Feb 28, 2018
ffe9325
[efiwrapper][VirtioBlk]Improve Virtio block read/write function
zhouji3x Feb 28, 2018
4b57cbc
drivers/abl: support the BS ExitBootService
jeremy-compostella Feb 27, 2018
1831777
libefiwrapper/core: Introduce the efiwrapper protocol
jeremy-compostella Mar 6, 2018
8ac5c61
01.0D
jeremy-compostella Mar 6, 2018
a2824df
libefiwrapper/core: fix error management
jeremy-compostella Mar 8, 2018
d4cf7a8
Revert "drivers/abl: support the BS ExitBootService"
jeremy-compostella Mar 9, 2018
49358bd
libefiwrapper/bs: make ExitBootService return EXIT_SUCCESS
jeremy-compostella Mar 9, 2018
2bb6858
01.0E
jeremy-compostella Mar 9, 2018
b3b386c
[efiwrapper] enable NVME driver
zhouji3x Jan 10, 2018
9c0e2f6
[efiwrapper] fix capsule compile error for x64 mode
zhouji3x Mar 8, 2018
d37ed96
01.0F
xihua-chen Mar 20, 2018
016d45e
Return EFI_NOT_FOUND if there is no available page in e820
beckwen Mar 20, 2018
8f7d09e
[REVERT ME] hack in fastboot to trigger SBL fw-update
zhimincx Mar 14, 2018
d901cb3
Create hardware configure file for tigerlake
GraspEmpty Mar 21, 2018
b728221
efiwrapper: Fix KW scan issue
zhouji3x Mar 30, 2018
8f51a5c
Fix UFS driver issues and make optimization
beckwen Mar 31, 2018
0ba2e72
[REVERT ME] hack in fastboot to trigger SBL fw-update
phireg Mar 27, 2018
1f542bf
ioc_uart find serial device by DID
zhimincx Apr 27, 2018
a37c902
[efiwrapper] Define NVME_PCI_DID and NVME_DISKBUS
GraspEmpty Apr 20, 2018
f88aba5
efiwrapper: identfiy flash medium per bdevlist
jwu55 Apr 2, 2018
6a4f0a0
[revert me] workround forcing HS200 mode on icelake/kabylake
GraspEmpty Nov 8, 2017
ffa42f2
Fastboot: Icelake USB config
haoyu-tang May 8, 2018
ca8b0d0
Fix build error for compiler flag
txu4 Jan 30, 2018
a28c57a
01.10
xihua-chen May 18, 2018
3bdcdfe
Implement virtio rpmb driver
yang-kaix Apr 13, 2018
1ef97ce
Fix ioc firmware flashing failure on fastboot mode
ustcxd May 23, 2018
3e37704
Merge android/o/mr1/master into master
xihua-chen May 30, 2018
17c1877
02.01
xihua-chen May 30, 2018
1fc59fb
Skip first page of the E820 memory range from 0x00000000 to 0x0000100…
beckwen Jun 7, 2018
f17cf69
Merge android/o/mr1/master into merge_branch
xihua-chen Jun 13, 2018
67668c7
remove LOCAL_CLANG_EXCEPTION_PROJECTS flag
qichen5x Mar 8, 2018
fe0f48b
Initialise the variable for clang compiler.
Jun 8, 2018
232cf1a
efiwrapper: Add fake NVME PCID for GP
jwu55 May 30, 2018
c4d229f
02.02
xihua-chen Jul 5, 2018
c82fd9a
Add enumeration type for virtual devices
yang-kaix Jul 10, 2018
06f5817
drivers/abl: support recovery and dnx reboot target
jeremy-compostella Jun 29, 2018
b586b9a
To correct IOC CBC setting
haoyu-tang Jun 20, 2018
029b3d5
Merge android/o/mr1/master into merge_branch
xihua-chen Jul 19, 2018
820e102
Adjust virtio rpmb driver for new virtual rpmb solution
yang-kaix Jul 20, 2018
95c430b
Support SBL self update trigger by fastboot
GraspEmpty Aug 2, 2018
990ccd9
Fix trigger fw update fail through fastboot binary in SPI
GraspEmpty Aug 14, 2018
c4446b1
Align notify tag define with latest SBL release(WW32)
GraspEmpty Aug 16, 2018
9dcc52b
Change RPMB_IOC_SEQ_CMD value to match with backend
yang-kaix Aug 17, 2018
8e30804
[heci] fix fw update fail issue
zhouji3x Aug 21, 2018
d1a51a9
drivers/sdhci_mmc: remove unecessary 2 ms delay
jeremy-compostella Aug 13, 2018
4e5ca23
modify defination of function bs_create_event_ex
mengxianglinx Sep 12, 2018
09ee75e
EFIWrapper: To support ACPI protocol
haoyu-tang Aug 27, 2018
8bb4763
WDT: add iTCO watchdog driver in efiwrapper
xinanlux Sep 28, 2018
30846e8
02.03
xihua-chen Oct 10, 2018
93fc20d
[efiwrapper] generate same emmc serialno with abl
zhouji3x Oct 10, 2018
24f90be
[efiwrapper] ioc ignore toggles when boot target is recovery
zhouji3x Oct 17, 2018
e48f63a
Fix virtio rpmb R/W issue when accessing multi-block
yang-kaix Oct 18, 2018
d824e19
Efiwrapper: ACPI protocol check OEM table ID and revision to replace …
haoyu-tang Oct 24, 2018
9370b4d
driver/abl: set the SMBIOS Type 2 Version to the platform ID
jeremy-compostella Oct 29, 2018
e04e244
[p_master] Clean critical KW issue in BOOT-OTA domain
GraspEmpty Nov 11, 2018
c90a10b
Disable virtual media debug log print
yang-kaix Dec 3, 2018
90366e8
drivers/gop: Graphical Output Protocol taking over pipe A surface 1
jeremy-compostella Dec 13, 2018
cfa89c5
Implement erase block function for virtio block
yang-kaix Dec 25, 2018
68778d8
02.04
xihua-chen Feb 14, 2019
e0ca7e6
[efiwrapper] add NVME security support
zhouji3x Jan 4, 2019
4d8d014
libefiwrapper: use SERIAL_IO_INTERFACE everywhere in serialio.c
May 14, 2019
1051d0f
libefiwrapper: move eraseblk.h from public include directory
May 14, 2019
bacf210
libefiwrapper: use EFI_DISK_IO_PROTOCOL rather than struct _EFI_DISK_…
May 14, 2019
64b367c
libefiwrapper: add eraseblk.o to obj list to build
May 14, 2019
8feee46
README: adding libx11-dev dependency
May 14, 2019
4021df3
host/gop.c: free graphics context in draw() function
Jul 31, 2019
4cd5d77
host: call LoadImage with parent handle and init child handle
Aug 2, 2019
d847e61
host: ncurses terminal simple text conin and conout support
Jul 31, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*~
cscope.*
94 changes: 94 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
EFIWRAPPER_LOCAL_PATH := $(call my-dir)
EFIWRAPPER_CFLAGS := -Wall -Wextra -Werror

ifeq ($(TARGET_UEFI_ARCH),x86_64)
EFIWRAPPER_CFLAGS += -DBUILD_X64
EFIWRAPPER_CFLAGS += -D__STDC_VERSION__=199901L
endif

ifeq ($(TARGET_BUILD_VARIANT),user)
EFIWRAPPER_CFLAGS += -DUSER -DUSERDEBUG
endif

ifeq ($(TARGET_BOARD_PLATFORM),icelakeu)
EFIWRAPPER_CFLAGS += -DPLATFORM_ICELAKE
endif

ifeq ($(TARGET_BOARD_PLATFORM),tigerlake)
EFIWRAPPER_CFLAGS += -DPLATFORM_TIGERLAKE
endif

ifeq ($(TARGET_BOARD_PLATFORM),kabylake)
EFIWRAPPER_CFLAGS += -DPLATFORM_KABYLAKE
endif

ifeq ($(TARGET_BOARD_PLATFORM),broxton)
EFIWRAPPER_CFLAGS += -DPLATFORM_BROXTON
endif

ifeq ($(EFIWRAPPER_USE_EC_UART),true)
EFIWRAPPER_CFLAGS += -DEFIWRAPPER_USE_EC_UART
endif

ifeq ($(TARGET_BUILD_VARIANT),userdebug)
EFIWRAPPER_CFLAGS += -DUSERDEBUG
endif

ifeq ($(CAPSULE_SOURCE),abl)
EFIWRAPPER_CFLAGS += -DCAPSULE4ABL
endif

ifeq ($(CAPSULE_SOURCE),sbl)
EFIWRAPPER_CFLAGS += -DCAPSULE4SBL
endif

EFIWRAPPER_CFLAGS += -DPRODUCT_NAME=\"$(TARGET_PRODUCT)\"

ifeq ($(PRODUCT_MANUFACTURER),)
EFIWRAPPER_CFLAGS += -DPRODUCT_MANUFACTURER=\"unknown\"
else
EFIWRAPPER_CFLAGS += -DPRODUCT_MANUFACTURER=\"$(PRODUCT_MANUFACTURER)\"
endif

ifeq ($(KERNELFLINGER_DISABLE_DEBUG_PRINT),true)
EFIWRAPPER_CFLAGS += -DDISABLE_DEBUG_PRINT
endif

ifeq ($(IOC_USE_SLCAN),true)
EFIWRAPPER_CFLAGS += -DIOC_USE_SLCAN
else ifeq ($(IOC_USE_CBC),true)
EFIWRAPPER_CFLAGS += -DIOC_USE_CBC
endif

EFIWRAPPER_HOST_CFLAGS := \
$(EFIWRAPPER_CFLAGS) \
-fshort-wchar \
-DEFI_FUNCTION_WRAPPER \
-DGNU_EFI_USE_MS_ABI \
-DHOST

ifeq ($(TARGET_IAFW_ARCH),x86_64)
EFIWRAPPER_HOST_ARCH += x86_64
else
EFIWRAPPER_HOST_ARCH += x86
endif

EFIWRAPPER_HOST_C_INCLUDES := \
external/gnu-efi/gnu-efi-3.0/inc \
external/gnu-efi/gnu-efi-3.0/inc/$(TARGET_EFI_ARCH_NAME) \
external/gnu-efi/gnu-efi-3.0/inc/protocol

include $(call all-subdir-makefiles)

include $(CLEAR_VARS)
LOCAL_PATH := $(EFIWRAPPER_LOCAL_PATH)
LOCAL_MODULE := efiwrapper-$(TARGET_BUILD_VARIANT)
LOCAL_STATIC_LIBRARIES := \
libefiwrapper-$(TARGET_BUILD_VARIANT) \
libgnuefi \
libefi \
libefiwrapper_drivers-$(TARGET_BUILD_VARIANT)
LOCAL_CFLAGS := $(EFIWRAPPER_CFLAGS)
LOCAL_SRC_FILES := \
main.c
include $(BUILD_IAFW_STATIC_LIBRARY)
25 changes: 25 additions & 0 deletions COPYING
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Copyright (c) 2016, Intel Corportaion
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17 changes: 17 additions & 0 deletions Make.defaults
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
ARCH := $(shell uname -m | sed s/i[3-9]86/ia32/)
GNU_EFI_PATH ?= /usr/local/include/efi
GNU_EFI_INCS := -I$(GNU_EFI_PATH) \
-I$(GNU_EFI_PATH)/$(ARCH) \
-I$(GNU_EFI_PATH)/protocol

EW_INCS = -I$(SRC_DIR)/include/libefiwrapper
EW_LIB = $(SRC_DIR)/libefiwrapper/libefiwrapper_host-$(TARGET_BUILD_VARIANT).a

PRODUCT_MANUFACTURER ?= unknown
PRODUCT_NAME ?= default_name

CFLAGS = -Wall -Werror -fshort-wchar -DGNU_EFI_USE_MS_ABI $(EXTRA_CFLAGS)

#default rule
%.o: %.c
$(CC) $(CFLAGS) $(GNU_EFI_INCS) $(EW_INCS) -c $< -o $@
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
SRC_DIR := .
include $(SRC_DIR)/Make.defaults

SUB_DIRS := libefiwrapper host
define submake
$(foreach d,$(SUB_DIRS),$(MAKE) -C $(d) $(1);)
endef

efiwrapper_host-eng: export EXTRA_CFLAGS := -DHOST
efiwrapper_host-userdebug: export EXTRA_CFLAGS := -DHOST -DUSERDEBUG
efiwrapper_host-user: export EXTRA_CFLAGS := -DHOST -DUSERDEBUG -DUSER

efiwrapper_host-eng \
efiwrapper_host-userdebug \
efiwrapper_host-user:
$(eval export TARGET_BUILD_VARIANT := $(subst efiwrapper_host-,,$@))
@$(MAKE) efiwrapper_host

efiwrapper_host: $(EW_LIB)
@$(MAKE) -C host

$(EW_LIB):
@$(MAKE) -C libefiwrapper

.PHONY: clean
clean:
@$(call submake,clean)

mrproper: clean
@$(call submake,mrproper)
85 changes: 85 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
EfiWrapper
==========

Overview
--------

EfiWrapper is a library which simulate a UEFI firmware
implementation. Its first purpose is to run a subset of the
[Kernelflinger](https://github.com/01org/kernelflinger/) OS loader to
run in a non-UEFI environment.

Basic architecture
------------------
* `libefiwrapper`: library that provides a basic implementation of the
Boot services and Runtime services. It includes basic EFI variable
management (no storage) and serial IO protocol support. It also
provides an abstraction for storage class implementation. This
library is system independent and MUST be kept that way.

* `libefiwrapper_drivers`: library including all the protocols
specified by the `LIBEFIWRAPPER_DRIVERS` Makefile variable. Drivers
are in the drivers/DRIVER\_NAME directories and might rely on
external libraries like the `libpayload` from the
[Coreboot](https://www.coreboot.org/) project.

* `host`: produce an `efiwrapper_host` host executable that can run an
EFI binary. See `Run an EFI binary on host` section.

* efiwrapper: library that provides the `main()` entry point which
initialize the libefiwrapper library and all the drivers before
calling the `efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *table)`
function.

Run an EFI binary on host
-------------------------

To build `efiwrapper_host`, run the following command in your Android
build environment:

``` bash
$ make efiwrapper_host-<BUILD_VARIANT>
```
Where `<BUILD_VARIANT>` is either `user`, `userdebug` or `eng`.

``` bash
$ efiwrapper_host --help
Usage: efiwrapper_host [OPTIONS] <EFI binary> [ARGS]
OPTIONS:
-h,--help Print this help
--list-drivers List available drivers
--disable-drivers=DRV1,DRV2 Disable drivers DRV1 and DRV2
```

The `efiwrapper_host` has built-in drivers:
``` bash
$ efiwrapper_host --list-drivers
Drivers list:
- disk: Emulate eMMC storage
- event: Event management for host
- tcp4: TCP/IP protocol
- fileio: File System Protocol support
- gop: Graphics Output Protocol support based on Xlib
- image: PE/COFF image
```

Drivers can be independently deactivated. For instance, if you want to
run Kernelflinger EFI binary witout the Graphic Output Protocol support:

``` bash
$ efiwrapper_host --disable-drivers=gop kernelflinger.efi -f
```

Dependencies
------------
* gnu-efi: libefiwrapper and efiwrapper libraries depends on the
gnu-efi library for EFI types definitions.

* drivers/*: most of these drivers depends on the `libpayload` library
from the [Coreboot](https://www.coreboot.org/) project.

* host/gop.c: libx11 devel library

Copyright and Licence
---------------------
EfiWrapper is licensed under the terms of the BSD 2-Clause.
41 changes: 41 additions & 0 deletions drivers/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
LOCAL_PATH := $(call my-dir)

# LIBEFIWRAPPER_DRIVERS must be defined for the current product with
# the list of drivers (see directories of this very directory).

include $(CLEAR_VARS)
LOCAL_MODULE := libefiwrapper_drivers-$(TARGET_BUILD_VARIANT)
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_STATIC_LIBRARIES := \
libpayload \
libefiwrapper-$(TARGET_BUILD_VARIANT) \
libgnuefi \
libefi
LOCAL_SRC_FILES := \
$(foreach drv, $(LIBEFIWRAPPER_DRIVERS), \
$(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/$(drv)/*.c)))
GEN := $(local-generated-sources-dir)/drivers.c
ifeq ($(LIBEFIWRAPPER_DRIVERS),)
$(GEN):
$(hide) mkdir -p $(dir $@)
$(hide) echo "/* Do not modify this auto-generated file. */" > $@
$(hide) echo "#error \"no driver selected. Cf. LIBEFIWRAPPER_DRIVERS Makefile variable.\"" >> $@
else
$(GEN):
$(hide) mkdir -p $(dir $@)
$(hide) echo "/* Do not modify this auto-generated file. */" > $@
$(hide) echo "#include \"ewdrv.h\"" >> $@
$(hide) $(foreach drv, $(LIBEFIWRAPPER_DRIVERS), echo "#include" \"$(drv)/$(drv).h\" >> $@;)
$(hide) echo "" >> $@
$(hide) echo "static ewdrv_t *drivers[] = {" >> $@
$(hide) $(foreach drv, $(LIBEFIWRAPPER_DRIVERS), echo "&"$(drv)_drv, >> $@;)
$(hide) echo "NULL" >> $@
$(hide) echo "};" >> $@
$(hide) echo "" >> $@
$(hide) echo "ewdrv_t **ew_drivers = drivers;" >> $@
endif
LOCAL_GENERATED_SOURCES := $(GEN)
LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)
LOCAL_CFLAGS := $(EFIWRAPPER_CFLAGS)
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../include/hardware
include $(BUILD_IAFW_STATIC_LIBRARY)
Loading