release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Wiki > Main > GigabeatSOriginalLoader (compare)

Difference: GigabeatSOriginalLoader (r5 vs. r4)

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, but any size disk 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.

MBR

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

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)

r7 - 08 Nov 2009 - 23:52:27 - TorneWuff

Revision r5 - 02 Nov 2009 - 23:15 - TorneWuff
Revision r4 - 15 Oct 2009 - 08:14 - NicolasPennequin
Copyright by the contributing authors.