Choose Wisely
While the OpenWRT build environment does do some basic dependency checking when you select a package for inclusion in your firmware, it’s still very possible to create a firmware image that simply won’t boot up due to missing software. In fact, some might argue it’s very easy to do just that.
Before deselecting too many items in the build configuration, make sure you have a pretty strong handle on basic Linux concepts and what makes the system run. If you have any doubts about what a particular package does in OpenWRT or Linux in general, it’s better to do a quick search for the package name online than just disabling it and seeing what happens.
On the other hand, the devices that OpenWRT runs on have an extremely limited amount of storage capacity. The router I personally do my OpenWRT work on only has 4 MB of flash. A bare bones OpenWRT image weighs in at around 3 MB, so you can see how there isn’t a lot of leg room on my hardware to start adding in every package that seems interesting. When selecting packages for your firmware, keep in mind the storage limitations of your device. Some packages are simply too large to fit in flash and may therefore rely on an external storage device, which in turn relies on your hardware having some way of connecting a storage device to it. It’s just as easy to select too many packages as it is too few.
Compiling the Image
With all of your packages selected and your configuration saved, you’re ready to build your firmware.
On single core machines you would simply run:
bash$ make
On dual or more core machines, you can break the build process up to take advantage of multiple processors. The rule of thumb is to use the number of processors plus 1 for how many concurrent jobs you want to use. So on a 6 core machine you would run:
bash$ make -j 7
In either event, the next step is…to wait. The OpenWRT build process is rather lengthy, so it could be awhile until this process completes. If the build ends with an error, you can re-run make with more verbose output by running the following command:
bash$ make V=99
Installing the Image
Hopefully the build process went well for you and didn’t take a ridiculous amount of time to complete. If you got to the end and there were no errors, then you should have firmware images for your hardware created under the /bin directory of the OpenWRT source. For example, when building for my TP-Link MR3220, I get the following files:
./bin/ar71xx/openwrt-ar71xx-tl-mr3220-v1-squashfs-factory.bin ./bin/ar71xx/openwrt-ar71xx-tl-mr3220-v1-squashfs-sysupgrade.bin
The first file, factory.bin, is for flashing over the original firmware your device came with. The second file, sysupgrade.bin, is for upgrading an existing OpenWRT installation. Don’t try to flash a sysupgrade.bin file over your stock firmware, as the results can be unpredictable.
Follow the device-specific instructions from the OpenWRT Wiki to find out the exact process required to replace your device’s stock firmware with this brand new image. Some devices allow you to install any image you like through their web configuration, other devices may require more exotic installation methods.
Where do we go from here?
If everything has gone as planned to this point, you should have a custom OpenWRT build running on your hardware. Poke around it a bit to make sure everything you wanted was installed and is working as expected. Keep an eye on “The Powerbase“ for a future guide on how to setup your new OpenWRT device, as well as some interesting things you can do with that miniature Linux box.





![[Sneak Peek] Vivaldi Content Store Shows Ankles For The Cinematograph](http://www.thepowerbase.com/wp-content/uploads/2012/05/makeplaylive-134x90.png)






![[Sneak Peek] Vivaldi Content Store Shows Ankles For The Cinematograph](http://www.thepowerbase.com/wp-content/uploads/2012/05/makeplaylive-50x50.png)

Pingback: Complete guide to compiling OpenWRT - Hack a Day
Pingback: Complete guide to compiling OpenWRT « Hackaday « Cool Internet Projects
Pingback: OpenWRT Build Guide: Start To Finish | szimpatikus.hu trackback proxy
Pingback: Complete guide to compiling OpenWRT | My Blog
Pingback: Complete guide to compiling OpenWRT | TechnoFiesta
Pingback: Complete guide to compiling OpenWRT « Gadgets « The Depot of Talk
Pingback: Complete guide to compiling OpenWRT « sanchezdiego.com.ar
Pingback: Complete guide to compiling OpenWRT | CisforComputers
Pingback: Complete guide to compiling OpenWRT | hollies quotes
Pingback: OpenWRT build guide « 0ddn1x: tricks with *nix
Pingback: Wireless control of a model car | offlinehacker