next up previous contents index
Next: Building a cross compiler, Up: Setting up an initial Previous: Setting up a cross   Contents   Index


Downloading the source packages

Table 2.1 lists the package, size and URL, where you can download the source packages. A good choice is the download into a folder of our new cross compiling environment:

$ mkdir SRC


Table 2.1: Source packages, sizes and URLs.
Package Size License URL
binutils-2.11.2 9,701 KB (L)GPLv2 ftp://ftp.gnu.org/gnu/binutils/binutils-2.11.2.tar.gz
gcc-3.0.1 17,631 KB (L)GPLv2 ftp://ftp.gnu.org/gnu/gcc/gcc-3.0.1/gcc-3.0.1.tar.gz
glibc-2.2.4 16,023 KB (L)GPLv2 ftp://ftp.gnu.org/gnu/glibc/glibc-2.2.4.tar.gz
busybox-0.60.5 767 KB GPLv2 http://www.busybox.net/downloads/busybox-0.60.5.tar.gz
sh-boot- 20010831-1455 233 KB LGPLv2 http://www.linuxdevices.com/files/article020/sh-boot-20010831-1455.tar.gz
binutils (Patch) 92 KB - http://www.linuxdevices.com/files/article020/binutils-2.11.2-sh-linux.diff
gcc (Patch) 101 KB - http://www.linuxdevices.com/files/article020/gcc-3.0.1-sh-linux.diff
glibc (Patch) 617 KB - http://www.linuxdevices.com/files/article020/glibc-2.2.4-sh-linux.diff
sh-boot (Patch) 35 KB - http://www.linuxdevices.com/files/article020/sh-boot-20010831-1455.diff


The next step is downloading and patching the Linux kernel. This is organized in three substeps:

  1. Download the Linux kernel, version 2.4.18.
  2. Fetch the sh - patches through CVS

    These patches are SuperH specific and the basic layer for the SEGA Dreamcast patches.

  3. Fetch the SEGA Dreamcast patches through CVS

Figure 2.1 illustrates how these patches interact.

Figure 2.1: The patches against the Linux kernel.
\includegraphics{linux_schichten.eps}

The first step mentioned above is fetching the Linux kernel sources. The kernel is licensed under the terms of the GNU Public License, Version 2 and about 23.0 MB. A nice program for the job is wget:

$ cd Dreamcast
$ mkdir BUILD
$ mkdir KERNEL
$ cd KERNEL
$ wget http://www.kernel.org/pub/linux/kernel\
  /v2.4/linux-2.4.18.tar.bz2

The backslash \ indicates that the following line belongs to the end of the actual line. The next step is the download of the linux-sh patches from the CVS repository (located at www.sourceforge.net). CVS will ask for a password, just press enter, no password is required:

$ cvs -d:pserver:anonymous@cvs.sf.net:\
  /cvsroot/linuxsh login
$ cvs -z3 -d:pserver:anonymous@cvs.sf.net:\
  /cvsroot/linuxsh co -r linux-2_4_18 linux
$ cvs -d:pserver:anonymous@cvs.sf.net:\
  /cvsroot/linuxsh logout
$ mv linux linux-sh

The last step is the download of the linux-sh-dc patches from the CVS repository (located at www.sourceforge.net):

$ cvs -d:pserver:anonymous@cvs.sf.net:\
  /cvsroot/linuxdc login
$ cvs -z3 -d:pserver:anonymous@cvs.sf.net:\
  /cvsroot/linuxdc co -r linux-sh-dc-2_4_18 linux-sh-dc
$ cvs -d:pserver:anonymous@cvs.sf.net:\
  /cvsroot/linuxdc logout

Now, the tricky moment begins. You have to remove the CVS control directories to avoid annoying warnings and errors during kernel compilation and merge all three sources together:

$ cd linux-sh
$ for i in $(find . -type d -name "CVS" -print); do rm -fr $i; done
$ cd ..
$ cd linux-sh-dc
$ for i in $(find . -type d -name "CVS" -print); do rm -fr $i; done
$ cd ..
$ bunzip2 -c linux-2.4.18.tar.bz2 | tar -xv
$ cd linux-sh
$ cp -fr . ../linux
$ cd ..
$ cd linux-sh-dc
$ cp -fr . ../linux
$ cd ..

The next step is correcting a compiler switch in the sh - architecture Makefile:

$ cat linux/arch/sh/Makefile | \
  sed s/CFLAGS.*\+\=\ \-m4\ \-mno\-implicit\-fp/\
  CFLAGS+=\-m4\ \-m4\-nofpu/ > ./Makefile.old
$ cat ./Makefile.old | \
  sed s/AFLAGS.*\+\=\ \-m4\ \-mno\-implicit\-fp/\
  AFLAGS+=\-m4\ \-m4\-nofpu/ > ./linux/arch/sh/Makefile

The last step is patching the Linux kernel with the LAN adapter device driver:

$ wget http://www.tu-bs.de/~y0018536/dc/src/\
  lan_adapter-0.0.7-linuxsh-2.4.18.patch.tar.bz2
$ bunzip2 -c lan_adapter-0.0.7-linuxsh-2.4.18.patch.tar.bz2 | \
  tar -xv
$ cd linux
$ patch -p1 < ../lan_adapter-0.0.7-linuxsh-2.4.18/\
  lan_adapter-0.0.7.patch

Hopefully, you will have now a linux-sh-dc 2.4.18 synchronized and patched kernel source tree.


next up previous contents index
Next: Building a cross compiler, Up: Setting up an initial Previous: Setting up a cross   Contents   Index
Christian Berger 2004-10-19