Thoughts on Implementing Access to Xbox Partitioning in Linux
written by Michael Steil, 15 May 2002
The Xbox makes use of a static and implicit partitioning: The locations and sizes of the four partitions are hard-coded into the Xbox kernel and cannot be changed, so there is no partition table.
Linux finds out the partitioning scheme of a hard disk by trying out all schemes it knows (IBM-PC, Macintosh, Amiga, Sun, SGI, ...). To make the Xbox partitioning get recognized when
- the Xbox hard disk is connected to a Linux PC to modify data on the FATX partitions, or
- Linux running on the Xbox boots and of course wants to access the FATX partitions,
there has to be additional code in the Linux source.
To recognize an Xbox hard disk, it is enough to test for the "BRFR" signature at the beginning of the fourth sector (sector #3, counting from 0, or 0x600 to 0x7ff, counting in bytes from the beginning of the hard disk). The chances that a non-Xbox hard disk gets erroneously recognized is about one to 4 billion (probably a bit below).
If the hard disk is in Xbox format, nothing more had to be read: The partitioning is apparent and can be returned to the caller within the kernel:
Partition | xboxdumper | Beginning | End | Size | Contents |
/dev/hda1 | 0 | 0.5 MB | 750.5 MB | 750 MB | Scratch A |
/dev/hda2 | 1 | 750.5 MB | 1500.5 MB | 750 MB | Scratch B |
/dev/hda3 | 2 | 1500.5 MB | 2250.5 MB | 750 MB | Scratch C |
/dev/hda4 | 3 | 2250.5 MB | 2750.5 MB | 500 MB | System |
/dev/hda5 | 4 | 2750.5 MB | 7645.5 MB | 4895 MB | Data |
/dev/hda6 | - | 7645.5 MB | end | ? | unused |
Unluckily, the Linux partition numbers are not the same as the numbers used by xboxdumper.
The space that is not used by the Xbox system software should be a separate partition in Linux: It's size is 1896 MB on a Seagate hard disk, so it is ideal for the Linux root partition. Later versions of the Xbox might have even bigger hard disks, as small ones will no longer get manufactured. So this space gets more and more important. Some partitioning schemes, such as the BSD one, support sub-partitions (slices) within partitions. It might be a good idea to define slices within /dev/hda6, so that the user can partition the Linux space according to their needs. One of these slices could be used as a swap partition, for example.
Linux could also use one of the Scratch partitions as swap space. (Does the Xbox system software recreate the filesystem? If not, we have to use a swap file within the filesystem upon boot, but we may format the filesystem, so that the swap file does not get fragmented. We might also overwrite the partition and make the bootloader reformat it in FATX format. Perhaps the Xbox ignores Scratch partitions with wrong formatting, so one could be permanently used as sawp space (or, using the slice technique, as data space as well as as swap space), and the Xbox has only two Scratch partitions left.)