package/busybox: default to BR2_TARGET_GENERIC_PASSWD_* algo

Make busybox follow the BR2_TARGET_GENERIC_PASSWD_* system configuration
option, E.G.

cat defconfig
BR2_x86_core2=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_X86_CORE2_MUSL_BLEEDING_EDGE=y
BR2_STATIC_LIBS=y
BR2_TARGET_GENERIC_PASSWD_SHA512=y

./target/usr/bin/mkpasswd --help
BusyBox v1.37.0 (2026-01-27 17:31:51 CET) multi-call binary.

Usage: mkpasswd [-P FD] [-m TYPE] [-S SALT] [PASSWORD] [SALT]

Print crypt(3) hashed PASSWORD

        -P N    Read password from fd N
        -m TYPE des,md5,sha256/512 (default sha512)
        -S SALT

./target/usr/bin/mkpasswd test
$6$VQ6lDdGRJOgs8Exs$gEWp1nN/FHCAgmoB6lD.fN13EKA40yV7WQmZJcFp114VrL/st74zP5iPsLHi5NFX/A6GAa1gD.yqzp5Lz3DKl/

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Peter Korsgaard
2026-01-27 17:35:26 +01:00
committed by Julien Olivain
parent fdeced6692
commit fb523a75cf
+13
View File
@@ -176,6 +176,18 @@ define BUSYBOX_SET_CRYPT_SHA
endef
endif
ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA256),y)
define BUSYBOX_SET_DEFAULT_PASSWD_ALGO
$(call KCONFIG_SET_OPT,CONFIG_FEATURE_DEFAULT_PASSWD_ALGO,"sha256")
endef
endif
ifeq ($(BR2_TARGET_GENERIC_PASSWD_SHA512),y)
define BUSYBOX_SET_DEFAULT_PASSWD_ALGO
$(call KCONFIG_SET_OPT,CONFIG_FEATURE_DEFAULT_PASSWD_ALGO,"sha512")
endef
endif
ifeq ($(BR2_USE_MMU),y)
define BUSYBOX_SET_MMU
$(call KCONFIG_DISABLE_OPT,CONFIG_NOMMU)
@@ -427,6 +439,7 @@ define BUSYBOX_KCONFIG_FIXUP_CMDS
$(BUSYBOX_SET_MDEV)
$(BUSYBOX_SET_CRYPT_SHA)
$(BUSYBOX_LINUX_PAM)
$(BUSYBOX_SET_DEFAULT_PASSWD_ALGO)
$(BUSYBOX_SET_INIT)
$(BUSYBOX_SET_WATCHDOG)
$(BUSYBOX_SET_SELINUX)