MCPcopy Create free account
hub / github.com/coreboot/coreboot / flashrom_host_write

Function flashrom_host_write

util/cbfstool/flashrom.c:109–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109int flashrom_host_write(struct buffer *buffer, const char *region)
110{
111 char *tmpfile;
112 char region_param[PATH_MAX];
113 int rv;
114
115 if (create_temp_file(&tmpfile) != 0)
116 return -1;
117 if (buffer_write_file(buffer, tmpfile) != 0) {
118 rv = -2;
119 goto fail;
120 }
121
122 if (region)
123 snprintf(region_param, sizeof(region_param), "%s:%s", region,
124 tmpfile);
125 const char *const argv[] = {
126 FLASHROM_EXEC_NAME,
127 "-p",
128 FLASHROM_PROGRAMMER_INTERNAL_AP,
129 "--noverify-all",
130 "-w",
131 region ? "-i" : tmpfile,
132 region ? region_param : NULL,
133 NULL,
134 };
135
136 rv = run_flashrom(argv);
137
138fail:
139 unlink(tmpfile);
140 free(tmpfile);
141
142 return rv;
143}

Callers 1

elog_writeFunction · 0.85

Calls 5

create_temp_fileFunction · 0.85
buffer_write_fileFunction · 0.85
run_flashromFunction · 0.85
snprintfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected