EDK2: Significant cleanup and

modularization, and add OVMF as an example of how to use it

svn path=/nixpkgs/trunk/; revision=33059
This commit is contained in:
Shea Levy 2012-03-14 06:57:58 +00:00
parent 853dd7266b
commit 6cf8e4f815
3 changed files with 68 additions and 26 deletions

View File

@ -0,0 +1,19 @@
{ stdenv, edk2 }:
stdenv.mkDerivation (edk2.setup "OvmfPkg/OvmfPkgX64.dsc" {
name = "OVMF-2012-03-13";
src = edk2.src;
patchPhase = ''
rm -fR Conf BaseTools EdkCompatibilityPkg
'';
meta = {
description = "Sample UEFI firmware for QEMU and KVM";
homepage = http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF;
license = "BSD";
maintainers = [ stdenv.lib.maintainers.shlevy ];
platforms = ["x86_64-linux" "i686-linux"];
};
})

View File

@ -2,16 +2,14 @@
let let
targetArch = if stdenv.isi686 then targetArch = if stdenv.isi686 then
"IA32" "IA32"
else if stdenv.isx86_64 then else if stdenv.isx86_64 then
"X64" "X64"
else else
throw "Unsupported architecture"; throw "Unsupported architecture";
in edk2 = stdenv.mkDerivation {
stdenv.mkDerivation {
name = "edk2-2012-03-13"; name = "edk2-2012-03-13";
src = fetchsvn { src = fetchsvn {
@ -24,24 +22,14 @@ stdenv.mkDerivation {
buildPhase = '' buildPhase = ''
make -C BaseTools make -C BaseTools
build="$(pwd)"
cd ..
mv $build $out
export EDK_TOOLS_PATH="$out"/BaseTools
cd $out
. edksetup.sh BaseTools
sed -e 's|Nt32Pkg/Nt32Pkg.dsc|MdeModulePkg/MdeModulePkg.dsc|' -e \
's|MYTOOLS|GCC46|' -e 's|IA32|${targetArch}|' -e 's|DEBUG|RELEASE|'\
< $out/Conf/target.txt > target.txt.tmp
mv target.txt.tmp $out/Conf/target.txt
sed -e 's|DEFINE GCC46_IA32_PREFIX = /usr/bin/|DEFINE GCC46_IA32_PREFIX = ""|' \
-e 's|DEFINE GCC46_X64_PREFIX = /usr/bin/|DEFINE GCC46_X64_PREFIX = ""|' \
-e 's|DEFINE UNIX_IASL_BIN = /usr/bin/iasl|DEFINE UNIX_IASL_BIN = ${iasl}/bin/iasl|' < $out/Conf/tools_def.txt > tools_def.txt.tmp
mv tools_def.txt.tmp $out/Conf/tools_def.txt
build
''; '';
installPhase = "true"; installPhase = ''
mkdir -vp $out
mv -v BaseTools $out
mv -v EdkCompatibilityPkg $out
mv -v edksetup.sh $out
'';
meta = { meta = {
description = "Intel EFI development kit"; description = "Intel EFI development kit";
@ -50,4 +38,37 @@ stdenv.mkDerivation {
maintainers = [ stdenv.lib.maintainers.shlevy ]; maintainers = [ stdenv.lib.maintainers.shlevy ];
platforms = ["x86_64-linux" "i686-linux"]; platforms = ["x86_64-linux" "i686-linux"];
}; };
}
passthru = {
setup = projectDscPath: attrs: {
buildInputs = [ pythonFull ] ++
stdenv.lib.optionals (attrs ? buildInputs) attrs.buildInputs;
configurePhase = ''
mkdir -v Conf
sed -e 's|Nt32Pkg/Nt32Pkg.dsc|${projectDscPath}|' -e \
's|MYTOOLS|GCC46|' -e 's|IA32|${targetArch}|' -e 's|DEBUG|RELEASE|'\
< ${edk2}/BaseTools/Conf/target.template > Conf/target.txt
sed -e 's|DEFINE GCC46_IA32_PREFIX = /usr/bin/|DEFINE GCC46_IA32_PREFIX = ""|' \
-e 's|DEFINE GCC46_X64_PREFIX = /usr/bin/|DEFINE GCC46_X64_PREFIX = ""|' \
-e 's|DEFINE UNIX_IASL_BIN = /usr/bin/iasl|DEFINE UNIX_IASL_BIN = ${iasl}/bin/iasl|' \
< ${edk2}/BaseTools/Conf/tools_def.template > Conf/tools_def.txt
export WORKSPACE="$PWD"
export EFI_SOURCE="$PWD/EdkCompatibilityPkg"
ln -sv ${edk2}/BaseTools BaseTools
ln -sv ${edk2}/EdkCompatibilityPkg EdkCompatibilityPkg
. ${edk2}/edksetup.sh BaseTools
'';
buildPhase = "
build
";
installPhase = "mv -v Build $out";
} // (removeAttrs attrs [ "buildInputs" ] );
};
};
in
edk2

View File

@ -5192,6 +5192,8 @@ let
oidentd = callPackage ../servers/identd/oidentd { }; oidentd = callPackage ../servers/identd/oidentd { };
openfire = callPackage ../servers/xmpp/openfire { }; openfire = callPackage ../servers/xmpp/openfire { };
OVMF = callPackage ../applications/virtualization/OVMF { };
postgresql = postgresql83; postgresql = postgresql83;