Creating a bootable Dreamcast disc

From dreamcast.wiki
Revision as of 11:02, 16 February 2020 by Unknown user (talk) (Created page with "== Workflow == The usual workflow to make self-bootable disc for the Dreamcast is as follows: * Build your source (usually using KOS) * Transform your .elf into bina...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Workflow

The usual workflow to make self-bootable disc for the Dreamcast is as follows:

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


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