How to rebuild the Untangle kernel

From UntangleWiki
Revision as of 14:08, 18 July 2014 by Rcox (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NOTE: This is not supported or verified by Untangle. We can not guarantee or support any system that uses this method to rebuild the Untangle Kernel. Also, be sure to comment out the standard Debian sources and run apt-get update as soon as you're done. The current version is v9 and these instructions have not been recently verified.

The following guide is for Untangle 7 (it should work for the 6.x series too, and later versions too just with a change of kernel version). Sometimes you just need your own kernel build, particularly if you have a device which became supported in a later kernel. In my case, I had a cheap USB ethernet adapter from eBay (costing US$1!) which provides a second NIC for Untangle - unfortunately the 2.6.26 kernel used by Untangle 7 doesn't have the necessary device ids which were added in 2.6.29. This guide shows how to rebuild the Untangle kernel in order to add these device ids.

The Cheap USB NIC

This US$1 NIC is very common on eBay: it is typically made of blue transparent plastic though it comes in many colors. It provides a 100Mbit ethernet but unfortunately only a USB1.1 interface which limits the speed to 12Mbit. Such a NIC is perfect for an ADSL modem connection as it would rarely exceed 12Mbit in most cases. The chipset is a Davicom DM9601 USB 1.1 10/100Mbps ethernet device and a Linux driver (dm9601) has been present since 2.6.24.

This device has a device id (retrieved from lsusb) of 0fe6:8101 and the patch enabling support for it in 2.6.29 (taken from here) is as follows:

--- a/drivers/net/usb/dm9601.c
+++ b/drivers/net/usb/dm9601.c
@@ -635,6 +635,10 @@ static const struct usb_device_id products[] = {
        USB_DEVICE(0x0a47, 0x9601),     /* Hirose USB-100 */
        .driver_info = (unsigned long)&dm9601_info,
+       {
+       USB_DEVICE(0x0fe6, 0x8101),     /* DM9601 USB to Fast Ethernet Adapter */
+       .driver_info = (unsigned long)&dm9601_info,
+        },
        {},                     // END

Before Anything Else

Before doing absolutely anything else you need to enable the Debian repositories. Open /etc/apt/sources.list using nano or whatever your favorite editor is and uncomment the four items in there. Run 'apt-get clean' and then 'apt-get update'.

Download the kernel source

Firstly open /etc/apt/sources.list and duplicate the first line replacing 'deb' with 'deb-src' like this:

deb lenny main contrib non-free
deb-src lenny main contrib non-free

Do an 'apt-get update', then 'apt-get source linux-image-2.6.26-1-untangle-686' (or whatever your kernel is: you can find out using 'uname -r' and 'apt-cache search linux-image').

WARNING: There is a bug in the debian source version of the Untangle kernel at present. You will need a copy of the full debian 2.6.26.tar.gz kernel.

Building the kernel

Next you need some build tools, so 'apt-get install build-essential kernel-package libncurses-dev fakeroot'. For some odd reason the source download outputs the kernel source into /boot rather than /usr/src - god knows why, but it hardly matters. Change directory into /boot/linux-2.6-2.6.26 and run 'cp ../config-2.6.26-1-untangle-686 .config' followed by 'make menuconfig' if you want to make any config changes.

Now is the time to apply patches, so do that now. In our particular case you should apply the above DM9601 kernel driver patch.

To start the build, do this:

make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-untangle-686-custom kernel-image kernel-headers

This part takes quite some time, so go do something else for a while.

Installing the kernel

After it's done you'll find two .deb files in /boot: these will install your new kernel.

dpkg -i *.deb

All you have to do now is to reboot and select the new kernel at the grub boot menu - Untangle should remember your choice from now on.

Congrats! You have added custom driver support to your Untangle box!

--Ned14 06:09, 21 October 2009 (PDT)