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 DC/NetBSD newbie. However, a 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 at http://mc.pp.se/dc/, BeTips.net http://www.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 the fun of it -- 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 (as of this writing there is no driver for it. Maybe you could write one?)
  • 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 BBA (broadband adaptor) 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 u*ix like system:

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

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 http://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 blank CD-R
  • Select "CDRecord" (the 4th 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 NeytBSD 5.1.2 files are in http://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 (man 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 mountd and nfsd 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 (man dhcpd.conf(5) for more info on this file's syntax). An example can be found a 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
    # sh /etc/rc.d/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, as well as other needed devices.
    # sh MAKEDEV all
  • Create a swapfile for the Dreamcast. You may pick any size you wish, but practical considerations say 32-64MB works best (much smaller and it's not helpful, much larger and it takes excessive physical RAM to maintain). Make sure it put it in the directory you're exporting as the Dreamcast's root.
    # dd if=/dev/zero of=swap bs=32k count=1024 
    (for 32MB)
  • 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 (if they're small).

You're done!

If you're going to be playing around with custom-compiled 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.