Code Monkey home page Code Monkey logo

intel / unicorn-for-efi Goto Github PK

View Code? Open in Web Editor NEW
32.0 4.0 7.0 12.79 MB

Unicorn Engine port for UEFI firmware

Home Page: https://www.unicorn-engine.org/

License: GNU General Public License v2.0

Ruby 0.65% CMake 0.27% Makefile 0.12% Python 1.76% F# 0.76% C# 0.10% Go 0.54% C 90.13% Haskell 0.56% Java 1.59% Pascal 0.81% Shell 0.75% Rust 0.57% Visual Basic 6.0 0.67% C++ 0.43% DenizenScript 0.02% Objective-C 0.24% Assembly 0.01% NASL 0.02%
uefi unicorn efi firmware

unicorn-for-efi's Introduction

Unicorn Engine port for UEFI firmware

Last updated: March 4th, 2024.

This fork of the Unicorn Engine brings support for building Unicorn-based applications and drivers in the UEFI firmware environment. This was developed as part of MultiArchUefiPkg.

This repo is intended to be temporary, as part of upstreaming activities. Our intention is to merge the UEFI support and assorted fixes into the main project repository.

See README.md for the original Unicorn Engine README.

Building

Currently the supported targets are AARCH64 UEFI and RISCV64 UEFI.

You need the TianoCore UEFI EDK2 environment set up. Here's an example for how the some of the Unicorn sample apps could be built in an EDK2 environment targeting RISCV64:

. edksetup.sh
export GCC5_RISCV64_PREFIX=riscv64-linux-gnu-

build -a RISCV64 -t GCC5 -p unicorn/efi/UnicornPkg.dsc -b DEBUG

You get UnicornSampleX86, UnicornSampleArm64 and UnicornSampleRV. The latter shows how it's possible to link against multiple target emulation libraries.

MultiArchUefiPkg itself is a great example of how to use Unicorn with UEFI.

Tested Compilers

Here's a rough idea of what's supposed to work. File bugs if UnicornPkg doesn't build for you.

AArch64

  • gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

RISC-V

X64

  • gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  • gcc version 13.1.0 (Homebrew GCC 13.1.0)

FAQ

Help, building UnicornPkg.dsc crashes during linking!

You're using a smaller machine and LTO is consuming all memory. Modify the UC_LTO_JOBS build parameter in UnicornPkg.dsc If the value is too high, the build may abort. If the value is too low, the build may take forever.

Help, building UnicornPkg.dsc takes forever!

Modify the UC_LTO_JOBS build parameter in UnicornPkg.dsc to a higher value or 'auto'. If the value is too high, the build may abort. If the value is too low, the build may take forever.

Note: newer versions of GCC (e.g. GCC 13) do much better with LTO compared to GCC 9, both in terms of speed and resource use.

unicorn-for-efi's People

Contributors

adrianherrera avatar andreiw avatar aquynh avatar bet4it avatar catenacyber avatar chenhuitao avatar chfl4gs avatar cseagle avatar danghvu avatar domenukk avatar enkomio avatar eqv avatar farmdve avatar feliam avatar jonathonreinhart avatar lunixbochs avatar mothran avatar mrexodia avatar practicalswift avatar qducasse avatar relapids avatar rhelmot avatar samothtronicien avatar sashs avatar seanheelan avatar stephengroat avatar tsrberry avatar williballenthin avatar wtdcode avatar xizhizhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

unicorn-for-efi's Issues

Investigate LTO issue seen with AArch64 builds

There is an AArch64 issue where due to LTO the build of UnicornSampleArm64
takes forever and then bombs out complaining about missing __ashrti3.
A workaround is to modify the EDK2 Conf/tools_def.txt to avoid LTO.

A few questions regarding the design

Hello!

I'm the maintainer from the Unicorn Engine and find this repo accidentally. I can see a few interesting designs & implementations here, and I'm happy you also plan to merge them upstream by following our convention. I have a few questions to discuss here:

This commit enables Unicorn to build in EFI environment. I'm totally new to EFI development and may I know if it's possible to do this with cmake? I think we want a single build system to handle everything.

If I understand it correctly, this API tricks tcg to call any given native code. Could you illustrate its usage and motivation?

btw, is it related to unicorn-engine/unicorn#1839 ?

Why do you need to hook for "hooks"?

  • LTO

I see many commits are related to LTO, why LTO is desired with EFI?

Thanks for your efforts and patience!

Support X64 builds.

Today efi/UnicornPkg.dsc only builds for AArch64 and RISCV64 targets. Enable X64 builds as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.