summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kuhn (Wuodan) <wuodan-gentoo@hispeed.ch>2012-08-31 19:03:00 +0200
committerStefan Kuhn (Wuodan) <wuodan-gentoo@hispeed.ch>2012-08-31 19:03:00 +0200
commita4f46cd900f6ec0c4874b1209ff11b235b922870 (patch)
tree6dd07b3319f4f487d4769b946047cff70a688c10
parentapp-cdr/dumpet-2.1 : reviewed by sunrise but they show no interest in (diff)
downloadwuodan-a4f46cd900f6ec0c4874b1209ff11b235b922870.tar.gz
wuodan-a4f46cd900f6ec0c4874b1209ff11b235b922870.tar.bz2
wuodan-a4f46cd900f6ec0c4874b1209ff11b235b922870.zip
sys-firmware/edk2 : work in progress, but compiles/runs here
-rw-r--r--sys-firmware/edk2/Manifest2
-rw-r--r--sys-firmware/edk2/edk2-0.ebuild186
-rw-r--r--sys-firmware/edk2/metadata.xml17
3 files changed, 205 insertions, 0 deletions
diff --git a/sys-firmware/edk2/Manifest b/sys-firmware/edk2/Manifest
new file mode 100644
index 0000000..daf33a6
--- /dev/null
+++ b/sys-firmware/edk2/Manifest
@@ -0,0 +1,2 @@
+EBUILD edk2-0.ebuild 6237 SHA256 f423e0d4cf707316399b09f5e3ec9a325943ee831d10468f614be070e99ec886 SHA512 1b991d1916f1fe5dca976c5d0242281dd8bb2b3ed3696624e5fac2c17ee15862524537545f3c92f8ff4afbd8e751d3282d1b2879968b0186cb7067dcd7453b69 WHIRLPOOL 1c3fda85a8c39eed60a8bdd83532de92664df8b12e30d43b9f9060eba4e1f96f9742c41f780d0b7bd884e43026145ae96ea259fba5e3584732861c4bbb2123a5
+MISC metadata.xml 634 SHA256 926504f700c193cd127263da7e38869bbc5a79260811fd0ebb49097d576e5191 SHA512 184cbcc668a57b07238e13fa7a4c3a15cb9c277265bd3071324e97d7f9c89a7a5eff37e393335a338381d7ee3cdb2626495f9e91b53b3fc06cf77b0fc36d45a8 WHIRLPOOL 7dc634a6befd693939988d936abb225861b2a6077084edfa64df1150e9b2054f11c33ee108faa5588395dfcdefe6056ab74f16ddd46cec096b04731afbe7b0da
diff --git a/sys-firmware/edk2/edk2-0.ebuild b/sys-firmware/edk2/edk2-0.ebuild
new file mode 100644
index 0000000..2f5c80e
--- /dev/null
+++ b/sys-firmware/edk2/edk2-0.ebuild
@@ -0,0 +1,186 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+EAPI=4
+
+PYTHON_DEPEND="2"
+PYTHON_USE_WITH="sqlite"
+inherit python subversion toolchain-funcs flag-o-matic
+
+DESCRIPTION="A modern, feature-rich, cross-platform firmware development env. for the UEFI and PI specifications"
+HOMEPAGE="http://sourceforge.net/apps/mediawiki/tianocore"
+SRC_URI=""
+REPO_REV="@11337"
+# REPO_REV="@13452"
+# REPO_REV="@13692"
+ESVN_REPO_URI="http://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2"
+REPO_PKG="
+ MdePkg
+ MdeModulePkg
+"
+use kvm && REPO_PKG+="
+ OvmfPkg
+ OptionRomPkg
+ UefiCpuPkg
+ IntelFrameworkModulePkg
+ PcAtChipsetPkg
+ FatBinPkg
+ EdkShellBinPkg
+ IntelFrameworkPkg
+ "
+( use kvm || use shell ) && REPO_PKG+="
+ ShellPkg
+ "
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64"
+IUSE="hello-world kvm shell"
+
+DEPEND="
+ app-arch/unzip
+ >=dev-vcs/subversion-1.5
+ sys-devel/binutils
+ sys-libs/glibc
+ kvm? (
+ >=app-emulation/qemu-kvm-0.9.1
+ sys-power/iasl
+ )"
+RDEPEND="kvm? ( >=app-emulation/qemu-kvm-0.9.1 )"
+
+S="$(dirname ${S})"
+
+# TODO:
+# fix this:
+# In function ‘void* memset(void*, int, size_t)’,
+# inlined from ‘SVfrVarStorageNode::SVfrVarStorageNode(EFI_GUID*, CHAR8*, EFI_VARSTORE_ID, EFI_STRING_ID, UINT32, BOOLEAN)’ at VfrUtilityLib.cpp:1309:41:
+# /usr/include/bits/string3.h:85:70: warning: call to void* __builtin___memset_chk(void*, int, long unsigned int, long unsigned int) will always overflow destination buffer
+# In function ‘void* memset(void*, int, size_t)’,
+# inlined from ‘SVfrVarStorageNode::SVfrVarStorageNode(EFI_GUID*, CHAR8*, EFI_VARSTORE_ID, SVfrDataType*, BOOLEAN)’ at VfrUtilityLib.cpp:1336:41:
+# /usr/include/bits/string3.h:85:70: warning: call to void* __builtin___memset_chk(void*, int, long unsigned int, long unsigned int) will always overflow destination buffer
+
+pkg_setup() {
+ if use !hello-world && use !kvm && use !shell; then
+ die "Select at least one module to be built!"
+ fi
+ python_set_active_version 2
+}
+
+src_unpack(){
+ einfo "### Be patient! ###"
+ einfo "Downloading individual folders is slow, but really decreases total download size."
+ einfo "### Be patient! ###"
+
+ mkdir Conf || die "Failed to 'mkdir Conf'"
+ ESVN_OPTIONS="--depth files" subversion_fetch "${ESVN_REPO_URI}${REPO_REV}"
+ # avoid downloading useless Bin (47MB) folder
+ ESVN_OPTIONS="--depth immediates" subversion_fetch "${ESVN_REPO_URI}/BaseTools${REPO_REV}" BaseTools
+ local dir
+ for dir in `find BaseTools -mindepth 1 -maxdepth 1 -type d | grep -v 'Bin$'`; do
+ subversion_fetch "${ESVN_REPO_URI}/${dir}${REPO_REV}" "${dir}"
+ done
+
+ for dir in ${REPO_PKG}; do
+ subversion_fetch "${ESVN_REPO_URI}/${dir}${REPO_REV}" "${dir}"
+ done
+}
+
+src_prepare(){
+ # errors occur with -O -O1 -O2 but not with -O3
+ filter-flags -O*
+ # patch compiler flags
+ sed -i -r -e "s/^(CC = ).*$/\1`tc-getCC`/" \
+ -e "s/^(CXX = ).*$/\1`tc-getCXX`/" \
+ -e "s/^(AS = ).*$/\1`tc-getAS`/" \
+ -e "s/^(AR = ).*$/\1`tc-getAR`/" \
+ -e "s/^(LD = ).*$/\1`tc-getLD`/" \
+ -e "s/^(CFLAGS = ).*$/\1`echo "${CFLAGS}"`/" \
+ -e "s/^(LFLAGS = ).*$/\1`echo "${LFLAGS}"`/" \
+ BaseTools/Source/C/Makefiles/header.makefile || die "Failed to patch compiler flags"
+ for file in dlg/makefile antlr/makefile support/genmk/makefile; do
+ sed -i -r -e "s/^(CC *= *).*$/\1`tc-getCC`/" \
+ -e "s/^(CXX *= *).*$/\1`echo "${CFLAGS}"`/" \
+ "BaseTools/Source/C/VfrCompile/Pccts/${file}" || die "Failed to patch compiler flags in ${file}"
+ done
+ sed -i -r -e "s/^(DEFINE GCC44_ALL_CC_FLAGS *=.*) -Werror /\1 `echo "${CFLAGS}"` /" \
+ -e "s/gcc$/`tc-getCC`/" \
+ -e "s/as$/`tc-getAS`/" \
+ -e "s/ar$/`tc-getAR`/" \
+ -e "s/ld$/`tc-getLD`/" \
+ BaseTools/Conf/tools_def.template || die "Failed to patch compiler flags"
+}
+
+src_compile(){
+ # $ARCH is used, preserve old value
+ # Gentoo uses 'amd64', the package needs 'X64'
+ local oldARCH="${ARCH}"
+ ARCH='X64'
+
+ # build the cross-compiler
+ emake -C BaseTools
+
+ export EDK_TOOLS_PATH="${S}"/BaseTools
+ # this mainly appends to $PATH
+ . edksetup.sh BaseTools
+
+ # build using the generated cross-compiler
+ # for a list of options, run 'build --help' or look at BaseTools/Source/Python/build/build.py MyOptionParser()
+ # TODO: -n X should be number of CPU+1. See no effect of it so far
+ local tagname="GCC$(gcc-major-version)$(gcc-minor-version)"
+ if use hello-world; then
+ build --arch "${ARCH}" --platform MdeModulePkg/MdeModulePkg.dsc --tagname "${tagname}" \
+ --module MdeModulePkg/Application/HelloWorld/HelloWorld.inf \
+ --buildtarget RELEASE || die "Failed to build HelloWorld"
+ # create startup.nsh for kvm testing
+ echo "fs0:\HelloWorld.efi" > Build/MdeModule/RELEASE_GCC45/X64/startup.nsh || die "Failed to
+ create startup.nsh"
+ fi
+
+ if use kvm; then
+ build --arch "${ARCH}" --platform OvmfPkg/OvmfPkgX64.dsc --tagname "${tagname}" \
+ --buildtarget RELEASE || die "Failed to build UEFI-shell"
+ fi
+
+ if use shell; then
+ build --arch "${ARCH}" --platform ShellPkg/ShellPkg.dsc --tagname "${tagname}" \
+ --module ShellPkg/Application/Shell/Shell.inf \
+ --buildtarget RELEASE || die "Failed to build UEFI-shell"
+ fi
+
+ # reset $ARCH
+ ARCH="${oldARCH}"
+}
+
+src_install(){
+ if use hello-world; then
+ insinto "/usr/share/${PN}/hello-world"
+ doins Build/MdeModule/RELEASE_GCC45/X64/HelloWorld.efi
+ doins Build/MdeModule/RELEASE_GCC45/X64/startup.nsh
+ fi
+
+ if use shell; then
+ insinto "/usr/share/${PN}/shell"
+ newins Build/Shell/RELEASE_GCC45/X64/Shell.efi Shellx64.efi
+ fi
+
+ if use kvm; then
+ insinto "/usr/share/${PN}/kvm"
+ newins Build/OvmfX64/RELEASE_GCC45/FV/OVMF.fd uefibios.bin
+ newins Build/OvmfX64/RELEASE_GCC45/FV/CirrusLogic5446.rom vgabios-cirrus.bin
+ # insinto /usr/share/qemu
+ dosym "../${PN}/kvm/uefibios.bin" /usr/share/qemu/uefibios.bin || die "WTF"
+ fi
+}
+
+pkg_postinst() {
+ use kvm && einfo "To use uefi with qemu-kvm, start it with '-bios uefibios.bin'"
+ if use hello-world; then
+ einfo "A sample HelloWorld.efi was installed in /usr/share/${PN}/hello-world."
+ if use kvm; then
+ einfo "To test the uefi support in kvm, simply run:"
+ einfo " qemu-kvm -hda fat:/usr/share/edk2/hello-world -bios uefibios.bin"
+ einfo "and await the message 'UEFI Hello World!' before the shell prompt appears."
+ fi
+ fi
+}
diff --git a/sys-firmware/edk2/metadata.xml b/sys-firmware/edk2/metadata.xml
new file mode 100644
index 0000000..3dbd636
--- /dev/null
+++ b/sys-firmware/edk2/metadata.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<maintainer>
+<email>maintainer-wanted@gentoo.org</email>
+</maintainer>
+<longdescription lang="en">
+EDK II is a modern, feature-rich, cross-platform firmware development
+environment for the UEFI and PI specifications.
+</longdescription>
+<use>
+<flag name="hello-world">Creates a HelloWorld.efi, ready to use with
+<pkg>app-emulation/qemu-kvm</pkg>.</flag>
+<flag name="kvm">Creates the uefi-bios for <pkg>app-emulation/qemu-kvm</pkg>.</flag>
+<flag name="shell">Creates the uefi-shell.</flag>
+</use>
+</pkgmetadata>