[1/4] part: efi: Add a Kconfig option for the number of partition entries

Message ID a43ee733c91c73f1a66c8cf72ea1ff4a3b645063.1511865262.git-series.maxime.ripard@free-electrons.com
State Superseded
Headers show
Series
  • sunxi: Ease eMMC usage and flashing
Related show

Commit Message

Maxime Ripard Nov. 28, 2017, 10:34 a.m.
On some SoCs, the SPL needs to be located right in the middle of the GPT
partition entries.

One way to work around that is to create partition entries for a smaller
number of partitions to accomodate with where the SPL will be. Create a
Kconfig option to allow to do that.

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 disk/Kconfig       | 13 +++++++++++++
 include/part_efi.h |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

Comments

Tom Rini Nov. 28, 2017, 2:50 p.m. | #1
On Tue, Nov 28, 2017 at 11:34:38AM +0100, Maxime Ripard wrote:

> On some SoCs, the SPL needs to be located right in the middle of the GPT

> partition entries.

> 

> One way to work around that is to create partition entries for a smaller

> number of partitions to accomodate with where the SPL will be. Create a

> Kconfig option to allow to do that.

> 

> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>


Reviewed-by: Tom Rini <trini@konsulko.com>


-- 
Tom
Andre Przywara Nov. 30, 2017, 12:20 a.m. | #2
On 28/11/17 10:34, Maxime Ripard wrote:
> On some SoCs, the SPL needs to be located right in the middle of the GPT
> partition entries.
> 
> One way to work around that is to create partition entries for a smaller
> number of partitions to accomodate with where the SPL will be. Create a
> Kconfig option to allow to do that.
> 
> Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Reviewed-by: Andre Przywara <andre.przywara@arm.com>

Thanks,
Andre.

> ---
>  disk/Kconfig       | 13 +++++++++++++
>  include/part_efi.h |  2 +-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/disk/Kconfig b/disk/Kconfig
> index 939656212065..f82beef6e689 100644
> --- a/disk/Kconfig
> +++ b/disk/Kconfig
> @@ -78,6 +78,19 @@ config EFI_PARTITION
>  	  common when EFI is the bootloader.  Note 2TB partition limit;
>  	  see disk/part_efi.c
>  
> +config EFI_PARTITION_ENTRIES_NUMBERS
> +	int "Number of the EFI partition entries"
> +	depends on EFI_PARTITION
> +	default 128
> +	help
> +	  Specify the number of partition entries in the GPT. This is
> +	  meant to allow less than the standard specifies for devices
> +	  that might need to place their first-stage bootloader in the
> +	  middle of a regular GPT.
> +
> +	  If unsure, leave at 128 entries, which is the standard
> +	  number.
> +
>  config EFI_PARTITION_ENTRIES_OFF
>          int "Offset (in bytes) of the EFI partition entries"
>  	depends on EFI_PARTITION
> diff --git a/include/part_efi.h b/include/part_efi.h
> index 31e6bc6e140f..4c8f6cc473c8 100644
> --- a/include/part_efi.h
> +++ b/include/part_efi.h
> @@ -27,7 +27,7 @@
>  #define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
>  #define GPT_HEADER_REVISION_V1 0x00010000
>  #define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL
> -#define GPT_ENTRY_NUMBERS		128
> +#define GPT_ENTRY_NUMBERS		CONFIG_EFI_PARTITION_ENTRIES_NUMBERS
>  #define GPT_ENTRY_SIZE			128
>  
>  #define PARTITION_SYSTEM_GUID \
>

Patch

diff --git a/disk/Kconfig b/disk/Kconfig
index 939656212065..f82beef6e689 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -78,6 +78,19 @@  config EFI_PARTITION
 	  common when EFI is the bootloader.  Note 2TB partition limit;
 	  see disk/part_efi.c
 
+config EFI_PARTITION_ENTRIES_NUMBERS
+	int "Number of the EFI partition entries"
+	depends on EFI_PARTITION
+	default 128
+	help
+	  Specify the number of partition entries in the GPT. This is
+	  meant to allow less than the standard specifies for devices
+	  that might need to place their first-stage bootloader in the
+	  middle of a regular GPT.
+
+	  If unsure, leave at 128 entries, which is the standard
+	  number.
+
 config EFI_PARTITION_ENTRIES_OFF
         int "Offset (in bytes) of the EFI partition entries"
 	depends on EFI_PARTITION
diff --git a/include/part_efi.h b/include/part_efi.h
index 31e6bc6e140f..4c8f6cc473c8 100644
--- a/include/part_efi.h
+++ b/include/part_efi.h
@@ -27,7 +27,7 @@ 
 #define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
 #define GPT_HEADER_REVISION_V1 0x00010000
 #define GPT_PRIMARY_PARTITION_TABLE_LBA 1ULL
-#define GPT_ENTRY_NUMBERS		128
+#define GPT_ENTRY_NUMBERS		CONFIG_EFI_PARTITION_ENTRIES_NUMBERS
 #define GPT_ENTRY_SIZE			128
 
 #define PARTITION_SYSTEM_GUID \