在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


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 /
 --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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值