From e01f0b69340df3fbd47810277703879d26cfb649 Mon Sep 17 00:00:00 2001 From: TolaMironcenko Date: Thu, 13 Feb 2025 00:27:24 +0700 Subject: [PATCH] added list-defconfigs and %_defconfig --- Makefile | 26 +++++++++++++++++++++----- configs/orangepi_pc_defconfig | 24 ++++++++++++------------ package/bash/Config.in | 4 ++-- package/busybox/Config.in | 4 ++-- package/curl/Config.in | 4 ++-- package/dropbear/Config.in | 6 +++--- package/git/Config.in | 8 ++++---- package/glibc/Config.in | 2 +- package/grub2/Config.in | 2 +- package/openssh/Config.in | 8 ++++---- package/sftp-server-dropbear/Config.in | 4 ++-- package/uboot/Config.in | 2 +- package/uclibc/Config.in | 2 +- package/zlib/Config.in | 6 +++--- scripts/funcs.mk | 9 +++++++++ support/config/config.mk | 19 +++++++++++++++++++ 16 files changed, 87 insertions(+), 43 deletions(-) create mode 100644 support/config/config.mk diff --git a/Makefile b/Makefile index f0a05da..b106a0d 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +TOPDIR := $(CURDIR) +DEFCONFIGS_DIR := $(CURDIR)/configs + nconfig: kconfig-nconf Config.in @@ -12,15 +15,16 @@ py-menuconfig: include scripts/funcs.mk include package/package.mk +include support/config/config.mk Command := $(firstword $(MAKECMDGOALS)) UC = $(shell echo $(Command) | tr '[:lower:]' '[:upper:]') -$(Command): - $(call CMD_CONFIGURE_$(call UC)) - $(call CMD_BUILD_$(call UC)) - $(call CMD_INSTALL_$(call UC)) +# $(Command): +# $(call CMD_CONFIGURE_$(call UC)) +# $(call CMD_BUILD_$(call UC)) +# $(call CMD_INSTALL_$(call UC)) all: $(call CMD_CONFIGURE_UCLIBC) @@ -48,4 +52,16 @@ endif $(call CMD_BUILD_UBOOT) $(call CMD_INSTALL_UBOOT) - \ No newline at end of file +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 \ No newline at end of file diff --git a/configs/orangepi_pc_defconfig b/configs/orangepi_pc_defconfig index 54a591f..c9e7211 100644 --- a/configs/orangepi_pc_defconfig +++ b/configs/orangepi_pc_defconfig @@ -13,24 +13,24 @@ CONFIG_SIMPLE_ARM=y # # Toolchain # -# CONFIG_SIMPLE_GLIBC is not set -CONFIG_SIMPLE_UCLIBC=y +# CONFIG_SIMPLE_PACKAGE_GLIBC is not set +CONFIG_SIMPLE_PACKAGE_UCLIBC=y CONFIG_SIMPLE_CROSS_COMPILE="" # # Target Packages # -CONFIG_SIMPLE_BUSYBOX=y -CONFIG_SIMPLE_ZLIB=y -CONFIG_SIMPLE_DROPBEAR=y -CONFIG_SIMPLE_SFTP_SERVER_DROPBEAR=y -CONFIG_SIMPLE_OPENSSH=y -CONFIG_SIMPLE_CURL=y -CONFIG_SIMPLE_BASH=y -CONFIG_SIMPLE_GIT=y +CONFIG_SIMPLE_PACKAGE_BUSYBOX=y +CONFIG_SIMPLE_PACKAGE_ZLIB=y +CONFIG_SIMPLE_PACKAGE_DROPBEAR=y +CONFIG_SIMPLE_PACKAGE_SFTP_SERVER_DROPBEAR=y +CONFIG_SIMPLE_PACKAGE_OPENSSH=y +CONFIG_SIMPLE_PACKAGE_CURL=y +CONFIG_SIMPLE_PACKAGE_BASH=y +CONFIG_SIMPLE_PACKAGE_GIT=y # # Bootloader # -CONFIG_SIMPLE_UBOOT=y -# CONFIG_SIMPLE_GRUB2 is not set +CONFIG_SIMPLE_PACKAGE_UBOOT=y +# CONFIG_SIMPLE_PACKAGE_GRUB2 is not set diff --git a/package/bash/Config.in b/package/bash/Config.in index dd6f4c2..ae8712b 100644 --- a/package/bash/Config.in +++ b/package/bash/Config.in @@ -1,5 +1,5 @@ -config SIMPLE_BASH +config SIMPLE_PACKAGE_BASH bool "Bash" - depends on SIMPLE_UCLIBC || SIMPLE_GLIBC + depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC help Borne again shell (default linux shell) \ No newline at end of file diff --git a/package/busybox/Config.in b/package/busybox/Config.in index 460156d..df9764d 100644 --- a/package/busybox/Config.in +++ b/package/busybox/Config.in @@ -1,4 +1,4 @@ -config SIMPLE_BUSYBOX - bool "busybox" +config SIMPLE_PACKAGE_BUSYBOX + bool "Busybox" help Default linux utilities \ No newline at end of file diff --git a/package/curl/Config.in b/package/curl/Config.in index 6611b25..bf95b6e 100644 --- a/package/curl/Config.in +++ b/package/curl/Config.in @@ -1,5 +1,5 @@ -config SIMPLE_CURL +config SIMPLE_PACKAGE_CURL bool "Curl" - depends on SIMPLE_UCLIBC || SIMPLE_GLIBC + depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC help http application \ No newline at end of file diff --git a/package/dropbear/Config.in b/package/dropbear/Config.in index aaea886..55e1126 100644 --- a/package/dropbear/Config.in +++ b/package/dropbear/Config.in @@ -1,6 +1,6 @@ -config SIMPLE_DROPBEAR - bool "dropbear" - depends on SIMPLE_UCLIBC || SIMPLE_GLIBC +config SIMPLE_PACKAGE_DROPBEAR + bool "Dropbear" + depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC select SIMPLE_ZLIB help Embedded ssh server diff --git a/package/git/Config.in b/package/git/Config.in index 6fc6a14..aefbecd 100644 --- a/package/git/Config.in +++ b/package/git/Config.in @@ -1,7 +1,7 @@ -config SIMPLE_GIT +config SIMPLE_PACKAGE_GIT bool "Git" - select SIMPLE_CURL - select SIMPLE_BASH - # depends on SIMPLE_BASH && SIMPLE_CURL + select SIMPLE_PACKAGE_CURL + select SIMPLE_PACKAGE_BASH + # depends on SIMPLE_PACKAGE_BASH && SIMPLE_PACKAGE_CURL help Git utilities \ No newline at end of file diff --git a/package/glibc/Config.in b/package/glibc/Config.in index 0e4927f..1866551 100644 --- a/package/glibc/Config.in +++ b/package/glibc/Config.in @@ -1,2 +1,2 @@ -config SIMPLE_GLIBC +config SIMPLE_PACKAGE_GLIBC bool "glibc" \ No newline at end of file diff --git a/package/grub2/Config.in b/package/grub2/Config.in index eb1b27a..ac0fb91 100644 --- a/package/grub2/Config.in +++ b/package/grub2/Config.in @@ -1,4 +1,4 @@ -config SIMPLE_GRUB2 +config SIMPLE_PACKAGE_GRUB2 bool "Grub2" help GNU GRUB is a Multiboot boot loader \ No newline at end of file diff --git a/package/openssh/Config.in b/package/openssh/Config.in index cdff9c3..893cb69 100644 --- a/package/openssh/Config.in +++ b/package/openssh/Config.in @@ -1,6 +1,6 @@ -config SIMPLE_OPENSSH - bool "openssh" - depends on SIMPLE_UCLIBC || SIMPLE_GLIBC - select SIMPLE_ZLIB +config SIMPLE_PACKAGE_OPENSSH + bool "Openssh" + depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC + select SIMPLE_PACKAGE_ZLIB help Ssh server \ No newline at end of file diff --git a/package/sftp-server-dropbear/Config.in b/package/sftp-server-dropbear/Config.in index 4a8cdf5..9f49ebc 100644 --- a/package/sftp-server-dropbear/Config.in +++ b/package/sftp-server-dropbear/Config.in @@ -1,3 +1,3 @@ -config SIMPLE_SFTP_SERVER_DROPBEAR +config SIMPLE_PACKAGE_SFTP_SERVER_DROPBEAR bool "Sftp server" - depends on SIMPLE_DROPBEAR \ No newline at end of file + depends on SIMPLE_PACKAGE_DROPBEAR \ No newline at end of file diff --git a/package/uboot/Config.in b/package/uboot/Config.in index bb128cf..b0efd3a 100644 --- a/package/uboot/Config.in +++ b/package/uboot/Config.in @@ -1,4 +1,4 @@ -config SIMPLE_UBOOT +config SIMPLE_PACKAGE_UBOOT bool "U-Boot" help Build "Das U-Boot" Boot Monitor diff --git a/package/uclibc/Config.in b/package/uclibc/Config.in index 8037281..02bb21d 100644 --- a/package/uclibc/Config.in +++ b/package/uclibc/Config.in @@ -1,2 +1,2 @@ -config SIMPLE_UCLIBC +config SIMPLE_PACKAGE_UCLIBC bool "uclibc" \ No newline at end of file diff --git a/package/zlib/Config.in b/package/zlib/Config.in index eb183d3..c38f0dc 100644 --- a/package/zlib/Config.in +++ b/package/zlib/Config.in @@ -1,3 +1,3 @@ -config SIMPLE_ZLIB - bool "zlib" - depends on SIMPLE_UCLIBC || SIMPLE_GLIBC \ No newline at end of file +config SIMPLE_PACKAGE_ZLIB + bool "Zlib" + depends on SIMPLE_PACKAGE_UCLIBC || SIMPLE_PACKAGE_GLIBC \ No newline at end of file diff --git a/scripts/funcs.mk b/scripts/funcs.mk index 0e98c61..8bc366a 100644 --- a/scripts/funcs.mk +++ b/scripts/funcs.mk @@ -1,5 +1,6 @@ reset_color = \033[0m white_background_color = \033[0;47m +green_background_color = \033[42m high_intensity_yellow_background_color = \033[0;103m high_intensity_red_background_color = \033[0;101m @@ -15,4 +16,12 @@ endef define warningmsg @echo -e "$(high_intensity_yellow_background_color) Warning: $1 $(reset_color)" +endef + +define successmsg + @echo -e "$(green_background_color) Success: $1 $(reset_color)" +endef + +define copy_file + @cp -v $1 $2 endef \ No newline at end of file diff --git a/support/config/config.mk b/support/config/config.mk new file mode 100644 index 0000000..b85ab72 --- /dev/null +++ b/support/config/config.mk @@ -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 \ No newline at end of file