Building OpenWRT for Raspberry Pi

In this step by step tutorial I’ll explain how to make the OpenWRT for Raspberry Pi.

In my case I used Oracle VM VirtualBox to virtualize an Ubuntu 14.04 64 bits Operative System. According to OpenWRT Debian Operative Systems are recommended to build the OpenWRT image.

1. Let’s start by installing all necessary tools,

$ sudo apt-get update
$ sudo apt-get install git-core subversion mercurial build-essential libssl-dev libncurses5-dev unzip gawk zlib1g-dev

2. Now we are going to configure all necessary environmental variables,

$ unset SED
$ export GREP_OPTIONS=
$ export PATH=$PATH:~/openwrt/openwrt/staging_dir/host/bin
$ export PATH=$PATH:~/openwrt/openwrt/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.16

3. One we have that let’s move to our user directory (or any other directory you consider) and clone the OpenWRT Git Repository,

$ cd 
$ git clone

4. Now we move to the openwrt directory and update and install all available feeds,

$ cd openwrt
$ ./scripts/feeds update -a
$ ./scripts/feeds install -a

5. Finally we configure what hardware are we using and what packages we want to compile,

$ make menuconfig

Since Iā€™m running this on a Raspberry Pi B+ board I choose BCM27XX as the target and BCM2708 for the sub-target. Please chose the target of your convenience according to your hardware setup following this guide:

Model SoC Target Subtarget
A BCM2835 @ 700MHz BCM27XX BCM2708
B BCM2835 @ 700MHz BCM27XX BCM2708
CM BCM2835 @ 700MHz BCM27XX BCM2708
A+ BCM2835 @ 700MHz BCM27XX BCM2708
B+ BCM2835 @ 700MHz BCM27XX BCM2708
Zero BCM2835 @ 1GHz BCM27XX BCM2708
2 B BCM2836 @ 900MHz BCM27XX BCM2709
3 B BCM2837 @ 1.2GHz BCM27XX BCM2710

Inside the Languages category I choose the Python submenu and then I mark with <*> the python package.

I also install the LuCI package by marking with a <*> the luci package inside the LuCI -> Collections submenu.

If there is any other package you might need this is the time to search for it and mark it with a <*>.

6. And now we finish by Making the OpenWRT image along with all selected packages

$ make 2>&1 | tee output.txt  

All output will be available on the screen and redirected to the output.txt file in case you need it. Take into account that this process might take several minutes or even hours.

7. After the long wait you’ll find in the ./bin directory a directory with it’s name matching the sub-target you selected in the menuconfig step. Inside that directory you’ll see a .img file. That’s the file you need to flash to your SD card.

You can use the Win32DiskImager application for Windows to write the .img file to the SD card. Under Linux you can use the dd command to flash the image following this great tutorial.


OpenWrt build system ā€“ Installation
OpenWrt Feeds
OpenWrt build system ā€“ Usage
OpenWRT – Raspberry Pi
Python not found in the Open WRT MenuConfig -> Languages

Leave a Reply

Your email address will not be published. Required fields are marked *