File:  [NetBSD Developer Wiki] / wikisrc / guide / inst-media.mdwn
Revision 1.2: download - view: text, annotated - select for diffs
Thu Mar 21 11:11:21 2013 UTC (12 months, 4 weeks ago) by jdf
Branches: MAIN
CVS tags: HEAD
Add TOCs to all chapters.

**Contents**

[[!toc levels=3]]

# Building NetBSD installation media

## Creating custom install or boot floppies for your architecture e.g. i386

Sometimes you may want to create your own boot or install floppies for i386
instead of using the precompiled ones, or tailor the ones built by the NetBSD
build system. This section outlines the steps to do so.

The overall idea is to have a filesystem with some tools (sysinst, ls,
whatever), and embed this filesystem as some sort of ramdisk into a NetBSD
kernel. The kernel needs to include the `md` pseudo device to be able to hold a
ramdisk. The kernel with the ramdisk can then be put on removable media or made
available via the net (using NFS or TFTP).

To perform the following steps, you need to be running a kernel with the `vnd`
pseudo device enabled (this is the default for a GENERIC kernel).

 1. First, you must create a valid kernel to put on your floppies, e.g.
    INSTALL. This kernel must include the `md` pseudo device, which allows
    embedding a ramdisk. See [[Compiling the kernel|guide/kernel]] for kernel
	building instructions.

 2. The next step is to create the ramdisk that gets embedded into the kernel.
    The ramdisk contains a filesystem with whatever tools are needed, usually
	[init(8)](http://netbsd.gw.com/cgi-bin/man-cgi?init+8+NetBSD-5.0.1+i386) and
    some tools like sysinst,
	[ls(1)](http://netbsd.gw.com/cgi-bin/man-cgi?ls+1+NetBSD-5.0.1+i386), etc.
	To create the standard ramdisk, run `make` in the
    `src/distrib/i386/ramdisks/ramdisk-big` directory (for NetBSD 3.x:
    `src/distrib/i386/floppies/ramdisk-big`).

	This will create the `ramdisk.fs` file in the directory. If you want to
	customize the contents of the filesystem, customize the `list` file.

 3. Now, the ramdisk gets inserted into the kernel, producing a new kernel which
    includes the ramdisk, all in one file. To do so, change into the
    `src/distrib/i386/instkernel` directory (for NetBSD 3.x:
    `src/distrib/i386/floppies/instkernel`) and run `make`.

 4. The next step is to make one or more floppy images, depending on the size of
    the kernel (including the ramdisk). This is done by changing into
    `/usr/src/distrib/i386/floppies/bootfloppy-big`, and running `make` again.

	This will create one or two (depending on the size of kernel) files named
	`boot1.fs` and `boot2.fs`

 5. Last, transfer these files to the floppies with the commands

        # dd if=boot1.fs of=/dev/fd0a bs=36b
        # dd if=boot2.fs of=/dev/fd0a bs=36b

 6. Put the first floppy in the drive and power on!

## Creating a custom install or boot CD with build.sh

Creating custom install or boot CDs is easy with `build.sh`. The NetBSD base
system includes the
[makefs(8)](http://netbsd.gw.com/cgi-bin/man-cgi?makefs+8+NetBSD-current)
tool for creating filesystems. This tool is used to create iso-images. Creating
iso-images includes these tasks:

 1. Release build

        #./build.sh release

 2. CD-ROM iso-image build

        #./build.sh iso-image

The `build.sh` iso-image command will build a CD-ROM image in
`RELEASEDIR/MACHINE/installation`

**Warning**: For now not all architectures are supported. The mac/68k ports
doesn't boot for now.


CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb