Building OpenWrt firmware

After the brief description of OpenWrt system in the previous article


we describe now how to build the firmware for our router.

We use as tartget device the TP-Link TL-MR3420 router version 1.

This model is in the list of the supported OpenWrt devices; here is the specific documentation for this device

TP-Link TL-MR3420

From the documentation we know that the SOC is an Atheros AR7241. This information will be used in the configruation phase of the buildin envinronment.  As a preliminary operation also download the original firmware of this router from the link

Original Firmware

In the page TP-Link TL-MR3420 we find the links to two differents versions of the OpenWrt firmware:

  • Firmware used to install OpenWrt: openwrt-15.05.1-ar71xx-generic-tl-mr3420-v1-squashfs-factory.bin.
  • Firmware used to update OpenWrt: openwrt-15.05.1-ar71xx-generic-tl-mr3420-v1-squashfs-sysupgrade.bin

If we have the original firmware in our device we must utilize the first one, while in the case of updates we use the second one..

We now execute the operation described in the link

OpenWrt Building

in the Debian envinronment installed in previous article

Debian Envinronment

In a shell command window we install the prerequisites as non root user (sviluppo in our case)

We create a folder OpenWrt under the home user folder (sviluppo in our case) and clone the repository. In this build we choose the stable branch 15.05

At the end of the git task, execute

We are now ready to build the firmware of the TP-Link TL-MR3420 V1.

Execute the command

and we choose as target Target System AR7xxx/AR9xxx as described in the following screenshotsOpenWrtmenuconfigWith the following choices we change the options

  • y: we buil it.
  • m: we build it as module.
  • n: we skip it.

At the following link

OpenWrt Building

we find all the documentation about the building.

In the Target System with enter we can choose our Target PlatformOpenWrtmenuconfigAtherosWe have to install the base packages to admin the system, so we access LuCI OptionOpenWrtmenuconfigLucithen CollectionsOpenWrtmenuconfigLuciCollectionsand at the end the luci package; with this option the system installs an http server tooOpenWrtmenuconfigLuciCollectionsBaseWe choose as modules some cryptographics packages in the kernel modules sectionsOpenWrtmenuconfigKernelModulesthen Cryptographic Api modulesOpenWrtmenuconfigKernelModulesCryptoApiand at the end the following modules merged into the firmware fileOpenWrtmenuconfigKernelModulesCryptoApioptionsYou should save the configuration in a file in order to use it again later. Finally save the configuration in the .config file.

We can now exit the menuconfig and execute the following command in the shell command window

This task checks for the prerequisites.

To build the firmware we execute

in verbose mode.

At the end of the task we can find the firmware in the atheros platform under the bin folder. In our case our images are highlighted in the following screenshotOpenWrtFirmwareWe can now flash the firmware.

WARNING: Before installing the firmware verify the recovery process of your router in the event of a problem, i.e how to start in recovery mode, flash via tftp, use JTAG, etc. The image installation on the device is at your own risk. We accept no responsibility if the installation leads to  malfunction or block of the device.

The OpenWrt web site describes all the vaious options to build the firmware and packages. In the next article

Building OpenWrt package

we’ll describe how to build and install from a shell window command the vsftpd package.