OpenWRT on the Netgear DG834G

Nov 30, 2005 / 0 comments

I spent too much time today reading MIPS disassembly of the ADAM2 bootload, as used on the Netgear DG834G. The problem is that the version used on the Netgear performs a checksum over most of the flash device on every boot. This makes the use of JFFS2, as done by OpenWRT, somewhat problematic. In an ideal world I'd try to compile up a newer, less restrictive version of ADAM2 but there's no JTAG on the Netgear that I've found and the thought of frying the bootloader and bricking the device wasn't appealing.

So what I've ended up doing is finding where the checksum is done and changing the branch instruction that aborts the boot to a nop. It's still scary, but it appears to do the job.

PLEASE NOTE THE BELOW COULD PERMANENTLY BREAK YOUR ROUTER

First, obtain your ADAM2 image. This is 128K and is mtd2 from the bootloader view. It should have an md5sum of 0530bfdf00ec155f4182afd70da028c1. If it doesn't, stop. The version I'm talking about is 0.18.01 as distributed by Netgear.

Assuming you have the right md5sum you want to go to offset 0x3944 where the 4 bytes should be 44 09 00 0C (representing a jal 0x90002510 during execution). Replace these 4 bytes with 0 (representing nop) and you should end up with a new image with an md5sum of d8a2f4623bf6f64b7427812f0e849aa7. You'll then need to do something like dd if=adam2-fix.bin of=/dev/mtdblock/2 on the device (I don't believe you'll be able to rewrite the bootloader from the bootloader for some reason...).

After that ADAM2 will still checksum the flash, but will continue to boot it after printing a checksum error message. This means you can go off and build yourself an OpenWRT AR7 based image and install it on your Netgear. Rock.

X session management

Nov 29, 2005 / 0 comments

I use evilwm as my window manager. I like it; I mainly end up with a whole bunch of xterms and only a handful of graphical apps (Firefox, Psi, xmms and GKrellM). evilwm's minimal decorations mean I can fit everything nicely on my screen without clutter, and the virtual desktops let me have various separated out bits (eg Firefox gets a full desktop to itself).

What I would like however is some form of session management. I'd like to be able to shutdown down my machine and when I restart it have my X setup look similar to when it was shut down, rather than having to start up a dozen apps and position them as I like them. I know I can do software suspend, but that doesn't cover kernel/library upgrades. I had a play with xsm, but although it could start up my xterms it didn't place them correctly. And didn't seem to restart Firefox, but I didn't poke that hard once I realised the xterms weren't getting placed.

Am I doing something wrong? Do I need some different window manager setup? I think I'd rather live with having to place stuff myself rather than pull in large amounts of GNOME. I've previously used Window Maker and Fluxbox for prolonged periods of time - can either of those do what I want better?

I was a brave boy at the dentist today

Nov 25, 2005 / 0 comments

My main fear in life is pain. I'm a wuss. Nowhere is this more obvious than when I'm at the dentist. I literally start shaking when I sit in the chair. While he's prodding around inside my mouth I can feel myself tense up more and more until I force myself to relax and then the process repeats. Being 6'1" I don't get a lot of people believing me when I tell them just how nervous the whole thing makes me.

Anyway. When I came to Norwich I managed to find a dentist who claimed to be suited to nervous patients. I went and didn't find them that good, but did make an appointment for my next checkup 6 months after my initial appointment. And then they cancelled it and I spent the next 3 years thinking I should really get round to sorting it out again and not doing so. Then several weeks ago I was having a conversation at an ALUG meeting with Becca and she recommended her dentist. So I decided I should give them a go and discovered that Phill also uses the same one and said they were good too.

I finally got around to going today (having filled out all the forms last week). The dentist was nice and friendly and took me on board about being shit scared. And said some consoling words about my teeth being in reasonable shape. I got away with a scale and polish (which I have to go back to get completed in a couple of weeks) and no mention of a drill anywhere. Rock. Now let's see if I can manage a regular checkup schedule. :)

Oh, it's the Guildhall Dental Practice at 9 Upper Goat Lane, Norwich if anyone else is looking. 01603 760032.

Network installing FreeBSD

Nov 24, 2005 / 0 comments

So, Black Cat Networks have a bunch of nice dedicated servers and I've been working on various network installs for them. Debian was of course easy; there's a nice netboot.tar.gz that has everything you need (including configs for serial consoles).

Fedora Core was a bit harder; there's mention about network boots and installs, but not a lot of docs. A pxelinux entry like:

label fedora
	kernel fc4/vmlinuz
	append initrd=fc4/initrd.img ramdisk_size=8192 console=ttyS0,9600n8 serial

does the right thing, with vmlinuz and initrd.img coming from http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/images/pxeboot/. Fedora's a bit annoying in that it doesn't offer you a selection of mirrors to network install from though, so you need to have worked that out for the install.

FreeBSD however, was much harder. Firstly, there aren't any decent docs about it that I could find. Secondly, it really wants to use NFS, even though TFTP will be required anyway for the PXE boot stage.

So, I ended up recompiling the pxeboot loader with LOADER_TFTP_SUPPORT enabled and LOADER_NFS_SUPPORT removed (though it still tries to do NFS mounts it seems). Of course, you can't do this under Linux easily. Nor can you do it on FreeBSD 4.10 it seems (I was recompiling the FreeBSD 6 loader). However you can on FreeBSD 5.4. You need the lib and sys source trees to do so. Or you can have my prebuilt copy, freebsd.0.

pxelinux config looks like:

label freebsd
	kernel boot/freebsd.0

assuming you put it in a boot subdirectory under your tftpboot root dir. You then need http://ftp.uk.freebsd.org/pub/FreeBSD/releases/i386/ISO-IMAGES/6.0/6.0-RELEASE-i386-bootonly.iso to get the rest of the /boot contents from. Burn it to CD or loopback mount it or work whatever magic does the trick for you to get access to the files in that image. Then copy all of /boot on it to boot in your tftproot. You don't actually need boot*, cdboot, loader or pxeboot, but they're all small files. Then, add the following to loader.conf:

boot_serial="YES"
console="comconsole"
kernel_options="-h"
vfs.root.mountfrom="ufs:/dev/md0c"

So, now you can type "freebsd" at your pxelinux boot prompt and it'll boot up the installer. Rock. I don't quite understand why I had to include the kernel_options line above - I thought setting boot_serial would do that for me. However, it works. With the only real pain being having to recompile pxeboot and the lack of docs. Which I've now sorted for you. ;)

Spamcop Kill Kittens.

Nov 16, 2005 / 0 comments

Dear SpamCop, Please die in a large chemical fire. Don't fucking expect me, as postmaster of a secondary MX, to read every single bounce that comes from it rather than just sending a bounce message. And try educating your lusers (and truely, some of them are lusers) about how to unsubscribe from lists rather than deciding to report them as spam. And while I'm not keen on marketing email, some of it is legitimate and has working opt out systems. Just because you missed the opt out box doesn't make it spam and doesn't mean the way to deal with it is to report it as such.

Gah. I like to think that SpamCop's heart in the right place, but it doesn't avoid the fact that I spend more time dealing with fuckwitted reports from them than I do with spam (because I do actually take the reports seriously as sometimes there's truth in them). Outblaze's FBL is the only other thing that comes close in terms of the sheer stupidity of the reporters.

SpamCop; Just Say No.

subscribe via RSS