aboutsummaryrefslogtreecommitdiffstats
path: root/extlinux
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2014-05-20 16:47:59 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2014-05-20 16:47:59 -0700
commit37eef6403a44cd7de97ce997cf899c0824792ce4 (patch)
tree43579e675834e7f1984763f171daae7e5516f8ba /extlinux
parent81609df52ac52636a6d4af9249ede641620cb3a7 (diff)
downloadsyslinux-37eef6403a44cd7de97ce997cf899c0824792ce4.tar.gz
syslinux-37eef6403a44cd7de97ce997cf899c0824792ce4.tar.xz
syslinux-37eef6403a44cd7de97ce997cf899c0824792ce4.zip
btrfs: Move ldlinux.sys to Boot Area B
ldlinux.sys is frequently too big to fit into Boot Area A (64K). Per a recent ruling by Chris Mason, we have a 768K Boot Area B at offset 256K, so use that to store ldlinux.sys. In theory we could split it up and make it slightly larger, however, ldlinux.sys is loaded below the 640K mark so it has to be smaller than that size anyway. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'extlinux')
-rw-r--r--extlinux/btrfs.h6
-rw-r--r--extlinux/main.c15
2 files changed, 15 insertions, 6 deletions
diff --git a/extlinux/btrfs.h b/extlinux/btrfs.h
index 4e2cb317..17a10be3 100644
--- a/extlinux/btrfs.h
+++ b/extlinux/btrfs.h
@@ -13,6 +13,12 @@
#define BTRFS_FSID_SIZE 16
#define BTRFS_UUID_SIZE 16
+/* Fixed areas reserved for the boot loader */
+#define BTRFS_BOOT_AREA_A_OFFSET 0
+#define BTRFS_BOOT_AREA_A_SIZE BTRFS_SUPER_INFO_OFFSET
+#define BTRFS_BOOT_AREA_B_OFFSET (256 * 1024)
+#define BTRFS_BOOT_AREA_B_SIZE ((1024-256) * 1024)
+
typedef __u64 u64;
typedef __u32 u32;
typedef __u16 u16;
diff --git a/extlinux/main.c b/extlinux/main.c
index 47c1e68e..7271a766 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -1,7 +1,7 @@
/* ----------------------------------------------------------------------- *
*
* Copyright 1998-2008 H. Peter Anvin - All Rights Reserved
- * Copyright 2009-2012 Intel Corporation; author: H. Peter Anvin
+ * Copyright 2009-2014 Intel Corporation; author: H. Peter Anvin
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -76,14 +76,17 @@
#define XFS_BOOTSECT_OFFSET (4 << SECTOR_SHIFT)
#define XFS_SUPPORTED_BLOCKSIZE 4096 /* 4 KiB filesystem block size */
-/* the btrfs partition first 64K blank area is used to store boot sector and
- boot image, the boot sector is from 0~512, the boot image starts after */
-#define BTRFS_BOOTSECT_AREA 65536
-#define BTRFS_EXTLINUX_OFFSET SECTOR_SIZE
+/*
+ * btrfs has two discontiguous areas reserved for the boot loader.
+ * Use the first one (Boot Area A) for the boot sector and the ADV,
+ * and the second one for "ldlinux.sys".
+ */
+#define BTRFS_EXTLINUX_OFFSET BTRFS_BOOT_AREA_B_OFFSET
+#define BTRFS_EXTLINUX_SIZE BTRFS_BOOT_AREA_B_SIZE
#define BTRFS_SUBVOL_MAX 256 /* By btrfs specification */
static char subvol[BTRFS_SUBVOL_MAX];
-#define BTRFS_ADV_OFFSET (BTRFS_BOOTSECT_AREA - 2 * ADV_SIZE)
+#define BTRFS_ADV_OFFSET (BOOT_AREA_A_OFFSET + BOOT_AREA_A_SIZE - 2*ADV_SIZE)
/*
* Get the size of a block device