diff options
author | sobomax <sobomax@FreeBSD.org> | 2011-12-31 00:09:33 +0000 |
---|---|---|
committer | sobomax <sobomax@FreeBSD.org> | 2011-12-31 00:09:33 +0000 |
commit | 3592175cf3af629b95ae03a65548de30a3662e3d (patch) | |
tree | 51f4117a2870ea35cfc767f78f1fa47a23c64293 /sbin/bsdlabel | |
parent | 6fc82bacd8ce4fd640b0bedb438ca948cb86b303 (diff) | |
download | FreeBSD-src-3592175cf3af629b95ae03a65548de30a3662e3d.zip FreeBSD-src-3592175cf3af629b95ae03a65548de30a3662e3d.tar.gz |
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
Diffstat (limited to 'sbin/bsdlabel')
-rw-r--r-- | sbin/bsdlabel/bsdlabel.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index 7be9db2..2dcffd0 100644 --- a/sbin/bsdlabel/bsdlabel.c +++ b/sbin/bsdlabel/bsdlabel.c @@ -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); |