Saturday, 30 January 2016

Setting up KallistiOS on Fedora

KallistiOS (or KOS for short) is the open source SDK for Dreamcast development. It can be a little tricky to understand the installation process so I'm just explaining it here, this is more for my own benefit than anything.

There are instructions for configuring KallisitiOS on the website, but they are focused on installing globally in /opt/ whereas I'm going to explain how to setup KOS in your home folder.


Step 1. Clone all the things


Firstly you need to get the code. KOS and its counterpart library port repository both use GIT. So, let's make a directory called "Dreamcast" and clone those things:

mkdir ~/Dreamcast
cd ~/Dreamcast
git clone git://git.code.sf.net/p/cadcdev/kallistios
git clone --recursive git://git.code.sf.net/p/cadcdev/kos-ports 


At this point you'll have two folders, kallistios and kos-ports. Forget about kos-ports for the time being.

Step 2. Building the toolchain


The "toolchain" is the GCC cross-compiler you need to build for the Dreamcast. There are two architectures to build: sh-elf and arm-eabi.

KOS has some scripts for helping you to build the toolchain, and these are found in the "utils/dc-chain" folder.

The first thing we need to do is alter the installation location to our "~/Dreamcast" folder.

Open "utils/dc-chain/Makefile" in a text editor, near the top of the file you'll find the following lines:

sh_prefix  := /opt/toolchains/dc/$(sh_target)
arm_prefix := /opt/toolchains/dc/$(arm_target)


You'll need to change them to:

sh_prefix  := /home/YOUR_USERNAME/Dreamcast/toolchain/$(sh_target)
arm_prefix := /home/YOUR_USERNAME/Dreamcast/toolchain/$(arm_target)


Now, we need to make sure we have all the required dependencies, run this command first:

sudo dnf builddep gcc
Once that's done, run the following commands:

cd ~/Dreamcast/kallistios/utils/dc-chain
./download.sh
./unpack.sh
make

You'll have to wait for each step to complete in full. Watch for any errors during the build, you may having additional missing dependencies. Hit up Google if that's the case :)

Step 3. Building KOS


OK, at this point you should have a "~/Dreamcast/toolchain" folder with stuff in it. You now need to set up your environment. Run the following commands:

cd ~/Dreamcast/kallistios
cp docs/environ.sh.sample environ.sh

Now open "~/Dreamcast/kallistios/environ.sh" in a text editor and change the KOS_BASE export so it's something like this:

export KOS_BASE="/home/YOUR_USERNAME/Dreamcast/kallistios"

Also change any references to sh-elf or arm-eabi to point to the folders in "~/Dreamcast/toolchain".

Edit your ~/.bashrc file and add the following to the end of it:

source /home/YOUR_USERNAME/Dreamcast/kallistios/environ.sh

Now, open a new terminal, run the following:

cd ~/Dreamcast/kallistios
make

Step 4. Build the ports you need


From now on it's up to you, you can "cd" into the individual ports that you want and run:

make install clean

Everything is now ready to go!

No comments:

Post a Comment