Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin/gpt Allow specifying the partition via -b startsec for ...



details:   https://anonhg.NetBSD.org/src/rev/dda42b34f263
branches:  trunk
changeset: 450058:dda42b34f263
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Apr 04 13:55:40 2019 +0000

description:
Allow specifying the partition via -b startsec for the biosboot cmd.

diffstat:

 sbin/gpt/biosboot.c |  16 ++++++++++++----
 sbin/gpt/gpt.8      |  11 +++++++----
 2 files changed, 19 insertions(+), 8 deletions(-)

diffs (97 lines):

diff -r 41f1f1dfc106 -r dda42b34f263 sbin/gpt/biosboot.c
--- a/sbin/gpt/biosboot.c       Thu Apr 04 12:38:27 2019 +0000
+++ b/sbin/gpt/biosboot.c       Thu Apr 04 13:55:40 2019 +0000
@@ -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 @@
 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 @@
                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 @@
        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 @@
                        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;
                }
diff -r 41f1f1dfc106 -r dda42b34f263 sbin/gpt/gpt.8
--- a/sbin/gpt/gpt.8    Thu Apr 04 12:38:27 2019 +0000
+++ b/sbin/gpt/gpt.8    Thu Apr 04 13:55:40 2019 +0000
@@ -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 @@
 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 @@
 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



Home | Main Index | Thread Index | Old Index