dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Search | Go
Wiki > Main > GigabeatSPort > GigabeatSInfo > GigabeatSOriginalLoader

Behaviour of the Gigabeat S bootloader

Loader version 1.3

WORK IN PROGRESS: this bootloader is currently being disassembled by TorneWuff

The first stage bootloader on the Gigabeat S, located in the flash, is very picky about what it will load. This is an attempt to document the requirements for it to boot.

It is likely that other versions of the loader have very similar or identical behaviour in most regards, but there are some differences, the details of which are not yet documented.

Disk requirements

Obtained by reverse engineering the function ATAReadMBR in the bootloader.

The bootloader can only handle disks with 512 byte sectors using LBA28: any size up to 128GiB should work. If it's not already partitioned and formatted then the bootloader will do this, creating a 150MB partition for the firmware and assigning all the remaining space to the second partition.

Using drives which don't support 512 byte sector writes, or drives which need LBA48, is likely to go wrong in crazy ways. If you want to try this out then please do contact TorneWuff who will try and help you work around the bootloader's restrictions.


If these checks fail the entire disk is repartitioned and reformatted:

  • MBR must start with the bytes E9 FD FF (infinite loop on x86)
  • MBR must have standard 55 AA signature at end
  • Partition types must be B or C (FAT32)
  • Must be two partitions (others must be partition type 0 or FF) but it doesn't matter which two it actually is - the first one found is treated as the boot partition, the second one found treated as the media partition).

Filesystem partition BPBs

If these checks fail for one partition only, just that partition is reformatted (If they fail for more than one the entire disk is repartitioned and reformatted):

  • First partition must be 4 sectors per cluster
  • Second partition must be 64 sectors per cluster
  • Extended boot signature at 0x42 must be 0x29 (normal for FAT32)
  • System identifier at 0x52 must be "FAT32 " (normal for FAT32)
  • Version must be 0 (normal for FAT32)
  • First byte must be 0xEB (beginning of jump, normal for most formats)
  • Sector size must be 512
If these checks fail the entire disk is repartitioned and reformatted:

  • Sector count in BPB must be equal to that in the partition table
Other assumptions:

  • If sectors per track * heads == 0 it assumes cylinders contain 512 sectors (not sure what this is used for)

Button behaviour

  • Holding MENU (the windows logo) and LEFT (on the d-pad, not the back key) on poweron triggers a full repartition/reformat of the disk.
  • Holding BACK (the arrow) and RIGHT (on the d-pad) on poweron triggers a reformat of the media (second) partition.
  • Holding MENU (the windows logo) and UP (on the d-pad) skips reflashing the flash with the contents of pmcboot_secure.bin and recovery.bin (proceeds directly to booting nk.bin)

Boot sequence

  1. Hardware init (this is a big step but not very interesting for our purposes at present)
  2. Check the above partition and filesystem properties
  3. Unless menu+up pressed, try to load eboot.bin from the firmware partition. If it exists and the modified timestamp on the file is different from the timestamp in flash (either direction!) then select this as the file for loading. If the timestamp is the same, or it doesn't exist, keep looking.
  4. If we're not going to load eboot.bin, unless menu+up pressed, try to load recovery.bin from the firmware partition. Handled same as eboot.bin.
  5. If we're not going to load eboot.bin or recovery.bin, try to load nk.bin from the firmware partition. If it exists, select this as the file for loading.
  6. If we still don't have a file to load, copy the recovery mode binary from flash to ram and run that.

r8 - 02 Apr 2021 - 20:46:06 - UnknownUser

Copyright © by the contributing authors.