Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Feb 2004 17:57:13 +0100
From:      Stefan Bethke <stb@lassitu.de>
To:        cjclark@alum.mit.edu
Cc:        sparc64@freebsd.org
Subject:   Re: OT: Solaris Jumpstart from FreeBSD
Message-ID:  <00C23764-5FD8-11D8-AA39-000393496BE8@lassitu.de>
In-Reply-To: <20040116072040.GA99497@blossom.cjclark.org>
References:  <20040116072040.GA99497@blossom.cjclark.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail-1--227213988
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed

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 
server.

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
    Volume:
    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

HTH,
Stefan


--Apple-Mail-1--227213988
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	x-unix-mode=0644;
	name="prtdklabel.c.txt"
Content-Disposition: attachment;
	filename=prtdklabel.c.txt

/*
 * Print a Sun disklabel structure
 *
 */

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


int
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;
}


int
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", 
			i, 
			l.dkl_vtoc.v_part[i].p_tag, 
			l.dkl_vtoc.v_part[i].p_flag);
		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;
}

--Apple-Mail-1--227213988
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	format=flowed




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

--Apple-Mail-1--227213988--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00C23764-5FD8-11D8-AA39-000393496BE8>