Creating a bootable Dreamcast disc

From dreamcast.wiki
Revision as of 16:07, 16 February 2020 by Unknown user (talk)
Jump to navigation Jump to search

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

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