Cross-Compiling, Boomstick Target
Posted: Fri Nov 23, 2012 5:17 pm
Hi,
I've been working a lot, but I still haven't gotten a kernel to load from my bootloader (which I rewrote). The issue right now is that I can't compile a flat binary for the second-stage bootloader/kernel. Host system is x86-64 Windows 7, using Cygwin.
I have read through the BabySteps tutorials, and am now working on implementing from the C Bare Bones tutorial, but I got stuck when trying to link my second stage bootloader with my basic kernel. I get:
Some Googling didn't turn up anything relevant, so I decided to actually set up a cross-compiler as recommended. In all honesty though, I don't understand how it differs so greatly from an ordinary compiler.
After reviewing the cross-compiler page, I found Boomstick, which appears to automate the process. I had to change the build.sh substantially (some of the packages aren't at their old locations), so I updated all the URLs and removed the old patches. The result is the following, which may, (if what I did makes sense) be of some use:The problem is that after a certain amount through, it will print this:What the right thing intended here was I knew even less than usual, so I didn't guess.
Can someone please explain what the --target parameter of configure in Boomstick was supposed to be? And possibly also why Cygwin's default ld didn't work?
Thanks,
I've been working a lot, but I still haven't gotten a kernel to load from my bootloader (which I rewrote). The issue right now is that I can't compile a flat binary for the second-stage bootloader/kernel. Host system is x86-64 Windows 7, using Cygwin.
I have read through the BabySteps tutorials, and am now working on implementing from the C Bare Bones tutorial, but I got stuck when trying to link my second stage bootloader with my basic kernel. I get:
Code: Select all
ld.exe: bootloader2.o: Relocations in generic ELF (EM: 3)
After reviewing the cross-compiler page, I found Boomstick, which appears to automate the process. I had to change the build.sh substantially (some of the packages aren't at their old locations), so I updated all the URLs and removed the old patches. The result is the following, which may, (if what I did makes sense) be of some use:
Code: Select all
OSNAME=myos
BINUTILS_VER=2.23.1
GCC_VER=4.6.3
GMP_VER=5.0.2
MPFR_VER=3.1.1
NEWLIB_VER=1.20.0
MPC_VER=0.8.1
export TARGET=x86_64-pc-${OSNAME}
export PREFIX=`pwd`/local
mkdir -p build
mkdir -p local
cd build
WFLAGS=-c
export PATH=$PREFIX/bin:$PATH
# Fetch each package
echo "FETCH BINUTILS"
wget $WFLAGS http://ftp.gnu.org/gnu/binutils/binutils-${BINUTILS_VER}.tar.gz
tar -xf binutils-${BINUTILS_VER}.tar.gz
echo "FETCH GCC"
wget $WFLAGS http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-core-${GCC_VER}.tar.gz
tar -xf gcc-core-${GCC_VER}.tar.gz
wget $WFLAGS http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-g++-${GCC_VER}.tar.gz
tar -xf gcc-g++-${GCC_VER}.tar.gz
wget $WFLAGS http://ftp.gnu.org/gnu/gcc/gcc-${GCC_VER}/gcc-fortran-${GCC_VER}.tar.gz
tar -xf gcc-fortran-${GCC_VER}.tar.gz
echo "FETCH GMP"
wget $WFLAGS http://ftp.gnu.org/gnu/gmp/gmp-${GMP_VER}.tar.gz
tar -xf gmp-${GMP_VER}.tar.gz
echo "FETCH MPFR"
wget $WFLAGS http://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VER}.tar.gz
tar -xf mpfr-${MPFR_VER}.tar.gz
echo "FETCH MPC"
wget $WFLAGS http://www.multiprecision.org/mpc/download/mpc-${MPC_VER}.tar.gz
tar -xf mpc-${MPC_VER}.tar.gz
echo "FETCH NEWLIB"
wget $WFLAGS ftp://sources.redhat.com/pub/newlib/newlib-${NEWLIB_VER}.tar.gz
tar -xf newlib-${NEWLIB_VER}.tar.gz
# Push new code into each package
echo "MAKE OBJECT DIRECTORIES"
mkdir -p binutils-obj
mkdir -p gcc-obj
mkdir -p newlib-obj
mkdir -p gmp-obj
mkdir -p mpfr-obj
mkdir -p mpc-obj
# Compile all packages
echo "COMPILE BINUTILS"
cd binutils-obj
../binutils-${BINUTILS_VER}/configure --target=$TARGET --prefix=$PREFIX --disable-werror || exit
make || exit
make install || exit
cd ..
echo "COMPILE GMP"
cd gmp-obj
../gmp-${GMP_VER}/configure --prefix=$PREFIX --disable-shared || exit
make || exit
make check || exit
make install || exit
cd ..
echo "COMPILE MPFR"
cd mpfr-obj
../mpfr-${MPFR_VER}/configure --prefix=$PREFIX --with-gmp=$PREFIX --disable-shared
make || exit
make check || exit
make install || exit
cd ..
echo "COMPILE MPC"
cd mpc-obj
../mpc-${MPC_VER}/configure --target=$TARGET --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --disable-shared || exit
make || exit
make check || exit
make install || exit
cd ..
echo "AUTOCONF GCC"
cd gcc-${GCC_VER}/libstdc++-v3
#autoconf || exit
cd ../..
echo "COMPILE GCC"
cd gcc-obj
../gcc-${GCC_VER}/configure --target=$TARGET --prefix=$PREFIX --enable-languages=c,c++,fortran --disable-libssp --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --disable-nls --with-newlib || exit
make all-gcc || exit
make install-gcc || exit
cd ..
echo "AUTOCONF NEWLIB"
cd newlib-${NEWLIB_VER}/newlib/libc/sys
autoconf || exit
cd ${OSNAME}
autoreconf || exit
cd ../../../../..
echo "CONFIGURE NEWLIB"
cd newlib-obj
../newlib-${NEWLIB_VER}/configure --target=$TARGET --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX || exit
echo "COMPILE NEWLIB"
make || exit
make install || exit
cd ..
echo "PASS-2 COMPILE GCC"
cd gcc-obj
#make all-target-libgcc
#make install-target-libgcc
make all-target-libstdc++-v3 || exit
make install-target-libstdc++-v3 || exit
make || exit
make install || exit
cd ..
echo "PASS-2 COMPILE NEWLIB"
cp ../newlib-files/syscalls.c newlib-${NEWLIB_VER}/newlib/libc/sys/${OSNAME}/syscalls.c
cd newlib-obj
#../newlib-${NEWLIB_VER}/configure --target=$TARGET --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX || exit
make || exit
make install || exit
cd ..
Code: Select all
COMPILE BINUTILS
checking build system type... i686-pc-cygwin
checking host system type... i686-pc-cygwin
checking target system type... Invalid configuration `x86_64-pc-myos': system `myos' not recognized
configure: error: /bin/sh ../binutils-2.23.1/config.sub x86_64-pc-myos failed
Can someone please explain what the --target parameter of configure in Boomstick was supposed to be? And possibly also why Cygwin's default ld didn't work?
Thanks,