From owner-svn-src-head@FreeBSD.ORG Fri Sep 12 20:05:09 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1F01ED2F; Fri, 12 Sep 2014 20:05:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2FC5156; Fri, 12 Sep 2014 20:05:08 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8CK58pU032745; Fri, 12 Sep 2014 20:05:08 GMT (envelope-from marcel@FreeBSD.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8CK58q4032742; Fri, 12 Sep 2014 20:05:08 GMT (envelope-from marcel@FreeBSD.org) Message-Id: <201409122005.s8CK58q4032742@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: marcel set sender to marcel@FreeBSD.org using -f From: Marcel Moolenaar Date: Fri, 12 Sep 2014 20:05:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271482 - head/usr.bin/mkimg X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Sep 2014 20:05:09 -0000 Author: marcel Date: Fri Sep 12 20:05:08 2014 New Revision: 271482 URL: http://svnweb.freebsd.org/changeset/base/271482 Log: Add support for adding empty partition entries. I.e. skip partition numbers or names. This gives more control over the actual layout and helps to construct BSD disklabels with /usr or /var at dedicated partitions. Obtained from: Juniper Networks, Inc. MFC after: 3 days Relnotes: yes Modified: head/usr.bin/mkimg/mkimg.1 head/usr.bin/mkimg/mkimg.c Modified: head/usr.bin/mkimg/mkimg.1 ============================================================================== --- head/usr.bin/mkimg/mkimg.1 Fri Sep 12 19:32:18 2014 (r271481) +++ head/usr.bin/mkimg/mkimg.1 Fri Sep 12 20:05:08 2014 (r271482) @@ -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. Modified: head/usr.bin/mkimg/mkimg.c ============================================================================== --- head/usr.bin/mkimg/mkimg.c Fri Sep 12 19:32:18 2014 (r271481) +++ head/usr.bin/mkimg/mkimg.c Fri Sep 12 20:05:08 2014 (r271482) @@ -101,6 +101,7 @@ usage(const char *why) "are determined\n\t\t\t\t by the named file\n"); fprintf(stderr, "\t[/]:-\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- scheme neutral partition type\n"); fprintf(stderr, "\t\t\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);