From owner-svn-src-all@FreeBSD.ORG Thu May 5 14:43:36 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F41031065675; Thu, 5 May 2011 14:43:35 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DD29E8FC17; Thu, 5 May 2011 14:43:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p45EhZ2a003975; Thu, 5 May 2011 14:43:35 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p45EhZnu003972; Thu, 5 May 2011 14:43:35 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201105051443.p45EhZnu003972@svn.freebsd.org> From: Adrian Chadd Date: Thu, 5 May 2011 14:43:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r221501 - head/share/man/man4 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 May 2011 14:43:36 -0000 Author: adrian Date: Thu May 5 14:43:35 2011 New Revision: 221501 URL: http://svn.freebsd.org/changeset/base/221501 Log: Add a manpage for geom_map(4). Submitted by: ray@dlink.ua Added: head/share/man/man4/geom_map.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Thu May 5 14:43:09 2011 (r221500) +++ head/share/man/man4/Makefile Thu May 5 14:43:35 2011 (r221501) @@ -134,6 +134,7 @@ MAN= aac.4 \ geom.4 \ geom_fox.4 \ geom_linux_lvm.4 \ + geom_map.4 \ geom_uzip.4 \ gif.4 \ gpib.4 \ Added: head/share/man/man4/geom_map.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/geom_map.4 Thu May 5 14:43:35 2011 (r221501) @@ -0,0 +1,179 @@ +.\" +.\" Copyright (c) 2011 Aleksandr Rybalko +.\" 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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 April 5, 2011 +.Dt GEOM_MAP 4 +.Os +.Sh NAME +.Nm geom_map +.Nd "GEOM module that map difined items as separate partitions" +.Sh SYNOPSIS +To compile this driver into the kernel, +place the following line in your +kernel configuration file: +.Bd -ragged -offset indent +.Cd "device geom_map" +.Ed +.Sh DESCRIPTION +The +.Nm +framework provides support for mapping defined parts of the media. Basicaly it +is helpful in the embedded devices where in the one continous flash are loader, +kernel and rootfs parts. The +.Nm +allows making them available as separate parts and protect loader from +overwriting. +.Pp +At boot time +.Nm +partitions listed (only with bootverbose) as: +.Bd -literal -offset indent +MAP: 0x30000, data=0x30000 "/dev/map/bootloader" +MAP: 30000x10000, data=0x10000 "/dev/map/factory" +MAP: 40000x7a0000, data=0x7a0000 "/dev/map/upgrade" +MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 +MAP: 40000x110000, data=0x110000 "/dev/map/kernel" +MAP: search key ".!/bin/sh" from 0x100000, step 0x10000 +MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" +MAP: 7e0000x20000, data=0x20000 "/dev/map/config" +.Ed +.Pp +Also +.Nm +current configuration can be accessible with sysctl's kern.geom.conftxt, +kern.geom.confxml, kern.geom.confdot or geom map list. +.Bd -literal -offset indent +# sysctl kern.geom.conftxt +kern.geom.conftxt: 0 MD md0 10485760 512 u 0 s 512 f 0 fs 0 l 10485760 t malloc +0 DISK cfid0 8388608 4 hd 0 sc 0 +1 MAP map/config 131072 4 i 5 o 8257536 entry 0 dsize 131072 +1 MAP map/rootfs 6881280 4 i 4 o 1376256 entry 0 dsize 6881280 +2 UNCOMPRESS map/rootfs.uncompress 18677760 512 +1 MAP map/kernel 1114112 4 i 3 o 262144 entry 0 dsize 1114112 +1 MAP map/upgrade 7995392 4 i 2 o 262144 entry 0 dsize 7995392 +1 MAP map/factory 65536 4 i 1 o 196608 entry 0 dsize 65536 +1 MAP map/bootloader 196608 4 i 0 o 0 entry 0 dsize 196608 +.Ed +.Pp +Driver configuration can be done in device hints file. List of used parameters: +.Bl -tag -width indent +.It Fa at +select media to attach +.It Fa name +name of partiton (will create device /dev/map/that_name) +.It Fa start +offset from the beginning of the parent media to start of the mapped partition. +This field can also have special value +"search:searchstart:searchstep:searchkey", where: +.Bl -tag -width indent +.It Fa searchstart +offset from the beginning of the parent media where search will be started +.It Fa searchstep +value of the increment used while searching for the partition boundary markers +.It Fa searchkey +key which will be used to find partition boundary markers. Wildcard "." char +can be used to match any char on that position +.El +.It Fa end +offset from the beginning of the parent media to end of the mapped partition. +This field can also have special value +"search:searchstart:searchstep:searchkey", look "start" for details. +.It Fa offset +offset where the data of mapped partition begins +.El +.Pp +Each record contains start address(bytes) from the media begin, size(bytes), +offset where the data of mapped partition begins, and the name of new device. +.Bd -literal -offset indent +MAP: 150000x690000, data=0x690000 "/dev/map/rootfs" +.Ed +.Bd -literal +00150000 - begin address +00690000 - size +00000000 - data begin from zero offset +00690000 - data size +"map/rootfs" - new media will be accessible via /dev/map/rootfs dev. +.Ed +.Sh EXAMPLES +.Pp +.Bl -bullet -compact +If we need to implement layout shown above, we need to define the folowing +hints: +.Bd -literal -offset indent +hint.map.0.at="cfid0" +hint.map.0.start=0x00000000 +hint.map.0.end=0x00030000 +hint.map.0.name="bootloader" +hint.map.0.readonly=1 + +.Ed +define "/dev/map/bootloader" at disk "cfid0" starting at 0x00000000 and end +0x00030000, also marked as readonly. +.Bd -literal -offset indent +hint.map.1.at="cfid0" +hint.map.1.start=0x00030000 +hint.map.1.end=0x00040000 +hint.map.1.name="factory" + +hint.map.2.at="cfid0" +hint.map.2.start=0x00040000 +hint.map.2.end=0x007e0000 +hint.map.2.name="upgrade" + +hint.map.3.at="cfid0" +hint.map.3.name="kernel" +hint.map.3.start=0x00040000 +hint.map.3.end="search:0x00100000:0x10000:.!/bin/sh" + +.Ed +define "/dev/map/kernel" at disk "cfid0" starting at 0x00040000, but end +position must be searched by the key ".!/bin/sh", from offset 0x00100000 to end +of media with step 0x10000. Real marker in that case is "#!/bin/sh", but "#" +terminates the line when hints file is parsed, so we need to use wildcard "." +instead of "#". +.Bd -literal -offset indent +hint.map.4.at="cfid0" +hint.map.4.name="rootfs" +hint.map.4.start="search:0x00100000:0x10000:.!/bin/sh" +hint.map.4.end=0x007e0000 + +hint.map.5.at="cfid0" +hint.map.5.start=0x007e0000 +hint.map.5.end=0x00800000 +hint.map.5.name="config" +.Ed +.El +.Sh SEE ALSO +.Xr GEOM 4 , +.Xr geom 8 , +.Xr sysctl 8 +.Sh AUTHORS +.An -nosplit +The +.Nm +driver was written by +.An "Aleksandr Rybalko" Aq ray@ddteam.net .