linuxboot / fiano

Go-based tools for modifying UEFI firmware
BSD 3-Clause "New" or "Revised" License
302 stars 49 forks source link

When displaying a file, use knownguids to display its "name" in parens if there is no USER_INTERFACE #277

Open rminnich opened 5 years ago

rminnich commented 5 years ago

Sometimes companies leave out the EFI_SECTION_USER_INTERFACE section for files in the FV, so all we can see is the GUID (Hi Intel!). Equally bad, programs like UefiTool now transparently substitute names for known file GUIDs, so when you look at a ROM image with UEFITool and with utk they look very different, and you're not sure why.

It would be nice in table format if the print were changed as follows:

Before:

   File     F9D88642-0737-49BC-81B5-6889CD57D9EA      EFI_FV_FILETYPE_DRIVER                   0x3bba

After:

   File     F9D88642-0737-49BC-81B5-6889CD57D9EA      EFI_FV_FILETYPE_DRIVER                   0x3bba (name)

i.e. put the name in parens for each line. Further, it would be good to know if the name from from the EFI_SECTION_USER_INTERFACE or known GUIDS, maybe something like

File F9D88642-0737-49BC-81B5-6889CD57D9EA EFI_FV_FILETYPE_DRIVER 0x3bba (UI=Shell)

File F9D88642-0737-49BC-81B5-6889CD57D9EA EFI_FV_FILETYPE_DRIVER 0x3bba (KG=shell)

This would also make grepping for names easier: utk wc_tiny_kernel.bin table|grep DRIVER

would show most of what we want: GUID, and name.

Finally, let's pretend that some IBV creates a file where the EFI_SECTION_USER_INTERFACE and known guid name differ -- it would be very nice to print something out too:

File F9D88642-0737-49BC-81B5-6889CD57D9EA EFI_FV_FILETYPE_DRIVER 0x3bba (UI=SomeStupidName,KG=Shell)

so we'd know things were a bit weird.

GanShun commented 5 years ago

One way to do this is to add a Name function to File that returns two strings, one from KG, one from a UI section. The irritating bit is that the file name is not part of the file, but the section, and it can even be in a nested section and not a direct child of the file.

rjoleary commented 5 years ago

We should also have a separate command called "uefi2english" which annotates GUIDs from stdin. For example:

$ echo "Starting F9D88642-0737-49BC-81B5-6889CD57D9EA..." | uefi2english
Starting F9D88642-0737-49BC-81B5-6889CD57D9EA (Shell)...

The command can also have an additional format argument (-f) to control formatting. For example:

$ echo "Starting F9D88642-0737-49BC-81B5-6889CD57D9EA..." | uefi2english -f "{{.Name}} ({{.GUID}})"
Starting Shell (F9D88642-0737-49BC-81B5-6889CD57D9EA)...
NikolajSchlej commented 2 years ago

@rminnich, you can do "File->Unload GUID database" in UEFITool and reopen the current image for it to not substitute GUIDs for names by default. I'll make an issue about having a checkbox like "View->BootGuard Markings" if somebody wants GUIDs to be visible by default instead of the names.

@all, please create issues in UEFITool's repo if you don't like something about the changes made, have ideas about improving the UI, or for any other reason, we'll appreciate your feedback.