Difference between revisions of "Geckoloader"

From WiiBrew
Jump to: navigation, search
m (some fixes)
(new version out: v0.0.3)
Line 1: Line 1:
 
geckoloader - coded by dhewg, #wiidev efnet/blitzed
 
geckoloader - coded by dhewg, #wiidev efnet/blitzed
  
*'''latest version: [[#v0.0.2b|v0.0.2b]]'''
+
*'''latest version: [[#v0.0.3|v0.0.3]]'''
  
 
==about==
 
==about==
Line 9: Line 9:
 
==requirements==
 
==requirements==
 
:*a usbgecko adapter
 
:*a usbgecko adapter
:*a gamecube pad
 
 
:*a way to boot wii homebrew
 
:*a way to boot wii homebrew
  
Line 16: Line 15:
 
:*no medium ejecting, rewriting and inserting required whatsoever
 
:*no medium ejecting, rewriting and inserting required whatsoever
 
:*this is especially useful for wii coders (fast development cycle)
 
:*this is especially useful for wii coders (fast development cycle)
:*reloading. the stub is placed at the memory location 0x80001800. this is PSO reload compatible, which means that any application can jump back there so that you can load another binary without reboot. the libogc exception handler also jumps to this address (when pressing Z)
+
:*reloading. the stub is placed at the memory location 0x80001800. this is PSO reload compatible, which means that any application can jump back there so that you can load another binary without reboot. the libogc exception handler also jumps to this address (when pressing Z on a gamecube pad)
 
:*the protocol used for uploading is compatible to the official geckotool (you can use your client of choice)
 
:*the protocol used for uploading is compatible to the official geckotool (you can use your client of choice)
 
:*as always, this is open source ;)
 
:*as always, this is open source ;)
Line 29: Line 28:
 
:the boot code will then execute the stub
 
:the boot code will then execute the stub
 
:the stub's job is to read the loader code from flash and execute it
 
:the stub's job is to read the loader code from flash and execute it
:finally, the loader code will accept incoming .dol's sent using a client application from the pc side
+
:finally, the loader code will accept incoming wii executables sent using a client application from the pc side
  
 
:the chosen architecture has the advantage that the tiny stub is the only component which has to stay intact in memory. while the usage of the usbgecko onboard flash might seem unnecessary at first, its purpose is the reloading feature. you will upload and run wii applications. these in return will allocate memory and write to it. if the loader code would stay somewhere in memory, any executed application might overwrite it this way, but since it sits on the onboard usbgecko flash, no application can corrupt it.
 
:the chosen architecture has the advantage that the tiny stub is the only component which has to stay intact in memory. while the usage of the usbgecko onboard flash might seem unnecessary at first, its purpose is the reloading feature. you will upload and run wii applications. these in return will allocate memory and write to it. if the loader code would stay somewhere in memory, any executed application might overwrite it this way, but since it sits on the onboard usbgecko flash, no application can corrupt it.
Line 35: Line 34:
 
==build==
 
==build==
 
:'''hint:''' a precompiled binary is included
 
:'''hint:''' a precompiled binary is included
 +
 +
:if you have compiled v0.0.2b before, remove <code>$DEVKITPPC/powerpc-gekko/lib/stub.lds</code>
  
 
:to compile the included code, you will need [http://www.devkitpro.org/ devkitPPC and libogc] r14 or higher
 
:to compile the included code, you will need [http://www.devkitpro.org/ devkitPPC and libogc] r14 or higher
:copy <code>stub/stub.lds</code> to <code>$DEVKITPPC/powerpc-gekko/lib</code>
 
 
:check config.h for some tuneables
 
:check config.h for some tuneables
 
:run <code>make</code> in the root dir
 
:run <code>make</code> in the root dir
Line 45: Line 45:
 
:*use the [[Twilight_Hack|Twilight hack]] in combination with the included geckoloader.elf to get this running
 
:*use the [[Twilight_Hack|Twilight hack]] in combination with the included geckoloader.elf to get this running
 
:*the boot code will show up
 
:*the boot code will show up
::*you have to write the loader code to the onboard usbgecko flash once, so press Z on your gamecube pad to do that
+
::*you have to write the loader code to the onboard usbgecko flash once, press the wii RESET button when asked to
::*just press A the next time you reboot the wii to skip the flash procedure
 
 
:*after that you will see the loader code in action
 
:*after that you will see the loader code in action
:*use a compatible client (like the included one <code>geckoupload</code>, or the official windows geckotool) to send a .dol
+
:*use a compatible client (like the included one <code>geckoupload</code>, or the official windows geckotool) to send a wii binary
 
:*the transfered binary should execute
 
:*the transfered binary should execute
 
:*if you loaded a game/app which has an option to jump back to 0x80001800, you will be presented with the loader code again. from there, you can transfer another binary again (no reboot required)
 
:*if you loaded a game/app which has an option to jump back to 0x80001800, you will be presented with the loader code again. from there, you can transfer another binary again (no reboot required)
  
:'''hint:''' try to upload the included <code>test.dol</code> first. it just prints a string to screen and has an option to jump back to the loader
+
:'''hint:''' try to upload the included <code>test.elf</code> first. it just prints a string to screen and has an option to jump back to the loader
  
 
==client usage==
 
==client usage==
:*set the environment variable <code>USBGECKODEVICE</code> to the tty device of the usbgecko adapter, eg:
+
:*the client uses a default tty device (except on windows), you can overwrite it using the environment variable <code>USBGECKODEVICE</code>
::<code>export USBGECKODEVICE=/dev/ttyUSB0</code>
 
 
:*make sure that your console is ready to receive an executable
 
:*make sure that your console is ready to receive an executable
 
:*pass the filename of the binary to <code>geckoupload</code>, for example:
 
:*pass the filename of the binary to <code>geckoupload</code>, for example:
::<code>geckoupload test.dol</code>
+
::<code>geckoupload test.elf</code>
  
 
:you can use this client to transfer
 
:you can use this client to transfer
:*wii .dol's to the geckoloader described on this page
+
:*wii .dol's and .elf's to the geckoloader described on this page
 
:*gamecube .dol's to the official usbgecko boot dvd
 
:*gamecube .dol's to the official usbgecko boot dvd
:*wii .elf's to the upcoming release of the twilight hack
 
  
 
==notes==
 
==notes==
:*please report back how it worked for you!
 
:*only .dol files are supported
 
 
:*you can not run gamecube binaries with this loader since we're working in wii mode here (that's a good thing)
 
:*you can not run gamecube binaries with this loader since we're working in wii mode here (that's a good thing)
:*the included client will not compile using mingw, patches are welcome. '''update''': i took the time to port it to win32. get on irc and ask me for a testing version if you're interested
 
:*the uploaded data is not verified by neither the included client nor the receiving loader code. pay attention to what you are sending to avoid annoying reboots
 
 
:*the default libogc base address for wii homebrew is at 0x80003f00. this gives a PSO compatible stub 0x1900 bytes of memory for code. hence, the stub's main() functions were written in c so that it's easy to improve/fix
 
:*the default libogc base address for wii homebrew is at 0x80003f00. this gives a PSO compatible stub 0x1900 bytes of memory for code. hence, the stub's main() functions were written in c so that it's easy to improve/fix
 
:*the loader initially puts a received binary in MEM2 to avoid overlaps. it will be relocated from there. unfortunately the loader itself has a base address in MEM1. putting it in MEM2 is on my TODO list
 
:*the loader initially puts a received binary in MEM2 to avoid overlaps. it will be relocated from there. unfortunately the loader itself has a base address in MEM1. putting it in MEM2 is on my TODO list
:*for the record: you can use the trucha signer to boot this app straight from dvd, but that is currently not supported nor endorsed. do not ask about it
+
:*you can use the trucha signer to boot this app straight from dvd
  
 
==thanks==
 
==thanks==
Line 84: Line 77:
  
 
==download==
 
==download==
 +
 +
===v0.0.3===
 +
:[[media:Geckoloader-0.0.3.tgz|geckoloader-0.0.3.tgz]]
  
 
===v0.0.2b===
 
===v0.0.2b===
Line 92: Line 88:
  
 
==changelog==
 
==changelog==
 +
 +
:*v0.0.3
 +
::*a gamecube pad isn't required anymore, the wii reset button is used to confirm the flash process
 +
::*the loader code is executed straight away if it has been flashed before (no interaction required)
 +
::*.elf file support thanks to tmbinc
 +
::*the stub doesn't overwrite the [[Memory Map|globals]] anymore, fixed by WinterMute
 +
::*a received binary is now written to MEM2 before relocating
 +
::*ported the client to win32 (binary included)
 +
::*the client now uses default device names on linux and os x
 +
::*the audio and dsp subsystems are initialized on reloading (no more annoying noise)
  
 
:*v0.0.2b
 
:*v0.0.2b

Revision as of 01:42, 11 March 2008

geckoloader - coded by dhewg, #wiidev efnet/blitzed

about

geckoloader is a native wii application which helps you to load and execute wii homebrew binaries in the easiest and fastest way possible. It acts as a server which will receive binaries directly using a usbgecko adapter.
a client tool to transfer such files is included.

requirements

  • a usbgecko adapter
  • a way to boot wii homebrew

features

  • 100% native wii mode
  • no medium ejecting, rewriting and inserting required whatsoever
  • this is especially useful for wii coders (fast development cycle)
  • reloading. the stub is placed at the memory location 0x80001800. this is PSO reload compatible, which means that any application can jump back there so that you can load another binary without reboot. the libogc exception handler also jumps to this address (when pressing Z on a gamecube pad)
  • the protocol used for uploading is compatible to the official geckotool (you can use your client of choice)
  • as always, this is open source ;)

architecture

geckoloader consists of 3 parts
  • stub
  • loader
  • boot
the boot code contains the other two code parts, and it is the executable that you have to run. it will write the loader code to the onboard usbgecko flash and place the stub into memory
the boot code will then execute the stub
the stub's job is to read the loader code from flash and execute it
finally, the loader code will accept incoming wii executables sent using a client application from the pc side
the chosen architecture has the advantage that the tiny stub is the only component which has to stay intact in memory. while the usage of the usbgecko onboard flash might seem unnecessary at first, its purpose is the reloading feature. you will upload and run wii applications. these in return will allocate memory and write to it. if the loader code would stay somewhere in memory, any executed application might overwrite it this way, but since it sits on the onboard usbgecko flash, no application can corrupt it.

build

hint: a precompiled binary is included
if you have compiled v0.0.2b before, remove $DEVKITPPC/powerpc-gekko/lib/stub.lds
to compile the included code, you will need devkitPPC and libogc r14 or higher
check config.h for some tuneables
run make in the root dir
run make install to copy geckoupload (the client) to $DEVKITPPC/bin

usage

  • use the Twilight hack in combination with the included geckoloader.elf to get this running
  • the boot code will show up
  • you have to write the loader code to the onboard usbgecko flash once, press the wii RESET button when asked to
  • after that you will see the loader code in action
  • use a compatible client (like the included one geckoupload, or the official windows geckotool) to send a wii binary
  • the transfered binary should execute
  • if you loaded a game/app which has an option to jump back to 0x80001800, you will be presented with the loader code again. from there, you can transfer another binary again (no reboot required)
hint: try to upload the included test.elf first. it just prints a string to screen and has an option to jump back to the loader

client usage

  • the client uses a default tty device (except on windows), you can overwrite it using the environment variable USBGECKODEVICE
  • make sure that your console is ready to receive an executable
  • pass the filename of the binary to geckoupload, for example:
geckoupload test.elf
you can use this client to transfer
  • wii .dol's and .elf's to the geckoloader described on this page
  • gamecube .dol's to the official usbgecko boot dvd

notes

  • you can not run gamecube binaries with this loader since we're working in wii mode here (that's a good thing)
  • the default libogc base address for wii homebrew is at 0x80003f00. this gives a PSO compatible stub 0x1900 bytes of memory for code. hence, the stub's main() functions were written in c so that it's easy to improve/fix
  • the loader initially puts a received binary in MEM2 to avoid overlaps. it will be relocated from there. unfortunately the loader itself has a base address in MEM1. putting it in MEM2 is on my TODO list
  • you can use the trucha signer to boot this app straight from dvd

thanks

  • shagkur, for helping me getting the stub working and providing the linkerscript
  • the devkitpro team
  • team tweezers for making all of this possible
  • all open source wii coders
  • nuke for sharing code for his adapter

download

v0.0.3

geckoloader-0.0.3.tgz

v0.0.2b

geckoloader-0.0.2b.tgz

v0.0.2

geckoloader-0.0.2.tgz

changelog

  • v0.0.3
  • a gamecube pad isn't required anymore, the wii reset button is used to confirm the flash process
  • the loader code is executed straight away if it has been flashed before (no interaction required)
  • .elf file support thanks to tmbinc
  • the stub doesn't overwrite the globals anymore, fixed by WinterMute
  • a received binary is now written to MEM2 before relocating
  • ported the client to win32 (binary included)
  • the client now uses default device names on linux and os x
  • the audio and dsp subsystems are initialized on reloading (no more annoying noise)
  • v0.0.2b
  • fixed a timing issue in the usbgecko flash code. since i couldn't reproduce this on my setup, thanks go out to bLAStY and NoNameNo for helping me hunting this one down
  • the included client now works on os x thanks to bushing
  • added an extra check for malformed .dol files (some doltool converted .elf's)
  • included a tiny test application
  • v0.0.2
  • first public release