How to build OpenWRT for Linksys WRT350n V2.1

Linksys WRT350N picture.I have a Linksys WRT350N wireless router. I’m using OpenWRT on it for almost 2 years. There is a wiki page about openwrt for wrt350n. For more help you need to read this openWRT forum discussion. I have to say a big thank you to all the people in that forum without whom it would never happen.

Here I will explain how to build openwrt Backfire 10.03.1 on a Fedora Linux. The complete building process is explained in this page.

Install required software

Install prerequisites as mentioned in that document. Do not forget to install ccache, and sdcc.

# yum install ccache sdcc

Download source

I will download the revision 29592 as mentioned in the Backfire 10.03.1 release page.

$ svn co svn://svn.openwrt.org/openwrt/branches/backfire@29592
$ cd backfire

We need a .conig file. A rather simple way is to download it from backfire download page for orion. The only problem is that all the packages are selected in this config.

$ wget "http://downloads.openwrt.org/backfire/10.03.1/orion/config" -O .config
$ make menuconfig

In the menu just deselect the Global build settings-->Select all packages by default option, then choose Exit and choose Yes to save the file. Since we still didn’t install any feeds, this will effectively deselect all the packages that has been selected in the downloaded config file.

Install feeds

You have to change the contents of the file feeds.conf.default to accommodate the revisions mentioned in the release page. Since I’m going to use LuCI web interface, I will also comment out the X-WRT feed.

Index: feeds.conf.default
===================================================================
--- feeds.conf.default	(revision 29592)
+++ feeds.conf.default	(working copy)
@@ -1,6 +1,6 @@
-src-svn packages svn://svn.openwrt.org/openwrt/branches/packages_10.03.1 svn://svn.openwrt.org/openwrt/packages
-src-svn xwrt http://x-wrt.googlecode.com/svn/branches/backfire_10.03/package
-src-svn luci http://svn.luci.subsignal.org/luci/tags/0.10.0/contrib/package
+src-svn packages svn://svn.openwrt.org/openwrt/branches/packages_10.03.1@29592 svn://svn.openwrt.org/openwrt/packages@29592
+#src-svn xwrt http://x-wrt.googlecode.com/svn/branches/backfire_10.03/package
+src-svn luci http://svn.luci.subsignal.org/luci/tags/0.10.0/contrib/package@8131
 #src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone
 #src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl
 #src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop

Then simply do:

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

Configure your image

There are some options you can choose in the .config file do a make menuconfig and:

  • select LuCI-->Collections-->luci as built-in. Very important if you need a web interface!
  • select Advanced configuration options-->Use ccache. Helps you in compile time
  • select Base system-->qos-scripts as built-in. It is a must have!
  • select Kernel modules-->Netfilter Extensions-->kmod-ipt-nathelper-extra as built-in. more nat helpers.
  • select LuCI-->Applications-->luci-app-qos as built-in
  • Choose other packages as you need.
  • You can deselect all the packages that are selected as <m> to reduce compile time.

Add some patches

If you chose the ccache option you need to apply the following changes to include/cmake.mk file:

Index: include/cmake.mk
===================================================================
--- include/cmake.mk	(revision 29592)
+++ include/cmake.mk	(working copy)
@@ -3,14 +3,25 @@
 MAKE_FLAGS+=VERBOSE=1

 ifeq ($(CONFIG_CCACHE),)
-  CMAKE_C_COMPILER:=$(TOOLCHAIN_DIR)/usr/bin/$(TARGET_CC)
+ ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
+  CMAKE_C_COMPILER:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CC)
   CMAKE_C_COMPILER_ARG1:=
-  CMAKE_CXX_COMPILER:=$(TOOLCHAIN_DIR)/usr/bin/$(TARGET_CXX)
+  CMAKE_CXX_COMPILER:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CXX)
   CMAKE_CXX_COMPILER_ARG1:=
+ else
+  CMAKE_C_COMPILER:=$(shell which $(TARGET_CC))
+  CMAKE_C_COMPILER_ARG1:=
+  CMAKE_CXX_COMPILER:=$(shell which $(TARGET_CXX))
+  CMAKE_CXX_COMPILER_ARG1:=
+ endif
 else
-  CMAKE_C_COMPILER:=$(STAGING_DIR_HOST)/bin/ccache
+  CCACHE:=$(shell which ccache)
+  ifeq ($(CCACHE),)
+    CCACHE:=$(STAGING_DIR_HOST)/bin/ccache
+  endif
+  CMAKE_C_COMPILER:=$(CCACHE)
   CMAKE_C_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CC))
-  CMAKE_CXX_COMPILER:=$(STAGING_DIR_HOST)/bin/ccache
+  CMAKE_CXX_COMPILER:=$(CCACHE)
   CMAKE_CXX_COMPILER_ARG1:=$(filter-out ccache,$(TARGET_CXX))
 endif

Build

On fedora, you need to add the sdcc directory to path:

$ export PATH=$PATH:/usr/libexec/sdcc

After all, You are ready to go.

$ make

Relax, it will take a lot of time, specially the first time.

Leave a comment