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.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
[yann.morin.1998@free.fr:
  - use if-endif block
  - move closer to main option for proper indentation
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
Markus Mayer 2022-10-14 10:20:12 -07:00 committed by Yann E. MORIN
parent eeeaa801f3
commit 4c7f1a439a
2 changed files with 20 additions and 1 deletions

View File

@ -6,5 +6,16 @@ config BR2_PACKAGE_MMC_UTILS
https://git.kernel.org/cgit/linux/kernel/git/cjb/mmc-utils.git https://git.kernel.org/cgit/linux/kernel/git/cjb/mmc-utils.git
if BR2_PACKAGE_MMC_UTILS
config BR2_PACKAGE_MMC_UTILS_ENABLE_DANGEROUS_COMMANDS
bool "Enable dangerous commands"
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.
endif
comment "mmc-utils needs a toolchain w/ headers >= 3.0" comment "mmc-utils needs a toolchain w/ headers >= 3.0"
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0 depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0

View File

@ -10,12 +10,20 @@ MMC_UTILS_SITE_METHOD = git
MMC_UTILS_LICENSE = GPL-2.0 MMC_UTILS_LICENSE = GPL-2.0
MMC_UTILS_LICENSE_FILES = mmc.h 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 # override AM_CFLAGS as the project Makefile uses it to pass
# -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2, and the latter conflicts # -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2, and the latter conflicts
# with the _FORTIFY_SOURCE that we pass when hardening options are # with the _FORTIFY_SOURCE that we pass when hardening options are
# enabled. # enabled.
define MMC_UTILS_BUILD_CMDS 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 endef
define MMC_UTILS_INSTALL_TARGET_CMDS define MMC_UTILS_INSTALL_TARGET_CMDS