aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStéphane Rochoy <stephane.rochoy@stormshield.eu>2026-04-24 07:03:31 +0000
committerPouria Mousavizadeh Tehrani <pouria@FreeBSD.org>2026-04-28 20:58:59 +0000
commit76de40889eed130442b67e14249f96e2e8f88f48 (patch)
tree0e676c30f3f7139e7390867ef659e509416380ea
parent48363f39f1417df3e39da53f219596f8501c9452 (diff)
efibootmgr: Show attributes, category and optional data when verbose
Also rework a bit the way device path are displayed for consistency. Signed-off-by: stephane.rochoy@stormshield.eu Reviewed by: imp Sponsored by: Stormshield Pull-Request: https://github.com/freebsd/freebsd-src/pull/2167
-rw-r--r--usr.sbin/efibootmgr/efibootmgr.82
-rw-r--r--usr.sbin/efibootmgr/efibootmgr.c71
2 files changed, 61 insertions, 12 deletions
diff --git a/usr.sbin/efibootmgr/efibootmgr.8 b/usr.sbin/efibootmgr/efibootmgr.8
index 62ca0d6da3b2..2d7aaf5bd4a4 100644
--- a/usr.sbin/efibootmgr/efibootmgr.8
+++ b/usr.sbin/efibootmgr/efibootmgr.8
@@ -200,7 +200,7 @@ variable.
Displays the UEFI device path of
.Ar unix-path .
.It Fl v -verbose
-Display the device path of boot entries in the output.
+Display extra information on boot entries: device path, attributes, category and optional data.
.El
.Sh EXAMPLES
To display the current
diff --git a/usr.sbin/efibootmgr/efibootmgr.c b/usr.sbin/efibootmgr/efibootmgr.c
index 1b572b613e05..e1786d9fc1bc 100644
--- a/usr.sbin/efibootmgr/efibootmgr.c
+++ b/usr.sbin/efibootmgr/efibootmgr.c
@@ -54,11 +54,27 @@
#include <efivar-dp.h>
#ifndef LOAD_OPTION_ACTIVE
-#define LOAD_OPTION_ACTIVE 0x00000001
+#define LOAD_OPTION_ACTIVE 0x00000001
+#endif
+
+#ifndef LOAD_OPTION_FORCE_RECONNECT
+#define LOAD_OPTION_FORCE_RECONNECT 0x00000002
+#endif
+
+#ifndef LOAD_OPTION_HIDDEN
+#define LOAD_OPTION_HIDDEN 0x00000008
+#endif
+
+#ifndef LOAD_OPTION_CATEGORY
+#define LOAD_OPTION_CATEGORY 0x00001F00
#endif
#ifndef LOAD_OPTION_CATEGORY_BOOT
-#define LOAD_OPTION_CATEGORY_BOOT 0x00000000
+#define LOAD_OPTION_CATEGORY_BOOT 0x00000000
+#endif
+
+#ifndef LOAD_OPTION_CATEGORY_APP
+#define LOAD_OPTION_CATEGORY_APP 0x00000100
#endif
#define BAD_LENGTH ((size_t)-1)
@@ -744,14 +760,14 @@ static void
print_loadopt_str(uint8_t *data, size_t datalen)
{
char *dev, *relpath, *abspath;
- uint32_t attr;
+ uint32_t attr, categ;
uint16_t fplen;
efi_char *descr;
uint8_t *ep = data + datalen;
- uint8_t *walker = data;
+ uint8_t *walker = data, *opt;
efidp dp, edp;
char buf[1024];
- int len;
+ int len, optlen;
int rv;
int indent;
@@ -775,11 +791,13 @@ print_loadopt_str(uint8_t *data, size_t datalen)
if (walker > ep)
return;
edp = (efidp)walker;
- /*
- * Everything left is the binary option args
- * opt = walker;
- * optlen = ep - walker;
- */
+
+ /* Everything left is the binary option args */
+ opt = walker;
+ optlen = ep - walker;
+
+ printf("\n");
+ printf(" dp:");
indent = 1;
while (dp < edp) {
if (efidp_size(dp) == 0)
@@ -787,7 +805,7 @@ print_loadopt_str(uint8_t *data, size_t datalen)
efidp_format_device_path(buf, sizeof(buf), dp,
(intptr_t)(void *)edp - (intptr_t)(void *)dp);
printf("%*s%s\n", indent, "", buf);
- indent = 10 + len + 1;
+ indent = 11;
rv = efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath);
if (rv == 0) {
printf("%*s%s:%s %s\n", indent + 4, "", dev, relpath, abspath);
@@ -797,6 +815,37 @@ print_loadopt_str(uint8_t *data, size_t datalen)
}
dp = (efidp)((char *)dp + efidp_size(dp));
}
+
+ /* Optional Data */
+ if (optlen > 0) {
+ printf(" opt/x: ");
+ efi_hexdump(opt, optlen, 11);
+ printf(" opt/a: ");
+ efi_asciidump(opt, optlen, 11);
+ }
+
+ /* Attributes */
+ printf(" attr: %#x<", attr);
+ if (attr & LOAD_OPTION_ACTIVE)
+ printf("ACTIVE,");
+ if (attr & LOAD_OPTION_FORCE_RECONNECT)
+ printf("FORCE_RECONNECT,");
+ if (attr & LOAD_OPTION_HIDDEN)
+ printf("HIDDEN,");
+ printf(">\n");
+
+ /* Category */
+ categ = (attr & LOAD_OPTION_CATEGORY);
+ printf(" categ: %#x<", categ);
+ switch (categ) {
+ case LOAD_OPTION_CATEGORY_APP:
+ printf("APP");
+ break;
+ case LOAD_OPTION_CATEGORY_BOOT:
+ printf("BOOT");
+ break;
+ }
+ printf(">\n");
}
static char *