我是靠谱客的博主 完美悟空,最近开发中收集的这篇文章主要介绍在Ubuntu下面编译EDK2 模拟器,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

前两天看别人用VS2005编译EDK的代码,然后调试,很惊奇,以前我都是在命令提示符下面编的。

第一次用VS2005编译EDK2的代码,感觉和以前的改变蛮大的,不过说明文档还是很详细的。

 

 

昨天晚上突然想到EDK2模拟器已经可以在Linux下面编译运行了!

也随便熟悉下新的Ubuntu 10.04.

http://docs.google.com/Doc?docid=0Ae9pEjPwQY7KZGc0dDV3emtfMGdkcjQzdg&hl=en

 

 

 

Build EDKII in Ubuntu 10.04

refer to: https://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Unix-like_systems

1.in ~:
 bash$ sudo apt-get install build-essential uuid-dev texinfo /
       bison flex libgmp3-dev libmpfr-dev subversion
bash$ mkdir ~/src
bash$ cd ~/srcsvn co /
 https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2 /
 --username guest
bash$ make -C edk2/BaseTools
bash$ cd ~/src/edk2/BaseTools/gcc
2.
X64:
bash$ ./mingw-gcc-build.py --arch=x64 --prefix=~/programs/gcc/x64

in EDKII(svn revision:10467), there is a bug:
BaseTools/gcc/mingw-gcc-build.py (line:217)
///
    source_files_x640 = {
        'gcc': {
            'url': 'http://ftpmirror.gnu.org/gcc/' + /
                   'gcc-$version/gcc-$version.tar.bz2',
            'version': '4.3.0',
            'md5': '197ed8468b38db1d3481c3111691d85b',
            },
        'mingw_hdr': {
            'url': 'http://sourceforge.net/projects/' + /
                   'mingw-w64/files/mingw-w64/mingw-w64-snapshot/' + /
                   'mingw-w64-v1.0-snapshot-$version.tar.bz2/download',
            'extract-dir': os.path.join('mingw-w64-v1.0-$version',
'mingw-w64-headers'),
            'version': '20100223',
            'md5': '700b9f54e740b1b962c8a3a0f52b7c04',
            },
        }
///
Should modify to:
///
    source_files_x64 = {
        'gcc': {
            'url': 'http://ftpmirror.gnu.org/gcc/' + /
                   'gcc-$version/gcc-$version.tar.bz2',
            'version': '4.3.0',
            'md5': '197ed8468b38db1d3481c3111691d85b',
            },
        'mingw_hdr': {
            'url': 'http://sourceforge.net/projects/' + /
                   'mingw-w64/files/mingw-w64/mingw-w64-snapshot/' + /
                   'mingw-w64-v1.0-snapshot-$version.tar.bz2/download',
            'extract-dir': os.path.join('mingw-w64-v1.0-$version',
'mingw-w64-headers'),
            'version': '20100228',
            'md5': '7aafb39c768c087e78f845957fd69f74',
            },
        }
///

Modify Conf Files

You will need to edit the Conf/tools_def.txt and Conf/target.txt files. These changes will enable the MdeModulePkg to be built using the gcc x64 compiler.

Enable GCC X64 Cross-Compiler

For the Conf/tools_def.txt file, find the following entry and comment the line out:

DEFINE UNIXGCC_X64_PETOOLS_PREFIX = /opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin/

Next, find the following entry and uncomment the line:

DEFINE UNIXGCC_X64_PETOOLS_PREFIX = ENV(HOME)/programs/gcc/x64/bin/x86_64-pc-mingw32-

To enable building your target image with X64 support the Conf/target.txt will also need to be modified.

Find the TARGET_ARCH definition in Conf/target.txt and change the corresponding line to match this

TARGET_ARCH = X64


or
IA32:
bash$ cd ~/src/edk2/BaseTools/gcc bash$ ./mingw-gcc-build.py --arch=ia32 / --prefix=~/programs/gcc/ia32

Modify Conf Files

Once the cross-compiler has been successfully built the Conf/tools_def.txt will need to be updated so the cross-compiler can be used.

Find the following statement in Conf/tools_def.txt and comment the line out:

DEFINE UNIXGCC_IA32_PETOOLS_PREFIX = /opt/tiano/i386-tiano-pe/i386-tiano-pe/bin/

Next, find the following statement and uncomment the line:

DEFINE UNIXGCC_IA32_PETOOLS_PREFIX = ENV(HOME)/programs/gcc/ia32/bin/i686-pc-mingw32-

To enable building your target image with IA32 support the Conf/target.txt will also need to be modified.

Find the TARGET_ARCH definition in Conf/target.txt and change the corresponding line to match this

TARGET_ARCH = IA32

3.Modify Conf/target.txt for Linux
ACTIVE_PLATFORM       = UnixPkg/UnixPkg.dsc
#set for *inux OS:
TOOL_CHAIN_TAG = ELFGCC


4.C ompile & build run:
bash$ cd ~/src/edk2
bash$ export EDK_TOOLS_PATH=~/src/edk2/BaseTools
bash$ . edksetup.sh BaseTools
bash$ build
bash$ cd ~/src/edk2/UnixPkg
bash$ ./build.sh run

   bash$ (gdb) run

Then it would be:

Run EDK2 Emulator in Ubuntu

 

---xt

最后

以上就是完美悟空为你收集整理的在Ubuntu下面编译EDK2 模拟器的全部内容,希望文章能够帮你解决在Ubuntu下面编译EDK2 模拟器所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(67)

评论列表共有 0 条评论

立即
投稿
返回
顶部