path: root/mbr/mbr.S
diff options
authorPaulo Alcantara <pcacjr@zytor.com>2012-06-08 18:07:59 -0300
committerPaulo Alcantara <pcacjr@zytor.com>2012-07-21 01:21:45 -0300
commit4298786ca19e9121568ecd4cc8b79d276ccfd24a (patch)
treee1a3607530069734e06ca59fdc4e29e3402dd0b8 /mbr/mbr.S
parenta126f17f663c438ef264a459fa130951dbac780d (diff)
mbr: Add support for loading VBRs from XFS filesystems
Before reading the VBR into 0x7C00, we need to check the first 4 bytes of the read sector and check whether it is a XFS superblock or not. If it is, then we need to read the right sector, which is the 4th sector of the XFS partition where the Syslinux boot sector lives in. This patch adds support for booting off XFS partitions properly on MBR HDDs. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
Diffstat (limited to 'mbr/mbr.S')
1 files changed, 13 insertions, 0 deletions
diff --git a/mbr/mbr.S b/mbr/mbr.S
index b71cfb7c..270a3568 100644
--- a/mbr/mbr.S
+++ b/mbr/mbr.S
@@ -265,6 +265,19 @@ boot:
movl %eax, 8(%si) /* Adjust in-memory partition table entry */
call read_sector
jc disk_error
+ /* Check if the read sector is a XFS superblock */
+ cmpl $0x42534658, (bootsec) /* "XFSB" */
+ jne no_xfs
+ /* We put the Syslinux boot sector at offset 0x800 (4 sectors), so we
+ * need to adjust %eax (%eax + 4) to read the right sector into 0x7C00.
+ */
+ addl $0x800 >> 0x09, %eax /* plus 4 sectors */
+ call read_sector
+ jc disk_error
cmpw $0xaa55, (bootsec+510)
jne missing_os /* Not a valid boot sector */
movw $driveno, %sp /* driveno == bootsec-6 */