OT: Solaris Jumpstart from FreeBSD

Stefan Bethke stb at lassitu.de
Sun Feb 15 08:57:19 PST 2004

Am 16.01.2004 um 08:20 schrieb Crist J. Clark:

> Before I hack away at the Solaris Jumpstart tools to get them to run
> on FreeBSD, I was wondering if anyone here has done or can provide a
> pointer to someone who has already done this and is willing to share
> scripts, patches, etc.
> Sorry for being off topic, but I figured if any FreeBSD community knew
> of something like this, this one would.

I always wanted to do that, but never found the time to fully set up a 

One problem that I did need to solve: extract the data from a install 
cd image. The standard Solaris CDs have one ISO in the usual location, 
but are also labelled and have UFS filesystems on them, which are 
neccessary for booting. The attached little tool will print out block 
numbers from the image so that one can extract the filesystems with dd. 
Sample output:

$ ./prtdklabel </Backup/iso/sol-9-u3-sparc-v1.iso
Label:     CD-ROM Disc for SunOS Solaris Installation
Cylinders: 2048
Heads:     1
Sectors:   640
VTOC version:    1
    Partitions:  8
    Partition #0: Tag: 0x0004, Flag: 0x0010
        Cyls:               0,          951
        Blocks:             0,       608640
    Partition #1: Tag: 0x0002, Flag: 0x0010
        Cyls:             951,          928
        Blocks:        608640,       593920
    Partition #2: Tag: 0x0000, Flag: 0x0000
        Cyls:            1879,            8
        Blocks:       1202560,         5120
    Partition #3: Tag: 0x0000, Flag: 0x0000
        Cyls:            1887,            8
        Blocks:       1207680,         5120
    Partition #4: Tag: 0x0000, Flag: 0x0000
        Cyls:            1895,            8
        Blocks:       1212800,         5120
    Partition #5: Tag: 0x0000, Flag: 0x0000
        Cyls:            1903,            8
        Blocks:       1217920,         5120
    Partition #6: Tag: 0x0000, Flag: 0x0000
        Cyls:               0,            0
        Blocks:             0,            0
    Partition #7: Tag: 0x0000, Flag: 0x0000
        Cyls:               0,            0
        Blocks:             0,            0


-------------- next part --------------
 * Print a Sun disklabel structure

#include <sys/types.h>
#include <sys/dklabel.h>
#include <stdio.h>

compute_cksum(struct dk_label *l)
	uint16_t *lb = (uint16_t *)l;
	int i;
	uint16_t cksum = 0;
	for (i=sizeof(*l)/sizeof(*lb); i; i--) {
		cksum ^= *lb++;
	return cksum;

main(int argc, char*argv[])
	struct dk_label l;
	int i;
	int bpc;
	read(0, &l, sizeof(l));
	if (l.dkl_magic != DKL_MAGIC) {
		printf("Invalid magic %x, not a disk label.\n", l.dkl_magic);
		return 1;
	if (compute_cksum(&l) != 0) {
		printf("Correct magic, but incorrect checksum, invalid disk label.\n");
		return 1;
	bpc = l.dkl_nsect*l.dkl_nhead;
	printf("Label:     %-.*s\n", LEN_DKL_ASCII, l.dkl_asciilabel);
	printf("Cylinders: %d\n", l.dkl_ncyl);
	printf("Heads:     %d\n", l.dkl_nhead);
	printf("Sectors:   %d\n", l.dkl_nsect);
	printf("VTOC version:    %d\n", l.dkl_vtoc.v_version);
	printf("    Partitions:  %d\n", l.dkl_vtoc.v_nparts);
	printf("    Volume:      %-.*s\n", LEN_DKL_VVOL, l.dkl_vtoc.v_volume);
	for (i=0; i<l.dkl_vtoc.v_nparts; i++) {
		printf("    Partition #%d: Tag: 0x%04x, Flag: 0x%04x\n", 
		printf("        Cyls:    %12d, %12d\n", l.dkl_map[i].dkl_cylno, l.dkl_map[i].dkl_nblk/bpc);
		printf("        Blocks:  %12d, %12d\n", l.dkl_map[i].dkl_cylno*bpc, l.dkl_map[i].dkl_nblk);
	return 0;
-------------- next part --------------

Stefan Bethke <stb at lassitu.de>   Fon +49 170 346 0140

More information about the freebsd-sparc64 mailing list