All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Mayer via buildroot <buildroot@buildroot.org>
To: Buildroot Mailing List <buildroot@buildroot.org>
Cc: Fabrice Fontaine <fontaine.fabrice@gmail.com>,
	Markus Mayer <mmayer@broadcom.com>
Subject: [Buildroot] [PATCH v2] mmc-utils: allow enabling of "dangerous commands"
Date: Fri, 14 Oct 2022 10:20:12 -0700	[thread overview]
Message-ID: <20221014172013.758628-1-mmayer@broadcom.com> (raw)

Provide a config option that allows the user to enable mmc's "dangerous
commands" if so desired. mmc-utils considers turning on permanent write
protection on a device a "dangerous command" and doesn't offer it by
default.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
---
 package/mmc-utils/Config.in    |  8 ++++++++
 package/mmc-utils/mmc-utils.mk | 10 +++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/package/mmc-utils/Config.in b/package/mmc-utils/Config.in
index 850aeac44571..0283658a7a57 100644
--- a/package/mmc-utils/Config.in
+++ b/package/mmc-utils/Config.in
@@ -8,3 +8,11 @@ config BR2_PACKAGE_MMC_UTILS
 
 comment "mmc-utils needs a toolchain w/ headers >= 3.0"
 	depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
+
+config BR2_PACKAGE_MMC_UTILS_ENABLE_DANGEROUS_COMMANDS
+	bool "Enable dangerous commands"
+	depends on BR2_PACKAGE_MMC_UTILS
+	help
+	   Enable support for dangerous commands in mmc-utils. mmc-utils
+	   considers turning on permanent write protection on a device a
+	   "dangerous command" and doesn't offer it by default.
diff --git a/package/mmc-utils/mmc-utils.mk b/package/mmc-utils/mmc-utils.mk
index c84737869264..14e2bee58736 100644
--- a/package/mmc-utils/mmc-utils.mk
+++ b/package/mmc-utils/mmc-utils.mk
@@ -10,12 +10,20 @@ MMC_UTILS_SITE_METHOD = git
 MMC_UTILS_LICENSE = GPL-2.0
 MMC_UTILS_LICENSE_FILES = mmc.h
 
+MMC_UTILS_CFLAGS = $(TARGET_CFLAGS)
+
+ifeq ($(BR2_PACKAGE_MMC_UTILS_ENABLE_DANGEROUS_COMMANDS),y)
+MMC_UTILS_CFLAGS += -DDANGEROUS_COMMANDS_ENABLED
+endif
+
 # override AM_CFLAGS as the project Makefile uses it to pass
 # -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2, and the latter conflicts
 # with the _FORTIFY_SOURCE that we pass when hardening options are
 # enabled.
 define MMC_UTILS_BUILD_CMDS
-	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) AM_CFLAGS=
+	$(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) \
+		CFLAGS="$(MMC_UTILS_CFLAGS)" \
+		AM_CFLAGS=
 endef
 
 define MMC_UTILS_INSTALL_TARGET_CMDS
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2022-10-14 17:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 17:20 Markus Mayer via buildroot [this message]
2022-10-14 19:18 ` [Buildroot] [PATCH v2] mmc-utils: allow enabling of "dangerous commands" Yann E. MORIN
2022-10-14 19:54   ` Markus Mayer via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221014172013.758628-1-mmayer@broadcom.com \
    --to=buildroot@buildroot.org \
    --cc=fontaine.fabrice@gmail.com \
    --cc=mmayer@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.