Building Cross Compiler Tools on the RPiThese instructions were derived from https://pdos.csail.mit.edu/6.828/2014/tools.html Note the following: You need to have networking up and running on your RPi2. Raspbian Packages Needed First do: $ sudo apt-get update Need to install a few packages on Raspbian: $ sudo apt-get install m4 $ sudo apt-get install libncurses5-dev $ sudo apt-get install libpixman-1-dev $ sudo apt-get install libglib2.0-dev Download the following using wget (e.g, put these in your Downloads directory in your home directory): ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2 http://ftp.gnu.org/gnu/mpfr/mpfr-3.1.3.tar.bz2 http://www.multiprecision.org/mpc/download/mpc-0.9.tar.gz http://ftpmirror.gnu.org/binutils/binutils-2.21.1.tar.bz2 http://gnu.mirror.vexxhost.com/gcc/gcc-4.8.5/gcc-4.8.5.tar.bz2 http://ftpmirror.gnu.org/gdb/gdb-7.3.1.tar.bz2 E.g, $ cd $ mkdir Downloads $ cd Downloads $ wget ftp://ftp.gmplib.org/pub/gmp-5.0.2/gmp-5.0.2.tar.bz2 $ sudo mkdir /opt/i386dev Create a src dir (you can put this somewhere in your home directory): $ cd $ mkdir src untar files into src dir, e.g., $ cd src $ tar xvjf ~/Downloads/gmp-5.0.2.tar.bz2 (note use tar xvzf for .gz files) Configure, compile and install each package: gmp $ cd gmp-5.0.2 $ ./configure --disable-shared --enable-static --prefix=/opt/i386dev $ make -j 4 $ sudo make install mpfr $ ./configure --disable-shared --enable-static --prefix=/opt/i386dev --with-gmp=/opt/i386dev $ make -j 4 $ sudo make install mpc $ cd mpc-0.9 $ ./configure --disable-shared --enable-static --prefix=/opt/i386dev --with-gmp=/opt/i386dev --with-mpfr=/opt/i386dev $ make -j 4 $ sudo make install binutils $ cd binutils-2.21.1 gcc $ cd gcc-4.8.5 gdb $ cd gdb-7.3.1$ ./configure --enable-static=yes --prefix=/opt/i386dev --target=i386-xv6-elf --program-prefix=i386-xv6-elf- --disable-werror $ make -j 4 all $ sudo make install qemu $ cd src $ git clone https://github.com/geofft/qemu.git -b 6.828-1.7.0 $ cd qemu $./configure --static --disable-kvm --disable-sdl --disable-werror --prefix=/opt/i386dev --target-list="i386-softmmu x86_64-softmmu"$ make -j 4 $ sudo make install xv6 $ cd src $ git clone git://github.com/mit-pdos/xv6-public.git $ cd xv6-public $ cp Makefile Makefile.org # Now put the Makefile attached below into xv6-public $ make $ make qemu Using gdb Follow the instruction here: Note that you need to use the cross compiled gdb, not the host gdb when debugging the kernel. For example, in the xv6 directory type: $ /opt/i386dev/bin/i386-xv6-elf-gdb kernel You may want to setup an alias for 'gdb_xv6' or something similar. cgdb cgdb is a nicer curses-based front end to gdb To compile in Raspbian on the RPi you need some additional packages: $ sudo apt-get install automake $ sudo apt-get install flex $ sudo apt-get install texinfo $ sudo apt-get install help2man $ sudo apt-get install libreadline6-dev $ cd src $ git clone git://github.com/cgdb/cgdb.git $ cd cgdb $ ./autogen.sh $ ./configure --prefix=/opt/i386dev --target=i386-xv6-elf --program-prefix=i386-xv6-elf- $ make -j 4 $ sudo make install Then use cgdb instead of gdb: $ /opt/i386dev/bin/i386-xv6-elf-cgdb -d /opt/i386dev/bin/i386-xv6-elf-gdb kernel |
Lectures >