View | Details | Raw Unified | Return to bug 231013
Collapse All | Expand All

(-)usr.sbin/efibootmgr/efibootmgr.8 (-1 / +3 lines)
Lines 36-42 Link Here
36
.Op Fl T
36
.Op Fl T
37
.Op Fl o Ar bootorder
37
.Op Fl o Ar bootorder
38
.Op Fl verbose
38
.Op Fl verbose
39
.Op Fl c -k Ar kernel -l Ar loader [-L Ar label] [--dry-run] [-b Bootvar]
39
.Op Fl c -k Ar kernel -l Ar loader [-L Ar label] [--dry-run] [-b Bootvar] [-m]
40
.Sh "DESCRIPTION"
40
.Sh "DESCRIPTION"
41
.Nm
41
.Nm
42
manipulates how UEFI Boot Managers boot the system.
42
manipulates how UEFI Boot Managers boot the system.
Lines 83-88 Link Here
83
Activate the given BootVarNum.
83
Activate the given BootVarNum.
84
.It Fl A -deactivate Ar BootVarNum
84
.It Fl A -deactivate Ar BootVarNum
85
Deactivate the given BootVarNum.
85
Deactivate the given BootVarNum.
86
.It Fl m -create-active
87
Set the created Boot Variable active.
86
.It Fl n -bootnext  Ar BootVarNum
88
.It Fl n -bootnext  Ar BootVarNum
87
Set BootVarNum as the BootNext variable.
89
Set BootVarNum as the BootNext variable.
88
.It Fl N -delete-bootnext 
90
.It Fl N -delete-bootnext 
(-)usr.sbin/efibootmgr/efibootmgr.c (-7 / +19 lines)
Lines 78-83 Link Here
78
	int     bootnum;
78
	int     bootnum;
79
	bool	copy;
79
	bool	copy;
80
	bool    create;
80
	bool    create;
81
	bool    create_active;
81
	bool    delete;
82
	bool    delete;
82
	bool    delete_bootnext;
83
	bool    delete_bootnext;
83
	bool    del_timeout;
84
	bool    del_timeout;
Lines 99-104 Link Here
99
	{"bootorder", required_argument, NULL, 'o'}, /* set order */
100
	{"bootorder", required_argument, NULL, 'o'}, /* set order */
100
	{"copy", required_argument, NULL, 'C'},		/* Copy boot method */
101
	{"copy", required_argument, NULL, 'C'},		/* Copy boot method */
101
	{"create", no_argument, NULL, 'c'},
102
	{"create", no_argument, NULL, 'c'},
103
	{"create-active", no_argument, NULL, 'm'},
102
	{"deactivate", required_argument, NULL, 'A'},
104
	{"deactivate", required_argument, NULL, 'A'},
103
	{"del-timout", no_argument, NULL, 'T'},
105
	{"del-timout", no_argument, NULL, 'T'},
104
	{"delete", required_argument, NULL, 'B'},
106
	{"delete", required_argument, NULL, 'B'},
Lines 171-180 Link Here
171
173
172
#define USAGE \
174
#define USAGE \
173
	"   [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help] \n\
175
	"   [-aAnNB Bootvar] [-t timeout] [-T] [-o bootorder] [-O] [--verbose] [--help] \n\
174
  [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar]]"
176
  [-c -l loader [-k kernel ] [-L label] [--dry-run] [-b Bootvar] [-m]]"
175
177
176
#define CREATE_USAGE \
178
#define CREATE_USAGE \
177
	"       efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run]"
179
	"       efibootmgr -c -l loader [-k kernel] [-L label] [--dry-run] [-m]"
178
#define ORDER_USAGE \
180
#define ORDER_USAGE \
179
	"       efibootmgr -o bootvarnum1,bootvarnum2,..."
181
	"       efibootmgr -o bootvarnum1,bootvarnum2,..."
180
#define TIMEOUT_USAGE \
182
#define TIMEOUT_USAGE \
Lines 191-197 Link Here
191
{
193
{
192
	int ch;
194
	int ch;
193
195
194
	while ((ch = getopt_long(argc, argv, "A:a:B:C:cDe:hk:L:l:Nn:Oo:Tt:v",
196
	while ((ch = getopt_long(argc, argv, "A:a:B:C:cDe:hk:L:l:mNn:Oo:Tt:v",
195
		    lopts, NULL)) != -1) {
197
		    lopts, NULL)) != -1) {
196
		switch (ch) {
198
		switch (ch) {
197
		case 'A':
199
		case 'A':
Lines 240-245 Link Here
240
			opts.loader = strdup(optarg);
242
			opts.loader = strdup(optarg);
241
			opts.loader = mangle_loader(opts.loader);
243
			opts.loader = mangle_loader(opts.loader);
242
			break;
244
			break;
245
		case 'm':
246
			opts.create_active = true;
247
			break;
243
		case 'N':
248
		case 'N':
244
			opts.delete_bootnext = true;
249
			opts.delete_bootnext = true;
245
			break;
250
			break;
Lines 385-391 Link Here
385
 * so it goes on the front, inactive.
390
 * so it goes on the front, inactive.
386
 * use -o 2,3,7 etc to affect order, -a to activate.
391
 * use -o 2,3,7 etc to affect order, -a to activate.
387
 */
392
 */
388
static void
393
static uint16_t
389
add_to_boot_order(char *bootvar)
394
add_to_boot_order(char *bootvar)
390
{
395
{
391
	size_t size;
396
	size_t size;
Lines 420-425 Link Here
420
	if (set_bootvar("BootOrder", new, size) < 0)
425
	if (set_bootvar("BootOrder", new, size) < 0)
421
		err(1, "set_bootvar");
426
		err(1, "set_bootvar");
422
	free(new);
427
	free(new);
428
429
	return val;
423
}
430
}
424
431
425
432
Lines 622-628 Link Here
622
629
623
static int
630
static int
624
make_boot_var(const char *label, const char *loader, const char *kernel, const char *env, bool dry_run,
631
make_boot_var(const char *label, const char *loader, const char *kernel, const char *env, bool dry_run,
625
	int bootnum)
632
	int bootnum, int set_active)
626
{
633
{
627
	struct entry *new_ent;
634
	struct entry *new_ent;
628
	uint32_t load_attrs = 0;
635
	uint32_t load_attrs = 0;
Lines 630-635 Link Here
630
	size_t lopt_size, llen, klen;
637
	size_t lopt_size, llen, klen;
631
	efidp dp, loaderdp, kerneldp;
638
	efidp dp, loaderdp, kerneldp;
632
	char *bootvar = NULL;
639
	char *bootvar = NULL;
640
	uint16_t bootnum_out;
633
	int ret;
641
	int ret;
634
642
635
	assert(label != NULL);
643
	assert(label != NULL);
Lines 683-689 Link Here
683
	if (ret)
691
	if (ret)
684
		err(1, "efi_set_variable");
692
		err(1, "efi_set_variable");
685
693
686
	add_to_boot_order(bootvar); /* first, still not active */
694
	bootnum_out = add_to_boot_order(bootvar); /* first, still not active */
687
	new_ent = malloc(sizeof(struct entry));
695
	new_ent = malloc(sizeof(struct entry));
688
	if (new_ent == NULL)
696
	if (new_ent == NULL)
689
		err(1, "malloc");
697
		err(1, "malloc");
Lines 694-699 Link Here
694
	free(load_opt_buf);
702
	free(load_opt_buf);
695
	free(dp);
703
	free(dp);
696
704
705
        /* set active if we have requested so */
706
        handle_activity(bootnum_out, set_active);
707
697
	return 0;
708
	return 0;
698
}
709
}
699
710
Lines 915-921 Link Here
915
		 */
926
		 */
916
		make_boot_var(opts.label ? opts.label : "",
927
		make_boot_var(opts.label ? opts.label : "",
917
		    opts.loader, opts.kernel, opts.env, opts.dry_run,
928
		    opts.loader, opts.kernel, opts.env, opts.dry_run,
918
		    opts.has_bootnum ? opts.bootnum : -1);
929
		    opts.has_bootnum ? opts.bootnum : -1,
930
		    opts.create_active);
919
	else if (opts.set_active || opts.set_inactive )
931
	else if (opts.set_active || opts.set_inactive )
920
		handle_activity(opts.bootnum, opts.set_active);
932
		handle_activity(opts.bootnum, opts.set_active);
921
	else if (opts.order != NULL)
933
	else if (opts.order != NULL)

Return to bug 231013