User:Columbus/OR1K Toolchain
Jump to navigation
Jump to search
A tutorial, how to build a OpenRISC toolchain. At the end of the tutorial, you have a GCC-Toolchain for or1k. I'm trying to use it for OS deving. I'll update it, when I've found other/better solutions, or a toolchain, that is good for OS deving.
Prerequisites
You must have git installed, and the folder /opt/or1k-toolchain should exist, and the user you're using should have write access.
Compiling the toolchain
The toolchain gets installed to /opt/or1k-toolchain In some directory do
# Clone repos
git clone git://github.com/openrisc/or1k-src.git
git clone git://github.com/openrisc/or1k-gcc.git
# Create build directories
mkdir build-or1k-src build-or1k-gcc
# Extend $PATH
export PATH=$PATH:/opt/or1k-toolchain
# Build src
cd build-or1k-src
../or1k-src/configure --target=or1k-elf \
--prefix=/opt/or1k-toolchain --enable-shared \
--disable-itcl --disable-tk --disable-tcl \
--disable-winsup --disable-gdbtk \
--disable-libgui --disable-rda --disable-sid \
--disable-sim --disable-gdb --with-sysroot \
--disable-newlib --disable-libgloss \
--disable-werror
make -j8
make install
# Build gcc
cd ../bld-or1k-gcc
../or1k-gcc/configure --target=or1k-elf \
--prefix=/opt/or1k-toolchain --enable-languages=c \
--disable-shared --disable-libssp --disable-werror
make -j8
make install -j8
# Rebuild src with newlib
cd ../bld-or1k-src
rm -rf *
../or1k-src/configure --target=or1k-elf \
--prefix=/opt/or1k-toolchain --enable-shared \
--disable-itcl --disable-tk --disable-tcl \
--disable-winsup --disable-gdbtk \
--disable-libgui --disable-rda --disable-sid \
--enable-sim --disable-or1ksim --enable-gdb \
--with-sysroot --enable-newlib \
--enable-libgloss --disable-werror
make -j8
make install -j8
# Rebuild gcc with newlib
cd ../bld-or1k-gcc
rm -rf *
../or1k-gcc/configure --target=or1k-elf \
--prefix=/opt/or1k-toolchain --enable-languages=c,c++ \
--disable-shared --disable-libssp --with-newlib \
--disable-werror
make -j8
make install -j8
Further
You can now
ls /opt/or1k-toolchain/bin
To see what got installed, and what the commands are you should use. Use
or1k-elf-run <filename>
To run an or1k-application