aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAKASHI Takahiro <takahiro.akashi@linaro.org>2022-04-15 16:11:56 +0900
committerTom Rini <trini@konsulko.com>2022-04-15 18:05:34 -0400
commit75a49cbc0f5631f833d10171df6e0fdd854b120c (patch)
tree44c8d78f5833aa7e8b920e4c44af74603614102a
parent846f347fd6484dccecaaf4c989b962ab04960ef3 (diff)
downloadu-boot-RFC/disk-dont-compile-when-not-necessary-spl-tpl.zip
u-boot-RFC/disk-dont-compile-when-not-necessary-spl-tpl.tar.gz
u-boot-RFC/disk-dont-compile-when-not-necessary-spl-tpl.tar.bz2
disk: don't compile in partition support for spl/tpl if not really necessaryRFC/disk-dont-compile-when-not-necessary-spl-tpl
We see some increase of spl code size due to partition support (disk/*) while none of particular partition types (CONFIG_SPL_XXX_PARTITION) are enabled. With this patch applied, part.c is no longer included unless really necessary. In addition, fix errors in CI build revealed after this change is made. Fixes: commit 88ca8e26958b ("disk: Add an option for partitions in SPL") Fixes: commit 17f8cda505e3 ("efi_loader: set partition GUID in device path for SIG_TYPE_GUID") Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>
-rw-r--r--cmd/Kconfig1
-rw-r--r--configs/cortina_presidio-asic-emmc_defconfig1
-rw-r--r--disk/Kconfig37
-rw-r--r--fs/fat/fat.c3
-rw-r--r--include/part.h14
-rw-r--r--include/sandboxblockdev.h2
-rw-r--r--lib/efi_loader/Kconfig1
7 files changed, 37 insertions, 22 deletions
diff --git a/cmd/Kconfig b/cmd/Kconfig
index d3abe3a..b69c269 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -1239,6 +1239,7 @@ config CMD_OSD
config CMD_PART
bool "part"
+ depends on PARTITIONS
select HAVE_BLOCK_DEVICE
select PARTITION_UUIDS
help
diff --git a/configs/cortina_presidio-asic-emmc_defconfig b/configs/cortina_presidio-asic-emmc_defconfig
index c22dcef..c217a00 100644
--- a/configs/cortina_presidio-asic-emmc_defconfig
+++ b/configs/cortina_presidio-asic-emmc_defconfig
@@ -18,7 +18,6 @@ CONFIG_LAST_STAGE_INIT=y
CONFIG_SYS_PROMPT="G3#"
CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y
-CONFIG_CMD_PART=y
CONFIG_CMD_WDT=y
CONFIG_BOOTP_BOOTFILESIZE=y
CONFIG_CMD_CACHE=y
diff --git a/disk/Kconfig b/disk/Kconfig
index 1370032..359af3b 100644
--- a/disk/Kconfig
+++ b/disk/Kconfig
@@ -2,8 +2,7 @@
menu "Partition Types"
config PARTITIONS
- bool "Enable Partition Labels (disklabels) support"
- default y
+ bool
help
Partition Labels (disklabels) Supported:
Zero or more of the following:
@@ -20,8 +19,7 @@ config PARTITIONS
as well.
config SPL_PARTITIONS
- bool "Enable Partition Labels (disklabels) support in SPL"
- default y if PARTITIONS
+ bool
select SPL_SPRINTF
select SPL_STRTO
help
@@ -30,8 +28,7 @@ config SPL_PARTITIONS
small amount of size to SPL, typically 500 bytes.
config TPL_PARTITIONS
- bool "Enable Partition Labels (disklabels) support in TPL"
- default y if PARTITIONS
+ bool
select TPL_SPRINTF
select TPL_STRTO
help
@@ -41,57 +38,61 @@ config TPL_PARTITIONS
config MAC_PARTITION
bool "Enable Apple's MacOS partition table"
- depends on PARTITIONS
+ select PARTITIONS
help
Say Y here if you would like to use device under U-Boot which
were partitioned on a Macintosh.
config SPL_MAC_PARTITION
bool "Enable Apple's MacOS partition table for SPL"
- depends on SPL && PARTITIONS
+ depends on SPL
default y if MAC_PARTITION
+ select SPL_PARTITIONS
config DOS_PARTITION
bool "Enable MS Dos partition table"
- depends on PARTITIONS
default y if DISTRO_DEFAULTS
default y if x86 || CMD_FAT || USB_STORAGE
+ select PARTITIONS
help
traditional on the Intel architecture, USB sticks, etc.
config SPL_DOS_PARTITION
bool "Enable MS Dos partition table for SPL"
- depends on SPL && PARTITIONS
+ depends on SPL
default n if ARCH_SUNXI
default y if DOS_PARTITION
+ select SPL_PARTITIONS
config ISO_PARTITION
bool "Enable ISO partition table"
- depends on PARTITIONS
default y if DISTRO_DEFAULTS
default y if MIPS || ARCH_TEGRA
+ select PARTITIONS
config SPL_ISO_PARTITION
bool "Enable ISO partition table for SPL"
- depends on SPL && PARTITIONS
+ depends on SPL
+ select SPL_PARTITIONS
config AMIGA_PARTITION
bool "Enable AMIGA partition table"
- depends on PARTITIONS
+ select PARTITIONS
help
Say Y here if you would like to use device under U-Boot which
were partitioned under AmigaOS.
config SPL_AMIGA_PARTITION
bool "Enable AMIGA partition table for SPL"
- depends on SPL && PARTITIONS
+ depends on SPL
default y if AMIGA_PARTITION
+ select SPL_PARTITIONS
config EFI_PARTITION
bool "Enable EFI GPT partition table"
- depends on PARTITIONS
default y if DISTRO_DEFAULTS
default y if ARCH_TEGRA
+ select PARTITIONS
select LIB_UUID
help
Say Y here if you would like to use device under U-Boot which
@@ -128,9 +129,10 @@ config EFI_PARTITION_ENTRIES_OFF
config SPL_EFI_PARTITION
bool "Enable EFI GPT partition table for SPL"
- depends on SPL && PARTITIONS
+ depends on SPL
default n if ARCH_SUNXI
default y if EFI_PARTITION
+ select SPL_PARTITIONS
config PARTITION_UUIDS
bool "Enable support of UUID for partition"
@@ -143,12 +145,11 @@ config PARTITION_UUIDS
config SPL_PARTITION_UUIDS
bool "Enable support of UUID for partition in SPL"
- depends on SPL && PARTITIONS
+ depends on SPL_PARTITIONS
default y if SPL_EFI_PARTITION
config PARTITION_TYPE_GUID
bool "Enable support of GUID for partition type"
- depends on PARTITIONS
depends on EFI_PARTITION
help
Activate the configuration of GUID type
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index df9ea2c..a7ec1c4 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -95,7 +95,8 @@ int fat_register_device(struct blk_desc *dev_desc, int part_no)
cur_dev = NULL;
/* Read the partition table, if present */
- if (part_get_info(dev_desc, part_no, &info)) {
+ if (CONFIG_IS_ENABLED(DOS_PARTITION) &&
+ part_get_info(dev_desc, part_no, &info)) {
if (part_no != 0) {
printf("** Partition %d not valid on device %d **\n",
part_no, dev_desc->devnum);
diff --git a/include/part.h b/include/part.h
index 53cfbdd..5f47a76 100644
--- a/include/part.h
+++ b/include/part.h
@@ -10,6 +10,7 @@
#include <ide.h>
#include <uuid.h>
#include <linker_lists.h>
+#include <linux/errno.h>
#include <linux/list.h>
struct block_drvr {
@@ -86,7 +87,7 @@ struct disk_part {
};
/* Misc _get_dev functions */
-#ifdef CONFIG_PARTITIONS
+#if CONFIG_IS_ENABLED(PARTITIONS)
/**
* blk_get_dev() - get a pointer to a block device given its type and number
*
@@ -275,6 +276,15 @@ static inline int blk_get_device_part_str(const char *ifname,
struct disk_partition *info,
int allow_whole_dev)
{ *dev_desc = NULL; return -1; }
+static inline int part_get_info_by_name_type(struct blk_desc *dev_desc,
+ const char *name,
+ struct disk_partition *info,
+ int part_type)
+{ return -ENOENT; }
+static inline int part_get_info_by_name(struct blk_desc *dev_desc,
+ const char *name,
+ struct disk_partition *info)
+{ return -ENOENT; }
static inline int
part_get_info_by_dev_and_name_or_num(const char *dev_iface,
const char *dev_part_str,
@@ -496,7 +506,7 @@ int layout_mbr_partitions(struct disk_partition *p, int count,
#endif
-#ifdef CONFIG_PARTITIONS
+#if CONFIG_IS_ENABLED(PARTITIONS)
/**
* part_driver_get_count() - get partition driver count
*
diff --git a/include/sandboxblockdev.h b/include/sandboxblockdev.h
index 4ca9554..dc983f0 100644
--- a/include/sandboxblockdev.h
+++ b/include/sandboxblockdev.h
@@ -26,4 +26,6 @@ struct host_block_dev {
*/
int host_dev_bind(int dev, char *filename, bool removable);
+int host_get_dev_err(int dev, struct blk_desc **blk_devp);
+
#endif
diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig
index d50cd25..b360efb 100644
--- a/lib/efi_loader/Kconfig
+++ b/lib/efi_loader/Kconfig
@@ -15,6 +15,7 @@ config EFI_LOADER
depends on !EFI_APP
default y if !ARM || SYS_CPU = armv7 || SYS_CPU = armv8
select LIB_UUID
+ select DOS_PARTITION
select PARTITION_UUIDS
select HAVE_BLOCK_DEVICE
select REGEX