[ previous ] [ next ] [ threads ]
 From:  "Morten Paulsen" <mup at paulsen dot tv>
 To:  <m0n0wall at lists dot m0n0 dot ch>
 Subject:  regarding NON-WiFI pccards old post from Joey Morin
 Date:  Thu, 2 Dec 2004 01:22:03 +0100
I looked at your post from Sun, 13 Jun 2004 00:23:05 -0400 (EDT) 

And was just wondering if you got it to work and how?
I can figure out how to do it.

Tanks in advanced.

Org. post

> ok.  i've gone down a dozen blind alleys and dead ends.  i finally,
> *FINALLY* managed to get a modified version of pccard.conf into
> generic-pc-1.1b12.img.  for those of you curious how, see the end of
> this email.
> ...
> ---------begin-ugly-dirty-tricks-----------
> ... <ugly dirty tricks ommitted to protect the young> ...
> ---------end-ugly-dirty-tricks-----------

nothing like the triumph of hard work over common sense.  i forwarded my
brother my little journal of this crazy endeavour and he called me up to
say, simply, "U-GLY."

he then fiddled a bit and sent an email telling me what he would have
done.  he speaks much better linux than i do.  here's (most of) his

As I said on the phone, I realized I could play w/ m0n0wall using
Here's what I did:

- grabbed generic-pc-1.0.img
- created VMware profile for 64MB machine w/ 20MB HD
- too lazy to go upstairs & get my INSERT CD, and the WWW site was down,
  so I grabbed the ISO from work
- told VMware to use the ISO as a CDROM
- booted VMware from the virtual CDROM
                      - it got an address via DHCP from my inexQ router
- used scp to copy generic-pc-1.0.img from my Linux host OS to /ramdisk
- gunzip'ed & dd'ed to my virtual HD

While still running INSERT, I decided to try mounting the HD filesystem.
Got it working after a few tries:

                      mount -o ro -t ufs -o ufstype=44bsd /dev/hda4

At first I had tried /dev/hda1 (didn't work), so I thought that there
no partitions (so I just mounted the whole HD), but then I noticed that
Manuel had used partition hda4.

Copied mfsroot.gz to /ramdisk & gunzip'ed.  "file mfsroot" shows:
                      mfsroot: Unix Fast File system (little-endian),
last mounted on
                      /mnt3, last written at Sun Feb 15 05:09:52 2004,
clean flag 1,
                      number of blocks 10240, number of data blocks
9887, number of
                      cylinder groups 1, block size 8192, fragment size
1024, minimum
                      percentage of free blocks 0, rotational delay 0ms,
                      rotational speed 60rps, SPACE optimization

Was able to mount it like so:
                      mount -o ro,loop -t ufs -o ufstype=44bsd mfsroot

so, for those who care, i've written a script allowing you to modify
generic-pc-1.0.img, or any other build.  used it to replace pccard.conf,
and to change /usr/local/www/fbegin.inc to include the following line:

                      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="exec.php"
                      class="navlnk">Execute command</a><br>

just before the "Reboot" option under "Diagnostics."  i know it was
ommitted for "security through obscurity" reasons, but i'm lazy, and
had to use exec.php so much lately to troubleshoot my many woes.  i will
probably use this script it to make other mods.  not having a freebsd
at my disposal, and not having a developers ken, this is the best
for me.  i'm not likely to delve into any kernel hacking, anyway...

the script was written for my slackware 7.1 box.  i'm sure it will
require some writing for a freebsd box.  it takes one argument, the
name of the image you want to modify.  here it is:

#!/bin/sh -

[ -e $1 ] || ! echo ERROR: \ file does not exist or no file specified ||
! echo \ \ \ \ \ \ \ \ Must specify an existing regular file || exit



mkdir --verbose $tmpdir/
mkdir --verbose $mntdir1/
mkdir --verbose $mntdir2/

echo Uncompressing $1 ...
gunzip -v < $1 > $tmpdir/$1.bin
echo Mounting ad0a ...
mount -v -o loop -t ufs -o ufstype=44bsd $tmpdir/$1.bin $mntdir1

echo Uncompressing mfsroot.gz ...
gunzip -v < $mntdir1/mfsroot.gz > $tmpdir/mfsroot
echo Mounting mfsroot ...
mount -v -o loop -t ufs -o ufstype=44bsd $tmpdir/mfsroot $mntdir2
echo Dropping into m0n0wall root filesystem, $mntdir2/
echo /dev/ad0a is $mntdir1/
echo Go crazy!  Type exit when done, and a new image will be built.
pushd $mntdir2

$shellcmd -

echo Unmounting mfsroot ...
umount -v $mntdir2
echo Compressing mfsroot ...
gzip -9v $tmpdir/mfsroot
echo Replacing mfsroot ...
mv -v $tmpdir/mfsroot.gz $mntdir1/
echo Unmounting ad0a ...
umount -v $mntdir1
echo Compressing  new image ...
gzip -9v < $tmpdir/$1.bin > $1.new
echo Cleaning up ...
rm -r -f -v $tmpdir/

echo Built $1.new

note that my mail client wraps long lines on outgoing mail, so you won't
be able to just cut-and-paste without re-joining long lines.  if anyone
wants a .gz of it, lemme know and i'll send it off-list.  i'd have
included it here, but the list etiquette discourages it.

oh yeah, and you'll need root, or at least mount rights.  this is a very
quick hack.  use at your own risk.  i hope it's useful.


p.s. i'll have more news re: my pcmcia woes soon.