Patchwork [U-Boot,v2,1/3] disk/part.c: Make features optional

login
register
mail settings
Submitter Matthew McClintock
Date May 23, 2011, 9:49 p.m.
Message ID <1306187382-26507-1-git-send-email-msm@freescale.com>
Download mbox | patch
Permalink /patch/97093/
State Superseded
Headers show

Comments

Matthew McClintock - May 23, 2011, 9:49 p.m.
If we don't want to build support for any partition types we can now
add #undef CONFIG_PARTITIONS in a board config file to keep this from
being compiled in. Otherwise boards assume this is compiled in by
default

Signed-off-by: Matthew McClintock <msm@freescale.com>
---
v2: Fix patch to apply to current tree

Note: This includes the fixes for MMC only. USB/SATA/etc need to do
something similiar

 common/cmd_mmc.c          |    2 ++
 disk/Makefile             |    2 +-
 drivers/mmc/mmc.c         |    2 ++
 include/config_defaults.h |    1 +
 4 files changed, 6 insertions(+), 1 deletions(-)
Mike Frysinger - May 24, 2011, 3:08 a.m.
On Monday, May 23, 2011 17:49:42 Matthew McClintock wrote:
> --- a/common/cmd_mmc.c
> +++ b/common/cmd_mmc.c
> @@ -180,7 +180,9 @@ int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc,
> char * const argv[]) mmc_dev = mmc_get_dev(curr_device);
>  		if (mmc_dev != NULL &&
>  				mmc_dev->type != DEV_TYPE_UNKNOWN) {
> +#ifdef CONFIG_PARTITIONS
>  			print_part(mmc_dev);
> +#endif

how about adding this logic to the header ?  then print_part() is 
transparently turned into a stub for all users ...
-mike

Patch

diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 176646d..fe8c77b 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -180,7 +180,9 @@  int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		mmc_dev = mmc_get_dev(curr_device);
 		if (mmc_dev != NULL &&
 				mmc_dev->type != DEV_TYPE_UNKNOWN) {
+#ifdef CONFIG_PARTITIONS
 			print_part(mmc_dev);
+#endif
 			return 0;
 		}
 
diff --git a/disk/Makefile b/disk/Makefile
index 17266a2..5affe34 100644
--- a/disk/Makefile
+++ b/disk/Makefile
@@ -27,7 +27,7 @@  include $(TOPDIR)/config.mk
 
 LIB	= $(obj)libdisk.o
 
-COBJS-y += part.o
+COBJS-$(CONFIG_PARTITIONS) 	+= part.o
 COBJS-$(CONFIG_MAC_PARTITION)   += part_mac.o
 COBJS-$(CONFIG_DOS_PARTITION)   += part_dos.o
 COBJS-$(CONFIG_ISO_PARTITION)   += part_iso.o
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 21aedba..f2d236c 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1007,7 +1007,9 @@  int mmc_startup(struct mmc *mmc)
 			(mmc->cid[1] >> 8) & 0xff, mmc->cid[1] & 0xff);
 	sprintf(mmc->block_dev.revision, "%d.%d", mmc->cid[2] >> 28,
 			(mmc->cid[2] >> 24) & 0xf);
+#ifdef CONFIG_PARTITIONS
 	init_part(&mmc->block_dev);
+#endif
 
 	return 0;
 }
diff --git a/include/config_defaults.h b/include/config_defaults.h
index 0337163..d023c63 100644
--- a/include/config_defaults.h
+++ b/include/config_defaults.h
@@ -16,5 +16,6 @@ 
 
 #define CONFIG_GZIP 1
 #define CONFIG_ZLIB 1
+#define CONFIG_PARTITIONS 1
 
 #endif