Building KOS on Linux mint (or Ubuntu): Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
''The following has been tested under Linux Mint 18 on 9/9/2018'' | |||
==Build the KOS toolchain== | |||
First, you'll need to download this [ | First, you'll need to download this [https://raw.githubusercontent.com/dreamcastdevs/dreamcast_tutorial/master/01_setup_KOS_toolchain/kos_setup_script.sh script]. | ||
In order to execute the script, you'll neet to set the execute flag on | In order to execute the script, you'll neet to set the execute flag on <code>kos_setup_script.sh</code>. | ||
In a terminal, type | In a terminal, type <code>chmod +x kos_setup_script.sh</code> then run it using <code>./kos_setup_script.sh</code>. | ||
This script will take a long time to complete (10~ mins on Intel i3 6100) as it is downloading a bunch of dependencies and installing them. | This script will take a long time to complete (10~ mins on Intel i3 6100) as it is downloading a bunch of dependencies and installing them. | ||
===Known Issues=== | |||
You might have some problem with | You might have some problem with <code>make_banner.sh</code>. If you do, delete the content of both <code>make_banner.sh</code> and <code>banner.h</code> and type run the script again using <code>./kos_setup_script.sh</code>. | ||
===Compiling done.=== | |||
When KOS is fully compiled, it should open a web browser and print this message in the terminal : | When KOS is fully compiled, it should open a web browser and print this message in the terminal : | ||
<pre>Welcome to KOS! Please check out the example in /opt/toolchains/dc/kos/examples/dreamcast/kgl/nehe/nehe02 to get started. After editing main.c, type "make" to create an ELF executable. Run it using an emulator. | |||
KOS documentation is at http://gamedev.allusion.net/docs/kos-current. When you start a new shell, please type -source /opt/toolchains/dc/kos/environ.sh- in order to set the environment variables. | KOS documentation is at http://gamedev.allusion.net/docs/kos-current. When you start a new shell, please type -source /opt/toolchains/dc/kos/environ.sh- in order to set the environment variables.</pre> | ||
===Source environ.sh=== | |||
In order for your toolchain to work properly, you'll need to source the <code>environ.sh</code> file. If you want to source it automatically, you can edit your <code>.bashrc</code> file using your favorite file editor and add | |||
<code>source /opt/toolchains/dc/kos/environ.sh</code> at the end of the file. | |||
In order for your toolchain to work properly, you'll need to source the | |||
Otherwise, just make sure you run | Otherwise, just make sure you run <syntaxhighlight lang="bash" inline>source /opt/toolchains/dc/kos/environ.sh</syntaxhighlight> in the terminal where you'll be compiling your Dreamcast programs. | ||
You can test that your environ file is source by running | You can test that your environ file is source by running <syntaxhighlight lang="bash" inline>echo $KOS_BASE</syntaxhighlight> and getting your KOS path in the terminal. You can also move to the KOS folder by typing <syntaxhighlight lang="bash" inline>cd $KOS_BASE</syntaxhighlight>. | ||
===Compile an example!=== | |||
Let's try to compile the Hello World exemple. | Let's try to compile the Hello World exemple. | ||
<syntaxhighlight lang="bash">cd $KOS_BASE/examples/dreamcast/hello</syntaxhighlight> and run <syntaxhighlight lang="bash">make</syntaxhighlight> | |||
You should get something like this : | You should get something like this : | ||
<pre>rm -f hello.elf romdisk.* | |||
kos-cc -c hello.c -o hello.o | kos-cc -c hello.c -o hello.o | ||
/opt/toolchains/dc/kos/utils/genromfs/genromfs -f romdisk.img -d romdisk -v -x .svn | /opt/toolchains/dc/kos/utils/genromfs/genromfs -f romdisk.img -d romdisk -v -x .svn | ||
Line 48: | Line 44: | ||
1 .keepme [0x801 , 0x38164f ] 0100644, sz 0, at 0x60 | 1 .keepme [0x801 , 0x38164f ] 0100644, sz 0, at 0x60 | ||
/opt/toolchains/dc/kos/utils/bin2o/bin2o romdisk.img romdisk romdisk.o | /opt/toolchains/dc/kos/utils/bin2o/bin2o romdisk.img romdisk romdisk.o | ||
kos-cc -o hello.elf hello.o romdisk.o | kos-cc -o hello.elf hello.o romdisk.o</pre> | ||
Bravo! You compiled your first Dreamcast program. | Bravo! You compiled your first Dreamcast program. |
Latest revision as of 15:43, 30 May 2020
The following has been tested under Linux Mint 18 on 9/9/2018
Build the KOS toolchain
First, you'll need to download this script.
In order to execute the script, you'll neet to set the execute flag on kos_setup_script.sh
.
In a terminal, type chmod +x kos_setup_script.sh
then run it using ./kos_setup_script.sh
.
This script will take a long time to complete (10~ mins on Intel i3 6100) as it is downloading a bunch of dependencies and installing them.
Known Issues
You might have some problem with make_banner.sh
. If you do, delete the content of both make_banner.sh
and banner.h
and type run the script again using ./kos_setup_script.sh
.
Compiling done.
When KOS is fully compiled, it should open a web browser and print this message in the terminal :
Welcome to KOS! Please check out the example in /opt/toolchains/dc/kos/examples/dreamcast/kgl/nehe/nehe02 to get started. After editing main.c, type "make" to create an ELF executable. Run it using an emulator. KOS documentation is at http://gamedev.allusion.net/docs/kos-current. When you start a new shell, please type -source /opt/toolchains/dc/kos/environ.sh- in order to set the environment variables.
Source environ.sh
In order for your toolchain to work properly, you'll need to source the environ.sh
file. If you want to source it automatically, you can edit your .bashrc
file using your favorite file editor and add
source /opt/toolchains/dc/kos/environ.sh
at the end of the file.
Otherwise, just make sure you run source /opt/toolchains/dc/kos/environ.sh
in the terminal where you'll be compiling your Dreamcast programs.
You can test that your environ file is source by running echo $KOS_BASE
and getting your KOS path in the terminal. You can also move to the KOS folder by typing cd $KOS_BASE
.
Compile an example!
Let's try to compile the Hello World exemple.
cd $KOS_BASE/examples/dreamcast/hello
and run
make
You should get something like this :
rm -f hello.elf romdisk.* kos-cc -c hello.c -o hello.o /opt/toolchains/dc/kos/utils/genromfs/genromfs -f romdisk.img -d romdisk -v -x .svn 0 rom 5b9594b5 [0xffffffff, 0xffffffff] 37777777777, sz 0, at 0x0 1 . [0x801 , 0x381647 ] 0040755, sz 0, at 0x20 1 .. [0x801 , 0x38163b ] 0040755, sz 0, at 0x40 [link to 0x20 ] 1 .keepme [0x801 , 0x38164f ] 0100644, sz 0, at 0x60 /opt/toolchains/dc/kos/utils/bin2o/bin2o romdisk.img romdisk romdisk.o kos-cc -o hello.elf hello.o romdisk.o
Bravo! You compiled your first Dreamcast program.