util/blobtool: rename to bincfg

The name blobtool is confusing as 'blob' is also used to
describe nonfree software in binary form.

Since this utility deals with binary configurations it
makes more sense to call it bincfg.

Change-Id: I3339274f1c42df4bb4a6b30b9538d91c3c03d7d0
Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo@no-log.org>
Reviewed-on: https://review.coreboot.org/23239
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Kocialkowski <contact@paulk.fr>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Denis 'GNUtoo' Carikli 2018-01-10 14:35:55 +01:00 committed by Nico Huber
parent 86391f1605
commit 780e931eed
18 changed files with 70 additions and 70 deletions

2
.gitignore vendored
View File

@ -84,7 +84,7 @@ util/*/.test
util/amdfwtool/amdfwtool util/amdfwtool/amdfwtool
util/archive/archive util/archive/archive
util/bimgtool/bimgtool util/bimgtool/bimgtool
util/blobtool/blobtool util/bincfg/bincfg
util/board_status/board-status util/board_status/board-status
util/cbfstool/cbfs-compression-tool util/cbfstool/cbfs-compression-tool
util/cbfstool/cbfstool util/cbfstool/cbfstool

View File

@ -88,7 +88,7 @@ subdirs-y += src/superio
subdirs-y += $(wildcard src/drivers/*) $(wildcard src/drivers/*/*) subdirs-y += $(wildcard src/drivers/*) $(wildcard src/drivers/*/*)
subdirs-y += src/cpu src/vendorcode subdirs-y += src/cpu src/vendorcode
subdirs-y += util/cbfstool util/sconfig util/nvramtool util/broadcom subdirs-y += util/cbfstool util/sconfig util/nvramtool util/broadcom
subdirs-y += util/futility util/marvell util/blobtool subdirs-y += util/futility util/marvell util/bincfg
subdirs-y += $(wildcard src/arch/*) subdirs-y += $(wildcard src/arch/*)
subdirs-y += src/mainboard/$(MAINBOARDDIR) subdirs-y += src/mainboard/$(MAINBOARDDIR)
subdirs-y += src/security subdirs-y += src/security
@ -497,7 +497,7 @@ $(ROMCC_BIN): $(top)/util/romcc/romcc.c
@# https://www.coreboot.org/pipermail/coreboot/2010-February/055825.html @# https://www.coreboot.org/pipermail/coreboot/2010-February/055825.html
$(HOSTCC) -g $(STACK) -Wall -o $@ $< $(HOSTCC) -g $(STACK) -Wall -o $@ $<
BLOBTOOL:=$(objutil)/blobtool/blobtool BINCFG:=$(objutil)/bincfg/bincfg
IFDTOOL:=$(objutil)/ifdtool/ifdtool IFDTOOL:=$(objutil)/ifdtool/ifdtool
$(IFDTOOL): $(IFDTOOL):
@ -578,7 +578,7 @@ gitconfig:
include util/crossgcc/Makefile.inc include util/crossgcc/Makefile.inc
.PHONY: tools .PHONY: tools
tools: $(objutil)/kconfig/conf $(CBFSTOOL) $(objutil)/cbfstool/cbfs-compression-tool $(FMAPTOOL) $(RMODTOOL) $(IFWITOOL) $(objutil)/nvramtool/nvramtool $(ROMCC_BIN) $(objutil)/sconfig/sconfig $(IFDTOOL) $(IFDFAKE) $(CBOOTIMAGE) $(AMDFWTOOL) $(FUTILITY) $(BLOBTOOL) tools: $(objutil)/kconfig/conf $(CBFSTOOL) $(objutil)/cbfstool/cbfs-compression-tool $(FMAPTOOL) $(RMODTOOL) $(IFWITOOL) $(objutil)/nvramtool/nvramtool $(ROMCC_BIN) $(objutil)/sconfig/sconfig $(IFDTOOL) $(IFDFAKE) $(CBOOTIMAGE) $(AMDFWTOOL) $(FUTILITY) $(BINCFG)
########################################################################### ###########################################################################
# Common recipes for all stages # Common recipes for all stages

View File

@ -104,11 +104,11 @@ config FMD_GENPARSER
Otherwise, say N to use the provided pregenerated scanner/parser. Otherwise, say N to use the provided pregenerated scanner/parser.
config UTIL_GENPARSER config UTIL_GENPARSER
bool "Generate SCONFIG & BLOBTOOL parser using flex and bison" bool "Generate SCONFIG & BINCFG parser using flex and bison"
default n default n
help help
Enable this option if you are working on the sconfig device tree Enable this option if you are working on the sconfig device tree
parser or blobtool and made changes to the .l or .y files. parser or bincfg and made changes to the .l or .y files.
Otherwise, say N to use the provided pregenerated scanner/parser. Otherwise, say N to use the provided pregenerated scanner/parser.

View File

@ -1,7 +1,7 @@
CC = gcc CC = gcc
YACC = bison YACC = bison
LEX = flex LEX = flex
TARGET=blobtool TARGET=bincfg
$(TARGET): $(TARGET).lex.o $(TARGET).tab.o $(TARGET): $(TARGET).lex.o $(TARGET).tab.o
$(CC) $^ -Wall -Wno-unused-function -g -lfl -o $@ $(CC) $^ -Wall -Wno-unused-function -g -lfl -o $@
@ -14,16 +14,16 @@ $(TARGET).tab.c $(TARGET).tab.h: $(TARGET).y
# Use this target to generate GbE for X200 # Use this target to generate GbE for X200
gen-gbe-ich9m: gen-gbe-ich9m:
./blobtool gbe-ich9m.spec gbe-ich9m.set gbe1.bin ./bincfg gbe-ich9m.spec gbe-ich9m.set gbe1.bin
# duplicate binary as per spec # duplicate binary as per spec
cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin cat gbe1.bin gbe1.bin > flashregion_3_gbe.bin
rm -f gbe1.bin rm -f gbe1.bin
# Use this target to generate IFD for X200 # Use this target to generate IFD for X200
gen-ifd-x200: gen-ifd-x200:
./blobtool ifd-x200.spec ifd-x200.set flashregion_0_fd.bin ./bincfg ifd-x200.spec ifd-x200.set flashregion_0_fd.bin
.PHONY: clean gen-gbe-ich9m gen-ifd-x200 .PHONY: clean gen-gbe-ich9m gen-ifd-x200
clean: clean:
rm -f *.lex.c *.tab.c *.tab.h *.o blobtool flashregion_0_fd.bin flashregion_3_gbe.bin rm -f *.lex.c *.tab.c *.tab.h *.o bincfg flashregion_0_fd.bin flashregion_3_gbe.bin

41
util/bincfg/Makefile.inc Normal file
View File

@ -0,0 +1,41 @@
bincfg_obj := bincfg.lex.o bincfg.tab.o
BINCFG_FLAGS += -I$(top)/util/bincfg -I$(objutil)/bincfg
$(objutil)/bincfg:
mkdir -p $@
$(objutil)/bincfg/.generated: $(objutil)/bincfg
touch $@
$(objutil)/bincfg/%.o: util/bincfg/%.c | $(objutil)/bincfg/.generated
printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
$(objutil)/bincfg/%.o: $(objutil)/bincfg/%.c
printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
ifeq ($(CONFIG_UTIL_GENPARSER),y)
$(top)/util/bincfg/bincfg.lex.c_shipped: $(top)/util/bincfg/bincfg.l
printf " FLEX $(subst $(top)/,,$(@))\n"
flex -L -o $@ $<
# the .c rule also creates .h
$(top)/util/bincfg/bincfg.tab.h_shipped: $(top)/util/bincfg/bincfg.tab.c_shipped
$(top)/util/bincfg/bincfg.tab.c_shipped: $(top)/util/bincfg/bincfg.y
printf " BISON $(subst $(top)/,,$(@))\n"
bison -l --defines=$(top)/util/bincfg/bincfg.tab.h_shipped -o $@ $<
endif
$(objutil)/bincfg/bincfg.lex.o: $(objutil)/bincfg/bincfg.tab.h
$(objutil)/bincfg/%: $(top)/util/bincfg/%_shipped
mkdir -p $(dir $@)
cp $< $@
$(objutil)/bincfg/bincfg: $(addprefix $(objutil)/bincfg/,$(bincfg_obj))
printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n"
$(HOSTCC) $(BINCFG_FLAGS) -o $@ $(addprefix $(objutil)/bincfg/,$(bincfg_obj))
$(addprefix $(objutil)/bincfg/,$(bincfg_obj)) : $(objutil)/bincfg/bincfg.tab.h $(objutil)/bincfg/bincfg.tab.c $(objutil)/bincfg/bincfg.lex.c

View File

@ -1,5 +1,5 @@
/* /*
* blobtool - Compiler/Decompiler for data blobs with specs * bincfg - Compiler/Decompiler for data blobs with specs
* Copyright (C) 2017 Damien Zammit <damien@zamaudio.com> * Copyright (C) 2017 Damien Zammit <damien@zamaudio.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -17,7 +17,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "blobtool.tab.h" #include "bincfg.tab.h"
extern struct blob binary; extern struct blob binary;

View File

@ -1,5 +1,5 @@
#line 3 "/coreboot/util/blobtool/blobtool.lex.c_shipped" #line 3 "/coreboot/util/bincfg/bincfg.lex.c_shipped"
#define YY_INT_ALIGNED short int #define YY_INT_ALIGNED short int
@ -485,7 +485,7 @@ int yy_flex_debug = 0;
#define YY_RESTORE_YY_MORE_OFFSET #define YY_RESTORE_YY_MORE_OFFSET
char *yytext; char *yytext;
/* /*
* blobtool - Compiler/Decompiler for data blobs with specs * bincfg - Compiler/Decompiler for data blobs with specs
* Copyright (C) 2017 Damien Zammit <damien@zamaudio.com> * Copyright (C) 2017 Damien Zammit <damien@zamaudio.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -501,7 +501,7 @@ char *yytext;
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "blobtool.tab.h" #include "bincfg.tab.h"
extern struct blob binary; extern struct blob binary;

View File

@ -299,7 +299,7 @@ static void generate_setter_bitfields(unsigned char *bin)
/* Reset blob position to zero */ /* Reset blob position to zero */
binary->bloblen = 0; binary->bloblen = 0;
fprintf (fp, "# AUTOGENERATED SETTER BY BLOBTOOL\n{\n"); fprintf (fp, "# AUTOGENERATED SETTER BY BINCFG\n{\n");
/* Traverse spec and output bitfield setters based on blob values */ /* Traverse spec and output bitfield setters based on blob values */
for (ptr = sym_table; ptr != (struct field *) 0; ptr = ptr->next) { for (ptr = sym_table; ptr != (struct field *) 0; ptr = ptr->next) {
@ -440,9 +440,9 @@ static void generate_binary(void)
#endif #endif
/* In a future release of Bison, this section will be replaced /* In a future release of Bison, this section will be replaced
by #include "blobtool.tab.h_shipped". */ by #include "bincfg.tab.h_shipped". */
#ifndef YY_YY_COREBOOT_UTIL_BLOBTOOL_BLOBTOOL_TAB_H_SHIPPED_INCLUDED #ifndef YY_YY_COREBOOT_UTIL_BINCFG_BINCFG_TAB_H_SHIPPED_INCLUDED
# define YY_YY_COREBOOT_UTIL_BLOBTOOL_BLOBTOOL_TAB_H_SHIPPED_INCLUDED # define YY_YY_COREBOOT_UTIL_BINCFG_BINCFG_TAB_H_SHIPPED_INCLUDED
/* Debug traces. */ /* Debug traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 0 # define YYDEBUG 0
@ -489,7 +489,7 @@ extern YYSTYPE yylval;
int yyparse (void); int yyparse (void);
#endif /* !YY_YY_COREBOOT_UTIL_BLOBTOOL_BLOBTOOL_TAB_H_SHIPPED_INCLUDED */ #endif /* !YY_YY_COREBOOT_UTIL_BINCFG_BINCFG_TAB_H_SHIPPED_INCLUDED */
/* Copy the second part of user declarations. */ /* Copy the second part of user declarations. */
@ -1979,10 +1979,10 @@ int main (int argc, char *argv[])
fclose(fp); fclose(fp);
} else { } else {
printf("Usage: Compile mode\n\n"); printf("Usage: Compile mode\n\n");
printf(" blobtool spec setter binaryoutput\n"); printf(" bincfg spec setter binaryoutput\n");
printf(" (file) (file) (file)\n"); printf(" (file) (file) (file)\n");
printf(" OR : Decompile mode\n\n"); printf(" OR : Decompile mode\n\n");
printf(" blobtool -d spec binary setteroutput\n"); printf(" bincfg -d spec binary setteroutput\n");
} }
return ret; return ret;
} }

View File

@ -30,8 +30,8 @@
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
#ifndef YY_YY_COREBOOT_UTIL_BLOBTOOL_BLOBTOOL_TAB_H_SHIPPED_INCLUDED #ifndef YY_YY_COREBOOT_UTIL_BINCFG_BINCFG_TAB_H_SHIPPED_INCLUDED
# define YY_YY_COREBOOT_UTIL_BLOBTOOL_BLOBTOOL_TAB_H_SHIPPED_INCLUDED # define YY_YY_COREBOOT_UTIL_BINCFG_BINCFG_TAB_H_SHIPPED_INCLUDED
/* Debug traces. */ /* Debug traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 0 # define YYDEBUG 0
@ -78,4 +78,4 @@ extern YYSTYPE yylval;
int yyparse (void); int yyparse (void);
#endif /* !YY_YY_COREBOOT_UTIL_BLOBTOOL_BLOBTOOL_TAB_H_SHIPPED_INCLUDED */ #endif /* !YY_YY_COREBOOT_UTIL_BINCFG_BINCFG_TAB_H_SHIPPED_INCLUDED */

View File

@ -1,5 +1,5 @@
/* /*
* blobtool - Compiler/Decompiler for data blobs with specs * bincfg - Compiler/Decompiler for data blobs with specs
* Copyright (C) 2017 Damien Zammit <damien@zamaudio.com> * Copyright (C) 2017 Damien Zammit <damien@zamaudio.com>
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -249,7 +249,7 @@ static void generate_setter_bitfields(unsigned char *bin)
/* Reset blob position to zero */ /* Reset blob position to zero */
binary->bloblen = 0; binary->bloblen = 0;
fprintf (fp, "# AUTOGENERATED SETTER BY BLOBTOOL\n{\n"); fprintf (fp, "# AUTOGENERATED SETTER BY BINCFG\n{\n");
/* Traverse spec and output bitfield setters based on blob values */ /* Traverse spec and output bitfield setters based on blob values */
for (ptr = sym_table; ptr != (struct field *) 0; ptr = ptr->next) { for (ptr = sym_table; ptr != (struct field *) 0; ptr = ptr->next) {
@ -542,10 +542,10 @@ int main (int argc, char *argv[])
fclose(fp); fclose(fp);
} else { } else {
printf("Usage: Compile mode\n\n"); printf("Usage: Compile mode\n\n");
printf(" blobtool spec setter binaryoutput\n"); printf(" bincfg spec setter binaryoutput\n");
printf(" (file) (file) (file)\n"); printf(" (file) (file) (file)\n");
printf(" OR : Decompile mode\n\n"); printf(" OR : Decompile mode\n\n");
printf(" blobtool -d spec binary setteroutput\n"); printf(" bincfg -d spec binary setteroutput\n");
} }
return ret; return ret;
} }

View File

@ -1,41 +0,0 @@
blobtool_obj := blobtool.lex.o blobtool.tab.o
BLOBTOOL_FLAGS += -I$(top)/util/blobtool -I$(objutil)/blobtool
$(objutil)/blobtool:
mkdir -p $@
$(objutil)/blobtool/.generated: $(objutil)/blobtool
touch $@
$(objutil)/blobtool/%.o: util/blobtool/%.c | $(objutil)/blobtool/.generated
printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(BLOBTOOL_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
$(objutil)/blobtool/%.o: $(objutil)/blobtool/%.c
printf " HOSTCC $(subst $(obj)/,,$(@))\n"
$(HOSTCC) $(BLOBTOOL_FLAGS) $(HOSTCFLAGS) -c -o $@ $<
ifeq ($(CONFIG_UTIL_GENPARSER),y)
$(top)/util/blobtool/blobtool.lex.c_shipped: $(top)/util/blobtool/blobtool.l
printf " FLEX $(subst $(top)/,,$(@))\n"
flex -L -o $@ $<
# the .c rule also creates .h
$(top)/util/blobtool/blobtool.tab.h_shipped: $(top)/util/blobtool/blobtool.tab.c_shipped
$(top)/util/blobtool/blobtool.tab.c_shipped: $(top)/util/blobtool/blobtool.y
printf " BISON $(subst $(top)/,,$(@))\n"
bison -l --defines=$(top)/util/blobtool/blobtool.tab.h_shipped -o $@ $<
endif
$(objutil)/blobtool/blobtool.lex.o: $(objutil)/blobtool/blobtool.tab.h
$(objutil)/blobtool/%: $(top)/util/blobtool/%_shipped
mkdir -p $(dir $@)
cp $< $@
$(objutil)/blobtool/blobtool: $(addprefix $(objutil)/blobtool/,$(blobtool_obj))
printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n"
$(HOSTCC) $(BLOBTOOL_FLAGS) -o $@ $(addprefix $(objutil)/blobtool/,$(blobtool_obj))
$(addprefix $(objutil)/blobtool/,$(blobtool_obj)) : $(objutil)/blobtool/blobtool.tab.h $(objutil)/blobtool/blobtool.tab.c $(objutil)/blobtool/blobtool.lex.c