aboutsummaryrefslogtreecommitdiff
path: root/scripts/allconfig/allconfig.c
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/allconfig/allconfig.c')
-rw-r--r--scripts/allconfig/allconfig.c38
1 files changed, 33 insertions, 5 deletions
diff --git a/scripts/allconfig/allconfig.c b/scripts/allconfig/allconfig.c
index 65c8b56..acd1050 100644
--- a/scripts/allconfig/allconfig.c
+++ b/scripts/allconfig/allconfig.c
@@ -2,23 +2,33 @@
#include <stdio.h>
#include <string.h>
#include <locale.h>
+#include <stdbool.h>
#include <kconfig/lkc.h>
#include <build_files.h>
#include <macros.h>
int verbose_level;
+bool full_config;
char *kconfig_file;
char *output_config_file;
char *input_config_file;
-int main(int argc, char ** argv) {
+void print_help();
+
+int main(int argc, char **argv) {
+ full_config = false;
verbose_level = 1;
int i;
for (i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "-v")) {
+ if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) {
+ print_help();
+ exit(0);
+ } else if (!strcmp(argv[i], "-v")) {
verbose_level++;
+ } else if (!strcmp(argv[i], "--all")) {
+ full_config = true;
} else if (kconfig_file == NULL) {
kconfig_file = argv[i];
} else if (input_config_file == NULL) {
@@ -31,8 +41,10 @@ int main(int argc, char ** argv) {
}
}
- if (output_config_file == NULL || kconfig_file == NULL || input_config_file == NULL) {
- Eprintf("Use with parameters: kconfig_file input_config output_config\n");
+ if (output_config_file == NULL || kconfig_file == NULL
+ || input_config_file == NULL) {
+ Eprintf("Parameters mismatch.\n");
+ print_help();
exit(-2);
}
@@ -59,8 +71,18 @@ int main(int argc, char ** argv) {
exit(-3);
}
+ struct property *prop;
for_all_symbols(i, sym) {
- if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) && sym->name != NULL) {
+ if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE)
+ && sym->name != NULL) {
+ if (!full_config) {
+ for_all_prompts(sym, prop) {
+ goto printit;
+ }
+ } else
+ goto printit;
+ continue;
+ printit:
fprintf(f, "CONFIG_%s=%s\n", sym->name,
sym_get_tristate_value(sym) == no ? "n" : "y");
}
@@ -69,3 +91,9 @@ int main(int argc, char ** argv) {
return 0;
}
+
+void print_help() {
+ printf("Usage: allconfig [-v] [-h] Kconfig Input Output\n");
+ printf(" This is generating full configuration.\n");
+ printf(" Output configuration has all configuration options.\n");
+}