SEGA Dreamcast: SLIP/Linux HOWTO

Christian Berger ( c.berger@tu-bs.de)

v0.01, 19 October 2002


This document describes the setup for a SLIP - communication between an x86 (aka HOST) and the famous Dreamcast (aka CLIENT). It lists the required software, tools, hardware and commands.

1. Introduction

2. Getting started on embedded Linux

3. Building the needed tools

4. Transfer the whole stuff into the Dreamcast

5. Using SLIP

6. Links and resources...


1. Introduction

This is the SEGA Dreamcast: SLIP/Linux HOWTO document. It is intended as a quick reference covering everything you need to know for building and configuring a SLIP - communication between a well known Intel x86 and the famous Dreamcast gaming console through a nullmodem cable. Hints, patches and references to the software needed to build the necessary software are given.

1.1 Contributors and Contacts

This document would not have been possible without all the information contributed by other people - those involved in the GNU/Linux SuperH Project [1] or the LinuxSH porting project [2], thousands of mailing list archives and tons of other HOWTOs, books or short hints found while surfing through the net.

Thanks to Alan Cox, who ported slattach.c to Linux, Bill Gatliff [3], who described the process for building the base Linux system, where my work started and Andrew Kieschnick [9], who wrotes this wonderful serial loader, which saves me lots of CD-Rs and money.

1.2 Acknowledgments

Dreamcast is a registered trademark of Sega, Inc. Other product names are trademarks of the respective holders, and are hereby considered properly acknowledged.

1.3 Revision History

Version 0.01

First version for public release.

1.4 New versions of this document

You will find the most recent version of this document at http://www.tu-bs.de/~y0018536/dc http://linuxdc.sf.net/slip-howto/sl0.html.

If you make a translation of this document into another language, let me know and I'll include a reference to it here.

1.5 Feedback

I rely on you, the reader, to make this HOWTO useful. If you have any suggestions, corrections, or comments, please send them to me (c.berger@tu-bs.de), and I will try to incorporate them in the next revision. Please add SEGA Dreamcast: SLIP/Linux HOWTO to the Subject-line of the mail for filtering it into the appropriate folder.

Before sending bug reports or questions, please read all of the information in this HOWTO, and send detailed information about the problem.

If you publish this document on a CD-ROM or in hardcopy form, a complimentary copy would be appreciated. Mail me for my postal address. Also consider making a donation to the Linux Documentation Project to help support free documentation for Linux. Contact the Linux HOWTO coordinator, Tim Bynum (linux-howto@sunsite.unc.edu), for more information.

1.6 Distribution Policy

Copyright (c) 2002 by Christian Berger. This document may be distributed under the terms set forth in the LDP license at sunsite.unc.edu/LDP/COPYRIGHT.html.

This HOWTO is free documentation; you can redistribute it and/or modify it under the terms of the LDP license. This document is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See the LDP license for more details.


2. Getting started on embedded Linux

If you're new to embedded Linux development, please refer to the "Running Linux on the Sega Dreamcast" HOWTO [4] written by Bill Gatliff. This short document wakes my interest for developing on gaming consoles. If you'd like to get further information on something like the toolchain for the linux base system or how a bootloader does his job, please follow the given link and refer to Bill's HOWTO.

For starting your community developing in embedded Linux system, you need a x86 personal computer running Linux (mostly all modern distributions should do the work, I prefer Mandrake's one), a free serial port, the PC <--> Dreamcast serial cable (aka coders cable, $25 at your favorite dealer or auction website) and a VGA adapter when you aren't using your TV for watching your Dreamcast's reaction.

First of all, you need some space and access to the superuser account for building the base system described in [4]. A Linux system is nothing without the well configured Linux kernel. Go straight to the LinuxSH porting project [2] and get the latest stable Linux kernel source tree simply using CVS [5].

Unpack the sources in your dedicated folder for building the whole stuff and patch it [6] using

patch -p0 < linux-2.4.13-pre.diff

for compiling without any errors with this .config [7]. After this is done, compile it as explained.

Additionally to Bill's step by step description, you have to create a special device file using the superuser account for communicate with the build in serial port:

...
cd $INITRD
mkdir dev
su -c "mknod ttySC1 c 204 9"
...

These two steps are necessary to build the kernel. The remaining stuff concerning the build of the toolchain is well described in [4]. Please follow these step right before you're asked to create a ramdisk image because we've to add some software.


3. Building the needed tools

This chapter explains how to configure and build the tools you need to setup a SLIP - device.

3.1 busybox

The chapter "Building an application" in [4] describes the steps to build Busybox, a popular tool (aka "swiss army knife") to administer any *nices. In our case, we've just to alter the file Config.h to our wishes. Simply open your favorite editor an comment out these tools you don't need and remove the double dashs from those lines, which concern about networking, especially

...
#define BB_IFCONFIG
...
#define BB_PING
...
#define BB_ROUTE
...

Without having at least these three tools, you won't be able to check your communication. Just leave the other lines in their proper state, save and quit. Follow the steps in Figure 7 in [4] for (cross) compiling this application and copying in their right place ($INITRD).

3.2 slattach

This tool is a layer between the device file corresponding to your serial port and a virtual network device for handling any IP request. Get the source at [8]. Unpack the archive in your dedicated folder an compile it using following command:

...
make CC=sh4-linux-gcc LDFLAGS=-static
...

The first argument CC means, that you want to build the source with your preferred C - compiler (in our case a cross compiler) and the second links our application without relying on any library (at this point, we don't have any - I hope, I'll describe this soon, too). After doing this, just copy the file slattach to $INITRD/sbin.

That's it. All you've to do now is to transfer this whole stuff into your Dreamcast as explained in [4] or just read on.


4. Transfer the whole stuff into the Dreamcast

Okay, you've got this wonderful cross compiled stuff, but how do we get this into the Dreamcast?

4.1 CD-R

Either you burn it onto a CD-R, put it in your Dreamcast, hit the power button and lean back as described in [4]...

4.2 dcload-serial

or, even better, you use Andrew's tool [9] to load your complete Linux distribution through your coders cable and save CD-Rs, money and time. To do this, just ignore Bill's steps to build the Dreamcast boot CD and copy the scrambled binary (kernel-boot.bin) in the dcload-serial folder. Put the dcload-serial-client disc into your Dreamcast (please refer to [9] for further information to build such a disc), hit the power button and wait for your idle... prompt.

Seeing this, simply execute the following command on your Linux box, wait while these two guys transfer your Linux distribution and see your embedded Dreamcast after a while in action:

./dc-tool-serial-1.0.3-linux -t /dev/ttyS1 -e -b 115200 -x kernel-boot.bin

Please change these parameters to your corresponding environment.


5. Using SLIP

So, you've just loaded your distribution into your Dreamcast, now it's time for using this connection.

5.1 HOST

Assuming you've correctly configured your Linux kernel (or left the standard one), simply enter following commands to start the SLIP - interface on your HOST:

...
slattach -s 9600 -p slip /dev/ttyS1 &
ifconfig sl0 192.168.0.1 pointopoint 192.168.0.2 up
route add 192.168.0.1 dev lo
route add 192.168.0.2 dev sl0
...

The first line initiates the software layer between serial device and virtual network device. The following command configures your virtual network device as a direct connection between two hosts. The last two set the proper routes to both hosts.

5.2 CLIENT

The story on your Dreamcast is a little bit more tricky, when you've just followed Bill's explanation, because some essential things are missing. First at all, we've to mount the proc filesystem:

...
mkdir /proc && mount -t proc none /proc
...

Without it, we can't read any information about our running Linux. The next ones are the same like above only with exchanged IP addresses:

...
slattach /dev/ttySC1
ifconfig sl0 192.168.0.2 pointopoint 192.168.0.1 up
route add 192.168.0.2 dev lo
route add 192.168.0.1 dev sl0
...

Okay, now it's time for the big final. Simply enter

...
ping 192.168.0.2
...

on your HOST and

...
ping 192.168.0.1
...

on your CLIENT. Lean back and congratulate yourself. You've connected two heterogenous architectures and let them talk to each other. At this point, you can run (almost) any IP based application between them.

Let me know your success stories.


6 Links and resources...

  • [1] GNU/Linux SuperH Project
  • [2] Linux/SH porting project/
  • [3] http://www.billgatliff.com
  • [4] http://www.billgatliff.com/articles/emblindc/emblindc/index.html
  • [5] LinuxSH CVS
  • [6] LinuxSH 2.4.13-pre3 patch
  • [7] LinuxSH 2.4.13-pre3 .config
  • [8] slattach.tar.gz
  • [9] dcload-serial