[ previous ] [ next ] [ threads ]
 From:  "Chad R. Larson" <clarson at eldocomp dot com>
 To:  "Christopher M. Iarocci" <iarocci at eastendsc dot com>, "m0n0wall at wenck dot com dot au" <m0n0wall at wenck dot com dot au>, "m0n0wall at lists dot m0n0 dot ch" <m0n0wall at lists dot m0n0 dot ch>
 Cc:  William Bloom <wbloom at eldocomp dot com>
 Subject:  Re: [m0n0wall] making changes
 Date:  Fri, 21 Nov 2003 23:35:16 -0700
At 05:48 PM 11/20/2003, Christopher M. Iarocci wrote:
>Is this so hard to implement?  I can't say I'm a programmer, and I 
>wouldn't presume to say I know how to do this, but if it isn't too hard, 
>I'd vote for it to be implemented in the next release.

I don't know how Manuel is allocating his time.  I think m0n0wall is sort 
of a hobby for him.  In other words, he's got a real job.

The hard part of making it configurable will be the PHP programming to add 
an option menu to the setup screen, and save the change in the config file, 
and fixup the XML parser to do something useful with it.

But it is relatively easy for you to jam some other value.  You =will= want 
a running FreeBSD system somewhere.  You'll either want to have build vnode 
support into the kernel ("pseudo-device vn") or load it ("kldload vn").

If you are planning to manipulate the CD-ROM version, you'll want to have 
the "mkisofs" package installed and copies of the floppy boot images from 
your FreeBSD installation.

Which configuration are you running?  The generic-pc, probably.  I'm 
running the net4501 image, and have a diskless PC that boots from CD-ROM 
for demo's to other folks around here.

The idea is pretty much the same.  Get the disk image, modify it, put it back.

We will assume you are running the generic PC, and booting from a CD, since 
that is the most complicated (dealing with ISO images) and perhaps in the 
most wide-spread use.  When following the steps below, be careful of 
mail-induced line wraps, especially if you're doing cut and paste.

Make a work place:
   $ mkdir /usr/local/src/m0n0wall
   $ cd /usr/local/src/m0n0wall

Get the ISO image (pick your own mirror):
   $ fetch http://m0n0wall.realshady.net/download/m0n0wall/cdrom-pb19r536.iso

Make sure you got it ok:
   $ md5 cdrom-pb19r536.iso
   MD5 (cdrom-pb19r536.iso) = 456b3aca7f33903a3bbee09fe4e96848

Configure a vnode (makes a file look like a device):
   # vnconfig -c vn0 ./cdrom-pb19r536.iso

Attach the downloaded image to the filesystem:
   # mount -t cd9660 /dev/vn0 /mnt

Retrieve the contents of the bootable image:
   $ mkdir ISO
   $ cp -r /mnt/* /usr/local/src/m0n0wall/ISO

Now we're done with the downloaded ISO image:
   # umount /mnt
   # vnconfig -u vn0

Get ready to manipulate the root filesystem
   $ cp ./ISO/mfsroot.gz .
   $ gunzip mfsroot

Attach the roof filesystem to host filesystem:
   # vnconfig -c vn0 ./mfsroot
   # mkdir root
   # mount -t ufs /dev/vn0 root

Navigate to the DHCP template file:
   $ cd /usr/local/src/m0n0wall/root/etc/inc

Edit the value (2 hour default lease, 1 day max):
   # cp services.inc junk
   # sed -e '/default-lease/s/600/7200/' -e '/max-lease/s/7200/86400/' < 
junk > services.inc
   # rm junk

Now unravel the mounts:
   # cd /usr/local/src/m0n0wall
   # umount root
   # rmdir root
   # vnconfig -u vn0

Put your newly changed root filesystem back into the tree:
   # gzip mfsroot
   # cp mfsroot.gz ./ISO

Now, here's a bit of ugly mystery.  The CD-ROM booter wants to find the BTX 
loader at "/BOOT/LOADER", but the "/BOOT/LOADER.RC" file calls out loading 
"/kernel.gz".  If we make a true ISO 9660 filesystem, all the file names 
will be upper cased, and then the LOADER.RC will be wrong.  But if we relax 
the ISO 9660 rules and allow lower case file names, then the booter won't 
find the BTX interpreter.  Perhaps Manuel would like to show us his 
"mkisofs" command line.  In the mean time, we're going to change the case 
of the path to the loader.
   # cd ./ISO
   # mkdir BOOT
   # cp boot/loader BOOT/LOADER
   # cd /usr/local/src/m0n0wall

Almost done, gotta recreate the ISO image:
   # mkisofs -d -allow-lowercase -b bootcdboot -no-emul-boot -c 
boot/boot.catalog -A pb19r536a -o cdrom-pb19r536a.iso ./ISO

And there you are!  Use your favorite tool (cdrecord?  Nero?) to burn the 
new image.  And, put your work where someone else can take advantage of 
it.  :-)



This message is intended for the sole use of the individual and entity to whom it is addressed, and
may contain information that is privileged, confidential and exempt from disclosure under applicable
law. If you are not the intended addressee, nor authorized to receive for the intended addressee,
you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or
any information contained in the message. If you have received this message in error, please
immediately advise the sender by reply email, and delete the message. Thank you.