From patchwork Fri Apr 15 07:11:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 561935 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6886:0:0:0:0 with SMTP id m6csp112962map; Fri, 15 Apr 2022 00:12:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgHl8wQnkHYG9YW7+/kj35peIRF0ScDR4KtfCmmnP0CV0ijj77zg5G0fdFRp7JbgLDaMd4 X-Received: by 2002:a05:6402:696:b0:41d:7345:41e1 with SMTP id f22-20020a056402069600b0041d734541e1mr6893538edy.179.1650006744157; Fri, 15 Apr 2022 00:12:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650006744; cv=none; d=google.com; s=arc-20160816; b=BskBThj8C8pFqBBLRWPwvF13y4pw5a/04t1EbBtP1o+PguPMUVkXhzH/EhqOiwGfz0 xfqvfd9Ml8SllOB1wP/saE9ZuwIMfBTHnEFcMxaq9pITq70Qerf+JCoeuRN1BfyoYJQ3 9ZSLOV3Mrq/DTtcoVIEH0EcFEbRWpBY0oFCp7D0VEEOnDC5rBe2EhT+lR0B9bvZY//iR N9UTPFbnuwyRnRnn2Cyjc4AbqKJACwHFUGsXb5vmldEm/CxUoyOJWEMuzQd19WxX25xs JDw3DVtOIcycYydY/AtNTYVhLZlAjf2s8OWHfnwObgert3sR0qP0z58Bk5ZpwLrycGHO BQYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=6p9YcBh/V+EndFjl1RpxsuHvonMzOt3yKM4glgPT1M0=; b=CtbmPGS+rk9j2fuOKkSd+v7cV9+f+KbS3r6MFxxu6+1naXXj4qieL8uP9JHadS5AzA YYmnvtTQdKfPqK3PvZn2d5m6rgS8aKdvllmAFun9LHR8uKjDueFLq0tLqiLixEiemY/f VN8bidYEe0DBaaskIR5bKQrSEhJoB1z8P6+8cpKLpUKR+SEkYwMMtrs3ttKkBDTLafun 91aniw1z42Kppsa8VChb8fb00CY9+OWipCd0vAJvFwxAJJUFeLohEs8Am/TzC0PWInpr L89tTSi1CDqBTlv7m/65ygEeqBECKKs3w/FmSkoC0eANw7iZFqdV6expQ5Vybl3ZDRDB wEGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eFhXXk3r; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id gl12-20020a170906e0cc00b006e6c2773fe0si512561ejb.133.2022.04.15.00.12.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 00:12:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eFhXXk3r; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 33DCD83894; Fri, 15 Apr 2022 09:12:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="eFhXXk3r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 075E483886; Fri, 15 Apr 2022 09:12:19 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0CE1D81898 for ; Fri, 15 Apr 2022 09:12:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x1032.google.com with SMTP id e8-20020a17090a118800b001cb13402ea2so7772202pja.0 for ; Fri, 15 Apr 2022 00:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6p9YcBh/V+EndFjl1RpxsuHvonMzOt3yKM4glgPT1M0=; b=eFhXXk3rmoYm3vwWb74pcubfB3Hwc52XojGoetx2iOwoESgNmO/HMDZw5OlJzgJbHB yGlSDWnbI1ceCMTG3QTjQ1cPcTZ6Dn0irB87IUwkWTJswKVS6Rv5+nlzbiOynCEIXlzV Jkwv53OQht+67U9SgIC/K9AGZuLhpsePrJahoCRtZ50XsVyw80wcrfHglXWjiLFDJ9pg SkOx81vR/vjEYZoBnoddFL79YbztzTaaeb0qNgyJnvYOXjGVYbdBy2/TLVKNrMy2zaNy bgveVG1BiB9JT9mXOe0/HTx+IoFJzLphmk1QG2G1nTnTIm2Eod6UER6YJbQ6HBeWIgnT jGiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6p9YcBh/V+EndFjl1RpxsuHvonMzOt3yKM4glgPT1M0=; b=ue9KuU1YvwNgU8oXPmhe88iSyahQMyEokDG01u8ZekpxtxbZ5dM/qQ7KSi/WSxO1oT Iy4AU90IY4njS9IubNuop8waCst/EJaxzuu9nlFiCh3xjmevlc9Vv2WQVDQKt2uHV4TR GbdjQnfIyPHizFK7AvOplnxrUuNRoLq6VALd26Ln1jCnx+hfqSY/v/eZti29lw1GCAdZ nXQnO7/TiPtpC8/KB1njMQrUadOgE1RKUlzXywwztNJtfauzxLZ9mAScRIi1mxys+7Wb IAMFgS9MiNxg0YrZTkmXKw8UVql8LC5hXkD/bSNZNg8K2sgmc9tG8r2edzSairfWA6WF HeRQ== X-Gm-Message-State: AOAM531ZEnJ854cHxEuYAhxR2ESZEbXTIF8mqEohyElLdKptjyPKYyrG HZZAuOZWSGiKDTqhkQMZmoCUYA== X-Received: by 2002:a17:902:8490:b0:156:9846:240 with SMTP id c16-20020a170902849000b0015698460240mr50038157plo.141.1650006734235; Fri, 15 Apr 2022 00:12:14 -0700 (PDT) Received: from localhost.localdomain ([2400:4050:c3e1:100:18f3:1e4:6c4:6ea3]) by smtp.gmail.com with ESMTPSA id l4-20020a056a0016c400b004f79504ef9csm1875418pfc.3.2022.04.15.00.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 00:12:13 -0700 (PDT) From: AKASHI Takahiro To: trini@konsulko.com, sjg@chromium.org, alex.nemirovsky@cortina-access.com, xypron.glpk@gmx.de Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [RFC] disk: don't compile in partition support for spl/tpl if not really necessary Date: Fri, 15 Apr 2022 16:11:56 +0900 Message-Id: <20220415071156.122261-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean 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 --- cmd/Kconfig | 1 + configs/cortina_presidio-asic-emmc_defconfig | 1 - disk/Kconfig | 37 ++++++++++---------- fs/fat/fat.c | 3 +- include/part.h | 14 ++++++-- include/sandboxblockdev.h | 2 ++ lib/efi_loader/Kconfig | 1 + 7 files changed, 37 insertions(+), 22 deletions(-) diff --git a/cmd/Kconfig b/cmd/Kconfig index d3abe3a06bff..b69c26912568 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 c22dcef7ec05..c217a00a1cf0 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 13700322e976..359af3b27e6d 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 df9ea2c028fc..a7ec1c4b759c 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 36b76f00563f..612d4c32b5c7 100644 --- a/include/part.h +++ b/include/part.h @@ -10,6 +10,7 @@ #include #include #include +#include #include 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, @@ -513,7 +523,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 4ca9554e38a0..dc983f0417b2 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 7dc24fbf0aa9..b615abf598b9 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -17,6 +17,7 @@ config EFI_LOADER select DM_EVENT select EVENT_DYNAMIC select LIB_UUID + select DOS_PARTITION select PARTITION_UUIDS select HAVE_BLOCK_DEVICE select REGEX