Creating a bootable Dreamcast disc: Difference between revisions

From dreamcast.wiki
Jump to navigation Jump to search
No edit summary
m (Starting refactoring. Added info about mkdcdisc.)
Line 1: Line 1:
== Workflow ==
== Full Overview of the steps involved ==


The usual workflow to make self-bootable disc for the [[Dreamcast]] goes like this.
The full list of steps to make self-bootable disc for the [[Dreamcast]] goes like this:


* Build your source (usually using [[KallistiOS]])
* Build your source (usually using [[KallistiOS]])
* Transform your .elf into binary  
* Transform your .elf executable into binary
* Scramble the binary
* Scramble the binary
* Build a .iso image from a directory
* Build a .iso image from a directory
* Transform the .iso into a .cdi image
* Transform the .iso into a .cdi image
* Transfer the .gdi image to your GDEMU/..., or burn the .cdi image to a cd-rom to launch it in a standard Dreamcast.


There are other details that could be taken into account:
There are other details that could be taken into account:
Line 14: Line 15:
* It is possible to make CDDA compatible images, this process in not currently covered here.
* It is possible to make CDDA compatible images, this process in not currently covered here.


== Linux ==  
Depending on the method/tools used, some of the above steps are simplified a lot:
* mkdcdisc: does the heavy lifting for you. Linux only for now.
* mkisofs + cdi4dc
* mkisofs + cdrecord
 
== mkdcdisc (Linux only for now) ==
 
[https://gitlab.com/simulant/mkdcdisc mkdcdisc] is a recent (2022) tool that pretty much does all the steps for you.
 
The minimum you need for it, is your executable .elf.
 
Example to build a bootable DC disc image nehe05.cdi, starting from an executable called nehe05.elf:
<syntaxhighlight lang="bash">
mkdcdisc -e nehe05.elf -o nehe05.cdi
</syntaxhighlight>
 
Example to build a bootable DC disc image mygame.cdi, starting from an executable called mygame.elf, with assets/textures/... files stored in a subfolder called "data":
<syntaxhighlight lang="bash">
mkdcdisc -e mygame.elf -D data -o mygame.cdi
</syntaxhighlight>
 
There are a lot of commandline options, so be sure to check them all out!
 
== mkisofs + cdi4dc ==


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.  
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.  
Line 40: Line 64:
   # Transform your .iso into a .cdi
   # Transform your .iso into a .cdi
   $KOS_BASE/utils/cdi4dc/cdi4dc $PROJECT_NAME.iso $PROJECT_NAME.cdi
   $KOS_BASE/utils/cdi4dc/cdi4dc $PROJECT_NAME.iso $PROJECT_NAME.cdi
== mkisofs + cdrecord  ==
TODO

Revision as of 20:03, 15 February 2025

Full Overview of the steps involved

The full list of steps to make self-bootable disc for the Dreamcast goes like this:

  • Build your source (usually using KallistiOS)
  • Transform your .elf executable into binary
  • Scramble the binary
  • Build a .iso image from a directory
  • Transform the .iso into a .cdi image
  • Transfer the .gdi image to your GDEMU/..., or burn the .cdi image to a cd-rom to launch it in a standard Dreamcast.

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.

Depending on the method/tools used, some of the above steps are simplified a lot:

  • mkdcdisc: does the heavy lifting for you. Linux only for now.
  • mkisofs + cdi4dc
  • mkisofs + cdrecord

mkdcdisc (Linux only for now)

mkdcdisc is a recent (2022) tool that pretty much does all the steps for you.

The minimum you need for it, is your executable .elf.

Example to build a bootable DC disc image nehe05.cdi, starting from an executable called nehe05.elf:

mkdcdisc -e nehe05.elf -o nehe05.cdi

Example to build a bootable DC disc image mygame.cdi, starting from an executable called mygame.elf, with assets/textures/... files stored in a subfolder called "data":

mkdcdisc -e mygame.elf -D data -o mygame.cdi

There are a lot of commandline options, so be sure to check them all out!

mkisofs + cdi4dc

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

mkisofs + cdrecord

TODO