2 * Copyright (c) 2017-2018 Netflix, Inc.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer
9 * in this position and unchanged.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #include <sys/cdefs.h>
27 __FBSDID("$FreeBSD$");
31 #include <sys/param.h>
51 #include <geom/geom.h>
52 #include <geom/geom_ctl.h>
53 #include <geom/geom_int.h>
58 #include <efivar-dp.h>
60 #ifndef LOAD_OPTION_ACTIVE
61 #define LOAD_OPTION_ACTIVE 0x00000001
64 #ifndef LOAD_OPTION_CATEGORY_BOOT
65 #define LOAD_OPTION_CATEGORY_BOOT 0x00000000
68 #define BAD_LENGTH ((size_t)-1)
70 #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
72 typedef struct _bmgr_opts {
102 static struct option lopts[] = {
103 {"activate", no_argument, NULL, 'a'},
104 {"bootnext", no_argument, NULL, 'n'}, /* set bootnext */
105 {"bootnum", required_argument, NULL, 'b'},
106 {"bootorder", required_argument, NULL, 'o'}, /* set order */
107 {"copy", required_argument, NULL, 'C'}, /* Copy boot method */
108 {"create", no_argument, NULL, 'c'},
109 {"deactivate", no_argument, NULL, 'A'},
110 {"del-timeout", no_argument, NULL, 'T'},
111 {"delete", no_argument, NULL, 'B'},
112 {"delete-bootnext", no_argument, NULL, 'N'},
113 {"device-path", no_argument, NULL, 'd'},
114 {"dry-run", no_argument, NULL, 'D'},
115 {"env", required_argument, NULL, 'e'},
116 {"esp", no_argument, NULL, 'E'},
117 {"fw-ui", no_argument, NULL, 'f'},
118 {"no-fw-ui", no_argument, NULL, 'F'},
119 {"help", no_argument, NULL, 'h'},
120 {"kernel", required_argument, NULL, 'k'},
121 {"label", required_argument, NULL, 'L'},
122 {"loader", required_argument, NULL, 'l'},
123 {"once", no_argument, NULL, 'O'},
124 {"set-timeout", required_argument, NULL, 't'},
125 {"unix-path", no_argument, NULL, 'p'},
126 {"verbose", no_argument, NULL, 'v'},
130 /* global efibootmgr opts */
131 static bmgr_opts_t opts;
133 static LIST_HEAD(efivars_head, entry) efivars =
134 LIST_HEAD_INITIALIZER(efivars);
147 LIST_ENTRY(entry) entries;
150 #define MAX_DP_LEN 4096
151 #define MAX_LOADOPT_LEN 8192
155 mangle_loader(char *loader)
159 for (c = loader; *c; c++)
167 #define COMMON_ATTRS EFI_VARIABLE_NON_VOLATILE | \
168 EFI_VARIABLE_BOOTSERVICE_ACCESS | \
169 EFI_VARIABLE_RUNTIME_ACCESS
172 * We use global guid, and common var attrs and
173 * find it better to just delete and re-create a var.
176 set_bootvar(const char *name, uint8_t *data, size_t size)
179 return efi_set_variable(EFI_GLOBAL_GUID, name, data, size,
185 " [-aAnB -b bootnum] [-N] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help]\n\
186 [-c -l loader [-k kernel] [-L label] [--dry-run] [-b bootnum]]"
188 #define CREATE_USAGE \
189 " efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run] [-b bootnum] [-a]"
190 #define ORDER_USAGE \
191 " efibootmgr -o bootvarnum1,bootvarnum2,..."
192 #define TIMEOUT_USAGE \
193 " efibootmgr -t seconds"
194 #define DELETE_USAGE \
195 " efibootmgr -B -b bootnum"
196 #define ACTIVE_USAGE \
197 " efibootmgr [-a | -A] -b bootnum"
198 #define BOOTNEXT_USAGE \
199 " efibootmgr [-n | -N] -b bootnum"
202 parse_args(int argc, char *argv[])
206 while ((ch = getopt_long(argc, argv, "AaBb:C:cdDe:EFfhk:L:l:NnOo:pTt:v",
207 lopts, NULL)) != -1) {
210 opts.set_inactive = true;
213 opts.set_active = true;
216 opts.has_bootnum = true;
217 opts.bootnum = strtoul(optarg, NULL, 16);
224 opts.cp_src = strtoul(optarg, NULL, 16);
228 case 'D': /* should be remove dups XXX */
232 opts.device_path = true;
236 opts.env = strdup(optarg);
239 opts.esp_device = true;
242 opts.no_fw_ui = true;
249 errx(1, "%s", USAGE);
253 opts.kernel = strdup(optarg);
257 opts.label = strdup(optarg);
261 opts.loader = strdup(optarg);
262 opts.loader = mangle_loader(opts.loader);
265 opts.delete_bootnext = true;
268 opts.set_bootnext = true;
275 opts.order = strdup(optarg);
278 opts.unix_path = true;
281 opts.del_timeout = true;
284 opts.set_timeout = true;
285 opts.timeout = strtoul(optarg, NULL, 10);
294 errx(1, "%s",CREATE_USAGE);
298 if (opts.order != NULL && *opts.order == '\0')
299 errx(1, "%s", ORDER_USAGE);
301 if ((opts.set_inactive || opts.set_active) && !opts.has_bootnum)
302 errx(1, "%s", ACTIVE_USAGE);
304 if (opts.delete && !opts.has_bootnum)
305 errx(1, "%s", DELETE_USAGE);
307 if (opts.set_bootnext && !opts.has_bootnum)
308 errx(1, "%s", BOOTNEXT_USAGE);
317 char *next_name = NULL;
323 while ((ret = efi_get_next_variable_name(&guid, &next_name)) > 0) {
325 * Only pay attention to EFI:BootXXXX variables to get the list.
327 if (efi_guid_cmp(guid, &EFI_GLOBAL_GUID) != 0 ||
328 strlen(next_name) != 8 ||
329 strncmp(next_name, "Boot", 4) != 0 ||
330 !isxdigit(next_name[4]) ||
331 !isxdigit(next_name[5]) ||
332 !isxdigit(next_name[6]) ||
333 !isxdigit(next_name[7]))
335 nent = malloc(sizeof(struct entry));
336 nent->name = strdup(next_name);
338 ret = efi_get_variable(*guid, next_name, &nent->data,
339 &nent->size, &nent->attrs);
341 err(1, "efi_get_variable");
343 nent->idx = strtoul(&next_name[4], NULL, 16);
344 LIST_INSERT_HEAD(&efivars, nent, entries);
350 set_boot_order(char *order)
364 size = sizeof(uint16_t) * cnt;
365 new_data = malloc(size);
369 while ((next = strsep(&cp, ",")) != NULL) {
370 new_data[i] = strtoul(next, NULL, 16);
371 if (new_data[i] == 0 && errno == EINVAL) {
372 warnx("can't parse %s as a numb", next);
373 errx(1, "%s", ORDER_USAGE);
378 if (set_bootvar("BootOrder", (uint8_t*)new_data, size) < 0)
379 err(1, "Unabke to set BootOrder to %s", order);
384 handle_activity(int bootnum, bool active)
386 uint32_t attrs, load_attrs;
391 asprintf(&name, "%s%04X", "Boot", bootnum);
394 if (efi_get_variable(EFI_GLOBAL_GUID, name, &data, &size, &attrs) < 0)
395 err(1, "No such bootvar %s\n", name);
397 load_attrs = le32dec(data);
400 load_attrs |= LOAD_OPTION_ACTIVE;
402 load_attrs &= ~LOAD_OPTION_ACTIVE;
404 le32enc(data, load_attrs);
406 if (set_bootvar(name, data, size) < 0)
407 err(1, "handle activity efi_set_variable");
412 * add boot var to boot order.
413 * called by create boot var. There is no option
414 * to add one independent of create.
416 * Note: we currently don't support where it goes
417 * so it goes on the front, inactive.
418 * use -o 2,3,7 etc to affect order, -a to activate.
421 add_to_boot_order(char *bootvar)
428 val = strtoul(&bootvar[4], NULL, 16);
430 if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) < 0) {
431 if (errno == ENOENT) { /* create it and set this bootvar to active */
435 err(1, "efi_get_variable BootOrder");
439 * We have BootOrder with the current order
440 * so grow the array by one, add the value
441 * and write the new variable value.
443 size += sizeof(uint16_t);
449 if (size > sizeof(uint16_t))
450 memcpy(new + sizeof(uint16_t), data, size - sizeof(uint16_t));
452 if (set_bootvar("BootOrder", new, size) < 0)
453 err(1, "set_bootvar");
459 remove_from_order(uint16_t bootnum)
465 if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) < 0)
472 for (j = i = 0; i < size; i += sizeof(uint16_t)) {
473 if (le16dec(data + i) == bootnum)
475 memcpy(new + j, data + i, sizeof(uint16_t));
476 j += sizeof(uint16_t);
479 warnx("Boot variable %04x not in BootOrder", bootnum);
480 else if (set_bootvar("BootOrder", new, j) < 0)
481 err(1, "Unable to update BootOrder with new value");
487 delete_bootvar(int bootnum)
493 * Try to delete the boot variable and remocve it
494 * from the boot order. We always do both actions
495 * to make it easy to clean up from oopses.
497 if (bootnum < 0 || bootnum > 0xffff)
498 errx(1, "Bad boot variable %#x", bootnum);
499 asprintf(&name, "%s%04X", "Boot", bootnum);
502 printf("Removing boot variable '%s'\n", name);
503 if (efi_del_variable(EFI_GLOBAL_GUID, name) < 0) {
505 warn("cannot delete variable %s", name);
507 printf("Removing 0x%x from BootOrder\n", bootnum);
508 remove_from_order(bootnum);
519 if (efi_del_variable(EFI_GLOBAL_GUID, "BootNext") < 0)
520 err(1, "efi_del_variable");
524 handle_bootnext(uint16_t bootnum)
528 le16enc(&num, bootnum);
529 if (set_bootvar("BootNext", (uint8_t*)&bootnum, sizeof(uint16_t)) < 0)
530 err(1, "set_bootvar");
535 compare(const void *a, const void *b)
540 memcpy(&c, a, sizeof(uint16_t));
541 memcpy(&d, b, sizeof(uint16_t));
551 make_next_boot_var_name(void)
554 uint16_t *vals, next_free = 0;
559 LIST_FOREACH(v, &efivars, entries) {
563 vals = malloc(sizeof(uint16_t) * cnt);
568 LIST_FOREACH(v, &efivars, entries) {
571 qsort(vals, cnt, sizeof(uint16_t), compare);
572 /* if the hole is at the beginning, just return zero */
576 /* now just run the list looking for the first hole */
577 for (i = 0; i < cnt - 1 && next_free == 0; i++)
578 if (vals[i] + 1 != vals[i + 1])
579 next_free = vals[i] + 1;
581 next_free = vals[cnt - 1] + 1;
582 /* In theory we could have used all 65k slots -- what to do? */
586 asprintf(&name, "%s%04X", "Boot", next_free);
593 make_boot_var_name(uint16_t bootnum)
598 LIST_FOREACH(v, &efivars, entries) {
599 if (v->idx == bootnum)
603 asprintf(&name, "%s%04X", "Boot", bootnum);
610 create_loadopt(uint8_t *buf, size_t bufmax, uint32_t attributes, efidp dp, size_t dp_size,
611 const char *description, const uint8_t *optional_data, size_t optional_data_size)
613 efi_char *bbuf = NULL;
618 if (optional_data == NULL && optional_data_size != 0)
620 if (dp == NULL && dp_size != 0)
624 * Compute the length to make sure the passed in buffer is long enough.
626 utf8_to_ucs2(description, &bbuf, &desc_len);
627 len = sizeof(uint32_t) + sizeof(uint16_t) + desc_len + dp_size + optional_data_size;
633 le32enc(pos, attributes);
634 pos += sizeof (attributes);
636 le16enc(pos, dp_size);
637 pos += sizeof (uint16_t);
639 memcpy(pos, bbuf, desc_len); /* NB:desc_len includes strailing NUL */
643 memcpy(pos, dp, dp_size);
646 if (optional_data && optional_data_size > 0) {
647 memcpy(pos, optional_data, optional_data_size);
648 pos += optional_data_size;
656 make_boot_var(const char *label, const char *loader, const char *kernel, const char *env, bool dry_run,
657 int bootnum, bool activate)
659 struct entry *new_ent;
660 uint32_t load_attrs = 0;
661 uint8_t *load_opt_buf;
662 size_t lopt_size, llen, klen;
663 efidp dp, loaderdp, kerneldp;
664 char *bootvar = NULL;
667 assert(label != NULL);
670 bootvar = make_next_boot_var_name();
672 bootvar = make_boot_var_name((uint16_t)bootnum);
674 err(1, "bootvar creation");
676 errx(1, "Must specify boot loader");
677 ret = efivar_unix_path_to_device_path(loader, &loaderdp);
679 errc(1, ret, "Cannot translate unix loader path '%s' to UEFI",
681 if (kernel != NULL) {
682 ret = efivar_unix_path_to_device_path(kernel, &kerneldp);
685 "Cannot translate unix kernel path '%s' to UEFI",
690 llen = efidp_size(loaderdp);
691 if (llen > MAX_DP_LEN)
692 errx(1, "Loader path too long.");
693 klen = efidp_size(kerneldp);
694 if (klen > MAX_DP_LEN)
695 errx(1, "Kernel path too long.");
696 dp = malloc(llen + klen);
698 errx(1, "Can't allocate memory for new device paths");
699 memcpy(dp, loaderdp, llen);
700 if (kerneldp != NULL)
701 memcpy((char *)dp + llen, kerneldp, klen);
703 /* don't make the new bootvar active by default, use the -a option later */
704 load_attrs = LOAD_OPTION_CATEGORY_BOOT;
706 load_attrs |= LOAD_OPTION_ACTIVE;
707 load_opt_buf = malloc(MAX_LOADOPT_LEN);
708 if (load_opt_buf == NULL)
711 lopt_size = create_loadopt(load_opt_buf, MAX_LOADOPT_LEN, load_attrs,
712 dp, llen + klen, label, env, env ? strlen(env) + 1 : 0);
713 if (lopt_size == BAD_LENGTH)
714 errx(1, "Can't create loadopt");
718 ret = efi_set_variable(EFI_GLOBAL_GUID, bootvar,
719 (uint8_t*)load_opt_buf, lopt_size, COMMON_ATTRS);
723 err(1, "efi_set_variable");
726 add_to_boot_order(bootvar); /* first, still not active */
727 new_ent = malloc(sizeof(struct entry));
730 memset(new_ent, 0, sizeof(struct entry));
731 new_ent->name = bootvar;
732 new_ent->guid = EFI_GLOBAL_GUID;
733 LIST_INSERT_HEAD(&efivars, new_ent, entries);
742 print_loadopt_str(uint8_t *data, size_t datalen)
744 char *dev, *relpath, *abspath;
748 uint8_t *ep = data + datalen;
749 uint8_t *walker = data;
756 if (datalen < sizeof(attr) + sizeof(fplen) + sizeof(efi_char))
758 // First 4 bytes are attribute flags
759 attr = le32dec(walker);
760 walker += sizeof(attr);
761 // Next two bytes are length of the file paths
762 fplen = le16dec(walker);
763 walker += sizeof(fplen);
764 // Next we have a 0 terminated UCS2 string that we know to be aligned
765 descr = (efi_char *)(intptr_t)(void *)walker;
766 len = ucs2len(descr); // XXX need to sanity check that len < (datalen - (ep - walker) / 2)
767 walker += (len + 1) * sizeof(efi_char);
770 // Now we have fplen bytes worth of file path stuff
777 * Everything left is the binary option args
779 * optlen = ep - walker;
783 efidp_format_device_path(buf, sizeof(buf), dp,
784 (intptr_t)(void *)edp - (intptr_t)(void *)dp);
785 printf("%*s%s\n", indent, "", buf);
786 indent = 10 + len + 1;
787 rv = efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath);
789 printf("%*s%s:%s %s\n", indent + 4, "", dev, relpath, abspath);
794 dp = (efidp)((char *)dp + efidp_size(dp));
799 get_descr(uint8_t *data)
807 pos += sizeof(uint32_t) + sizeof(uint16_t);
808 desc = (efi_char*)(intptr_t)(void *)pos;
810 buf = malloc(len + 1);
811 memset(buf, 0, len + 1);
821 print_boot_var(const char *name, bool verbose, bool curboot)
829 ret = efi_get_variable(EFI_GLOBAL_GUID, name, &data, &size, NULL);
832 load_attrs = le32dec(data);
834 printf("%c%s%c %s", curboot ? '+' : ' ', name,
835 ((load_attrs & LOAD_OPTION_ACTIVE) ? '*': ' '), d);
838 print_loadopt_str(data, size);
846 os_indication_supported(uint64_t indication)
853 ret = efi_get_variable(EFI_GLOBAL_GUID, "OsIndicationsSupported", &data,
857 return (le64dec(data) & indication) == indication;
868 ret = efi_get_variable(EFI_GLOBAL_GUID, "OsIndications", &data, &size,
872 return le64dec(data);
876 os_indications_set(uint64_t mask, uint64_t val)
878 uint8_t new[sizeof(uint64_t)];
880 le64enc(&new, (os_indications() & ~mask) | (val & mask));
881 return set_bootvar("OsIndications", new, sizeof(new));
884 /* Cmd epilogue, or just the default with no args.
885 * The order is [bootnext] bootcurrent, timeout, order, and the bootvars [-v]
888 print_boot_vars(bool verbose)
891 * just read and print the current values
892 * as a command epilogue
899 uint16_t *boot_order = NULL, current;
902 if (os_indication_supported(EFI_OS_INDICATIONS_BOOT_TO_FW_UI)) {
904 (os_indications() & EFI_OS_INDICATIONS_BOOT_TO_FW_UI) != 0;
905 printf("Boot to FW : %s\n", boot_to_fw_ui != 0 ?
909 ret = efi_get_variable(EFI_GLOBAL_GUID, "BootNext", &data, &size, &attrs);
911 printf("BootNext : %04x\n", le16dec(data));
914 ret = efi_get_variable(EFI_GLOBAL_GUID, "BootCurrent", &data, &size,&attrs);
915 current = le16dec(data);
916 printf("BootCurrent: %04x\n", current);
918 ret = efi_get_variable(EFI_GLOBAL_GUID, "Timeout", &data, &size, &attrs);
920 printf("Timeout : %d seconds\n", le16dec(data));
923 if (efi_get_variable(EFI_GLOBAL_GUID, "BootOrder", &data, &size, &attrs) > 0) {
925 warn("Bad BootOrder variable: odd length %d", (int)size);
926 boot_order = malloc(size);
928 printf("BootOrder : ");
929 for (size_t i = 0; i < size; i += 2) {
930 boot_order[i / 2] = le16dec(data + i);
931 printf("%04X%s", boot_order[i / 2], i == size - 2 ? "\n" : ", ");
935 if (boot_order == NULL) {
937 * now we want to fetch 'em all fresh again
938 * which possibly includes a newly created bootvar
940 LIST_FOREACH(v, &efivars, entries) {
941 print_boot_var(v->name, verbose, v->idx == current);
944 LIST_FOREACH(v, &efivars, entries) {
947 for (int i = 0; i < bolen; i++) {
950 snprintf(buffer, sizeof(buffer), "Boot%04X", boot_order[i]);
951 if (!print_boot_var(buffer, verbose, boot_order[i] == current))
952 printf("%s: MISSING!\n", buffer);
953 LIST_FOREACH(v, &efivars, entries) {
954 if (v->idx == boot_order[i]) {
961 printf("\n\nUnreferenced Variables:\n");
962 LIST_FOREACH(v, &efivars, entries) {
964 print_boot_var(v->name, verbose, v->idx == current);
975 efi_del_variable(EFI_GLOBAL_GUID,"Timeout");
979 handle_timeout(int to)
983 le16enc(&timeout, to);
984 if (set_bootvar("Timeout", (uint8_t *)&timeout, sizeof(timeout)) < 0)
985 errx(1, "Can't set Timeout for booting.");
989 report_esp_device(bool do_dp, bool do_unix)
995 uint16_t current, fplen;
996 char *name, *dev, *relpath, *abspath;
997 uint8_t *walker, *ep;
1002 if (do_dp && do_unix)
1003 errx(1, "Can't report both UEFI device-path and Unix path together");
1005 ret = efi_get_variable(EFI_GLOBAL_GUID, "BootCurrent", &data, &size,&attrs);
1007 err(1, "Can't get BootCurrent");
1008 current = le16dec(data);
1009 if (asprintf(&name, "Boot%04X", current) < 0)
1010 err(1, "Can't format boot var\n");
1011 if (efi_get_variable(EFI_GLOBAL_GUID, name, &data, &size, NULL) < 0)
1012 err(1, "Can't retrieve EFI var %s", name);
1013 // First 4 bytes are attribute flags
1016 walker += sizeof(uint32_t);
1017 // Next two bytes are length of the file paths
1018 fplen = le16dec(walker);
1019 walker += sizeof(fplen);
1020 // Next we have a 0 terminated UCS2 string that we know to be aligned
1021 descr = (efi_char *)(intptr_t)(void *)walker;
1022 len = ucs2len(descr); // XXX need to sanity check that len < (datalen - (ep - walker) / 2)
1023 walker += (len + 1) * sizeof(efi_char);
1025 errx(1, "malformed boot variable %s", name);
1026 // Now we have fplen bytes worth of file path stuff
1029 edp = (efidp)walker;
1031 errx(1, "malformed boot variable %s", name);
1033 efidp_format_device_path_node(buf, sizeof(buf), dp);
1034 printf("%s\n", buf);
1037 if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) != 0)
1038 errx(1, "Can't convert to unix path");
1040 if (abspath == NULL)
1041 errx(1, "Can't find where %s:%s is mounted",
1043 abspath[strlen(abspath) - strlen(relpath) - 1] = '\0';
1044 printf("%s\n", abspath);
1046 printf("%s\n", dev);
1055 set_boot_to_fw_ui(bool to_fw)
1059 if (!os_indication_supported(EFI_OS_INDICATIONS_BOOT_TO_FW_UI)) {
1061 errx(1, "boot to fw ui not supported");
1065 ret = os_indications_set(EFI_OS_INDICATIONS_BOOT_TO_FW_UI,
1068 errx(1, "failed to set boot to fw ui");
1072 main(int argc, char *argv[])
1075 memset(&opts, 0, sizeof (bmgr_opts_t));
1076 parse_args(argc, argv);
1078 if (!efi_variables_supported())
1079 errx(1, "efi variables not supported on this system. root? kldload efirt?");
1085 * side effect, adds to boot order, but not yet active.
1087 make_boot_var(opts.label ? opts.label : "",
1088 opts.loader, opts.kernel, opts.env, opts.dry_run,
1089 opts.has_bootnum ? opts.bootnum : -1, opts.set_active);
1090 else if (opts.set_active || opts.set_inactive )
1091 handle_activity(opts.bootnum, opts.set_active);
1092 else if (opts.order != NULL)
1093 set_boot_order(opts.order); /* create a new bootorder with opts.order */
1094 else if (opts.set_bootnext)
1095 handle_bootnext(opts.bootnum);
1096 else if (opts.delete_bootnext)
1098 else if (opts.delete)
1099 delete_bootvar(opts.bootnum);
1100 else if (opts.del_timeout)
1102 else if (opts.set_timeout)
1103 handle_timeout(opts.timeout);
1104 else if (opts.esp_device)
1105 report_esp_device(opts.device_path, opts.unix_path);
1106 else if (opts.fw_ui)
1107 set_boot_to_fw_ui(true);
1108 else if (opts.no_fw_ui)
1109 set_boot_to_fw_ui(false);
1111 print_boot_vars(opts.verbose);