Well what you need is an ARMv5 version of gcc 4.2.x (must be the same major/minor version used to compile the existing kernel, see /proc/version) and a copy of the linux kernel source from http://opensource.buffalo.jp/ls-x-165.html
Most people would need to setup a cross compiler, although since i have a very similar system (marvell sheevaplug), i was just able to use a native compiler on there. Thinking about it, you could also make a chroot on the nas device itself and use something like debootstrap or a gentoo stage3 tarball.
The buffalo kernel source comes with separate makefiles for different types of hardware, and copies of their kernel configs. I copied buffalo/configs/buffalo_nas_fw_88f6281.config to .config and ran menuconfig with the appropriate makefile (make -f Makefile.88f6281 menuconfig), i also had to edit the makefile to disable use or a cross compiler as i wasn't using one.
I then built the entire kernel (make -f Makefile.88f6281), and copied out the nfsd module and the other modules it depended on and put them on the NAS. In theory, my kernel should be almost identical to the stock one and it *should* be able to boot although i haven't tried that. After i familiarise myself with the recovery procedure i may well consider trying.