Tutorials
Sunday, 20 September 2015 22:15

Compiling OpenWrt from source

Written by 

Compiling OpenWrt from source

To compile OpenWrt from source, you need a computer running Linux such as Ubuntu. If you are like me and don't have a Linux computer, you can still use your Windows computer to compile OpenWrt.

In order to run Linux on a Windows, you must install virtual machine on you computer. Virtual machines allow you to run any operating system in a window on your desktop, I'm using the free VirtualBox for my case, please read here for details.

After you get your Linux installation up and running, please continue the following process to build your OpenWRT.

  • Login to Ubuntu and open (press Ctrl+Alt+T) the Terminal as shown in figure below:
    Terminal

  • Downloads the package lists from the repositories
    sudo apt-get update

  • Download & install necessary packages for the cross-compilation process
    sudo apt-get install subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc
    sudo apt-get install unzip python wget

  • OpenWrt source repository downloads, I am using the release version of Barrier Breaker 14.07.
    git clone git://git.openwrt.org/14.07/openwrt.git

  • Download and install all available "feeds". Depend on your internet connection, it takes some time to complete this process.
    cd openwrt
    ./scripts/feeds update -a
    ./scripts/feeds install -a

  • Make OpenWrt Buildroot check for missing packages on your build-system using one of the following commands;
    make defconfig
    make prereq
    make menuconfig

  • After a few seconds you should see the main screen for configuring OpenWRT. In this tutorial, I'm selecting TP-Link TL-MR3020.
    OpenWrt Configuration

  • Exit the menu system when finished going through all the categories of software. Make sure to confirm that you want to save your OpenWRT configuration.
    Save your new configuration

  • Optional: You can also modify the kernel config for the selected target system. Depend on your internet connection, it takes some time to complete this process.
    make kernel_menuconfig
  • After the process is completed, you should see the kernel configuration menu.
    Kernel Configuration

  • Exit the menu system when finished going through all the categories of software. Make sure to confirm that you want to save your OpenWRT configuration.
  • With all of your packages selected and your configuration saved, you’re ready to build your firmware. It takes one to several hours to complete this build process. 
    make
    If you want 4 parallel jobs from make
    make -j 4
    or watch it do its thing
    make V=s
  • The result firmware image is generated in the Home/openwrt/bin/ folder.
    Result firmware image

  • Flash the factory.bin to your router.
  • You may want to get a clean build after running the "make" command. If you do a make distclean, buildroot will delete your .config file.
    make distclean

Read 3738 times Last modified on Sunday, 25 October 2015 21:30

Leave a comment