先下载 Binutils 2.20 和 GCC Core 4.4.2。
Binutils 2.20: http://ftp.gnu.org/gnu/binutils/binutils-2.20.tar.bz2
Binutils 2.20 Loongson2f 补丁: http://heiher.info/sftp/files/binutils-2.20-loongson2f.patch
GCC Core: http://ftp.gnu.org/gnu/gcc/gcc-4.4.2/gcc-core-4.4.2.tar.bz2
设置环境变量和新建目录
$ mkdir -p /opt/loongson-cross-tools/usr/{bin, lib, share} $ echo "PATH=$PATH:/opt/loongson-cross-tools/usr/bin" >> ~/.bashrc |
编译 Binutils:
$ tar xjf binutils-2.20.tar.bz2 $ cd binutils-2.20 $ patch -Np1 -i ../binutils-2.20-loongson2f.patch $ cd .. && mkdir binutils-build && cd binutils-build $ ../binutils-2.20/configure --prefix=/opt/loongson-cross-tools/usr --target=mipsel-pc-linux-gnu --with-sysroot=/opt/loongson-cross-tools --enable-64-bit-bfd --disable-nls --enable-shared $ make configure-host $ make $ make install |
编译 GCC:
$ tar xjf gcc-core-4.4.2.tar.bz2 $ mkdir gcc-build && cd gcc-build $ ../gcc-4.4.2/configure --prefix=/opt/loongson-cross-tools/usr --target=mipsel-pc-linux-gnu --with-sysroot=/opt/loongson-cross-tools --disable-multilib --with-newlib --disable-nls --disable-shared --disable-threads --enable-languages=c --with-abi=64 $ make all-gcc $ make all-target-libgcc $ make install-gcc $ make install-target-libgcc |
Over!
I got error after execute make command for compiling binutils-2.20 under Ubuntu 9.10
I wonder why?
please help!
libtool: link: ar cru .libs/libbfd.a archive.o archures.o bfd.o bfdio.o bfdwin.o cache.o coffgen.o corefile.o format.o init.o libbfd.o opncls.o reloc.o section.o syms.o targets.o hash.o linker.o srec.o binary.o tekhex.o ihex.o stabs.o stab-syms.o merge.o dwarf2.o simple.o compress.o verilog.o elf32-mips.o elfxx-mips.o elf-vxworks.o elf32.o elf.o elflink.o elf-attrs.o elf-strtab.o elf-eh-frame.o dwarf1.o ecofflink.o coff-mips.o ecoff.o elfn32-mips.o elf64-mips.o elf64.o elf64-gen.o elf32-gen.o cpu-mips.o archive64.o
ar: symbol lookup error: ar: undefined symbol: bfd_plugin_set_program_name
make[4]: *** [libbfd.la] 错误 127
make[4]:正在离开目录 `/home/bill/loongson/binutils-build/bfd’
http://www.heiher.info/service/files/binutils-2.20-loongson2f.patch
this address is not valid,would you please tell me how to load this patch?
thanks in advance.
scp sftp@heiher.info:heiher/files/binutils-2.20-loongson2f.patch .
password: sftp
scp sftp@heiher.info:heiher/files/binutils-2.20-loongson2f.patch .
ssh: connect to host heiher.info port 22: Connection timed out
求破啊
这些补丁已经合并到官方,现在应该不再用自己打补丁了。
我按照你方法做了一个,但是没头文件与库
在网上看了下,要另安一些软件
请问与之对应的
glibc
glibc-linuxtheads
linux-glibc-headers
linux-kernel
的这些版本是随意的还是有针对性,如果是有针对性的怎么知道是哪个版本
这个方法是用于编译内核交叉编译环境的,没有C库。我当时是在 Unix Center 的服务器上做的。如果需要编译应用程序,还需要交叉编译C库,不过用处不大。