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
发表评论 取消回复