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
The next step is downloading and patching the Linux kernel. This is organized in three substeps:
These patches are SuperH specific and the basic layer for the SEGA Dreamcast patches.
Figure 2.1 illustrates how these patches interact.
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.