OpenWrt Forum Archive

Topic: Custom x86 Image (NO LONGER MAINTAINED)

The content of this topic has been archived between 6 Sep 2015 and 6 May 2018. Unfortunately there are posts – most likely complete pages – missing.

Due to the real world and lack of free time this project is defunct. Sources / releases will remain mirrored for the time being.

I have put together a custom x86 image for machines that boast a bit more power than the standard ALIX / Soekris / similar platforms.  I have tweaked the base x86 kernel to include SMP up to 4Gb ram support, btrfs support and a few other niceties that can be used with more powerful cpu / ram combinations.  The primary goal was to be able to fully utilize my Atom 1.8ghz dual core processor and 2Gb ram with a solid filesystem (ext4 + journal / btrfs).  Another goal was to replace pfSense as my router's distribution which I have been using due to nut and newer zabbix packages.  I have added 3 custom packages to the OpenWRT including nut, ca-certificates and a more recent version of zabbix.

Full details can be found on the project page and the image can be downloaded from the download page (both linked below).  I am new to the OpenWRT build process so there are some outstanding cleanup items left to address.  Please let me know what you think.

Project Page/Sources/Tracker: https://bitbucket.org/nuskunetworks/nnopenwrt
Version: 2014-03-09 -- r64cee057a24a93167009126dbd35c86e486d5dc1
Primary mirror: https://nusku.net/openwrt/
Secondary mirror: https://nuskunetworks.box.com/s/9a4248d4f94a59ee1201

Changelog

Resync with upstream
Updated to include PAM 1.1.3 from Debian
Enabled PAM by default
Added usb-ip kernel packages (per forum request)
Added ppp RFC 4638 patch (per forum request)
Packaged yubico-c and yubico-client
Enabled curl package
Enabled nmap packages (per forum request)
Enabled iperf packages (per forum request)
Enabled ncat packages (per forum request)
Enabled ndiff package (per forum request)
Enabled nping package (per forum request)

(Last edited by mcrosson on 16 Jul 2014, 04:55)

Huh, great idea!

For now I have fully configured openwrt on wdnr3700 router but lately I was looking for expanding its capabilities by changing platform to x86. Ive found quite nice foxconn 3500 nettop - it has wifi, 1Gb lan, 4 usb etc. Ill try to install Your image to see if its working.

Do you plan on using a USB wired network adapter or USB WiFi adapter with the WNDR3700 replacement?  I am not sure, but I may have omitted the USB networking drivers from my build.  I will double check and include the USB networking drivers if you think you may need them.

I will definitely be needing them at least in the short term.

I'm planning to run this on my Atom D525 with the ultimate goal of updating to a more suitable board and case later (one where I can actually use a second ethernet card rather than USB which I will need for now).

I am working on getting an updated build going that will include various USB network drivers (wifi / wired) as packages.  Unfortunately I have been having troubles getting a clean build from the trunk.  Hopefully I will meet with success soon.

For reference, I am thinking of using this http://www.mini-box.com/I-O-shield-and- … r-DN2800MT as that should allow me to put in a 5Ghz WiFi card, 2.4Ghz WiFi card and a second ethernet card. (although fat chance of me getting a 5Ghz card with the right regulatory domain flashed on it)

It sucks that all the Atom boards with dual gigabit ethernet built-in cost about three to four times the price.  But I BADLY need to get away from the crappy Realtek 8111E ethernet chipset, it just doesn't work right in Linux.  Its fine unless the link goes down, then its impossible to get the link back up without a full power cycle.  Not a very good bug to have on a router.

That is the motherboard I was considering upgrading to from my current Atom board.  I ended up going with a PCI to MiniPCI adapter for the second wifi controller since I can get enough bandwidth out of the PCI bus for a 2x2 wireless card and a DSL WAN connection. 

One issue I ran into recently was the Atheros 9220 MiniPCI card I just purchased does not want to work in host ap mode at all.  My pre-existing Ath 9382 (mini-pci express) works fine though.  It looks like the drivers may be the issue.  I am working on this item as part of my updated build.

I ordered the Intel DN2800MT today.  Might not have if I wasn't having such huge problems with the Realtek ethernet not coming up properly on boot and failing outright if the link drops - which obviously might happen if the modem reboots.

I'm torn between just sticking Mageia on it or your build of OpenWRT.  The issue is the power management supposedly only works optimally in the very latest kernel versions and I am thinking its almost guaranteed I will end up putting a lot of server junk on it with it being mostly overkill for router hardware.  No point having a second server running 24/7 if I can move everything over onto a single box and that is likely easier with a full distro.  I might even keep Xorg on it in which case I HAVE to use kernel 3.3+ as the GPU is not supporting on anything older.

Of course there are big pros for OpenWRT too.  The main one being it would be a quick and painless process to copy over the configuration from my Buffalo.  The second one being its optimised for remote configuration via the web browser, I'm not sure of anything remotely comparable for a normal distro, although I suppose it could be a project for me to write my own GUI in PHP for it.

My biggest bugbear is trying to understand iptables though.

I would shy away from my OpenWRT build if you are going to be doing general server stuff like Apache / PHP / MySQL and the like.  I am focused on the router end of the spectrum. 

I do know that the DN2800MT would make a great router or a light weight server machine.  I am using a dual-core 2.0ghz atom board as a server along with a 1.6ghz atom for my router.  The only "problem" I've had is the atom can be a little slow when PostgreSQL has to process a large, complex query.

Also do not forget about potentially running LuCI from within a full distribution.  I looked at doing that initially but decided building OpenWRT would be easier given I know nothing of Lua, but I know how to build a Linux box from scratch thanks to using Gentoo all these years.

(Last edited by mcrosson on 10 May 2012, 21:48)

I have just published an updated version that is built on r31743 of SVN.  This includes a number of updated packages.  I have yet to figure out a good way to upgrade all of the packages in-place.  For now the standard re-install the image from scratch method is the recommended upgrade path for this build.

I'm stuck between a rock and a hard place, because I'm going to need to patch my kernel or rethink things. 

I really wanted to move my Intranet onto the router so that I do not have the current cumbersome configuration of the server probing the router for stats, which in turn probes the modem.  Its hard keeping everything working nicely when any of the three gets rebooted as no matter how hard I try to catch the monitoring scripts hanging, I can't seem to prevent it.

I really was hoping not to have to stray from distro provided packages but I now realise that if I want to use IMQ, I have no choice.  In their infinite wisdom the Linux kernel maintainers feel IMQ should not be implemented at kernel level so it seems its only obtainable by patching the kernel source and compiling your own.  Despite the fact its impossible to achieve the same functionality in user space.

There really does seem to be some bloody mindedness when it comes to the kernel stuff, this is not the first I have run into problems getting things supported in a stock kernel.

No wonder its always been so hard to find routers supporting QoS.  The thing is, QoS was one big reason for me to switch to an Atom as I wasn't convinced a MIPS CPU could comfortably handle QoS for a 100Mbit WAN connection.

I moved to an Atom for QoS myself.  I turned on Layer 7 inspection and it definitely took more than the standard MIPS / Geode equipment to keep up.  I stuck to the stock kernel QoS and the standard Layer 7 tools to achieve the QoS setup I wanted.  I am not familiar with IMQ but if it is a set of kernel patches, you could go with a distro that lets you build your own kernel.  I know Gentoo and Arch are a bit better about 3rd party kernel patch sets than most.  Both are pretty competent distributions as well.  Might be worth looking into for the setup you described.

You could potentially bring LuCI into Gentoo or Arch as well which would give you easier management of the routing functionality.

To make LuCI work on a normal distro you would need to rewrite the entire userland of the target distro to act like OpenWrt or rewrite the entire UI to cope with at least a dozen different config formats, init script flavors and distro management systems; either way - it would be be too complex to bother and far exceed the required effort to patch IMQ into OpenWrt.

Wanted to say "thanks" for this - I'm watching closely, as OpenWrt definitely has the best wlan support I can find, and my feeble attempts to compile a better kernel for x86 have completely failed. Looking to replace my RSPro board soon with Atom (already have a DN2800MT here, in fact).

Got the DN2800MT up on the bench and it does boot! Haven't done much else with it, but --

Intel DN2800MT
SparkLAN WPEA-127N (Atheros AR9380) in the full-height miniPCIe slot
Intel Gigabit CT card in the PCIe x1 slot
Booting from 4GB USB flash drive

If you're interested, I put the kernel log here, https://www.atomicmonkey.org/nnopenwrt/ … el-log.txt

My point is the QoS package for OpenWRT does EXACTLY what I want, prioritising by port.  But I cannot for the life of me figure out if that is one of the things possible WITHOUT IMQ, as OpenWRT on my router IS using IMQ.

After reading up some more this seems to be a "snag" with trunk, its missing IMQ support yet official releases include it.

I'm not having much luck with Mageia though (its a complete mess if you don't want a desktop, hostapd compiled without support for 802.11n being one example) so I'm still looking at alternatives which brings me back to this project.

I mean sure I could compile fixes in manually, but that is not something you want to be doing on a router.  You want to be able to install the latest security fixes with minimal risk of screwing things up because its the single most important part of the network.

Doogie: I'm glad to see you got it booted.  And thank you very much for the kernel log.  It looks nearly identical to the kernel output I get on my configuration.  I am running an Atom Mount Olive board with a SparkLAN.  I have been successful in getting my SparkLAN setup as an access point in both 2.4ghz and 5ghz configurations.

I noticed there appears to be an oops / notice about the db.txt file linked in the wireless registry.  I am aware of the "problem" and am working on solving it currently.  It should not prevent the SparkLAN card from working in HostAP mode.  Also, there are a few messages about module versions which I also receive.  I believe this is related to me having some kernel modules selected in the OpenWRT main configuration which will install modules on top of what I have setup with a custom kernel.  I am still working on understanding fully how the custom kernel stuff works and hopefully will have those notices taken care of soon.

I hope to have an updated build that addresses some of these points and others soon.  I am waiting on a development board to arrive so I can do my testing on non-live equipment.  My Fiancee was not pleased the last time I applied a test build to the live router at home....

Something that may not be immediately obvious in the build is that I set it up to work with btrfs root filesystems.  I am currently using btrfs for my root filesystem so I can better manage the upgrade  process.  I discovered that OpenWRT's version of opkg will not update certain packages such as the kernel which prevents an in-place upgrade similar to what apt-get dist-upgrade on Debian does.  The only way I found to upgrade the x86 builds of OpenWRT was to re-dd the disk image on top of the live install after running a backup or copying the rootfs.tar.gz image on top of the the live filesystem which can cause problems.  Due to this I switched over to btrfs from ext4 so I could use the snapshot feature to do an in-place upgrade without losing my installed packages and configuration.  I plan on writing a python program to automate the process and when it is complete I will be including it in the build.  In the interim, I can post my btrfs based upgrade process if you are interested.

Alex: I had a similar issue that you are in terms of the alternatives to OpenWRT.  They were half baked, poorly supported, designed for very light weight equipment such as the RouterBoard or designed for very high end equipment with Intel i7's, lots of ram and the like.  I always seemed to come back to OpenWRT's x86 build despite it not fully utilizing my Atom hardware.  I started this project so I could use OpenWRT and the advanced features of my Atom hardware such as >128Mb ram, multiple cores and "lots" of expansion.  I also want to smooth out some of the rough edges of the distribution on x86 as well.  Things like upgrades, more features on packages (snort comes to mind) and additional packages such as ca-certificates from Debian (this is part of my build now).


I am currently maintaining some patches and custom packages for my build of OpenWRT.  If you have the patches and general information on enabling IMQ on the OpenWRT trunk and appropriate packages I can work on including them in my build.

The official patches are at http://www.linuximq.net/ but I would think though you need to know specifically how OpenWRT apply those patches so as to package them up so the dependencies pull in correctly.

opkg whatdepends kmod-ipt-imq
Root set:
  kmod-ipt-imq
What depends on root set
        iptables-mod-imq 1.4.6-3.1      depends on kmod-ipt-imq
        qos-scripts 1.2.1-3.2   depends on iptables-mod-imq

opkg whatdepends qos-scripts
Root set:
  qos-scripts
What depends on root set
        luci-app-qos 0.10.0-1   depends on qos-scripts

Other packages I want to use are mysql-server and mplayer.  I am happy to compile those myself though if you can give me a tips on how to do so. (although I'm betting its quicker to do it yourself than try to explain how)  Oh and Java so I can run serviio on there.

That said, I would think its possible to use the standard x86 packages for none-kernel stuff?  You would just be missing any SMP optimisations which I believe mplayer is still a strictly single-threaded app anyway due to it primarily being optimised to use the CPU cache for video decoding (I just want it to play audio files).

So you can see why I was trying to use a full distro, my usage falls just a little outside the realm of a typical router although OpenWRT itself has packages for all the above I believe apart from Java, which I would think is not too hard to get going as you just use the standard x86 version?

Alex: I will take a look at integrating the IMQ patches into the build.  It may take me awhile as my time these days is very limited.

Is it possible to install your custom image on a USB stick in a read/write/bootable fashion?  I see various instructions for getting OpenWRT on a USB stick but none of them seem particularly clear about or address using an ext4 partition for it.

I am thinking that would be the most quick and painless way to test it without overwriting the existing Mageia installation on the SSD.

That way I can also more easily test OpenWRT alongside different full distros and quickly fall back onto OpenWRT if everything goes wrong.  Its just so hard trying to custom build a router like this because obviously you need a working router in the meantime but also to be able to test it as you go.  Fortunately, I currently have several static IPs so I use this as a secondary router, but this will not be the case soon so testing will be problematic.

You can download the openwrt-x86-generic-rootfs-ext4.img.gz file for creating a USB stick that boots my build of OpenWRT.  The img files contains a boot partition and ext4 root filesystem.  From finnix / another distro you can easily run "zcat <img.gz> | sudo dd of=/dev/sdusb bs=4M" to write it out to the USB stick.

Note that I have built a custom kernel so you can boot OpenWRT off USB / IDE / SATA reliably.  I had problems with sata and usb boot on the vanilla x86 OpenWRT images.

Also, bear in mind that the "upgrade" procedure for x86 OpenWRT is to re-write a new disk image.  They have patched opkg so it will not upgrade some packages (ie. kernel).  I am working on a process that will use btrfs snapshots to provider a better upgrade path than the default.

Not having much luck so far, generic-rootfs doesn't boot, generic-combined does but fails to find the root fs.

You are right: the generic-combined is the image necessary for booting.  Sorry about that, I transposed the filenames I was looking at.

For your boot issue it is due to the grub.cfg, /etc/fstab or /etc/config/fstab file and the way OpenWRT uses the device node for mounting instead of label or UUID.  It is likely the grub file causing the problem since OpenWRT does not appear to have a root filesystem entry in either fstab file that I see. 

You can update the grub config from another Linux distro and the general steps for updating it are

1. Boot finnix / Ubuntu / Knoppix / other
2. mkdir /tmp/openwrt_boot
3. mount /dev/[sdx]1 # Where [sdx] is the OpenWRT drive and the 1 is the boot partition.
    # The boot partition is contained in the combined image file
4. blkid | grep /dev/[sdx]1 # Replace [sdx] as you did in the above step
    # This will give you the label / uuid / type of filesystem for the boot filesystem
5. [favorite_editor] /tmp/openwrt_boot/boot/grub/menu.lst
6. Change the "root=/dev/sda2" portion of the kernel lines to be similar to the following:
    root=UUID=4e65d229-1bec-47e8-8807-2223513645b4 # The bits after UUID= should be changed to reflect the uuid you found
7. Reboot into OpenWRT



If this procedure does not fix booting OpenWRT let me know and if possible the error message you get after Grub attempts to boot.

I couldn't get it to boot using LABEL or UUID, only /dev/sdb2 would work.  Support missing in the kernel maybe?

It also keeps auto mounting the /dev/sda3 partition for some odd reason, even though the USB stick is /dev/sdb.

Its annoying as I don't want /dev/sda mounting unless I can put the "discard" flag on there, or it will muck up the SSD garbage collection.

I'm also puzzled why its showing 4 WiFi radios when there are only two cards in there.  It seems to be picking up the dual a+g(n) support then duplicating them as g/n only cards.  The duplicates do not work even if the first two are disabled though, probably due to the fact it seems to have fabricated the MAC addresses of the duplicates.