added list-defconfigs and %_defconfig

This commit is contained in:
wt committed 2025-02-13 00:27:24 +07:00
1 parent f638ff09b0
commit e01f0b6934
16 files changed
+86 -42

No files matched your search

+20 -4
View File
@@ -1,3 +1,6 @@
TOPDIR := $(CURDIR)
DEFCONFIGS_DIR := $(CURDIR)/configs
nconfig: nconfig:
kconfig-nconf Config.in kconfig-nconf Config.in
@@ -12,15 +15,16 @@ py-menuconfig:
include scripts/funcs.mk include scripts/funcs.mk
include package/package.mk include package/package.mk
include support/config/config.mk
Command := $(firstword $(MAKECMDGOALS)) Command := $(firstword $(MAKECMDGOALS))
UC = $(shell echo $(Command) | tr '[:lower:]' '[:upper:]') UC = $(shell echo $(Command) | tr '[:lower:]' '[:upper:]')
$(Command): # $(Command):
$(call CMD_CONFIGURE_$(call UC)) # $(call CMD_CONFIGURE_$(call UC))
$(call CMD_BUILD_$(call UC)) # $(call CMD_BUILD_$(call UC))
$(call CMD_INSTALL_$(call UC)) # $(call CMD_INSTALL_$(call UC))
all: all:
$(call CMD_CONFIGURE_UCLIBC) $(call CMD_CONFIGURE_UCLIBC)
@@ -48,4 +52,16 @@ endif
$(call CMD_BUILD_UBOOT) $(call CMD_BUILD_UBOOT)
$(call CMD_INSTALL_UBOOT) $(call CMD_INSTALL_UBOOT)
list-defconfigs:
$(call list-defconfigs,$(TOPDIR))
%_defconfig:
$(call msg,Copy defconfig: $@ to .config)
$(if \
$(wildcard $(DEFCONFIGS_DIR)/$@),\
$(call copy_file,$(DEFCONFIGS_DIR)/$@,$(TOPDIR)/.config),\
$(call errmsg,Can't find $@)\
)
$(call successmsg,Copy defconfig: $@ to .config is OK)
.PHONY: %_defconfig
+12 -12
View File
@@ -13,24 +13,24 @@ CONFIG_SIMPLE_ARM=y
# #
# Toolchain # Toolchain
# #
# CONFIG_SIMPLE_GLIBC is not set # CONFIG_SIMPLE_PACKAGE_GLIBC is not set
CONFIG_SIMPLE_UCLIBC=y CONFIG_SIMPLE_PACKAGE_UCLIBC=y
CONFIG_SIMPLE_CROSS_COMPILE="" CONFIG_SIMPLE_CROSS_COMPILE=""
# #
# Target Packages # Target Packages
# #
CONFIG_SIMPLE_BUSYBOX=y CONFIG_SIMPLE_PACKAGE_BUSYBOX=y
CONFIG_SIMPLE_ZLIB=y CONFIG_SIMPLE_PACKAGE_ZLIB=y
CONFIG_SIMPLE_DROPBEAR=y CONFIG_SIMPLE_PACKAGE_DROPBEAR=y
CONFIG_SIMPLE_SFTP_SERVER_DROPBEAR=y CONFIG_SIMPLE_PACKAGE_SFTP_SERVER_DROPBEAR=y
CONFIG_SIMPLE_OPENSSH=y CONFIG_SIMPLE_PACKAGE_OPENSSH=y
CONFIG_SIMPLE_CURL=y CONFIG_SIMPLE_PACKAGE_CURL=y
CONFIG_SIMPLE_BASH=y CONFIG_SIMPLE_PACKAGE_BASH=y
CONFIG_SIMPLE_GIT=y CONFIG_SIMPLE_PACKAGE_GIT=y
# #
# Bootloader # Bootloader
# #
CONFIG_SIMPLE_UBOOT=y CONFIG_SIMPLE_PACKAGE_UBOOT=y
# CONFIG_SIMPLE_GRUB2 is not set # CONFIG_SIMPLE_PACKAGE_GRUB2 is not set
+2 -2
View File
@@ -1,5 +1,5 @@
config SIMPLE_BASH config SIMPLE_PACKAGE_BASH
bool "Bash" bool "Bash"
depends on SIMPLE_UCLIBC || SIMPLE_GLIBC depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC
help help
Borne again shell (default linux shell) Borne again shell (default linux shell)
+2 -2
View File
@@ -1,4 +1,4 @@
config SIMPLE_BUSYBOX config SIMPLE_PACKAGE_BUSYBOX
bool "busybox" bool "Busybox"
help help
Default linux utilities Default linux utilities
+2 -2
View File
@@ -1,5 +1,5 @@
config SIMPLE_CURL config SIMPLE_PACKAGE_CURL
bool "Curl" bool "Curl"
depends on SIMPLE_UCLIBC || SIMPLE_GLIBC depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC
help help
http application http application
+3 -3
View File
@@ -1,6 +1,6 @@
config SIMPLE_DROPBEAR config SIMPLE_PACKAGE_DROPBEAR
bool "dropbear" bool "Dropbear"
depends on SIMPLE_UCLIBC || SIMPLE_GLIBC depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC
select SIMPLE_ZLIB select SIMPLE_ZLIB
help help
Embedded ssh server Embedded ssh server
+4 -4
View File
@@ -1,7 +1,7 @@
config SIMPLE_GIT config SIMPLE_PACKAGE_GIT
bool "Git" bool "Git"
select SIMPLE_CURL select SIMPLE_PACKAGE_CURL
select SIMPLE_BASH select SIMPLE_PACKAGE_BASH
# depends on SIMPLE_BASH && SIMPLE_CURL # depends on SIMPLE_PACKAGE_BASH && SIMPLE_PACKAGE_CURL
help help
Git utilities Git utilities
+1 -1
View File
@@ -1,2 +1,2 @@
config SIMPLE_GLIBC config SIMPLE_PACKAGE_GLIBC
bool "glibc" bool "glibc"
+1 -1
View File
@@ -1,4 +1,4 @@
config SIMPLE_GRUB2 config SIMPLE_PACKAGE_GRUB2
bool "Grub2" bool "Grub2"
help help
GNU GRUB is a Multiboot boot loader GNU GRUB is a Multiboot boot loader
+4 -4
View File
@@ -1,6 +1,6 @@
config SIMPLE_OPENSSH config SIMPLE_PACKAGE_OPENSSH
bool "openssh" bool "Openssh"
depends on SIMPLE_UCLIBC || SIMPLE_GLIBC depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC
select SIMPLE_ZLIB select SIMPLE_PACKAGE_ZLIB
help help
Ssh server Ssh server
+2 -2
View File
@@ -1,3 +1,3 @@
config SIMPLE_SFTP_SERVER_DROPBEAR config SIMPLE_PACKAGE_SFTP_SERVER_DROPBEAR
bool "Sftp server" bool "Sftp server"
depends on SIMPLE_DROPBEAR depends on SIMPLE_PACKAGE_DROPBEAR
+1 -1
View File
@@ -1,4 +1,4 @@
config SIMPLE_UBOOT config SIMPLE_PACKAGE_UBOOT
bool "U-Boot" bool "U-Boot"
help help
Build "Das U-Boot" Boot Monitor Build "Das U-Boot" Boot Monitor
+1 -1
View File
@@ -1,2 +1,2 @@
config SIMPLE_UCLIBC config SIMPLE_PACKAGE_UCLIBC
bool "uclibc" bool "uclibc"
+3 -3
View File
@@ -1,3 +1,3 @@
config SIMPLE_ZLIB config SIMPLE_PACKAGE_ZLIB
bool "zlib" bool "Zlib"
depends on SIMPLE_UCLIBC || SIMPLE_GLIBC depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC
+9
View File
@@ -1,5 +1,6 @@
reset_color = \033[0m reset_color = \033[0m
white_background_color = \033[0;47m white_background_color = \033[0;47m
green_background_color = \033[42m
high_intensity_yellow_background_color = \033[0;103m high_intensity_yellow_background_color = \033[0;103m
high_intensity_red_background_color = \033[0;101m high_intensity_red_background_color = \033[0;101m
@@ -16,3 +17,11 @@ endef
define warningmsg define warningmsg
@echo -e "$(high_intensity_yellow_background_color) Warning: $1 $(reset_color)" @echo -e "$(high_intensity_yellow_background_color) Warning: $1 $(reset_color)"
endef endef
define successmsg
@echo -e "$(green_background_color) Success: $1 $(reset_color)"
endef
define copy_file
@cp -v $1 $2
endef
+19
View File
@@ -0,0 +1,19 @@
define list-defconfigs
@first=true; \
for defconfig in $(1)/configs/*_defconfig; do \
[ -f "$${defconfig}" ] || continue; \
if $${first}; then \
if [ "$(2)" ]; then \
printf 'External configs in "$(call qstrip,$(2))":\n'; \
else \
printf "Built-in configs:\n"; \
fi; \
first=false; \
fi; \
defconfig="$${defconfig##*/}"; \
printf " %-35s - Build for %s\n" "$${defconfig}" "$${defconfig%_defconfig}"; \
done; \
$${first} || printf "\n"
endef
.PHONY: list-defconfigs