Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion tools/rimage/src/rimage.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <errno.h>
#include <string.h>
#include <stdbool.h>
Expand Down Expand Up @@ -34,6 +35,7 @@ static void usage(char *name)
fprintf(stdout, "\t -y verify signed file\n");
fprintf(stdout, "\t -q resign binary\n");
fprintf(stdout, "\t -p set PV bit\n");
fprintf(stdout, "\t -Q, --quiet suppress informational stdout logs\n");
}

int main(int argc, char *argv[])
Expand All @@ -45,12 +47,18 @@ int main(int argc, char *argv[])
int use_ext_man = 0;
unsigned int pv_bit = 0;
bool imr_type_override = false;
bool quiet = false;
static const struct option long_options[] = {
{ "quiet", no_argument, NULL, 'Q' },
{ NULL, 0, NULL, 0 }
};

memset(&image, 0, sizeof(image));

image.imr_type = MAN_DEFAULT_IMR_TYPE;

while ((opt = getopt(argc, argv, "ho:va:s:k:ri:f:b:ec:y:q:pl")) != -1) {
while ((opt = getopt_long(argc, argv, "ho:va:s:k:ri:f:b:ec:y:q:plQ",
long_options, NULL)) != -1) {
switch (opt) {
case 'o':
image.out_file = optarg;
Expand Down Expand Up @@ -101,6 +109,9 @@ int main(int argc, char *argv[])
case 'l':
image.loadable_module = true;
break;
case 'Q':
quiet = true;
break;
default:
/* getopt's default error message is good enough */
return 1;
Expand Down Expand Up @@ -153,6 +164,10 @@ int main(int argc, char *argv[])
return -EINVAL;
}
}

if (quiet && !freopen("/dev/null", "w", stdout))
fprintf(stderr, "error: unable to redirect stdout: %s\n", strerror(errno));

/* find machine */
heap_adsp = malloc(sizeof(struct adsp));
if (!heap_adsp) {
Expand Down
Loading