Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151714336
D4403.id10802.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D4403.id10802.diff
View Options
Index: usr.bin/mkimg/mbr.c
===================================================================
--- usr.bin/mkimg/mbr.c
+++ usr.bin/mkimg/mbr.c
@@ -100,7 +100,12 @@
STAILQ_FOREACH(part, &partlist, link) {
size = round_track(part->size);
dp = dpbase + part->index;
- dp->dp_flag = (part->index == 0 && bootcode != NULL) ? 0x80 : 0;
+ if (active_partition != 0)
+ dp->dp_flag =
+ (part->index + 1 == active_partition) ? 0x80 : 0;
+ else
+ dp->dp_flag =
+ (part->index == 0 && bootcode != NULL) ? 0x80 : 0;
mbr_chs(&dp->dp_scyl, &dp->dp_shd, &dp->dp_ssect,
part->block);
dp->dp_typ = ALIAS_TYPE2INT(part->type);
Index: usr.bin/mkimg/mkimg.h
===================================================================
--- usr.bin/mkimg/mkimg.h
+++ usr.bin/mkimg/mkimg.h
@@ -58,6 +58,7 @@
extern u_int nsecs;
extern u_int secsz; /* Logical block size. */
extern u_int blksz; /* Physical block size. */
+extern uint32_t active_partition;
static inline lba_t
round_block(lba_t n)
Index: usr.bin/mkimg/mkimg.1
===================================================================
--- usr.bin/mkimg/mkimg.1
+++ usr.bin/mkimg/mkimg.1
@@ -40,6 +40,7 @@
.Op Fl c Ar capacity
.Op Fl f Ar format
.Op Fl o Ar outfile
+.Op Fl a Ar active
.Op Fl v
.Op Fl y
.Op Fl s Ar scheme Op Fl p Ar partition ...
@@ -119,7 +120,7 @@
partitioning scheme with the
.Fl s
option, but without specifying any partitions.
-When the size required to for all the partitions is larger than the
+When the size required for all the partitions is larger than the
given capacity, then the disk image will be larger than the capacity
given.
.Pp
@@ -139,6 +140,25 @@
.Nm
utility will create images that are identical.
.Pp
+The
+.Ar active
+option is used to mark a partition as active, if the partitioning
+scheme supports it.
+Only the
+.Ar mbr
+scheme supports this concent.
+Normally,
+.Mn
+will only mark the first partition as active when boot code is
+specified.
+The
+.Ar active
+option overrides it.
+The number specified is 1-based to correspond to the number after
+the 's' in the partition's name.
+Specifying a number larger than the number of partitions ensures
+none are marked as active.
+.Pp
A set of long options exist to query about the
.Nm
utility itself.
Index: usr.bin/mkimg/mkimg.c
===================================================================
--- usr.bin/mkimg/mkimg.c
+++ usr.bin/mkimg/mkimg.c
@@ -73,6 +73,7 @@
u_int nsecs = 1;
u_int secsz = 512;
u_int blksz = 0;
+uint32_t active_partition = 0;
static void
print_formats(int usage)
@@ -148,6 +149,7 @@
fprintf(stderr, "\t--schemes\t- list partition schemes\n");
fprintf(stderr, "\t--version\t- show version information\n");
fputc('\n', stderr);
+ fprintf(stderr, "\t-a <num>\t- mark num'th partion as active\n");
fprintf(stderr, "\t-b <file>\t- file containing boot code\n");
fprintf(stderr, "\t-c <num>\t- capacity (in bytes) of the disk\n");
fprintf(stderr, "\t-f <format>\n");
@@ -484,9 +486,14 @@
bcfd = -1;
outfd = 1; /* Write to stdout by default */
- while ((c = getopt_long(argc, argv, "b:c:f:o:p:s:vyH:P:S:T:",
+ while ((c = getopt_long(argc, argv, "a:b:c:f:o:p:s:vyH:P:S:T:",
longopts, NULL)) != -1) {
switch (c) {
+ case 'a': /* ACTIVE PARTITION, if supported */
+ error = parse_uint32(&active_partition, 1, 100, optarg);
+ if (error)
+ errc(EX_DATAERR, error, "Partition ordinal");
+ break;
case 'b': /* BOOT CODE */
if (bcfd != -1)
usage("multiple bootcode given");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 11, 5:32 AM (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31270266
Default Alt Text
D4403.id10802.diff (3 KB)
Attached To
Mode
D4403: Add a new flag to mkimg (-a num) to specify the active partition for those partitioning schemes that have this concept. Implement it as an override for mbr's setting 0x80 in the flags for the first partition when we have boot code.
Attached
Detach File
Event Timeline
Log In to Comment