Making Firmware For the Linksys WRT Routers

Hi

I have a Linksys WRT1900AC v1 router and my friend has the version 2. I would like to compile my own firmware with packages that we want. Currently I'm following this guide

https://openwrt.org/docs/guide-developer/quickstart-build-images

and I'm currently presented with the GUI configuration menu. The first section asks for the target system but I can't find Marvell/mvebu in the list. I've used this utility before to compile my own UPnP package but that was for just one package. Is there a guide on what I need to include in so that I don't load with broken firmware?

The other question I have is what version of LEDE is the builder building off? If it's newer than 17.04 does that mean I can install the latest WiFi drivers?

I had 17.04 installed but after a memory issue I was asked to try out 18.06. The memory issue was resolved but then I had other problems such as SSH not working, PPPoE not working etc. hence why I would to try and make my own firmware with packages that I want pre-installed.

Many thanks

Will

Selecting Marvell EBU Armada on the openwrt-18.06 branch should reveal (among others)

( ) Linksys WRT1200AC (Caiman)
( ) Linksys WRT1900ACv2 (Cobra) 

Can I use the 'multiple devices' option under the 'Target Profile's menu, or do I compile each one separately?

If the only reason you're doing that is to have additional packages pre-installed in your custom firmware, I'd highly recommend image builder instead of compiling from scratch.

You need to compile each separately. The good news is that most of the packages won't have to be recompiled, so it should go quite quickly. If you think you're going to do this more than occasionally, installing ccache and enabling it in the build (Developer options, as I recall), will speed things. If you've got a multi-core build box and don't mind it being consumed by the compile

make -j5 clean download world

is my "mantra" for my 4-core CPU (one more thread with the -j option than cores is a common choice).

I prefer the full build environment as it isn't all that much harder to install than the image builder and about the same to configure an image. It also lets you patch things, either because they're broken, or because you want it to behave differently.

Look into the "env" feature as well. It lets you store your .config and any files in a git repo so you can flip between configs on different branches (of your own) with ease.

1 Like

Given that you want multiple subtarget devices for a common target, you can compile everything in one go, and have different packages per subtarget device using the per device root file system available under Target Devices of main menu.

There is an example config.seed for your target of interest on my drop, the link is off my avatar if that helps.

As I'm a newbie to developing my own firmware what do I set the 'Target Images' to? Also at what point do I select the branch of OpenWRT/LEDE? Lastly when going through the rest of the menu, am I better off starting with the LuCI packages because I have noticed when selecting packages to be installed it automatically selects the dependencies on the other menus?

In short how do I know what I need to install on the make menuconfig for basic and safe operation? I just want a simple build like the stable releases but would like to pre-install more LuCI packages. Also I'm not sure if this possible but is there way to pre-configure some of the settings like a wireless AP SSID and key for example?

Many thanks

Will

You can pre-install files to the file system by adding them to the files/ directory in the build tree. For example, to add a pre-configured /etc/config/wireless file to your image, place it at files/etc/config/wireless

For a "basic and safe" build, the defaults for your architecture are what are in the "snapshot" builds. Many people add a LuCI package by selecting, for example luci-ssl or luci-ssl-openssl, depending on if you need the OpenSSL library for other purposes. (luci-ssl uses the mbedTLS library)

This is the root of the folder 'openwrt' which is the clone from git.
Screenshot%20from%202018-06-13%2016-23-15
In which folder do I place the pre-configured files?

https://openwrt.org/docs/guide-developer/build-system/use-buildsystem#custom_files

You might consider managing both the files and your .config with the git-based script described at https://openwrt.org/docs/guide-developer/env (Having set it up, I just go into the env/ directory and use git there.)

In regard to the buildroot I'm already in the root folder, so in my case I'll need to make a directory 'files/etc/config/'?

Use Image Builder then.

I'd rather try and learn how to compile if from scratch and if all goes well I may release them to the forums like others are doing. Does anybody know how davidc502 compiles his builds for the WRT series of routers? He has recently released built some images with the latest kernels on which I too would like to include.

On a side note I keep getting these errors when I use the 'make' command

make -r world: build failed. Please re-run make with -j1 V=s to see what's going on
/media/will/DATA/openwrt/include/toplevel.mk:216: recipe for target 'world' failed
make: *** [world] Error 1

I'd guess the most common reasons for build failures can be resolved by running make download first, or something similar to the "all-in-one"

make -jN clean download world

I would imagine that virtually everyone that builds OpenWRT images from source uses the OpenWRT build system. They may include their own patches or specify different versions, but for the code involved licensed under GPL, they're obligated to provide you with a machine-readable copy of the source code. Since David seems to be a reasonable guy, it's probably already in his threads or in notes where he posts his builds.

Grab a config.seed and Configure using a config diff. I'm ignoring some possibly important bits (patches, files/ directory...), but a start.

Do as it states in the message to see the actual issue.

make -j1 V=s

You can indeed. Tick the box and after you can select the devices you'd like to build for inner that target. The 'per device rootfs' option even allows you to include e.g. package A for the v1 but not for the v2, package B for the v2 and not for the v1, etc. It's pretty neat stuff. I use it myself to run a single build for ar71xx devices with e.g. LuCI and other tidbits excluded for some devices.

Hi Guys

sorry for the long reply. I've been extremely busy and haven't had time to get back to compiling my router firmware till now.

The question I have is, when saving the the configuration as the '.config' does it need to stay that name or can it be called something else like '.config WRT 1900'? If so do I need to specify the config on the compile command or is it a simple case of loading the 'make menuconfig' loading the configuration, save and exit?

Many thanks

Will

It must be called .config.

1 Like

I've now actually installed Ubuntu Budgie onto my physical machine rather than doing it through virtualization so I've got more processing power.

These are the commands I compute in Terminal:-

1. sudo apt-get install subversion g++ zlib1g-dev build-essential git python rsync man-db
2. sudo apt-get install libncurses5-dev gawk gettext unzip file libssl-dev wget zip time
3. git clone https://git.openwrt.org/openwrt/openwrt.git
4. cd '/home/will/openwrt'
5. git branch release
6. git checkout release
7. ./scripts/feeds update -a && ./scripts/feeds install -a
8. echo CONFIG_TARGET_mvebu=y > .config
9. make defconfig && make prereq
10. make menuconfig

Inside the make menuconfig I've selected Target Profile (Linksys WRT1900AC (Mamba)) just to keep the process easier of trying to compile for the other LinksysWRT series of routers. I then proceed onto the the following menus/sub menus checking a '*' (pressing 'Y' on the keyboard) next to each item:-

  • Base system
  • LuCI
  • Network
  • Utilities

I skip the following menus:-

  • Boot Loaders (empty)
  • Development (not needed)
  • Extra packages (empty)
  • Firmware (the firmware for my router is already selected inside)
  • Fonts (not needed)
  • Languages (not needed)
  • Libraries (I don't know what they are and looking at the description it doesn't seem I need them)
  • Mail (not needed)
  • Multimedia (not needed)
  • Sound (not needed)
  • Xorg (not needed)

Screenshot%20from%202018-07-20%2011-03-41

Once finished I save the configuration as the default '.config' and select exit. I then use the following command to compile.

make -j4 download

After a couple of minutes I usually get an error message. Weirdly enough it seems to have completed but I have no idea where the image file is located. Its says on this guide it should be located in the '/bin' directory which I don't have.

However, what's detailed above, I would like to know if I'm doing anything wrong? It's also interesting why I'm now not getting errors on a physical PC over a virtual one where I did unless it was because I was compiling for all of the Marvell Armada devices?