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

Function ifwi_repack

util/cbfstool/cse_serger.c:415–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413}
414
415static int ifwi_repack(void)
416{
417 if (!ifwi.repack)
418 return 0;
419
420 struct buffer output_buff;
421 const size_t size = ifwi.file_end_offset;
422 struct buffer bpdt_buff;
423
424 if (buffer_create(&output_buff, size, "Output IFWI")) {
425 ERROR("Unable to allocate output buff!\n");
426 return -1;
427 }
428
429 buffer_clone(&bpdt_buff, &output_buff);
430
431 ifwi.bpdt_ops->update_checksum(ifwi.bpdt_hdr, &ifwi.bpdt_entries[0]);
432
433 if (ifwi.bpdt_ops->write_hdr(&bpdt_buff, ifwi.bpdt_hdr))
434 return -1;
435
436 if (write_bpdt_entries(&bpdt_buff))
437 return -1;
438
439 subpart_write(&output_buff);
440
441 if (buffer_write_file(&output_buff, params.image_name)) {
442 ERROR("File write error!\n");
443 return -1;
444 }
445
446 printf("Image written successfully to %s.\n", params.image_name);
447 return 0;
448}
449
450static bool should_process_partition(int type)
451{

Callers 1

mainFunction · 0.70

Calls 6

buffer_createFunction · 0.85
buffer_cloneFunction · 0.85
write_bpdt_entriesFunction · 0.85
subpart_writeFunction · 0.85
buffer_write_fileFunction · 0.85
printfFunction · 0.85

Tested by

no test coverage detected