Implement -m option to enable/disable slices.
This commit is contained in:
parent
fc2ff140c2
commit
5868a099d9
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=48038
@ -22,7 +22,7 @@
|
|||||||
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||||
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" $Id: boot0cfg.8,v 1.2 1999/02/22 09:36:54 rnordier Exp $
|
.\" $Id: boot0cfg.8,v 1.3 1999/02/26 14:57:17 rnordier Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd February 21, 1999
|
.Dd February 21, 1999
|
||||||
.Dt BOOT0CFG 8
|
.Dt BOOT0CFG 8
|
||||||
@ -36,6 +36,7 @@
|
|||||||
.Op Fl b Ar boot0
|
.Op Fl b Ar boot0
|
||||||
.Op Fl d Ar drive
|
.Op Fl d Ar drive
|
||||||
.Op Fl f Ar file
|
.Op Fl f Ar file
|
||||||
|
.Op Fl m Ar mask
|
||||||
.Op Fl o Ar options
|
.Op Fl o Ar options
|
||||||
.Op Fl t Ar ticks
|
.Op Fl t Ar ticks
|
||||||
.Ar disk
|
.Ar disk
|
||||||
@ -89,6 +90,11 @@ is acceptable here.
|
|||||||
Specify that a backup copy of the preexisting MBR should be written to
|
Specify that a backup copy of the preexisting MBR should be written to
|
||||||
.Ar file .
|
.Ar file .
|
||||||
This file is created if it does not exist, and truncated if it does.
|
This file is created if it does not exist, and truncated if it does.
|
||||||
|
.It Fl m Ar mask
|
||||||
|
Specify slices to be enabled/disabled, where
|
||||||
|
.Ar mask
|
||||||
|
is an integer between 0 (no slices enabled) and 0xf (all four slices
|
||||||
|
enabled).
|
||||||
.It Fl o Ar options
|
.It Fl o Ar options
|
||||||
A comma-separated string of any of the following options may be
|
A comma-separated string of any of the following options may be
|
||||||
specified (with
|
specified (with
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id: boot0cfg.c,v 1.2 1999/02/22 09:36:54 rnordier Exp $";
|
"$Id: boot0cfg.c,v 1.3 1999/02/26 14:57:17 rnordier Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -85,17 +85,17 @@ main(int argc, char *argv[])
|
|||||||
const char *bpath, *fpath, *disk;
|
const char *bpath, *fpath, *disk;
|
||||||
ssize_t n;
|
ssize_t n;
|
||||||
int B_flag, v_flag, o_flag;
|
int B_flag, v_flag, o_flag;
|
||||||
int d_arg, t_arg;
|
int d_arg, m_arg, t_arg;
|
||||||
int o_and, o_or;
|
int o_and, o_or;
|
||||||
int fd, fd1, up, c, i;
|
int fd, fd1, up, c, i;
|
||||||
|
|
||||||
bpath = "/boot/boot0";
|
bpath = "/boot/boot0";
|
||||||
fpath = NULL;
|
fpath = NULL;
|
||||||
B_flag = v_flag = o_flag = 0;
|
B_flag = v_flag = o_flag = 0;
|
||||||
d_arg = t_arg = -1;
|
d_arg = m_arg = t_arg = -1;
|
||||||
o_and = 0xff;
|
o_and = 0xff;
|
||||||
o_or = 0;
|
o_or = 0;
|
||||||
while ((c = getopt(argc, argv, "Bvb:d:f:o:t:")) != -1)
|
while ((c = getopt(argc, argv, "Bvb:d:f:m:o:t:")) != -1)
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'B':
|
case 'B':
|
||||||
B_flag = 1;
|
B_flag = 1;
|
||||||
@ -112,6 +112,9 @@ main(int argc, char *argv[])
|
|||||||
case 'f':
|
case 'f':
|
||||||
fpath = optarg;
|
fpath = optarg;
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
m_arg = argtoi(optarg, 0, 0xf, 'm');
|
||||||
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
stropt(optarg, &o_and, &o_or);
|
stropt(optarg, &o_and, &o_or);
|
||||||
o_flag = 1;
|
o_flag = 1;
|
||||||
@ -157,6 +160,10 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
if (d_arg != -1)
|
if (d_arg != -1)
|
||||||
buf[OFF_DRIVE] = d_arg;
|
buf[OFF_DRIVE] = d_arg;
|
||||||
|
if (m_arg != -1) {
|
||||||
|
buf[OFF_FLAGS] &= 0xf0;
|
||||||
|
buf[OFF_FLAGS] |= m_arg;
|
||||||
|
}
|
||||||
if (o_flag) {
|
if (o_flag) {
|
||||||
buf[OFF_FLAGS] &= o_and;
|
buf[OFF_FLAGS] &= o_and;
|
||||||
buf[OFF_FLAGS] |= o_or;
|
buf[OFF_FLAGS] |= o_or;
|
||||||
@ -188,7 +195,8 @@ main(int argc, char *argv[])
|
|||||||
part[i].dp_size);
|
part[i].dp_size);
|
||||||
}
|
}
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf("drive=0x%x options=", buf[OFF_DRIVE]);
|
printf("drive=0x%x mask=0x%x options=", buf[OFF_DRIVE],
|
||||||
|
buf[OFF_FLAGS] & 0xf);
|
||||||
for (i = 0; i < nopt; i++) {
|
for (i = 0; i < nopt; i++) {
|
||||||
if (i)
|
if (i)
|
||||||
printf(",");
|
printf(",");
|
||||||
@ -264,7 +272,7 @@ static void
|
|||||||
usage(void)
|
usage(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "%s\n%s\n",
|
fprintf(stderr, "%s\n%s\n",
|
||||||
"usage: boot0cfg [-Bv] [-b boot0] [-d drive] [-f file] [-o options]",
|
"usage: boot0cfg [-Bv] [-b boot0] [-d drive] [-f file] [-m mask]",
|
||||||
" [-t ticks] disk");
|
" [-o options] [-t ticks] disk");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user