Créer un CDROM d'installation bootable

Auteur : Olivier BOYER - oboyer () ajoute ! org

Mots clés

OpenBSD, installation, media, cdrom, bootable


OpenBSD n'a ni sponsor important, ni organisation commerciale réelle.

Et pourtant, développer, maintenir un tel projet nécessite des fonds, et OpenBSD en manque. C'est pourquoi OpenBSD ne livre pas d'images ISO d'installation [note: depuis la version 4.2, l'image installXY.iso est fournie]. Ses développeurs conseillent d'acheter les CDROM pour financer le projet, ou de faire une donation en argent, ou en matériel. Par votre contribution vous augmentez les chances de voir de futures versions d'OpenBSD.

La procédure suivante s'exécute sur un OpenBSD, et s'applique à un OpenBSD 3.4 pour une architecture Intel i386, mais elle devrait être la même pour n'importe qu'elle version. Pour une autre architecture matérielle, remplacez i386 par votre architecture.

Préparer l'arborescence

Exécutez les commandes suivantes :

$ mkdir -p /tmp/openbsd/3.4/i386
$ cd /tmp/openbsd/3.4/i386

Télécharger les sets d'installation et les sources

Exécutez les commandes suivantes :

$ cd /tmp/openbsd/3.4/i386
$ ncftpget -T*
$ cd /tmp/openbsd/3.4
$ ncftpget
$ ncftpget
$ ncftpget
$ ncftpget

Générer l'image ISO

Exécutez les commandes suivantes :

$ cd /tmp/openbsd
$ export REL="3.4"
$ mkisofs -v -l -r -T -J -L \
	-V "OpenBSD ${REL} Release" \
	-b ${REL}/i386/cdrom$(echo $REL|tr -d '.').fs \
	-c boot.catalog \
	-o /tmp/image.iso \

ATTENTION : Le fichier de boot est relatif à la racine de l'image ISO

Tester l'image ISO

Monter l'image ISO

Pour tester le contenu de l'image ISO, il faut la monter. Procédez comme suit :

$ sudo vnconfig svnd0 /tmp/image.iso
$ sudo mount -t cd9660 /dev/svnd0c /mnt

Démonter l'image ISO

Procédez comme suit :

$ sudo umount /mnt
$ sudo vnconfig -u svnd0

Graver l'image ISO

Trouver l'adresse SCSI du graveur

Procédez comme suit :

$ sudo cdrecord -scanbus
	1,3,0   103) 'PLEXTOR ' 'CD-R   PX-W4012S' '1.01' Removable CD-ROM

Graver l'image ISO

Procédez comme suit :

$ sudo cdrecord -v -eject speed=4 dev=1,3,0 -data /tmp/image.iso

Supprimer les sets d'installation

Maintenant que l'image ISO est gravée, pensez à supprimer les sets d'installation et l'image générée.

$ rm -Rf /tmp/openbsd
$ rm -f /tmp/image.iso


Le script

Un script pas propre, sans prétentions, … ni tests d'erreurs.

# A simple and durty script to :
# download OpenBSD Release files, and generate an iso image"
# Olivier BOYER - oct 2006

export OB_ARCH='i386'
export OB_VERSION='3.9'

export OB_MIRROR=''
export OB_PATH='pub/OpenBSD'

export TMPDIR='/tmp'
export TMPPATH="${TMPDIR}/openbsd"

export PATH="/bin:/usr/bin:/usr/local/bin"

echo "create OpenBSD ${OB_VERSION}/${OB_ARCH} Release path"
mkdir -p ${TMPPATH}/${OB_VERSION}/${OB_ARCH} || exit 1
cd ${TMPPATH}/${OB_VERSION}/${OB_ARCH} || exit 1

echo "download OpenBSD ${OB_VERSION}/${OB_ARCH} files"
ncftpget -T ${OB_RELEASE}/${OB_ARCH}/*
cd ${TMPPATH}/${OB_VERSION} || exit 1
ncftpget ${OB_RELEASE}/ports.tar.gz
ncftpget ${OB_RELEASE}/src.tar.gz
ncftpget ${OB_RELEASE}/sys.tar.gz

echo "generate OpenBSD ${OB_VERSION}/${OB_ARCH} iso file"
cd ${TMPPATH} || exit 1
mkisofs -v -l -r -T -J -L \
   -V "OpenBSD ${OB_VERSION} Release" \
   -b ${OB_VERSION}/${OB_ARCH}/cdrom$(echo $OB_VERSION|tr -d '.').fs \
   -c boot.catalog \
   -o ${TMPDIR}/openbsd-${OB_VERSION}-${OB_ARCH}.iso \

echo ""
echo "archive created"
echo ""
echo " to brun this archive, do the following :"
echo " $ sudo cdrecord -scanbus 2>&1 |grep "Removable CD-ROM"
echo "     1,3,0   103) 'PLEXTOR ' 'CD-R  PX-W4012S' '1.01' Removable CD-ROM"
echo " $ sudo cdrecord -v -eject speed=4 dev=1,3,0 -data /tmp/image.iso"

exit 0

Détails de la commande mkisofs

mkisofs format :
	mkisofs [options] -o <filename> </path/to/data>

mkisofs options :
	-V <volid>
		Specifies the volume ID (volume name or  label)  to  be
		written into the master block.  This parameter can also
		be set in the file .mkisofsrc with VOLI=id.

		Verbose execution.

	-o <filename>
		is the name of the file to which the iso9660 filesystem
		image  should  be  written.

	-b <eltorito_boot_image>
		Specifies the path and filename of the boot image to be
		used  when making an "El Torito" bootable CD. The path-
		name must be relative to the source path  specified  to
		mkisofs. This option is required to make an "El Torito"
		bootable CD.  The boot image must be exactly  the  size
		of  either  a  1.2,  1.44,  or  a  2.88 meg floppy

	-c <boot_catalog>
		Specifies the path and filename of the boot catalog  to
		be  used  when  making  an "El Torito" bootable CD. The
		pathname must be relative to the source path  specified
		to  mkisofs. This option is required to make a bootable
		CD.  This file will be inserted into  the  output  tree
		and  not  created  in the source filesystem, so be sure
		the specified filename does not conflict with an exist-
		ing  file,  as it will be excluded. Usually a name like
		"boot.catalog" is chosen.

		Generate SUSP and RR records using the Rock Ridge  pro-
		tocol  to  further  describe  the  files on the iso9660

		This is like the -R  option,  but  file  ownership  and
		modes  are  set to more useful values.  The uid and gid
		are set to zero, because they are usually  only  useful
		on  the  author's system, and not useful to the client.

		Generate a file TRANS.TBL  in  each  directory  on  the
		CDROM, which can be used on non-Rock Ridge capable sys-
		tems to help establish the correct file  names.

		Generate Joliet directory records in addition to  regu-
		lar  iso9660 file names.  This is primarily useful when
		the discs are to be used on  Windows-NT  or  Windows-95
		machines.    The  Joliet  filenames  are  specified  in
		Unicode and each path component can be up to 64 Unicode
		characters  long.   Note  that  Joliet is no standard -
		CD's that use only Joliet extensions  but  no  standard
		Rock  Ridge  extensions  may  usually  only  be used on
		Microsoft Win32 systems.
		Allow  full  31  character  filenames.   Normally   the
		ISO9660 filename will be in an 8.3 format which is com-
		patible with MS-DOS, even though the  ISO9660  standard
		allows  filenames  of  up to 31 characters. 
		Use with caution.

		Allow filenames to begin with  a  period.   Usually,  a
		leading  dot is replaced with an underscore in order to
		maintain MS-DOS compatibility.
doc/openbsd/install_cdrom.txt · Dernière modification: 2009/12/23 22:36 (édition externe)     Haut de page