Running OpenRISC on RedHat

Rui Zhang
3 min readFeb 19, 2016

--

I spent several hours last night to set up OpenRISC on the new server and summarized all steps. The following is a quick guide to help you get OpenRISC running on a RedHat server. Most of the contents are based on OpenRISC website, but minor changes have been made in this guide for RedHat. The RedHat release I am dealing with is Red Hat Enterprise Linux Server release 6.7 (Santiago). Hope this guide can help people who need to run OpenRISC on a RedHat server like me. Enjoy!

Part 0: Installing gcc 4.8 on CentOS 6

The GCC distributed with CentOS 6 is 4.4.7, which is pretty outdated. So first of all, gcc 4.8+ needs to be installed. If you have a later version of gcc, you can skip this part. To install gcc 4.8+, follow the guide in this link: https://gist.github.com/stephenturner/e3bc5cfacc2dc67eca8b

Part 1: OpenRISC GNU Toolchain Installation

Make sure you are using bash and you have your gcc 4.8+ environment variables enabled.

scl enable devtoolset-2 bash

Install all required libraries to compile the GNU tools.

sudo yum install build-essential make gcc g++ flex bison patch texinfo ncurses-devel libmpfr-devel libgmp3-devel libmpc-devel libzip-devel

Download and extract all the necessary tools.

wget http://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.bz2
tar xjvf binutils-2.25.tar.bz2
git clone git://github.com/openrisc/or1k-gcc.git
git clone git://github.com/openrisc/or1k-src.git
git clone git://sourceware.org/git/newlib.git

Set up environment variables.

export PREFIX=/opt/or1k-elf
export PATH=$PATH:$PREFIX/bin
sudo mkdir $PREFIX

Build binutils:

mkdir build-binutils; cd build-binutils
../binutils-2.25/configure --target=or1k-elf --prefix=$PREFIX --enable-shared --disable-itcl --disable-tk --disable-tcl --disable-winsup --disable-gdbtk --disable-libgui --disable-rda --disable-sid --disable-sim --with-sysroot
make
make install
cd ..

Build gcc stage1:

mkdir build-gcc-stage1; cd build-gcc-stage1
../or1k-gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c --disable-shared --disable-libssp
make
make install
cd ..

Build newlib:

mkdir build-newlib; cd build-newlib
../newlib-2.2.0.20150225/configure --target=or1k-elf --prefix=$PREFIX
make
make install
cd ..

Build gcc stage2:

mkdir build-gcc-stage2; cd build-gcc-stage2
../or1k-gcc/configure --target=or1k-elf --prefix=$PREFIX --enable-languages=c,c++ --disable-shared --disable-libssp --with-newlib
make
make install
cd ..

Build gdb:

mkdir build-gdb; cd build-gdb
../or1k-src/configure --target=or1k-elf --prefix=$PREFIX --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 --disable-newlib --disable-libgloss
make
make install
cd ..

Finally, don’t forget to add the following line to your ~/.bashrc file.

export PATH=$PATH:/opt/or1k-elf/bin

Part 2: ORPSoCv2 Installation

Download ORPSoCv2:

git clone https://github.com/lab305itep/orpsocv2.git

Install Icarus Verilog:

yum install iverilog

Install the SystemC library: Download the Core SystemC Language and Examples from http://www.accellera.org/downloads/standards/systemc. Then extract the file and install it:

tar zxvf systemc-2.3.1.tgz
cd systemc-2.3.1
mkdir objdir
cd objdir
export CXX=g++
../configure
make
sudo make install

Add export SYSTEMC=/OpenRISC/system-2.3.1 to ~/.bashrc

Install the Verilog-Perl library: Download the Verilog-Perl-3.418 from http://search.cpan.org/~wsnyder/. Then extract the file and install it:

tar xvzf InstlPkgs/Verilog-Perl-3.418.tar.gz
cd Verilog-Perl-3.418
perl Makefile.PL
make
make test
sudo make install

Install the System-Perl library: Download the SystemPerl-1.344 from http://search.cpan.org/~wsnyder/. Then extract the file and install it:

tar xvzf InstlPkgs/SystemPerl-1.344.tar.gz
cd SystemPerl-1.344
perl Makefile.PL
make
sudo make install

Installing the Verilator library:

git clone http://git.veripool.org/git/verilator
cd verilator
autoconf
./configure
make
sudo make install

You are all set!

--

--