Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Aug 2018 21:49:26 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 231013] [patch] efibootmgr(8): Add option to activate EFI boot entry after creating it
Message-ID:  <bug-231013-227-Th0miHsA2J@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-231013-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-231013-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D231013

Warner Losh <imp@FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |imp@FreeBSD.org

--- Comment #3 from Warner Losh <imp@FreeBSD.org> ---
-a should already be there for that.

diff --git a/usr.sbin/efibootmgr/efibootmgr.c
b/usr.sbin/efibootmgr/efibootmgr.c
index eaf7a1c1903..103c993f66d 100644
--- a/usr.sbin/efibootmgr/efibootmgr.c
+++ b/usr.sbin/efibootmgr/efibootmgr.c
@@ -622,7 +622,7 @@ create_loadopt(uint8_t *buf, size_t bufmax, uint32_t
attributes, efidp dp, size_

 static int
 make_boot_var(const char *label, const char *loader, const char *kernel, c=
onst
char *env, bool dry_run,
-       int bootnum)
+    int bootnum, bool activate)
 {
        struct entry *new_ent;
        uint32_t load_attrs =3D 0;
@@ -665,6 +665,8 @@ make_boot_var(const char *label, const char *loader, co=
nst
char *kernel, const c

        /* don't make the new bootvar active by default, use the -a option
later */
        load_attrs =3D LOAD_OPTION_CATEGORY_BOOT;
+       if (activate)
+               load_attrs |=3D LOAD_OPTION_ACTIVE;
        load_opt_buf =3D malloc(MAX_LOADOPT_LEN);
        if (load_opt_buf =3D=3D NULL)
                err(1, "malloc");
@@ -693,7 +695,6 @@ make_boot_var(const char *label, const char *loader, co=
nst
char *kernel, const c
        LIST_INSERT_HEAD(&efivars, new_ent, entries);
        free(load_opt_buf);
        free(dp);
-
        return 0;
 }

@@ -915,7 +916,7 @@ main(int argc, char *argv[])
                 */
                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.set_active);
        else if (opts.set_active || opts.set_inactive )
                handle_activity(opts.bootnum, opts.set_active);
        else if (opts.order !=3D NULL)

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-231013-227-Th0miHsA2J>