Re: [meta-intel] [PATCH 2/3] rmc: Enable reading the contents of an existing fingerprint file
> On Feb 6, 2017, at 2:28 PM, Todor Minchev> wrote: > > On Mon, 2017-02-06 at 12:01 -0800, Jianxun Zhang wrote: >> Tudor, >> Please refer to my 3 inline comments. >> >>> On Feb 2, 2017, at 2:37 PM, Todor Minchev >>> wrote: >>> >>> The contents of an existing fingerprint file can be read and output on >>> the command line with the following options: >>> >>> ./rmc -F -i input_fingerprint_file >> Suggest we have a new top option for dumping in parallel with -F to keep >> usages clear and simple for users. > > We can use -E to extract both the database and the fingerprint? > > rmc -E -d rmc.db > rmc -E -f rmc.fingerprint good idea. > >>> >>> Signed-off-by: Todor Minchev >>> --- >>> src/rmc.c | 121 >>> +++--- >>> 1 file changed, 76 insertions(+), 45 deletions(-) >>> >>> diff --git a/src/rmc.c b/src/rmc.c >>> index 062dd36..a051ccf 100644 >>> --- a/src/rmc.c >>> +++ b/src/rmc.c >>> @@ -14,33 +14,35 @@ >>> #include >>> >>> #define USAGE "RMC (Runtime Machine configuration) Tool\n" \ >>> -"NOTE: Most of usages require root permission (sudo)\n" \ >>> -"rmc -F [-o output_fingerprint]\n" \ >>> +"NOTE: Most of usages require root permission (sudo)\n\n" \ >>> +"rmc -F [-o output_fingerprint] | -i input_fingerprint\n" \ >>>"rmc -R [-f ] -b [-o >>> output_record]\n" \ >>>"rmc -D [-o output_database]\n" \ >>> - "rmc -B -d -o output_file\n" \ >>> - "\n" \ >>> - "-F: generate board rmc fingerprint of board\n" \ >>> - "-R: generate board rmc record of board with its fingerprint and file >>> blobs.\n" \ >>> -"-f: fingerprint file to be packed in record, rmc will create a >>> fingerprint for board and use it internally to\n" \ >>> -"generate record if -f is missed.\n" \ >>> -"-b: files to be packed in record\n" \ >>> - "-G: generate rmc database file with records specified in record file >>> list\n" \ >>> - "-B: get a flie blob with specified name associated to the board rmc is >>> running on\n" \ >>> - "-d: database file to be queried\n" \ >>> - "-o: path and name of output file of a specific command\n" \ >>> - "\n" \ >>> -"Examples (Steps in an order to add board support into rmc):\n" \ >>> -"generate board fingerprint:\n" \ >>> -"rmc -F\n\n" \ >>> -"generate a rmc record for the board with two file blobs, output >>> to:\n" \ >>> -"a specified file:\n" \ >>> -"rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \ >>> -"generate a rmc database file with records from 3 different boards:\n" >>> \ >>> -"rmc -D board1_record board2_record board3_record\n\n" \ >>> -"query a file blob named audio.conf associated to the board rmc is >>> running on in database my_rmc.db and output\n" \ >>> -"to /tmp/new_audio.conf:\n" \ >>> -"rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n" >>> +"rmc -B -d -o output_file\n\n" >>> \ >>> + "-F: manage fingerprint file\n" \ >>> +"\t-o output_file: store RMC fingerprint of current board in >>> output_file\n" \ >>> +"\t-i input_file: print RMC fingerprint stored in input_file\n\n" \ >>> + "-R: generate board rmc record of board with its fingerprint and file >>> blobs.\n" \ >>> +"\t-f intput_file : input fingerprint file to be packed in record\n\n" >>> \ >>> +"\tNOTE: RMC will create a fingerprint for the board and use it to\n" \ >>> +"\tgenerate record if an input fingerprint file is not provided.\n\n" \ >>> +"\t-b: files to be packed in record\n\n" \ >>> + "-G: generate rmc database file with records specified in record file >>> list\n\n" \ >>> + "-B: get a file blob with specified name associated to the board rmc >>> is\n" \ >>> + "running on\n" \ >>> +"\t-d: database file to be queried\n" \ >>> +"\t-o: path and name of output file of a specific command\n\n" \ >>> +"Examples (Steps in an order to add board support into rmc):\n\n" \ >>> +"1. Generate board fingerprint:\n" \ >>> +"\t./rmc -F\n\n” \ >> Why do we force the rmc in current dir here? rmc can be installed to a >> system path like other programs. > > Yes, this can be anywhere. > >> >>> +"2. Generate a rmc record for the board with two file blobs and save >>> it\n" \ >>> +"to a specified file:\n" \ >>> +"\t./rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \ >>> +"3. Generate a rmc database file with records from 3 different >>> boards:\n" \ >>> +"\t./rmc -D board1_record board2_record board3_record\n\n" \ >>> +"4. Query a file blob named audio.conf associated to the board rmc >>> is\n" \ >>> +"running on in database my_rmc.db and output to >>> /tmp/new_audio.conf:\n" \ >>> +"\t./rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n" >>> >>> >>> #define RMC_OPT_CAP_F (1 << 0) >>> @@ -51,6 +53,7 @@ >>> #define RMC_OPT_O
Re: [meta-intel] [PATCH 2/3] rmc: Enable reading the contents of an existing fingerprint file
Tudor, Please refer to my 3 inline comments. > On Feb 2, 2017, at 2:37 PM, Todor Minchev> wrote: > > The contents of an existing fingerprint file can be read and output on > the command line with the following options: > > ./rmc -F -i input_fingerprint_file Suggest we have a new top option for dumping in parallel with -F to keep usages clear and simple for users. > > Signed-off-by: Todor Minchev > --- > src/rmc.c | 121 +++--- > 1 file changed, 76 insertions(+), 45 deletions(-) > > diff --git a/src/rmc.c b/src/rmc.c > index 062dd36..a051ccf 100644 > --- a/src/rmc.c > +++ b/src/rmc.c > @@ -14,33 +14,35 @@ > #include > > #define USAGE "RMC (Runtime Machine configuration) Tool\n" \ > -"NOTE: Most of usages require root permission (sudo)\n" \ > -"rmc -F [-o output_fingerprint]\n" \ > +"NOTE: Most of usages require root permission (sudo)\n\n" \ > +"rmc -F [-o output_fingerprint] | -i input_fingerprint\n" \ > "rmc -R [-f ] -b [-o output_record]\n" > \ > "rmc -D [-o output_database]\n" \ > - "rmc -B -d -o output_file\n" \ > - "\n" \ > - "-F: generate board rmc fingerprint of board\n" \ > - "-R: generate board rmc record of board with its fingerprint and file > blobs.\n" \ > -"-f: fingerprint file to be packed in record, rmc will create a > fingerprint for board and use it internally to\n" \ > -"generate record if -f is missed.\n" \ > -"-b: files to be packed in record\n" \ > - "-G: generate rmc database file with records specified in record file > list\n" \ > - "-B: get a flie blob with specified name associated to the board rmc is > running on\n" \ > - "-d: database file to be queried\n" \ > - "-o: path and name of output file of a specific command\n" \ > - "\n" \ > -"Examples (Steps in an order to add board support into rmc):\n" \ > -"generate board fingerprint:\n" \ > -"rmc -F\n\n" \ > -"generate a rmc record for the board with two file blobs, output to:\n" \ > -"a specified file:\n" \ > -"rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \ > -"generate a rmc database file with records from 3 different boards:\n" \ > -"rmc -D board1_record board2_record board3_record\n\n" \ > -"query a file blob named audio.conf associated to the board rmc is > running on in database my_rmc.db and output\n" \ > -"to /tmp/new_audio.conf:\n" \ > -"rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n" > +"rmc -B -d -o output_file\n\n" \ > + "-F: manage fingerprint file\n" \ > +"\t-o output_file: store RMC fingerprint of current board in > output_file\n" \ > +"\t-i input_file: print RMC fingerprint stored in input_file\n\n" \ > + "-R: generate board rmc record of board with its fingerprint and file > blobs.\n" \ > +"\t-f intput_file : input fingerprint file to be packed in record\n\n" \ > +"\tNOTE: RMC will create a fingerprint for the board and use it to\n" \ > +"\tgenerate record if an input fingerprint file is not provided.\n\n" \ > +"\t-b: files to be packed in record\n\n" \ > + "-G: generate rmc database file with records specified in record file > list\n\n" \ > + "-B: get a file blob with specified name associated to the board rmc is\n" > \ > + "running on\n" \ > +"\t-d: database file to be queried\n" \ > +"\t-o: path and name of output file of a specific command\n\n" \ > +"Examples (Steps in an order to add board support into rmc):\n\n" \ > +"1. Generate board fingerprint:\n" \ > +"\t./rmc -F\n\n” \ Why do we force the rmc in current dir here? rmc can be installed to a system path like other programs. > +"2. Generate a rmc record for the board with two file blobs and save > it\n" \ > +"to a specified file:\n" \ > +"\t./rmc -R -f fingerprint -b file_1 file_2 -o my_board.record\n\n" \ > +"3. Generate a rmc database file with records from 3 different > boards:\n" \ > +"\t./rmc -D board1_record board2_record board3_record\n\n" \ > +"4. Query a file blob named audio.conf associated to the board rmc is\n" > \ > +"running on in database my_rmc.db and output to /tmp/new_audio.conf:\n" \ > +"\t./rmc -B audio.conf -d my_rmc.db -o /tmp/new_audio.conf\n\n" > > > #define RMC_OPT_CAP_F (1 << 0) > @@ -51,6 +53,7 @@ > #define RMC_OPT_O (1 << 5) > #define RMC_OPT_B (1 << 6) > #define RMC_OPT_D (1 << 7) > +#define RMC_OPT_I (1 << 8) > > static void usage () { > fprintf(stdout, USAGE); > @@ -78,7 +81,7 @@ static void dump_fingerprint(rmc_fingerprint_t *fp) { > static int write_fingerprint_file(const char* pathname, rmc_fingerprint_t > *fp) { > int i; > int first = 0; > - > +/* TODO - do we need to open/close file multiple times to write each > field */ > for (i = 0; i < RMC_FINGER_NUM; i++) { > if