FreeBSD Bugzilla – Attachment 196692 Details for
Bug 231013
[patch] efibootmgr(8): Add option to activate EFI boot entry after creating it
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch (Revision 1)
efibootmgr-createactive-r1.patch (text/plain), 4.03 KB, created by
Neel Chauhan
on 2018-08-29 22:10:15 UTC
(
hide
)
Description:
Patch (Revision 1)
Filename:
MIME Type:
Creator:
Neel Chauhan
Created:
2018-08-29 22:10:15 UTC
Size:
4.03 KB
patch
obsolete
>Index: usr.sbin/efibootmgr/efibootmgr.8 >=================================================================== >--- usr.sbin/efibootmgr/efibootmgr.8 (revision 338392) >+++ usr.sbin/efibootmgr/efibootmgr.8 (working copy) >@@ -36,7 +36,7 @@ > .Op Fl T > .Op Fl o Ar bootorder > .Op Fl verbose >-.Op Fl c -k Ar kernel -l Ar loader [-L Ar label] [--dry-run] [-b Bootvar] >+.Op Fl c -k Ar kernel -l Ar loader [-L Ar label] [--dry-run] [-b Bootvar] [-m] > .Sh "DESCRIPTION" > .Nm > manipulates how UEFI Boot Managers boot the system. >@@ -83,6 +83,8 @@ > Activate the given BootVarNum. > .It Fl A -deactivate Ar BootVarNum > Deactivate the given BootVarNum. >+.It Fl m -create-active >+Set the created Boot Variable active. > .It Fl n -bootnext Ar BootVarNum > Set BootVarNum as the BootNext variable. > .It Fl N -delete-bootnext >Index: usr.sbin/efibootmgr/efibootmgr.c >=================================================================== >--- usr.sbin/efibootmgr/efibootmgr.c (revision 338392) >+++ usr.sbin/efibootmgr/efibootmgr.c (working copy) >@@ -78,6 +78,7 @@ > int bootnum; > bool copy; > bool create; >+ bool create_active; > bool delete; > bool delete_bootnext; > bool del_timeout; >@@ -99,6 +100,7 @@ > {"bootorder", required_argument, NULL, 'o'}, /* set order */ > {"copy", required_argument, NULL, 'C'}, /* Copy boot method */ > {"create", no_argument, NULL, 'c'}, >+ {"create-active", no_argument, NULL, 'm'}, > {"deactivate", required_argument, NULL, 'A'}, > {"del-timout", no_argument, NULL, 'T'}, > {"delete", required_argument, NULL, 'B'}, >@@ -171,10 +173,10 @@ > > #define USAGE \ > " [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help] \n\ >- [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar]]" >+ [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar] [-m]]" > > #define CREATE_USAGE \ >- " efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run]" >+ " efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run] [-m]" > #define ORDER_USAGE \ > " efibootmgr -o bootvarnum1,bootvarnum2,..." > #define TIMEOUT_USAGE \ >@@ -191,7 +193,7 @@ > { > int ch; > >- while ((ch = getopt_long(argc, argv, "A:a:B:C:cDe:hk:L:l:Nn:Oo:Tt:v", >+ while ((ch = getopt_long(argc, argv, "A:a:B:C:cDe:hk:L:l:mNn:Oo:Tt:v", > lopts, NULL)) != -1) { > switch (ch) { > case 'A': >@@ -240,6 +242,9 @@ > opts.loader = strdup(optarg); > opts.loader = mangle_loader(opts.loader); > break; >+ case 'm': >+ opts.create_active = true; >+ break; > case 'N': > opts.delete_bootnext = true; > break; >@@ -385,7 +390,7 @@ > * so it goes on the front, inactive. > * use -o 2,3,7 etc to affect order, -a to activate. > */ >-static void >+static uint16_t > add_to_boot_order(char *bootvar) > { > size_t size; >@@ -420,6 +425,8 @@ > if (set_bootvar("BootOrder", new, size) < 0) > err(1, "set_bootvar"); > free(new); >+ >+ return val; > } > > >@@ -622,7 +629,7 @@ > > static int > make_boot_var(const char *label, const char *loader, const char *kernel, const char *env, bool dry_run, >- int bootnum) >+ int bootnum, int set_active) > { > struct entry *new_ent; > uint32_t load_attrs = 0; >@@ -630,6 +637,7 @@ > size_t lopt_size, llen, klen; > efidp dp, loaderdp, kerneldp; > char *bootvar = NULL; >+ uint16_t bootnum_out; > int ret; > > assert(label != NULL); >@@ -683,7 +691,7 @@ > if (ret) > err(1, "efi_set_variable"); > >- add_to_boot_order(bootvar); /* first, still not active */ >+ bootnum_out = add_to_boot_order(bootvar); /* first, still not active */ > new_ent = malloc(sizeof(struct entry)); > if (new_ent == NULL) > err(1, "malloc"); >@@ -694,6 +702,9 @@ > free(load_opt_buf); > free(dp); > >+ /* set active if we have requested so */ >+ handle_activity(bootnum_out, set_active); >+ > return 0; > } > >@@ -915,7 +926,8 @@ > */ > make_boot_var(opts.label ? opts.label : "", > opts.loader, opts.kernel, opts.env, opts.dry_run, >- opts.has_bootnum ? opts.bootnum : -1); >+ opts.has_bootnum ? opts.bootnum : -1, >+ opts.create_active); > else if (opts.set_active || opts.set_inactive ) > handle_activity(opts.bootnum, opts.set_active); > else if (opts.order != NULL)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 231013
: 196692