Dreamcast

Sega Dreamcast

The Dreamcast is Sega's SH-4 based console gaming system, it uses the SH7091 CPU subtype.

HOWTO Boot The Dreamcast

Please note, the method described immediately below describes building a kernel for an NFS root mounted system for which you need some sort of LAN connection between your NFS server/build machine and the Dreamcast. It is also possible to build a working kernel with only a serial connection - see the bottom of the page for the differences between the two methods.

Overview (NFS root)

Install cross compiler

First you need a cross-compiler! Visit Dan Kegel's [WWW] website and build a SH cross-compiler. For Gentoo users, you can simply do this:

 # emerge crossdev && crossdev -t sh4

See the FrontPage for other methods.

Cross compile kernel

See the FrontPage for how to get the source and use it.

For a NFS root, I normally use this simple kernel append:

 $ grep CONFIG_CMDLINE .config

 CONFIG_CMDLINE="console=ttySC1,115200 panic=3 root=/dev/nfs nfsroot=192.168.1.4:/mnt/dreamcast,v3,tcp init=/bin/bash"

The panic will automatically reboot the dreamcast when something goes bad so you don't have to manually cycle the power. 192.168.1.4 is my NFS server and I connect to it using NFSv3 over TCP since it's a *lot* more reliable than NFSv2 or UDP.

Burn Bootable Image

1. Prepare the image you want to burn

You will need an IP.BIN file (this is the bootstrap code that gets everything going). Then you will need a 1ST_READ.BIN file. This is the binary that is hardcoded to be executed by IP.BIN. So, when creating the ISO image, make sure you have 1ST_READ.BIN in the / of it.

2. Figure out how to use cdrecord

Basically, you need to know what to pass to the dev parameter. Replace all dev=0,0,0 with whatever you have on your system. I use an IDE drive, so I just have to use dev=/dev/cdr.

3. Creating the image

First we need to create the audio session on the disc:

# dd if=/dev/zero bs=2352 count=300 of=audio.raw
# cdrecord dev=0,0,0 -multi -audio audio.raw

Now we make the ISO from the cdimage directory. Remember, the file cdimage/1ST_READ.BIN must exist for this to work.

# mkisofs -l -r -C 0,11702 -G IP.BIN -o tmp.iso cdimage/

4. Burning the image

Now burn it :P.

# cdrecord dev=0,0,0 -multi -xa tmp.iso

Now put the disc in your Dreamcast and it should work, hooray !

Setup DHCP/NFS server

Install a dhcp server such as ISC's [WWW] dhcp. Here's a basic config:

subnet 192.168.1.0 netmask 255.255.255.0 {
  range 192.168.1.200 192.168.1.250;
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.1.255;
}

host dreamcast {
  hardware ethernet 00:d0:f1:02:b7:61;
  fixed-address 192.168.1.6;
}

You will have to change the ethernet MAC to match the MAC of your BBA. 192.168.1.6 will be the IP given to the dreamcast.

Setup /etc/exports for the nfsroot:

/mnt/nfsroot  dreamcast(async,rw,no_root_squash)

Then unpack a SH distro into /mnt/nfsroot

Transmit kernel to running daemon

Connect the serial port of your PC to the dreamcast via a [WWW] Coder Cable. You can find directions online on how to make your [WWW] own.

Run a terminal program such as [WWW] minicom and connect it to your local serial port (normally /dev/ttyS0 or /dev/ttyS1 ... this value has nothing to do with the command line given to the kernel earlier). Make sure you set it to run at the same buad as what you built into the kernel (normally 115200).

Once you've compiled your kernel, install [WWW] dc-tool-ip and use it to send the kernel to the dreamcast:

$ dc-tool-ip -n -x arch/sh/boot/zImage -t x.x.x.x

(Where x.x.x.x is some ip address - you can fix that using arp or similar, or fix the sources for dc-tool-ip to hard wire in an IP).

If you watch the TV, it should tell you that it's receiving and executing the image. Wait a little and with any luck, you should get output on the serial console.

Early User Space method

(Use this if you haven't got some sort of NIC - you'll still need a serial cable though and it also works with Dreamcasts with BBAs/LAs)

Since 2.5.xx, the linux kernel build has included a replacement method, called [WWW] Early User Space or INITRAMFS (for inital RAM filesystem), for the [WWW] initrd - the initial ram disk. Previously initrds were the standard way to boot - without NFS Root - diskless systems like the Dreamcast (they are also used in the big ix86 distros to load up drivers before the 'real' root filesystem is mounted).

INITRAMFS offers an opportunity to bundle a root file system inside the zImage (built as above). The kernel will then (depending on the presence of the INITRAMFS archive and the kernel command line) boot the bundled filesystem (or rather mount the filesystem and then run the specified init).

The steps required to do this are very similar to those specified above for the NFS root kernel.

Specifically you need to use the cross compilation tools to build both the kernel and an appropriate filesystem for the Dreamcast.

When building the kernel you need to ensure CONFIG_INITRAMFS_SOURCE is specified (see the INITRAMFS documentation). I have this:

CONFIG_INITRAMFS_SOURCE="/home/adrian/linux-sh/initrd"

Where /home/adrian/linux-sh/initrd is a busybox installation with the addition of an init in the root directory (created simply by ln -s ./bin/busybox init)

The kernel build process turns the specified directory into an appropriate .cpio.gz which is bundled into the kernel zImage which is then passed to the Dreamcast using either serial or network tools as described above.

(When building the kernel avoid specifying kernel autoconfiguration and root filsystem on NFS for obvious reasons and similarly ensure that the kernel command line does not specify a root filesystem).

Additional Information

last edited 2005-11-09 23:20:43 by ArthurOthieno