Creating a bootable Dreamcast disc

From dreamcast.wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Workflow

The usual workflow to make self-bootable disc for the Dreamcast goes like this.

  • Build your source (usually using KallistiOS)
  • Transform your .elf into binary
  • Scramble the binary
  • Build a .iso image from a directory
  • Transform the .iso into a .cdi image

There are other details that could be taken into account:

  • You can make Audio/Data and Data/Data .cdi files. Both can selfboot, but the files will be organized differently on the physical CD. Citation needed
  • You'll need to provide a valid IP.BIN, these can be modified to display a logo during the boot screen, apply patches or execute some code.
  • It is possible to make CDDA compatible images, this process in not currently covered here.

Linux

This is an example for automating the .cdi image process under Linux. Consider this more like a template as you'll need to edit the paths, names, etc to your own project.

 #! /bin/sh
 PROJECT_DIR=$PWD/build
 PROJECT_NAME="Project_Name"
 TARGET="main.elf"
 # Build your program
 # This assumes that you can properly build your source code. The program main output will be $TARGET
 make $TARGET
 # Elf transform
 sh-elf-objcopy -R .stack -O binary $TARGET output.bin
 # Scrambling process
 $KOS_BASE/utils/scramble/scramble output.bin 1ST_READ.bin
 # Creating a .iso image from a directory 
 # Make sure you have a working IP.BIN in your current directory. Or change IP.BIN path to wherever you like.
 # Useful option for mkisofs is *-m* which allow to exclude files from the iso image (useful to remove .git, or some other folder) 
 mkisofs -C 0,11702 -V $PROJECT_NAME -G IP.BIN -r -J -l -o $PROJECT_NAME.iso $DIR
 # Transform your .iso into a .cdi
 $KOS_BASE/utils/cdi4dc/cdi4dc $PROJECT_NAME.iso $PROJECT_NAME.cdi