Loading code from Windows

Running code on the Gigabeat involves patching the original nk.bin file, inserting the custom binary executable, and using the patched Gigabeat V update utility to upload the new nk.bin file to the player.

Step 1

Compile (or use the precompiled binaries) and use the mknkboot tool (below) on a unmodified nk.bin file. A unmodified nk.bin file can be found in the patched Gigabeat V updater (nk_orig.bin). The mknkboot tool inserts the binary executable, and patches it to bypass the signature check. Usage :

mknkboot <firmware file> <boot file> <output file>

This will create a file in the current directory, which is what you need to upload to the player.

With the current build system for the Gigabeat S, the <firmware file> you should use is the nk_orig.bin file from the patched Gigabeat V updater. The <boot file> is bootloader/bootloader.bin after you've built the bootloader with the rockbox toolchain. This creates an original firmware image (i.e. with Windows Mobile) plus the Rockbox bootloader. Alternatively, you can skip the mknkboot step, and use the nk.bin file in the build directory. This doesn't include the original firmware however, and therefore dual-booting is not possible.

Step 2

For the gigabeat to accept the firmware update, it must either be in the recovery mode, or in the original firmware. To enter recovery mode, HARD reset the player (turn off the battery switch and turn it back on), and hold left (on the cross, not '<--') and the windows button while booting to enter recovery mode. This will format the hard drive. Performing the update from the OF will not format your player.

Step 3

Download the install.bat script and put it together with the modified nk.bin file in the same directory as the patched Gigabeat V updater. Connect the gigabeat to the computer and to the charger, and then run the install.bat script. Remove the usb cable when the updater is done, and the gigabeat will flash the new firmware (be careful not to remove the power while it's flashing), then run it. Once this is done when the Gigabeat is powered up again, if you want the Official Firmware to be loaded, you need to switch the hold switch on the device to the "On" position.

Using the sendfirm.exe program:

Open a Commandline prompt (cmd.exe)

Change dir to your sendfirm.exe

Run "sendfirm [PATH_TO_YOUR_NK_BIN]"

Loading code from Linux

What you need:

mknkboot (in SVN)

sendfirm (in SVN)

Step 1

Compile (or use the precompiled binaries) and use the mknkboot tool (below) on a unmodified nk.bin file. A unmodified nk.bin file can be found in the patched Gigabeat V updater (nk_orig.bin). The mknkboot tool inserts the binary executable, and patches it to bypass the signature check. Usage :

mknkboot <firmware file> <boot file> <output file>

This will create a file in the current directory, which is what you need to upload to the player.

With the current build system for the Gigabeat S, the <firmware file> you should use is the nk_orig.bin file from the patched Gigabeat V updater. The <boot file> is bootloader/bootloader.bin after you've built the bootloader with the rockbox toolchain. This creates an original firmware image (i.e. with Windows Mobile) plus the Rockbox bootloader. Alternatively, you can skip the mknkboot step, and use the nk.bin file in the build directory. This doesn't include the original firmware however, and therefore dual-booting is not possible.

Step 2

For the gigabeat to accept the firmware update, it must either be in the recovery mode, or in the original firmware. To enter recovery mode, HARD reset the player (turn off the battery switch and turn it back on), and hold left (on the cross, not '<--') and the windows button while booting to enter recovery mode. This will format the hard drive. Performing the update from the OF will not format your player.

Step 3

Compile the sendfirm tool (available in SVN in /utils/MTP), and use it to send the modified nk.bin file (produced by mknkboot) to your gigabeat. The sendfirm utility requires the libraries lib-mtp and lib-usb present to compile.

Usage:

sendfirm <file to send>

This will transfer the new firmware to the device (doesn't flash anything, much safer), and reset it, at which point it will then load the new firmware.

Note: The sendfirm tool is only meant to send either a patched nk.bin or a nk.bin compiled from the Gigabeat S bootloader. Anything else like a rockbox binary or tar will result in your device becoming non-functional. A format and restore is required.

Running Rockbox

Note: Before the bootloader could be used to install a complete rockbox build the single rockbox.gigabeat was transfered to the device. Since the first found 'rockbox.gigabeat' file will be used you have to delete rockbox.gigabeat first in order to update if you haven't used a complete build before.

Eboot.bin and Recovery.bin were extracted with guidance from Zunepet. The dumprom utility was used written by Willem who extracted the kernel/firmware image.

Original Firmware Graphics Setup Analysis

The Gigabeat S's processor, the i.mx31 uses a very complex yet powerful piece of hardware called the IPU(Image Processing Unit) to process graphics. A detailed description of this component is given in chapter 44 of the i.mx31 reference manual. Provided here is

Partial disassembly of the original firmware configuration of the IPU(full disassembly to be completed soon)

For the most part only initialization values of said registers are given. Please reference the manual to decode the meanings.(If possible this will be done in the future, this was a large undertaking without doing this)

Points of interest in the i.mx31 reference manual related to this subject :

The IPU Register Memory Map(page 1957 in Adobe Acrobat)

The IPU Internal Memory Access Address and Data Registers(page 2003)

IDMAC(Image DMA Controller) Channel Parameter Memory Map(page 2010)

IDMAC Description(page 2233)

IPU Internal Memories Mappings(page 2276)

Configuration of the IPU in the original firmware begins at 0x8805F3DC of eboot.bin->nk.exe.An important aspect of the configuration of the IPU that may concern developers at this time is the setup of the framebuffer. Rather than doing a memory remap of the fb, it may be very beneficial to totally reposition the fb within the memory space. Among the many internal memories of the IPU, there is the IDMAC Channel Parameter Memory.Repositioning the fb base address is done by setting values in IDMAC Channel Parameter Memory, more specifically at the values of EBA0 and EBA1(see page 2011,2014, and 2235 for more info). To access this one must set the IPU Internal Memory Access register to access the IDMAC Channel Parameter Memory, then read/write using the Internal Memory Data Register. Please read the IDMAC description for more detailed information. Also other internal memories can be accessed using the internal memory access and data registers, to provide greater configuration, other than what is needed on the macro level using the IPU main registers.

Official Gigabeat S Updater version 1.2

Select Mobile audio player then 2006 Select either mes30v or mes60v then firmware Download the iso file : MESV12US.iso Direct link Extract the iso with your favorite extractor (7zip for example). You get 2 files : Autorun.inf and gbs_update_1_2_us.exe Extract the exe file with 7zip for example and you get the following files : nk.bin , recovery.bin ,pmcboot_secure.bin plus a folder named 'us' containing License.txt and SUpdate.exe

If you just want to recover the original firmware, run the exe file and follow the instructions.

Firmware Recovery

Windows

If for whatever reason the Gigabeat S firmware is not booting due to some error, your fault or not, here is a tool that will help you recover the original firmware functionality. This uses the patched Gigabeat V updater from above which has been patched by Zunepet (this has been explained in the Gigabeat S forum post) to recognize and update the Gigabeat S firmware. I have written a small batch file called recover.bat that will do the recovery process. It is included in the archive.

Or you could put your Gigabeat S into recovery mode and use sendfirm.exe to copy the stock nk.bin to your device.

Linux

Simply put your Gigabeat S into recovery mode and use sendfirm to copy the stock nk.bin to your device.

HDD

Port Pin Assignments

MC13783 Info

nk.bin format

See BIN format on http://www.xs4all.nl/~itsme/projects/xda/wince-flashfile-formats.html Of note is the image length header. This rarely reflects the actual image length, and as far as I can tell is used by the bootloader to tell if the .bin file should be written to flash memory or loaded to ram. When loading a custom nk.bin file you should ensure that this length is greater than say 16mb to ensure that a bad image is not flashed.