├── run.sh ├── Dockerfile ├── dcbuild.sh └── README.md /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Small KOS-Wrapper Script 3 | if [ -z "$1" ] ; then 4 | cmd="make" 5 | else 6 | cmd=$@ 7 | fi 8 | 9 | [ -z "$KOS_BASE" ] && source /opt/toolchains/dc/kos/environ.sh 10 | echo "######### KallistiOS Environment ##########" 11 | echo "# CMD: $cmd" 12 | $cmd 13 | exit 0 14 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ######################################################################## 2 | # Dockerfile to build KallistiOS Toolchain + Additional Dreamcast Tools 3 | ######################################################################## 4 | FROM nold360/kallistios-sdk:minimal 5 | 6 | # Additinal DC Tools: 7 | # - mksdiso Toolkit 8 | # - cdi4dc & mds4cd (iso converter) 9 | # 10 | RUN git clone --depth=1 https://github.com/Nold360/mksdiso /opt/mksdiso && \ 11 | cd /opt/mksdiso/ && cp -r mksdiso /root/.mksdiso && \ 12 | cp bin/burncdi bin/mksdiso /usr/local/bin/ && \ 13 | cd src && make all && make install && cp binhack/bin/binhack32 /usr/local/bin/ 14 | 15 | RUN git clone --depth=1 https://github.com/kazade/img4dc /opt/img4dc && \ 16 | mkdir /opt/img4dc/build && cd /opt/img4dc/build && cmake .. && make && \ 17 | mv mds4dc/mds4dc cdi4dc/cdi4dc /usr/local/bin/ 18 | -------------------------------------------------------------------------------- /dcbuild.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Wrapper script to use with nold360/kallistios-sdk 3 | # This script is used on THE HOST running docker! 4 | # 5 | # By combining docker and this script, you can a full-featured, 6 | # prebuild Dreamcast SDK in just like a minute! 7 | ACTION=$1 8 | 9 | if ! type docker &>/dev/null; then 10 | echo "You need to install docker to use dcbuild" 11 | exit 1 12 | fi 13 | 14 | # Environment Configuration Defaults 15 | ISO=${ISO:-mygame.iso} 16 | GAME_TITLE=${GAME_TITLE:-MY_GAME} 17 | DOCKER_IMAGE="nold360/kallistios-sdk" 18 | DCRUN="docker run --rm -ti -v $(pwd):/src $DOCKER_IMAGE" 19 | 20 | function usage { 21 | echo "Wrapper Script for Docker-Image nold360/kallistios-sdk" 22 | echo "By Nold 2017 - http://github.com/nold360/docker-kallistios-sdk" 23 | echo 24 | echo "Usage: $0 [args...]" 25 | echo -e " - make\t\t Build Project" 26 | echo -e " - ip\t\t Create IP.BIN using makeip" 27 | echo -e " - clean\t Cleanup everything, deletes *.iso, *.cdi, IP.BIN + depends" 28 | echo -e " - bin \t Convert ARG to 'main.bin" 29 | echo -e " - iso\t\t scramble main.bin to 1ST_READ.BIN & genisoimage from iso-folder" 30 | echo -e " - cdi\t\t convert iso-image to cdi" 31 | echo 32 | echo "You can also run things like 'dcbuild bash' to get a shell inside the container" 33 | echo "Or 'dcbuild mksdiso' to convert your project / a CDI-Image to Dreamshell SDISO" 34 | } 35 | 36 | if [ -z "$ACTION" ] ; then 37 | usage 38 | exit 1 39 | fi 40 | 41 | # Additional "clean" option, removes *.iso, *.cdi & IP.BIN related 42 | if [ "$ACTION" == "clean" ] ; then 43 | $DCRUN make clean 44 | set -x 45 | rm -rf iso/ 46 | rm -f *.iso *.cdi main.bin IP.BIN IP.TMPL ip.txt 47 | set +x 48 | 49 | # Generate IP.BIN from scratch, change "ip.txt" to your needs and run "dcbuild ip" again 50 | # to customize IP.BIN 51 | elif [ "$ACTION" == "ip" ] ; then 52 | [ ! -f ip.txt ] || [ ! -f IP.TMPL ] && $DCRUN cp /opt/mksdiso/src/makeip/{ip.txt,IP.TMPL} /src 53 | $DCRUN makeip ip.txt IP.BIN 54 | 55 | # Create Binary from ELF 56 | elif [ "$ACTION" == "bin" ] ; then 57 | ELF=$2 58 | if [ ! -e "$ELF" ] ; then 59 | echo "Error: elf-file '$ELF' doesn't exist!" 60 | usage 61 | exit 1 62 | fi 63 | $DCRUN sh-elf-objcopy -R .stack -O binary $ELF main.bin 64 | 65 | # Create CDI / ISO 66 | elif [ "$ACTION" == "cdi" ] || [ "$ACTION" == "iso" ] ; then 67 | mkdir iso &>/dev/null 68 | $DCRUN scramble main.bin iso/1ST_READ.BIN 69 | [ ! -f iso/1ST_READ.BIN ] && exit 1 70 | 71 | [ ! -f IP.BIN ] && $0 ip 72 | $DCRUN genisoimage -V $GAME_TITLE -G IP.BIN -joliet -rock -l -o $ISO iso 73 | else 74 | # Otherwise just run the command directly into the container 75 | $DCRUN $@ 76 | fi 77 | 78 | # Convert ISO to CDI 79 | if [ "$ACTION" == "cdi" ] ; then 80 | if [ -f "$ISO" ] ; then 81 | $DCRUN cdi4dc $ISO $ISO.cdi -d 82 | else 83 | echo "Error: ISO-file '$ISO' doesn't exist! Run 'dcbuild bin' first" 84 | fi 85 | fi 86 | exit 0 87 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Docker KallistiOS - Dreamcast SDK 2 | This image provides a full powered [KallistiOS](http://gamedev.allusion.net/softprj/kos/) SDK for Developing Homebrew for the Sega Dreamcast. 3 | It has been build, so you don't have to compile/setup the KOS-Toolchain yourself & keep your system clean. If you have Docker installed on your system - it's like one command to compile your code using KOS! 4 | 5 | ## Image Tags & Included Software 6 | |nold360/kallistios-sdk:minimal| 7 | |---| 8 | |Based on Debian Jessie| 9 | |Latest KallistiOS SDK + Ported Libraries| 10 | 11 | |nold360/kallistios-sdk:latest| 12 | |---| 13 | |Based on nold360/kallistios-sdk:minimal| 14 | |Latest [mksdiso](https://github.com/Nold360/mksdiso) Toolkit for creating SD-ISOs, scrambling & more| 15 | |mds4dc & cdi4dc for Image creation ([source](https://github.com/kazade/img4dc))| 16 | |makeip for custom IP.BIN creation (taken from mksdiso)| 17 | | Other Dreamcast-related tools: binhack32, burncdi, cdirip, isofix, makeip, scramble| 18 | 19 | |nold360/kallistios-sdk:dreamshell| 20 | |---| 21 | |Based on nold360/kallistios-sdk:latest| 22 | |Latest [DreamShell](https://github.com/Nold360/DreamShell)* Sourcecode & Toolchain| 23 | |Patched GCC 5.2.0 & KOS-Toolchain| 24 | |More Ported Libs (SDL, ...)| 25 | 26 | \* I've forked Dreamshell, so I don't have to do so much patching in the Dockerfile. I made no modifications to DS itself! 27 | 28 | I've also created a wrapper-script called "**[dcbuild](https://github.com/Nold360/docker-kallistios-sdk/blob/master/dcbuild.sh)**" which handles some development tasks for you! 29 | Here is a quick video demonstation of dcbuild + this container here: https://www.youtube.com/watch?v=yjm4iSrerM0 30 | 31 | ## Using the image 32 | If you have created your first KOS project and built a Makefile for it, you can compile your sourcecode like this: 33 | ``` 34 | $ docker run -ti -v $(pwd):/src nold360/kallistios-sdk make 35 | ``` 36 | 37 | The Volume `-v $(pwd):/src`will include your current working directory (aka your KOS-project directory) into the container. 38 | The `make` command at the end is default and can be changed as needed. (Like `make dreamcast` or whatever). 39 | 40 | ## Installing dcbuild 41 | You will find an additional shellscript called "dcbuild" in the [Github](https://github.com/nold360/docker-kallistios-sdk) of this container. 42 | Install the script inside the PATH of your **HOST** running this container: 43 | ``` 44 | $ sudo wget -O/usr/local/bin/dcbuild https://raw.githubusercontent.com/Nold360/docker-kallistios-sdk/master/dcbuild.sh 45 | $ sudo chmod +x /usr/local/bin/dcbuild 46 | ``` 47 | 48 | ## Using dcbuild 49 | dcbuild is a wrapper for this container. It'll give you some nice possibillities like: 50 | - Building your Project 51 | - Creating .bin, .iso & .cdi 52 | - Creating (custom) IP.BIN 53 | - Get a bash-shell inside the container (for debugging) 54 | 55 | ### Examples 56 | #### Build Project (using Makefile): 57 | ``` 58 | ~/myproject $> dcbuild make 59 | ``` 60 | Example Output: 61 | ``` 62 | ######### KallistiOS Environment ########## 63 | # CMD: make 64 | rm -f example1.elf romdisk.* 65 | kos-cc -c example1.c -o example1.o 66 | kos-cc -o example1.elf example1.o 67 | ``` 68 | 69 | #### Create binary from elf: 70 | ``` 71 | ~/myproject $> dcbuild bin example1.elf 72 | ``` 73 | Example Output: 74 | ``` 75 | ######### KallistiOS Environment ########## 76 | # CMD: sh-elf-objcopy -R .stack -O binary example1.elf main.bin 77 | ``` 78 | 79 | #### Create IP.BIN: 80 | Note: IP.BIN can be customized by editing "ip.txt" & rerun "dcbuild ip" 81 | ``` 82 | ~/myproject $> dcbuild ip 83 | ``` 84 | Example Output: 85 | ``` 86 | ######### KallistiOS Environment ########## 87 | # CMD: cp /opt/mksdiso/src/makeip/ip.txt /opt/mksdiso/src/makeip/IP.TMPL /src 88 | ######### KallistiOS Environment ########## 89 | # CMD: makeip ip.txt IP.BIN 90 | Setting CRC to B6D8 (was 0000) 91 | ``` 92 | 93 | #### Create CDI-Image 94 | ``` 95 | ~/myproject $> dcbuild cdi 96 | ``` 97 | Example Output: 98 | ``` 99 | ######### KallistiOS Environment ########## 100 | # CMD: scramble main.bin iso/1ST_READ.BIN 101 | ######### KallistiOS Environment ########## 102 | # CMD: genisoimage -V MY_GAME -G IP.BIN -joliet -rock -l -o mygame.iso iso 103 | Total translation table size: 0 104 | Total rockridge attributes bytes: 253 105 | Total directory bytes: 0 106 | Path table size(bytes): 10 107 | Max brk space used 0 108 | 336 extents written (0 MB) 109 | ######### KallistiOS Environment ########## 110 | # CMD: cdi4dc mygame.iso mygame.iso.cdi -d 111 | CDI4DC - 0.4b - Written by SiZiOUS 112 | http://www.sizious.com/ 113 | 114 | Image method............: Data/Data 115 | Volume name.............: MY_GAME 116 | Writing data pregap.....: OK 117 | Writing datas track.....: [688128/688128] - 100% 118 | 338 block(s) written (27.16MB used) 119 | Writing pregap tracks...: OK 120 | Writing header track....: OK 121 | Writing CDI header......: OK 122 | 123 | Woohoo... All done OK! 124 | You can burn it now (TO A CD-RW PLEASE AGAIN... BETA VERSION !!!)... 125 | ``` 126 | 127 | #### Cleanup Everything 128 | Watch out: This will run "make clean" and delete all *.iso, *.cdi & IP.BIN-related files in your current directory. Also it deletes the "iso"-folder & main.bin (if existing). 129 | ``` 130 | ~/myproject $> dcbuild clean 131 | ``` 132 | Example Output: 133 | ``` 134 | ######### KallistiOS Environment ########## 135 | # CMD: make clean 136 | rm -f example1.elf example1.o romdisk.* 137 | + rm -rf iso/ 138 | + rm -f '*.iso' '*.cdi' main.bin IP.BIN IP.TMPL ip.txt 139 | + set +x 140 | 141 | ``` 142 | 143 | 144 | ## Environment Variables 145 | There are a few variables that can be customized by setting them inside your environment. 146 | ### ISO 147 | Name of the ISO/CDI created by dcbuild 148 | `export ISO=my_game_name.iso"` 149 | 150 | ### GAME_TITLE 151 | Title of your game (will be used in ISO, **not** IP.BIN) 152 | `export GAME_TITLE="MY_AWESOME_GAME"` 153 | 154 | ## Troubleshooting 155 | You can run bash in your SDK Environemnt, too. This might help finding the problem. Also feel free to open issues on [github](https://github.com/Nold360/docker-kallistios-sdk) 156 | `$ docker run -ti -v $(pwd):/src nold360/kallistios-sdk bash` 157 | --------------------------------------------------------------------------------