Martin Roth (martinroth@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12529
-gerrit
commit 8d3c826f938583ed34f2c5347cc271a696ad31f8 Author: Martin Roth martinroth@google.com Date: Tue Nov 24 12:34:16 2015 -0700
sconfig: pass in devicetree filename
Instead of forcing the hardcoded 'devicetree.cb' filename under the mainboard directory, this allows mainboards to select a filename for the devicetree file.
This allows mainboard variants that need to use different devicetree files to live in the same directory.
Change-Id: I761e676ba5d5f70d1fb86656b528f63db169fcef Signed-off-by: Martin Roth martinroth@google.com --- Makefile.inc | 4 ++-- src/Kconfig | 8 ++++++++ util/sconfig/main.c | 32 +++++++++++++++++++++----------- 3 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/Makefile.inc b/Makefile.inc index 53b658b..4e9f9a9 100644 --- a/Makefile.inc +++ b/Makefile.inc @@ -369,10 +369,10 @@ $(BIMGTOOL): $(top)/util/bimgtool/bimgtool.c ####################################################################### # needed objects that every mainboard uses # Creation of these is architecture and mainboard independent -$(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/devicetree.cb $(objutil)/sconfig/sconfig +$(obj)/mainboard/$(MAINBOARDDIR)/static.c: $(src)/mainboard/$(MAINBOARDDIR)/$(call strip_quotes, $(CONFIG_DEVICETREE)) $(objutil)/sconfig/sconfig @printf " SCONFIG $(subst $(src)/,,$(<))\n" mkdir -p $(obj)/mainboard/$(MAINBOARDDIR) - $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR) + $(objutil)/sconfig/sconfig $(MAINBOARDDIR) $(obj)/mainboard/$(MAINBOARDDIR) $(call strip_quotes, $(CONFIG_DEVICETREE))
ramstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c romstage-y+=$(obj)/mainboard/$(MAINBOARDDIR)/static.c diff --git a/src/Kconfig b/src/Kconfig index 8439a00..471d305 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -323,6 +323,14 @@ config BOARD_ID_STRING This string is placed in the 'board_id' CBFS file for indicating board type.
+config DEVICETREE + string + default "devicetree.cb" + help + This symbol is for mainboards to select a different file name for + their devicetree.cb file. This allows board variants that need + different devicetree files to be in the same directory. + config RAM_CODE_SUPPORT bool default n diff --git a/util/sconfig/main.c b/util/sconfig/main.c index 27027f5..afed63c 100644 --- a/util/sconfig/main.c +++ b/util/sconfig/main.c @@ -547,7 +547,7 @@ static void inherit_subsystem_ids(FILE *file, struct device *dev)
static void usage(void) { - printf("usage: sconfig vendor/mainboard outputdir [-{s|b|k} outputfile]\n"); + printf("usage: sconfig vendor/mainboard outputdir devicefile [-{s|b|k} outputfile]\n"); printf("\t-s file\tcreate ramstage static device map\n"); printf("\t-b file\tcreate bootblock init_mainboard()\n"); printf("\t-k file\tcreate Kconfig devicetree section\n"); @@ -555,27 +555,37 @@ static void usage(void) exit (1); }
+#define VENDOR_MAINBOARD_ARG 1 +#define OUTPUTDIR_ARG 2 +#define DEVICEFILE_ARG 3 +#define OUTPUTTYPE_ARG 4 +#define OUTPUTFILE_ARG 5 + +#define MIN_ARGS 4 +#define MAX_ARGS 6
int main(int argc, char** argv) { - if (argc != 3 && argc != 5) + if (argc != MIN_ARGS && argc != MAX_ARGS) usage();
- char *mainboard=argv[1]; - char *outputdir=argv[2]; - char *devtree=malloc(strlen(mainboard)+30); - sprintf(devtree, "src/mainboard/%s/devicetree.cb", mainboard); + char *mainboard=argv[VENDOR_MAINBOARD_ARG]; + char *outputdir=argv[OUTPUTDIR_ARG]; + char *devfile=argv[DEVICEFILE_ARG]; + char *devtree=malloc(strlen(mainboard)+strlen(devfile)+30); + sprintf(devtree, "src/mainboard/%s/%s", mainboard, devfile); char *outputc;
- if (argc == 3) { + if (argc == MIN_ARGS) { scan_mode = STATIC_MODE; outputc=malloc(strlen(outputdir)+20); sprintf(outputc, "%s/static.c", outputdir); - } else if (argc == 5) { - if ((argv[3][0] != '-') || (argv[3][2] == 0)) { + } else if (argc == MAX_ARGS) { + if ((argv[OUTPUTTYPE_ARG][0] != '-') || + (argv[OUTPUTTYPE_ARG][2] == 0)) { usage(); }
- switch (argv[3][1]) { + switch (argv[OUTPUTTYPE_ARG][1]) { case 's': scan_mode = STATIC_MODE; break; @@ -589,7 +599,7 @@ int main(int argc, char** argv) { usage(); break; } - char *outputfile=argv[4]; + char *outputfile=argv[OUTPUTFILE_ARG];
outputc=malloc(strlen(outputdir)+strlen(outputfile)+2); sprintf(outputc, "%s/%s", outputdir, outputfile);