From owner-svn-src-user@FreeBSD.ORG Fri Mar 28 05:06:13 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 89F1D958; Fri, 28 Mar 2014 05:06:13 +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 6AE22911; Fri, 28 Mar 2014 05:06:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s2S56D1t082734; Fri, 28 Mar 2014 05:06:13 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s2S56DR3082731; Fri, 28 Mar 2014 05:06:13 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201403280506.s2S56DR3082731@svn.freebsd.org> From: Marcel Moolenaar Date: Fri, 28 Mar 2014 05:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r263867 - user/marcel/mkimg X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Mar 2014 05:06:13 -0000 Author: marcel Date: Fri Mar 28 05:06:12 2014 New Revision: 263867 URL: http://svnweb.freebsd.org/changeset/base/263867 Log: Make mkimg a general command and not a maintenance command. Added: user/marcel/mkimg/mkimg.1 - copied unchanged from r263865, user/marcel/mkimg/mkimg.8 Deleted: user/marcel/mkimg/mkimg.8 Modified: user/marcel/mkimg/Makefile Modified: user/marcel/mkimg/Makefile ============================================================================== --- user/marcel/mkimg/Makefile Fri Mar 28 04:51:18 2014 (r263866) +++ user/marcel/mkimg/Makefile Fri Mar 28 05:06:12 2014 (r263867) @@ -2,7 +2,7 @@ PROG= mkimg SRCS= mkimg.c scheme.c -MAN= mkimg.8 +MAN= mkimg.1 CFLAGS+=-DSPARSE_WRITE @@ -16,7 +16,7 @@ SRCS+= \ pc98.c \ vtoc8.c -BINDIR?=/usr/sbin +BINDIR?=/usr/bin DPADD= ${LIBUTIL} LDADD= -lutil Copied: user/marcel/mkimg/mkimg.1 (from r263865, user/marcel/mkimg/mkimg.8) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ user/marcel/mkimg/mkimg.1 Fri Mar 28 05:06:12 2014 (r263867, copy of r263865, user/marcel/mkimg/mkimg.8) @@ -0,0 +1,151 @@ +.\" Copyright (c) 2013, 2014 Juniper Networks, Inc. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd March 27, 2014 +.Dt MKIMG 1 +.Os +.Sh NAME +.Nm mkimg +.Nd "utility to make a disk image" +.Sh SYNOPSIS +.Nm +.Op Fl H Ar heads +.Op Fl P Ar blksz +.Op Fl S Ar secsz +.Op Fl T Ar tracksz +.Op Fl b Ar bootcode +.Op Fl o Ar outfile +.Op Fl v +.Fl s Ar scheme +.Fl p Ar partition +.Op Fl p Ar partition ... +.Sh DESCRIPTION +The +.Nm +utility creates a disk image from the raw partition contents specified with +the +.Ar partition +argument(s) and using the partitioning scheme specified with the +.Ar scheme +argument. +The disk image is written to +.Ar stdout +by default or the file specified with the +.Ar outfile +argument. +.Pp +The disk image can be made bootable by specifying the scheme-specific boot +block contents with the +.Ar bootcode +argument and, +depending on the scheme, +with a boot partition. +The contents of such a boot partition is provided like any other partition +and the +.Nm +utility does not treat it any differently from other partitions. +.Pp +Some partitioning schemes need a disk geometry and for those the +.Nm +utility accepts the +.Ar tracksz +and +.Ar heads +arguments, specifying the number of sectors per track and the number of +heads per cylinder (resp.) +.Pp +Both the logical and physical sector size can be specified and for that the +.Nm +utility +accepts the +.Ar secsz +and +.Ar blksz +arguments. +The +.Ar secsz +argument is used to specify the logical sector size. +This is the sector size reported by a disk when queried for its capacity. +Modern disks use a larger sector size internally, +referred to as block size by the +.Nm +utility and this can be specified by the +.Ar blksz +argument. +The +.Nm +utility will use the (physical) block size to determine the start of +partitions and to round the size of the disk image. +.Pp +The +.Op Fl v +option increases the level of output that the +.Nm +utility prints. +.Sh EXAMPLES +To create a bootable disk image that is partitioned using the GPT scheme and +containing a root file system that was previously created using +.Xr makefs +and also containing a swap partition, run the +.Nm +utility as follows: +.Dl % mkimg -s gpt -b /boot/pmbr -p freebsd-boot:=/boot/gptboot \ +-p freebsd-ufs:=root-file-system.ufs -p freebsd-swap::1G \ +-o gpt.img +.Pp +A nested partitioning scheme is created by running the +.Nm +utility twice. +The output of the first will be fed as the contents of a partition to the +second. +This can be done using a temporary file, like so: +.Dl % mkimg -s bsd -b /boot/boot -p freebsd-ufs:=root-file-system.ufs \ +-p freebsd-swap::1G -o /tmp/bsd.img +.Dl % mkimg -s mbr -b /boot/mbr -p freebsd:=/tmp/bsd.img -o mbr-bsd.img +.Pp +Alternatively, the +.Nm +utility can be run in a cascaded fashion, whereby the output of the +first is fed directly into the second. +To do this, run the +.Nm +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 +.Sh SEE ALSO +.Xr gpart 8 +.Xr makefs 8 +.Xr mdconfig 8 +.Xr newfs 8 +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 11.0 +.Sh AUTHORS +The +.Nm +utility and manpage were written by Marcel Moolenaar