hangar eleven - your premier resource for console development
 
hangar-eleven.de - Dreamcast Development - Burning to Bootable CD

 

Dreamcast Dev:

Hardware
Console
DC Serial Link
Schematics

Documentation
KalistiOS Docs
Graphics FAQ
Sound FAQ

Development
Free GNU Devkit
KallistiOS
Serial/IP Link
GFX Converters

Tutorials
Installing CygWin
SH4 Toolchain
Making Binutils
Making xGCC
Making Newlib
Making xGCC
Preparing GCC
ARM Toolchain
Making Binutils
Making xGCC
Compiling KOS
First DC program
Writing
Compiling
Uploading
Serial Slave
DC-Tool Kit
Making a CD

Downloads

Contact me

 


Burning you program into a bottable CD
Written: November 24th, 2001 @ 10:59 GMT

Software needed for burning your Program to a selfboot CD:

[MKISOFS / CDRECORD Package (needs Cygwin installed)]
[Marcus Comstedts Binary scrambler (Cygwin precompiled)]
[Marcus Comstedts IP.BIN creator]


This small tutorial will teach you how to burn your compiled program into a selfbooting CD for your Dreamcast. (this tutorial is based on information by Marcus Comstedt which can be found here).

Before you're able to start, check whether or not you have the CDRECORD or MKISOFS tools (typing which cdrecord in your development bash will do. If this command says not found you don't have the tools). In case you don't have these tools just download the package above and copy them somewhere into your path (like /usr/local/bin).

The next step would be creating a working directory (in my case it's called dcselfboot and I will use that name in the next steps for easier clarification). You should also unpack the IP.BIN creator and the SCRAMBLER into that directory (see the download links above).

NOTE:
All the CD-Record commands use the direct address of the burner as the dev option. You can get this ID by calling cdrecord -scanbus and check where your burner is sitting on the bus. Just use this ID instead of 1,1,0 !!!

So here is the walkthrough of burning a CD:

  • Copy your binary into dcselfboot (normally called yourname.elf)
  • Convert the ELF-file to into a binary with the following command:

    sh-elf-objcopy -O binary yourname.elf yourname.bin

  • One very important feature of the DC bootloader is that when reading or booting a binary off a CD (this does not apply to GDs) it does not load the binary continuously into RAM but somewhat scatters the data pseudo-randomly in memory. So in order to be able to have it in memory like the DC wants it we must scramble our binary.

    Use the following command-line to do so:

    scramble yourname.bin 1ST_READ.BIN

  • Every ISO File contains 15 reserved sectors that can contain bootstrap code. In case of the Dreamcast this bootstrap contains regional information, bootfile (which is normally called 1ST_READ.BIN) and some other information as well as some executable code (see at Marcus' homepage for further information on the bootstrap). We have to construct such a bootstrap for our CD.

    Edit the ip.txt file to reflect your binary. (Most settings can be used as they are, just check that the right boot-file is set)

    Call the following commandline to create the IP.BIN:

    makeip ip.txt IP.BIN

  • Now you're ready to burn the whole stuff:
  • First we create the necessary first-session audio-track:

    dd if=/dev/zero bs=2352 count=300 of=audio.raw
    (this basically creates a zero-filled file since it reads from /dev/zero)

  • Now we burn this track and open a new session for our program:

    cdrecord dev=1,1,0 -multi -audio audio.raw

  • Our file-system has to reflect the session we just burned so we're getting the position where the new session is starting:

    cdrecord dev=1,1,0 -msinfo
    (the comma-separated number pair we're getting will be used in the next step where x,y is standing)

  • Now we make our ISO File containing our binary:

    mkisofs -l -C x,y -o tmp.iso 1ST_READ.BIN
    (where x,y is what we got using the -msinfo command)

  • Now we add our bootstrap to the ISO:

    (cat IP.BIN;dd if=tmp.iso bs=2048 skip=16) > data.raw

  • Now we burn this data track that contains the bootstrap and the binary:

    cdrecord dev=1,1,0 -multi -xa1 data.raw

  • Put the disc into your Dreamcast and have fun with your production.

As I already stated this small tutorial is based on Marcus Comstedts work !


 

 

 

Last changed November 24, 2001 Contact me via eMail

Website Design © 2001 by Thorsten Titze / hangar-eleven.de
(the pictures used for the design were taken from QNX RTP V6.1)
All brand names used on this site are registered trademarks of their respective owners
No copyright infringement is intended