[PATCH 06/23] disk: Use Makefile to omit partition drivers

Simon Glass sjg at chromium.org
Sun Aug 7 17:46:51 CEST 2022


At present these files have an #ifdef covering the whole file. Move the
condition to the Makefile instead.

Add BLK to the condition since future patches will adjust things so that
HAVE_BLOCK_DEVICE is only for SPL, but the partition drivers are needed
in U-Boot proper too.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 disk/Makefile     | 4 ++++
 disk/part_amiga.c | 4 ----
 disk/part_dos.c   | 4 ----
 disk/part_efi.c   | 3 ---
 disk/part_iso.c   | 3 ---
 disk/part_mac.c   | 3 ---
 drivers/Makefile  | 1 +
 7 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/disk/Makefile b/disk/Makefile
index ec148832b33..458e21e3fb7 100644
--- a/disk/Makefile
+++ b/disk/Makefile
@@ -9,8 +9,12 @@ obj-$(CONFIG_$(SPL_TPL_)PARTITIONS)  += part.o
 ifdef CONFIG_$(SPL_TPL_)BLK
 obj-$(CONFIG_$(SPL_TPL_)PARTITIONS)  += disk-uclass.o
 endif
+
+# Must have BLK or HAVE_BLOCK_DEVICE to support partitions
+ifneq ($(CONFIG_$(SPL_TPL_)BLK),$(CONFIG_HAVE_BLOCK_DEVICE),)
 obj-$(CONFIG_$(SPL_TPL_)MAC_PARTITION)   += part_mac.o
 obj-$(CONFIG_$(SPL_TPL_)DOS_PARTITION)   += part_dos.o
 obj-$(CONFIG_$(SPL_TPL_)ISO_PARTITION)   += part_iso.o
 obj-$(CONFIG_$(SPL_TPL_)AMIGA_PARTITION) += part_amiga.o
 obj-$(CONFIG_$(SPL_TPL_)EFI_PARTITION)   += part_efi.o
+endif
diff --git a/disk/part_amiga.c b/disk/part_amiga.c
index ac7ada54781..45d3a704866 100644
--- a/disk/part_amiga.c
+++ b/disk/part_amiga.c
@@ -11,8 +11,6 @@
 #include "part_amiga.h"
 #include <part.h>
 
-#ifdef CONFIG_HAVE_BLOCK_DEVICE
-
 #undef AMIGA_DEBUG
 
 #ifdef AMIGA_DEBUG
@@ -387,5 +385,3 @@ U_BOOT_PART_TYPE(amiga) = {
 	.print		= part_print_amiga,
 	.test		= part_test_amiga,
 };
-
-#endif
diff --git a/disk/part_dos.c b/disk/part_dos.c
index 94fae7166d7..a94702c5f34 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -23,8 +23,6 @@
 #include "part_dos.h"
 #include <part.h>
 
-#ifdef CONFIG_HAVE_BLOCK_DEVICE
-
 #define DOS_PART_DEFAULT_SECTOR 512
 
 /* should this be configurable? It looks like it's not very common at all
@@ -518,5 +516,3 @@ U_BOOT_PART_TYPE(dos) = {
 	.print		= part_print_ptr(part_print_dos),
 	.test		= part_test_dos,
 };
-
-#endif
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 5090efd1192..ad94504ed90 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -28,8 +28,6 @@
 #include <linux/ctype.h>
 #include <u-boot/crc.h>
 
-#ifdef CONFIG_HAVE_BLOCK_DEVICE
-
 /* GUID for basic data partitons */
 #if CONFIG_IS_ENABLED(EFI_PARTITION)
 static const efi_guid_t partition_basic_data_guid = PARTITION_BASIC_DATA_GUID;
@@ -1204,4 +1202,3 @@ U_BOOT_PART_TYPE(a_efi) = {
 	.print		= part_print_ptr(part_print_efi),
 	.test		= part_test_efi,
 };
-#endif /* CONFIG_HAVE_BLOCK_DEVICE */
diff --git a/disk/part_iso.c b/disk/part_iso.c
index 1061f341d35..4cd619bf46d 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -12,8 +12,6 @@
 #include <asm/unaligned.h>
 #include "part_iso.h"
 
-#ifdef CONFIG_HAVE_BLOCK_DEVICE
-
 /* #define	ISO_PART_DEBUG */
 
 #ifdef	ISO_PART_DEBUG
@@ -241,4 +239,3 @@ U_BOOT_PART_TYPE(iso) = {
 	.print		= part_print_iso,
 	.test		= part_test_iso,
 };
-#endif
diff --git a/disk/part_mac.c b/disk/part_mac.c
index e01ae745661..ae8263f755a 100644
--- a/disk/part_mac.c
+++ b/disk/part_mac.c
@@ -20,8 +20,6 @@
 #include "part_mac.h"
 #include <part.h>
 
-#ifdef CONFIG_HAVE_BLOCK_DEVICE
-
 /* stdlib.h causes some compatibility problems; should fixe these! -- wd */
 #ifndef __ldiv_t_defined
 typedef struct {
@@ -247,4 +245,3 @@ U_BOOT_PART_TYPE(mac) = {
 	.print		= part_print_mac,
 	.test		= part_test_mac,
 };
-#endif
diff --git a/drivers/Makefile b/drivers/Makefile
index eba9940231f..f2154e15d6a 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -60,6 +60,7 @@ obj-$(CONFIG_SPL_USB_HOST) += usb/host/
 obj-$(CONFIG_OMAP_USB_PHY) += usb/phy/
 obj-$(CONFIG_SPL_SATA) += ata/ scsi/
 obj-$(CONFIG_HAVE_BLOCK_DEVICE) += block/
+obj-$(CONFIG_SPL_BLK) += block/
 obj-$(CONFIG_SPL_THERMAL) += thermal/
 
 endif
-- 
2.37.1.559.g78731f0fdb-goog



More information about the U-Boot mailing list