Module Name: src
Committed By: martin
Date: Thu Apr 4 13:55:40 UTC 2019
Modified Files:
src/sbin/gpt: biosboot.c gpt.8
Log Message:
Allow specifying the partition via -b startsec for the biosboot cmd.
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sbin/gpt/biosboot.c
cvs rdiff -u -r1.67 -r1.68 src/sbin/gpt/gpt.8
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sbin/gpt/biosboot.c
diff -u src/sbin/gpt/biosboot.c:1.30 src/sbin/gpt/biosboot.c:1.31
--- src/sbin/gpt/biosboot.c:1.30 Thu Sep 7 10:23:33 2017
+++ src/sbin/gpt/biosboot.c Thu Apr 4 13:55:40 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: biosboot.c,v 1.30 2017/09/07 10:23:33 christos Exp $ */
+/* $NetBSD: biosboot.c,v 1.31 2019/04/04 13:55:40 martin Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#ifdef __RCSID
-__RCSID("$NetBSD: biosboot.c,v 1.30 2017/09/07 10:23:33 christos Exp $");
+__RCSID("$NetBSD: biosboot.c,v 1.31 2019/04/04 13:55:40 martin Exp $");
#endif
#include <sys/stat.h>
@@ -72,7 +72,7 @@ __RCSID("$NetBSD: biosboot.c,v 1.30 2017
static int cmd_biosboot(gpt_t, int, char *[]);
static const char *biosboothelp[] = {
- "[-A] [-c bootcode] [-i index] [-L label]",
+ "[-A] [-c bootcode] [-i index] [-L label] [-b startsec]",
#if notyet
"[-a alignment] [-b blocknr] [-i index] [-l label]",
"[-s size] [-t type]",
@@ -230,6 +230,10 @@ biosboot(gpt_t gpt, daddr_t start, uint6
if (entry < 1 && label == NULL && size > 0 &&
m->map_start == start && m->map_size == (off_t)size)
break;
+ /* next could be start sector specified by -b option */
+ if (entry < 1 && label == NULL && size == 0 &&
+ m->map_start == start)
+ break;
}
if (m == NULL) {
@@ -270,7 +274,7 @@ cmd_biosboot(gpt_t gpt, int argc, char *
uint8_t *label = NULL;
char *bootpath = NULL;
- while ((ch = getopt(argc, argv, "Ac:i:L:")) != -1) {
+ while ((ch = getopt(argc, argv, "Ac:i:L:b:")) != -1) {
switch(ch) {
case 'A':
active = 1;
@@ -287,6 +291,10 @@ cmd_biosboot(gpt_t gpt, int argc, char *
if (gpt_name_get(gpt, &label) == -1)
goto usage;
break;
+ case 'b':
+ if (gpt_human_get(gpt, &start) == -1)
+ goto usage;
+ break;
default:
goto usage;
}
Index: src/sbin/gpt/gpt.8
diff -u src/sbin/gpt/gpt.8:1.67 src/sbin/gpt/gpt.8:1.68
--- src/sbin/gpt/gpt.8:1.67 Tue Mar 26 14:55:02 2019
+++ src/sbin/gpt/gpt.8 Thu Apr 4 13:55:40 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpt.8,v 1.67 2019/03/26 14:55:02 martin Exp $
+.\" $NetBSD: gpt.8,v 1.68 2019/04/04 13:55:40 martin Exp $
.\"
.\" Copyright (c) 2002 Marcel Moolenaar
.\" All rights reserved.
@@ -26,7 +26,7 @@
.\"
.\" $FreeBSD: src/sbin/gpt/gpt.8,v 1.17 2006/06/22 22:22:32 marcel Exp $
.\"
-.Dd March 26, 2019
+.Dd April 4, 2019
.Dt GPT 8
.Os
.Sh NAME
@@ -249,8 +249,8 @@ command.
The format is a plist.
It should not be modified.
.\" ==== biosboot ====
-.It Nm Ic biosboot Oo Fl A Oc Oo Fl c Ar bootcode Oc Oo Fl i Ar index Oc \
-Oo Fl L Ar label Oc
+.It Nm Ic biosboot Oo Fl A Oc Oo Fl c Ar bootcode Oc Oo Fl b Ar startsec Oc \
+Oo Fl i Ar index Oc Oo Fl L Ar label Oc
The
.Ic biosboot
command allows the user to configure the partition that contains the
@@ -279,6 +279,9 @@ The
option selects the partition by label.
If there are multiple partitions with the same label, the
first one found will be used.
+The
+.Fl b
+options selects the partition by start block.
.\" ==== create ====
.It Nm Ic create Oo Fl AfP Oc Oo Fl p Ar partitions Oc
The