PDA

View Full Version : How to build an elf, and run it in Chankast



I_am_a_newbie
November 30th, 2004, 11:19
My complete Windows guide to building an elf, converting it to a disk image and emulating it in Chankast.

I've spent over two days trying to find out what I needed to compile and run code for the DreamCast, and there was so much information that made lots of assumptions about cygwin, gnu and who knows what. I am a Windows guy, and I knew NOTHING about this, so therefore I got nowhere. Then I found rawoul's complete devkit, and it was *almost* all you need, but people were having problems. I solved my issues, and have successfully compiled an elf. Here is a step by step report, starting from having a Windows XP machine with an internet browser and an internet connection (it should work with other versions of windows also)

Compiling an elf
1. go to www.cygwin.cpp, run their setup program (http://www.cygwin.com/setup.exe). Use all default settings, but you must also install package: devel -> 'Make: The GNU version of the 'make' utility', version 3.80-1
2. Check your 'c:\windows\system32'. If you have a file called cygwin1.dll, then it might very well be out of date (I had this, don't know what installed this). Rename this to cygwin1old.dll, to get it out of the way
3. Download the 57mb development package from http://rawoul.free.fr/dcdev.tar.bz2, and move it to c:\cygwin\home\USER (where USER depends on what the name of your currently logged on user name is)
4. Open start menu->program files->cygwin bash shell
5. In cygwin shell, type: 'cd /home/USER' (where USER depends on what the name of your currently logged on user name is)
6. In cygwin shell, type 'tar -xvjf dcdev.tar.bz2'
7. The \cygwin\home\USER\dcdev\environ.sh file has a bug, as it assumed that the user was named rawoul. In a text editor (not notepad, it cannot read it properly, I used visual studio), edit this file, line 55, to contain: export PATH="${PATH}:${KOS_CC_BASE}/bin:${DC_ROOT}/dc/bin"
8. in cygwin shell, type 'cd dcdev'
9. in cygwin shell, type 'source environ.sh'
10. in cygwin shell, type 'cd sticks'
11. in cygwin shell, type 'make'
12. after a while it should finish, and if you scroll up there should be 1 warning in total (unused variable IrisController&p).
13. in cygwin shell, type 'dir'. There should now be a file called sticksb0.elf

Making a Disk Image

14. In the cygwin prompt: 'sh-elf-objcopy -R .stack -O binary sticksb0.elf sticksb0.bin'
15. In the cygwin prompt: 'mkdir sticksdisk'
16. You need to get an IP.BIN file into the disk folder. I extracted IP.BIN from the Stars demo (http://dev.dcemulation.com/files/dcsoftware/demos/stars_bin.tar.gz). IMPORTANT: Don't extract anything else.
17. In the cygwin prompt: 'scramble sticksb0.bin sticksdisk/1ST_READ.BIN'
18. In the cygwin prompt: 'dir sticksdisk' This should now contain two files, 1ST_READ.BIN and IP.BIN
19. download selfboot from http://www.dchomebrew.org/zacmcd/Files/Selfboot.exe
20. install it to c:\selfboot
21. run c:\selfboot\selfboot.exe
22. choose the folder C:\cygwin\home\USER\dcdev\sticks\sticksdemo (where user is your user name when you logged into windows).
23. Now you can generate your image for Disk Juggler or Nero. I used Disk Juggler to test this, and for emulating. When done, there is an image in c:\selfboot, called sticksdemo.cdi. You can burn this to disk if you want, or you can run it in chankast

Testing In Chankast

24. download and install Daemon Tools v3.29 (important: do not a newer version, it might not run), from http://www.daemon-tools.cc/dtcc/portal/download.php?mode=Download&id=27
25. when done (and possibly after rebooting your PC), there is a new icon in your system tray (lower right corner), it's a red lightning bolt on a silver sphere. Right click, go to virtual cd/dvd-rom, go to device 0: [DEVICE:] (no media), and select Mount Image. Choose sticksdemo.cdi. Make sure you remember the letter for DEVICE.
26. Install chankast alpha .25, and get it to run to the bios screen (plenty of other guides for that – go to www.chanka.org for hints). Quit out.
27. Start Chankast. In the plugins menu, make sure CDRom plugin is set to 'CDRom Interface xxx'. If the emulator requests it, quit and restart chankast.
28. In Options->Configure drive, choose the drive letter from three steps above
29. Choose Run->Start. It should now boot to the sticks game. It crashes after the menu (Due to chankast not being finished), but at least it shows that the compile works.

If you see any bugs in this please report them here. If not, I want to spread this guide around, because it is a pain to set this up

Artchi
December 8th, 2004, 04:52
Thank you for this tutorial! :)

Why are you testing your elf on a CD? Look at this:
http://adk.napalm-x.com/dc/dcload-serial/

You need a DC-Coderscable from Liksang and then you can upload your elf in to the DC main memory and start it there.

http://www.lik-sang.com/info.php?category=4&products_id=48&PHPSESSID=3616a e1d011c5395f8db5c19cbd1ba5c

Burn dc-load on a CD and put it in your DC. And on your PC you need dc-tool for an upload, there is a Linux and a Windows compiled version. Your elf can ofcourse send printf-commands to the console on your PC, great for debugging.

I_am_a_newbie
December 12th, 2004, 00:03
You are welcome.

I tested the code running from CD primarily because I wanted to make sure that I had all the steps necessary to ship a project. Truth be told, I hate the trial-and-error nature of setting up a build environment for a new machine. By getting it all done at once means that from now on I only have to focus on *real* programming.

Besides, at the time I did not have the coder cable or the broadband adapter - I just got the broadband adapter from a friend a couple of days ago

Aphex
January 7th, 2005, 02:14
Nice guide :)