0xC*_*22L 7 linux gcc abi cross-compiling linux-kernel
现在的问题是相对简单的:我怎样才能建立4.x版系列的GCC(连同的binutils和朋友),关于相同的架构主机编译器的目标2.4 ABI?
主机系统将是x86或x86_64,唯一的要求是只要ABI匹配,构建的ELF文件就在旧内核上运行.(存在内核源/头)
为了将其链接,也需要兼容的libc.但是,我也可以动态链接它,因为我知道(g)libc版本.
任何指针都将非常感激.我对crosstool-ng有点熟悉,但这似乎不再支持2.4内核了(出于显而易见的原因).
最简单的方法可能是在旧操作系统上设置现代工具链。
RHEL 2.1 或 3 可能是最好的,因为直到最近才支持它们。
编译 gcc 4 可能很棘手,因为您还需要数学库。您可能需要采取多阶段方法。
编辑:
对于编译较新的 gcc:
像这样的东西:
cd ~/software
tar xjf $DOWNLOAD/gcc/gcc-core-${GCCVER}.tar.bz2 || failure "unpack gcc failed"
tar xjf $DOWNLOAD/gcc/gcc-g++-${GCCVER}.tar.bz2 || failure "unpack g++ failed"
cd gcc-${GCCVER}
tar xjf $DOWNLOAD/gmp-5.0.2.tar.bz2 || failure "unpack gmp failed"
#tar xjf $DOWNLOAD/gmp-4.3.2.tar.bz2 || failure "unpack gmp failed"
ln -s gmp-* gmp
tar xjf $DOWNLOAD/mpfr-2.4.2.tar.bz2 || failure "unpack mpfr failed"
#tar xjf $DOWNLOAD/mpfr-2.4.2.tar.bz2 || failure "unpack mpfr failed"
ln -s mpfr-* mpfr
tar xzf $DOWNLOAD/mpc-0.9.tar.gz || failure "unpack mpc failed"
ln -s mpc-* mpc
cd ..
mkdir gcc-build
cd gcc-build
../gcc-${GCCVER}/configure --prefix=/opt/tools || failure "configure failed"
make || failure "make failed"
make install || failure "install failed"
Run Code Online (Sandbox Code Playgroud)