mmc-utils: allow enabling of "dangerous commands"
PATCH v2 1/1 mmc-utils: allow enabling of "dangerous commands"
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.
--- package/mmc-utils/Config.in | 8 ++++++++ package/mmc-utils/mmc-utils.mk | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
package/mmc-utils/Config.in +8 -0
@@ -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.
package/mmc-utils/mmc-utils.mk +9 -1
@@ -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
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Yann E. MORIN
AppliedMarkus, All,
On 2022-10-14 10:20 -0700, Markus Mayer via buildroot spake thusly:
Quoted 17 lines
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 <[email protected]>--- package/mmc-utils/Config.in | 8 ++++++++ package/mmc-utils/mmc-utils.mk | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)package/mmc-utils/Config.in +0
-0@@ -8,3 +8,11 @@ config BR2_PACKAGE_MMC_UTILS
package/mmc-utils/Config.in config BR2_PACKAGE_MMC_UTILS · line 18
Quoted 10 lines
package/mmc-utils/Config.in +8
-0comment "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.
Sub-options must immediately follow the main option, or the indentation is not correct.
We also prefer if-endif blocks when introducing new sub-options, for consistency across the code base.
Applied to master with the above two changes, thanks.
Regards,
Yann E. MORIN.
Quoted 33 lines
package/mmc-utils/mmc-utils.mk +9
-1@@ -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_CMDSSignature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 16 lines · Yann E. MORIN
package/mmc-utils/Config.in config BR2_PACKAGE_MMC_UTILS · line 18
Quoted 12 lines
package/mmc-utils/Config.in +8
-0@@ -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.Sub-options must immediately follow the main option, or the indentation is not correct.
Quoted 2 lines
We also prefer if-endif blocks when introducing new sub-options, for consistency across the code base.
Gotcha.
Quoted 1 line
Applied to master with the above two changes, thanks.
Thanks for the fixup.
Regards,
-Markus
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot