Subject: Re: Booting multiuser from floppy.
To: None <tech-kern@netbsd.org>
From: James Chacon <jchacon@genuity.net>
List: tech-kern
Date: 08/27/2000 18:12:09
I remember Jordan talking at the open source conference about FreeBSD going
this route as a default offering. i.e. a floppy image you could take with
you (say when you're visiting parents) that would do ethernet/ppp/ssh. Enough
to get on the net in some way securely without having to modify the host
system.

This seems about 80% of the way there. Is there any reason a floppy image
like this shouldn't just get added into the distrib tree so folks could do this
exact thing without having to roll their own? Granted it's mostly only a win 
on x86 for the reasons above but even on other systems it can be handy.

James


>On Thu, 17 Aug 2000, Roger Brooks wrote:
>
>>I have managed to build an md system on a single floppy which boots
>>multi-user.  I did this early this year when our Novell servers went
>>belly-up and I thought I'd see if I could make a bootable multi-session
>>telnet disk.  I managed to build a kernel with 8 virtual consoles (pcvt).
>>It didn't automatically come up multi-user, although this turned out to
>>be an advantage, as I needed to log in as root anyway to set the IP address
>>to that of the PC I was using.  I forget exactly what I had to do to get
>>everything working, but one thing which did cause problems was that
>>the getpwXXX() routines in the minimal libc didn't grok encrypted passwords
>>properly.  AFAIR it didn't know about /etc/master.passwd, but then
>>I don't expect that anyone has needed encrypted passwords on a floppy
>>system before.  I can check the details tonight.
>
>
>Building a Modified Bootfloppy
>==============================
>
>This is the procedure which I followed to build a multiuser system
>with telnet on a single floppy under NetBSD 1.4 (i386).  I'm assuming
>you will be using a stripped-down kernel to save space.  My kernel
>was intended to run telnet over an ethernet link, and allow access
>to floppies (FAT or FFS) and NFS.  I'm reconstructing something which
>I did in a couple of evenings about 6 months ago, so the following
>instructions may have a few holes...
>
>
>1.      cd /usr/src/sys/arch/i386/conf
>
>    Create a new kernel config file (mine is called TELNET).  I started with
>    the INSTALL config, and took out CD9660, EXT2FS and all the SCSI, wdc,
>    pciide and serial port drivers.  I also took out everything EISA-related,
>    (as I knew we didn't have any EISA machines) and DDB.  I added entries for
>    PCVT (you'd have to use wscons in current), and apart from that the only
>    device drivers I was left with were fdc and most of the ethernet controllers.
>
>    You'll very likely have to iterate this procedure when either (a) you
>    run out of space and have to remove something else, or (b) you have room
>    to spare on the floppy and decide to add device drivers.
>
>2.      config TELNET
>
>        cd ../compile/TELNET
>
>        make depend && make
>
>    As you have committed major butchery on the config file, it may take a
>    few tries before the kernel compiles
>
>
>3.      cd /usr/src/distrib/i386/floppies
>
>        mkdir telnetfloppy
>
>        cp bootfloppy-common/list telnetfloppy
>
>    You now need to create a telnetfloppy/Makefile.
>
>        cp bootfloppy/Makefile telnetfloppy/Makefile    
>
>    Now edit telnetfloppy/Makefile, and replace the line
>
>        .include "${TOP}/bootfloppy-common/Makefile.inc"
>
>    by a copy of the included file.  Next, modify the following records
>    in the merged Makefile:
>
>        KERN?=  ${.CURDIR}/../../../../sys/arch/i386/compile/TELNET/netbsd
>
>        COMMONDIR=    ${TOP}/telnetfloppy
>
>        RAMDISK       !=cd $(.CURDIR)/../ramdisk-telnet/; \
>                printf "xxx: .MAKE\n\t@echo \$${.OBJDIR}/ramdisk-telnet.fs\n" | \
>
>
>4.  (Still in /usr/src/distrib/i386/floppies)
>
>        mkdir ramdisk-telnet
>
>        (cd ramdisk && tar cf - .) | (cd ramdisk-telnet && tar xvfpB -)
>
>        cd ramdisk-telnet
>
>        make clean
>
>    Edit Makefile, to modify the record
>
>        IMAGE=                ramdisk-telnet.fs
>
>
>    You will also need to modify the AUXDEPENDS= record as you go on.
>
>    The contents of the ramdisk are controlled by three other files:
>
>        mtree.conf          (used by mtree to build ramdisk directory tree)
>        ramdiskbin.conf     (controls what goes into the crunched binary)
>        list                (controls links to crunched binary and other
>                             file on ramdisk).
>
>
>    You will need to hack ramdiskbin.conf and list to suit what you intend
>    to put in the ramdisk.  You will notice that init is built from
>    distrib/utils/init_s -- comment out (or remove) this line and add init
>    to one of the "progs" lines (this will build a fully-functional init
>    into the crunched binary).  Of course you will need to remove
>    sysinst and the other install stuff.
>
>    You will probably need different (compared to /usr/src/etc) versions of
>    some /etc files, so create /usr/src/distrib/i386/ramdisk-telnet/etc and
>    put them there (I needed  gettytab profile ttys and master.passwd), then
>    modify list accordingly  -- if you don't modify list, it won't go onto the
>    ramdisk.  Modify the definition of AUX_DEPENDS in Makefile to
>    reflect these changes (and get rid of anything related to the
>    install procedure which you've removed).
>
>5.  (Still in /usr/src/distrib/i386/floppies/ramdisk-telnet)
>
>        make
>
>        cd ../telnetfloppy
>
>        make
>
>        dd if=boot.fs of=/dev/rfd0b
>
>6.  If the ramdisk/kernel is too big (or you have lots of free space!),
>    go back to step 4 and modify ramdiskbin.conf, or go back to step 1
>    and modify the kernel config.   Iterate until everything fits (or
>    you give up in frustration!)
>
>
>Some of the commands on the install ramdisk are slimmed-down versions,
>with the sources in /usr2/src/distrib/utils.  The crunched binary is
>linked against libhack.o (from sources in /usr2/src/distrib/utils/libhack).
>The main problem which I found was that the version of getpwXXX in
>libhack expects encrypted passwords to be in /etc/passwd
>(not /etc/master.passwd).
>
>
>Apart from the problem with passwd, I didn't find out how to get the
>system to come up multi-user straight away.  But someone else has
>described how to fix this (no wonder I couldn't find it -- in a bloody
>device driver!).  However, this was something of a blessing in diguise,
>as owing to the passwd problem I wouldn't otherwise have been able to
>log in a root to set the IP address and default router.  The passwd
>file had another user "telnet" with a null password, and when I exited
>the single-user shell I was gratified to see 8 login prompts come up on
>8 PCVT consoles!
>
>I've just checked the floppy image, and this configuration (no local
>disks apart from the floppy), but with ftp and telnet has 423 KB free
>space, so I could get quite a bit more stuff on the floppy.  Of course
>this *is* 1.4, not current.
>
>
>
>Roger
>
>------------------------------------------------------------------------------
>Roger Brooks (Systems Programmer),          |  Email: R.S.Brooks@liv.ac.uk
>Computing Services Dept,                    |  Tel:   +44 151 794 4441
>The University of Liverpool,                |  Fax:   +44 151 794 4442
>PO Box 147, Liverpool L69 3BX, UK           | 
>------------------------------------------------------------------------------
>
>
>
>
>