Thursday, 12 July 2012

NetBSD/dreamcast from NetBSD in 4 minutes?

So last night I located an easy way to burn a NetBSD/dreamcast bootable CD from a Windows box, along the way discovering it was *almost* possible to use that mechanism to have the iso9660 filesystem used as the root fs.

It annoyed me that it was now quicker to burn a NetBSD/dreamcast CD on a Windows box than a *ix box, so tonight I decided to address that.

A fair number of years ago Marcus Comstedt write a number of very handy Dreamcast development tools, including a couple of utilities to generate a Dreamcast bootloader and then process a binary suitable for use with that bootloader ('makeip' and 'scramble' from http://mc.pp.se/dc/sw.html)

All I needed to do was wrap them in a little shell script, throw in a call to mkisofs to create an iso9660 CD filesystem and cdrecord to write and and I was done.

Then the creatures started feeping.
  • Obviously it would be convenient if the script could download the necessary kernel files from ftp.netbsd.org automatically, but you should also be able to point it at a locally built kernel
  • If downloading the version should be selectable
  • Selection of a plain GENERIC or GENERIC plus ramdisk be possible
  • As a final bonus it should be able to download a complete NetBSD distribution, extract and burn it onto the CD as the root filesystem
The end result was dc-burn-netbsd on github, and a sysutils/dc-tools pkgsrc entry which included dc-burn-netbsd, makeip, scramble, and a couple more dc tools.

... and finally the feeping stopped.

I can now say I've run a Dreamcast with an iso9660 (rockridge) root filesystem. Its not exactly fast, and you would really want to union mount some ramdisks over /var and suchlike to even consider trying to take it multiuser, but it works :)


% dc-burn-netbsd -h
Usage: dc-burn-netbsd [opts]
-C : Clean work directory before starting
-c opts : Set cdrecord opts (driveropts=burnfree gracetime=3)
-d : Take kernel/ & sets/ under datadir - no downloading
-h : This help
-k type : Set kernel type (GENERIC_MD) eg: GENERIC or GENERIC_MD
-n : Generate data but do not write (just display cdrecord commands)
-r : Include full NetBSD release on CD
-t tmpd : Set temporary work directory to tmpd
-v vers : Set NetBSD version (6.0_BETA2) eg: 5.1 6.0_BETA2

dc-burn will create a temporary work directory dc-burn-netbsd-files which will
need to have sufficient space to store the downloaded & generated files.

if -d is used the directory is expected to match the layout on ftp.netbsd.org:
- kernel/netbsd-$type.bin.gz, and
- sets/base.tgz (etc - if -r given)



2 comments:

  1. You need to change the usage message so that "-d :" reads "-d datadir :" and you need to add "t:" to the first parameter to the call to getopts in dc-burn-netbsd.

    Thanks for the script and package. It only took a couple of minutes and I booted 6.0_BETA2 on my dreamcast.

    ReplyDelete
    Replies
    1. Thanks - fix pushed to github. Will hold off cutting new pkgsrc version in case something else turns up soon :)

      Did you try a root on MD or root on ISO9660 version? Obviously the first is much faster but its nice to have the full OS there...

      What hardware do you have with your DC?

      Delete