Subject: one stop towards install CDs
To: None <tech-install@NetBSD.org>
From: Hubert Feyrer <hubert@feyrer.de>
List: tech-install
Date: 02/10/2006 03:57:25
Background on how our i386 install floppies work:
 	1) a kernel is made that reserves space for a ramdisk
 	2) a ramdisk is built (src/distrib/i386/floppy/ramdisk-*)
 	3) the ramdisk is inserted into the kernel
            (src/distrib/i386/floppy/instkernel)
 	4) a floppy or floppy-set is made from the kernel with the ramdisk
    	   (src/distrib/i386/floppy/bootfloppy*)
 	   bootfloppy-big is special, as it's a 2.88MB floppy used to
 	   create ISOs with emulate-floppy-boot.

So far, creating a boot CD/ISO was a manual process using the 2.88MB 
boot-big.fs from 4) with bootfloppy-big.

Now that we have a working 'makefs -t cd9660', things can be done slightly 
different:

 	1) to 3) remain unchanged; the idea here is that the boot floppy
 	         can be removed from the drive after loading the kernel
                  with the ramdisk; Keeping things outside a ramdisk like
                  we do on harddisks is left untouched here & now.
   	4') We can use makefs -t cd9660 and bootxx_cd9660 to create a
  	    ISO that boots a kernel of ~any size (that fits into RAM).

As a by-product of the next g4u release, I've came up with a small 
framework to do 4'). It's only a first attempt, but it works for me, and 
I'd appreciate if people could pick this up and go from there.

To test:
  * grab http://www.feyrer.de/Misc/bootcd.tgz and
  * unpack it in src/distrib/i386/floppy
  * build.sh release <- this is to make all the kernels and ramdisk-* and
    whatnot, basically 1) to 3) above
  * Now we have built an INSTALL kernel, tools, bootxx_cd9660 and
    .../instkernel/obj*/netbsd-INSTALL.gz with embedded
    .../ramdiskbig/obj*/ramdisk-big.fs (mapping of what ramdisk is put into
    which kernel is in .../instkernel/Makefile)
  * Last, we can make the ISO:
    cd src/distrib/i386/floppy/bootcd
    make obj
    make
  * Test:
    ls -l obj*
    qemu -cdrom boot.iso

Long term, it may make sense to move the Makefile.bootcd to some place 
like src/distrib/common so e.g. i386 and amd64 can share the code, and as 
we end up with floppy dirs, ISO/CD dirs, RAMDISK dirs and whatnot in 
src/distrib/i386/floppy, I think it makes sense to move the whole mess in
src/distrib/i386/floppy/* one level up to src/distrib/i386.

Comments?


  - Hubert