What's new

Beginner Guide:In Windows, how to build an elf, make an image, and run it in Chancast

gammelpot

New member
Here is 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.

That's all I had to do. If you use this guide and find problems, please post them here. If you use this guide and have success, please ALSO post here - thanks :)
 

4by4

New member
so spyro, if a project is sleeping its getting better? i wish you were my project manager.
 
Last edited:

misterikkit

New member
Wow, that is a nifty package. I have the problem that I need to compile an ELF on a windows system, and it would be a lot more work to get linux running on this laptop.

Right now I'm downloading a Knoppix ISO, but that will take a long time to complete. In the mean time, I'm trying to figure out how to use those elf compilers to compile my project.

I guess the problem is that `source environ.sh` changes where the compiler looks for certain files, and it can't find things like sys/io.h.
Is there a way to just use kos- compilers to make my ELFs?

EDIT:
Oh, I suppose the fact that I'm not compiling for dreamcast might have something to do with it. I just want to build ELFs! )=
 
Last edited:

Top