summaryrefslogtreecommitdiffstats
path: root/usr.bin/mkimg
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2014-09-22 15:22:57 +0000
committermarcel <marcel@FreeBSD.org>2014-09-22 15:22:57 +0000
commita6288e6f8dd6adc0fe8a9e9250a8b65ec769c0f5 (patch)
treeb0ff061466558ee11ffe5d8fa333fe1b0c12a5d7 /usr.bin/mkimg
parentd6ca07d629c0f45abbd985021d134d0d474b5eca (diff)
downloadFreeBSD-src-a6288e6f8dd6adc0fe8a9e9250a8b65ec769c0f5.zip
FreeBSD-src-a6288e6f8dd6adc0fe8a9e9250a8b65ec769c0f5.tar.gz
MFC 271482: Add support for adding empty partition entries.
Relnotes: yes Approved by: re@ (gjb)
Diffstat (limited to 'usr.bin/mkimg')
-rw-r--r--usr.bin/mkimg/mkimg.121
-rw-r--r--usr.bin/mkimg/mkimg.c9
2 files changed, 29 insertions, 1 deletions
diff --git a/usr.bin/mkimg/mkimg.1 b/usr.bin/mkimg/mkimg.1
index ed14cc8..db492ed 100644
--- a/usr.bin/mkimg/mkimg.1
+++ b/usr.bin/mkimg/mkimg.1
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 4, 2014
+.Dd September 12, 2014
.Dt MKIMG 1
.Os
.Sh NAME
@@ -171,6 +171,25 @@ utility as follows:
.Dl % mkimg -s mbr -b /boot/mbr -p freebsd:-'mkimg -s bsd -b /boot/boot \
-p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G' -o mbr-bsd.img
.Pp
+To accomodate the need to have partitions named or numbered in a certain
+way, the
+.Nm
+utility allows for the specification of empty partitions.
+For example, to create an image that is compatible with partition layouts
+found in
+.Pa /etc/disktab ,
+the 'd' partition often needs to be skipped.
+This is accomplished by inserting an unused partition after the first 2
+partition specifications.
+It is worth noting at this time that the BSD scheme will automatically
+skip the 'c' partition by virtue of it referring to the entire disk.
+To create an image that is compatible with the qp120at disk, use the
+.Nm
+utility as follows:
+.Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \
+-p freebsd-swap::20M -p- -p- -p- -p- -p freebsd-ufs:=usr-file-system.ufs \
+-o bsd.img
+.Pp
For partitioning schemes that feature partition labels, the
.Nm
utility supports assigning labels to the partitions specified.
diff --git a/usr.bin/mkimg/mkimg.c b/usr.bin/mkimg/mkimg.c
index 4513e66..ab95d94 100644
--- a/usr.bin/mkimg/mkimg.c
+++ b/usr.bin/mkimg/mkimg.c
@@ -101,6 +101,7 @@ usage(const char *why)
"are determined\n\t\t\t\t by the named file\n");
fprintf(stderr, "\t<t>[/<l>]:-<cmd>\t- partition content and size "
"are taken from\n\t\t\t\t the output of the command to run\n");
+ fprintf(stderr, "\t-\t\t\t- unused partition entry\n");
fprintf(stderr, "\t where:\n");
fprintf(stderr, "\t\t<t>\t- scheme neutral partition type\n");
fprintf(stderr, "\t\t<l>\t- optional scheme-dependent partition "
@@ -140,6 +141,9 @@ pwr_of_two(u_int nr)
* '-' contents holds a command to run; the output of
* which is the contents of the partition.
* contents the specification of a partition's contents
+ *
+ * A specification that is a single dash indicates an unused partition
+ * entry.
*/
static int
parse_part(const char *spec)
@@ -149,6 +153,11 @@ parse_part(const char *spec)
size_t len;
int error;
+ if (strcmp(spec, "-") == 0) {
+ nparts++;
+ return (0);
+ }
+
part = calloc(1, sizeof(struct part));
if (part == NULL)
return (ENOMEM);
OpenPOWER on IntegriCloud