NetBSD/dreamcast: How to use NetBSD/dreamcast


Introduction

I just bought a Dreamcast to run NetBSD. What do I do now?

Getting NetBSD up and running on the Sega Dreamcast is pretty easy as long as you know what's involved. This document is aimed at the NetBSD newbie as well as the NetBSD/dreamcast newbie. However, familiarity with some flavor of UNIX is recommended. Information for this document has been culled from the port-dreamcast mailing list archive, Marcus Comstedt's homepage, BeTips.net, Josh Tolbert's Dreamcast How-to, and personal trial and error.

This HOWTO will focus on netbooting your Dreamcast, since you need a writable filesystem to do anything useful with the system. As booting from a CD can be useful for test purposes (and since some people might want to do it just for fun!), brief instructions on that setup are included as well.

Requirements

You will need the following:

  • Dreamcast console. Some have reported that units manufactured after September 2000 may have issues booting NetBSD; your mileage may vary
  • Dreamcast keyboard
  • (OPTIONAL) Dreamcast mouse
  • Blank CD-Rs (CD-RWs cannot be read by the Dreamcast)
  • A machine running NetBSD, Linux, or Windows with a CD writer
  • If you have a broadband adapter (BBA) for the Dreamcast, a machine running NetBSD or Linux to act as an NFS server

Make a Bootable Kernel CD

From NetBSD, Linux, or other UNIX-like system:

  • Install the dc-tools package from pkgsrc. It includes Marcus Comstedt's tools for preparing images for Dreamcast boot and the dc-burn-netbsd script, which downloads a NetBSD kernel, prepares it, and writes a CD image. This will automatically install the cdrtools package (which includes mkisofs and cdrecord).
  • Ensure a blank CD is in the drive, then as root, run:
    # dc-burn-netbsd
    This will burn a bootable CD containing a kernel with a built-in ramdisk, which is the minimum NetBSD system on a standalone Dreamcast. It should boot up directly into a basic shell.
  • Alternatively, again with a blank CD, as root, run:
    # dc-burn-netbsd -k GENERIC -r
    This will burn a bootable CD containing a GENERIC kernel and an entire NetBSD distribution. Upon booting on a Dreamcast, the system will prompt for a root filesystem. At this point, you should answer 'gdrom0'. Hit 'Enter' for any other questions.

Here's how to create a CD from Windows. In this case, we do not have the option to include the root filesystem on the main disk.

  • Download BootDreams.
  • Create a new directory.
  • Download a NetBSD/dreamcast .bin kernel from ftp.NetBSD.org/pub/NetBSD/NetBSD-5.1.2/dreamcast/binary/kernel/ (replace 5.1.2 with the latest NetBSD version).
  • Uncompress the downloaded kernel and rename to netbsd.bin (to ensure it is no longer than 12 characters + .bin), and put into above directory.
  • Run BootDreams.
  • Insert a blank CD-R.
  • Select "CDRecord" (the fourth icon in the interface).
  • Click "Browse" and select the above directory.
  • Click "Process" and answer "Yes" to any questions.

Prepare the NFS Server & Filesystem

  • Fetch the set files. The NetBSD 5.1.2 files are in ftp.NetBSD.org/pub/NetBSD/NetBSD-5.1.2/dreamcast/binary/sets/ (adjust the 5.1.2 to the desired NetBSD version).
  • Untar them into a conveniently exportable directory on your *BSD/Linux PC.
  • Set up your /etc/exports (see exports(5) for more info on this file's syntax). An example can be found on Josh's site. Make sure that you've:
    • Set -maproot=0. (Otherwise, the Dreamcast won't have permissions to mount the filesystem.)
    • Specified a network or host the share is accessible to. (Otherwise, you could end up making it writable to the world -- a Really Bad Thing.)
  • Make sure mountd and nfsd are running; a simple
    ps aux | grep '(mount|nfs)'d
    will show if they're currently up. If they're not, run service mountd start and service nfsd start as root to start them now. To ensure they start at boot time in the future, edit /etc/rc.conf so that nfs_server=YES, lockd=YES, and statd=YES.
  • Set up your /etc/dhcpd.conf (see dhcpd.conf(5) for more info on this file's syntax). An example can be found at Josh's site, or alternatively at Alex Kirk's site. Things to keep in mind when configuring dhcpd.conf:
    • You MUST specify the Dreamcast's MAC Address in the host section. This can be found by looking at your BBA; it's on the sticker.
    • Your root-path option should be wherever your world files were extracted.
    • Options such as domain name servers aren't strictly necessary, but tend to make life easier.
  • Make sure dhcpd is running; turn it on with
    # service dhcpd start
    if it's not on. To ensure that DHCP is running whenever your box is, edit /etc/rc.conf so that dhcpd=YES.
  • Run the MAKEDEV script in /home/dreamcast/dev/. This will create your console and other needed devices.
    # sh MAKEDEV all
  • Create a swap file for the Dreamcast. You may pick any size you wish, but practical considerations say 32 to 64 MB works best. Much smaller and it's not helpful; much larger and it takes excessive physical RAM to maintain. Make sure to put it in the directory you're exporting as the Dreamcast's root.
    # dd if=/dev/zero of=swap bs=32k count=1024
    (for 32 MB)
  • Edit /home/dreamcast/etc/fstab (or wherever you've placed the Dreamcast root) to mount the appropriate filesystems:
    192.168.2.69:/home/alex/dreamcast/dc / nfs rw,auto 0 0
    /swap none swap sw 0 0
    /kern /kern kernfs rw
    /proc /proc procfs rw 0 0
    /dev/gdrom0c /mnt/gdrom cd9660 ro,noauto 0 0
        

Try it Out

  • Put your CD into the Dreamcast and power up. If you made the CD correctly, a familiar NetBSD bootup sequence will begin. If you've done this with a Dreamcast manufactured after September 2000, please notify the mailing list.
  • If you run into problems, chances are your /etc/exports or /etc/dhcpd.conf are messed up. You'll want to first double-check them for stupid mistakes (we all make them, don't feel bad). If you've got a specific error message with no description, look in /usr/src/sys/sys/errno.h for a brief explanation.
  • If you're really stuck, browse the mailing list archives. They're quite helpful. If you want to search them, your best bet is to use Google's Advanced Search; restrict the domain to mail-index.NetBSD.org and make sure that you include dreamcast in your query.
  • That failing, post to the list itself. Please be detailed and include relevant error messages, configuration files, logfiles, and so on (if they're small).

You're Done!

If you're going to be playing around with custom kernels a lot, I'd recommend following the instructions on Josh's IP Slave page, which gives instructions on a setup where you won't have to burn a CD for each fresh new kernel.