From owner-svn-src-head@FreeBSD.ORG Sat Dec 31 00:09:33 2011 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 98A3A10656D1; Sat, 31 Dec 2011 00:09:33 +0000 (UTC) (envelope-from sobomax@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6CCCB8FC13; Sat, 31 Dec 2011 00:09:33 +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 pBV09Xfp037345; Sat, 31 Dec 2011 00:09:33 GMT (envelope-from sobomax@svn.freebsd.org) Received: (from sobomax@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pBV09Xxs037343; Sat, 31 Dec 2011 00:09:33 GMT (envelope-from sobomax@svn.freebsd.org) Message-Id: <201112310009.pBV09Xxs037343@svn.freebsd.org> From: Maxim Sobolev Date: Sat, 31 Dec 2011 00:09:33 +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: r229049 - head/sbin/bsdlabel X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 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: Sat, 31 Dec 2011 00:09:33 -0000 Author: sobomax Date: Sat Dec 31 00:09:33 2011 New Revision: 229049 URL: http://svn.freebsd.org/changeset/base/229049 Log: Use in-label sectorsize to determine position of the label when writing label into a file image. The most common use - putting disklabel into ISO file. Before this change the label would always go to the offset 512, while geom_part code expects it to be in the 1st sector (i.e. 2048 incase of ISO). BSD disklabels provide good and lightweight way to logically split livecds. It is non-intrusive as far as ISO9660 goes (both boot-wise and metadata-wise) and completely transparent to anything but BSD, so you can have BSD-specific area appended after regular ISO. And with a little bit of GEOM trickery you can do even more interesting stuff with it. For example we make "hybrid" bootable CDs using this method. We create bootable ISO with kernel and such and append UFS image compressed with UZIP and it works like a charm. We put label based on the offsef of the BSD part into the ISO. The kernel boots off normal ISO9660 part, tastes label attaches it, tastes UZIP, attaches it and finally mounts UFS using GEOM_LABEL. This provides much better way of eliminating waste than doing "crunched" build. MFC after: 1 month Modified: head/sbin/bsdlabel/bsdlabel.c Modified: head/sbin/bsdlabel/bsdlabel.c ============================================================================== --- head/sbin/bsdlabel/bsdlabel.c Sat Dec 31 00:03:13 2011 (r229048) +++ head/sbin/bsdlabel/bsdlabel.c Sat Dec 31 00:09:33 2011 (r229049) @@ -400,7 +400,7 @@ writelabel(void) for (i = 0; i < lab.d_npartitions; i++) if (lab.d_partitions[i].p_size) lab.d_partitions[i].p_offset += lba_offset; - bsd_disklabel_le_enc(bootarea + labeloffset + labelsoffset * secsize, + bsd_disklabel_le_enc(bootarea + labeloffset + labelsoffset * lab.d_secsize, lp); fd = open(specname, O_RDWR); @@ -434,7 +434,7 @@ writelabel(void) gctl_ro_param(grq, "class", -1, "BSD"); gctl_ro_param(grq, "geom", -1, pname); gctl_ro_param(grq, "label", 148+16*8, - bootarea + labeloffset + labelsoffset * secsize); + bootarea + labeloffset + labelsoffset * lab.d_secsize); errstr = gctl_issue(grq); if (errstr != NULL) { warnx("%s", errstr);