Skip to content

Commit

Permalink
Dump EFI module name and type in json
Browse files Browse the repository at this point in the history
  • Loading branch information
TakahiroHaruyama committed Sep 11, 2024
1 parent 1e8f300 commit eb7d954
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
8 changes: 8 additions & 0 deletions efiXloader/uefitool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ void efiloader::Uefitool::dump(const UModelIndex &index, uint8_t el_type,
.is_null()) { // check if GUID already exists
get_unique_name(module_name);
images_guids[guid.c_str()] = module_name.c_str();
mod_types[module_name.c_str()] =
fileTypeToUString(model.subtype(index.parent())).toLocal8Bit();
file->qname.swap(module_name);
file->write();
files.push_back(file);
Expand Down Expand Up @@ -307,6 +309,8 @@ void efiloader::Uefitool::dump(const UModelIndex &index, uint8_t el_type,
if (module_name.size()) {
// save image to the images_guids
images_guids[module_name.c_str()] = module_name.c_str();
mod_types[module_name.c_str()] =
fileTypeToUString(model.subtype(index.parent())).toLocal8Bit();
}
}
break;
Expand Down Expand Up @@ -370,4 +374,8 @@ void efiloader::Uefitool::dump_jsons() {
out.replace_extension("").replace_extension(".images.json");
std::ofstream out_guids(out);
out_guids << std::setw(4) << images_guids << std::endl;
// Dump module types
out.replace_extension("").replace_extension(".mod_types.json");
std::ofstream out_mod_types(out);
out_mod_types << std::setw(4) << mod_types << std::endl;
}
3 changes: 2 additions & 1 deletion efiXloader/uefitool.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Uefitool {
}
messages = ffs.getMessages();
}
~Uefitool(){};
~Uefitool() {};
void show_messages();
bool messages_occurs() { return !messages.empty(); };
void dump();
Expand All @@ -133,6 +133,7 @@ class Uefitool {
void dump_jsons(); // dump JSON with DEPEX and GUIDs information for each image
json all_deps; // DEPEX information for each image
json images_guids; // matching the modules to the parent's GUIDs
json mod_types; // EFI module name and its type
TreeModel model;
const char *buffer;
uint32_t buffer_size;
Expand Down

0 comments on commit eb7d954

Please sign in to comment.