OpenWRT Build Instructions

From Compex Wiki
Jump to: navigation, search

There is a newer version here:

OpenWRT Compile Instructions

OpenWRT Build Overview

This section describes how to compile the OpenWRT firmware image using a software development kit (SDK) from Compex to work on Compex's boards. It integrates ath9K and ath10K.

The previous OpenWRT used was the Attitude Adjustment 12.09, with Kernel version 3.3.8.

The current OpenWRT used is the Barrier Breaker revision 43889, with Kernel version 3.10.49. The following boards are being supported:

  • WPJ342
  • WPJ344
  • WPJ531
  • WPJ558

As at 2015-03-17, the Ethernet drivers and on-board wireless are working well for all four boards using this Barrier Breaker.


Barrier Breaker with ath9k and ath10k

OpenWRT with ath9k and ath10k can be built to run on Compex boards and radio cards.

Filename: SDK150324_BB.tar.bz2 Version of the SDK: B150324 Boards supported by this SDK: WPJ558, WPJ344, WPJ342, WPJ531.

Recommended Linux Host: CentOS 6.x, Debian 7.x


ath9k

ath9K supports 11n radios, which includes WPJ558 on-board, WPJ344 on-board radio, WPJ342 onboard radio, as well as all Compex's 11n radio offerings, including WLE200NX, WLE200N2-23, WLE350NX, WLE350N5-25 etc.

ath10k

ath10K supports 11ac radio cards, which includes WLE900V5-23 and WLE900VX radio cards. The radio card is to be inserted into the Mini PCIe slot on the board.

For first build

The following are the commands that you can run at the Linux terminal prompt. The “$” in the beginning of the line represents the shell prompt.

# To extract the compressed file:
$ tar xvf SDK150324_BB.tar.bz2
$ cd BarrierBreaker/openwrt
$ ./scripts/feeds update -i
# use feeds command to install additional packages, e.g. luci
$ ./scripts/feeds install luci
# run make menuconfig, select desired configs, and then build
$ make menuconfig
$ make


In the make menuconfig please choose the board model in “Target Profile”.

Picture1.png

Picture2.png

Also, you would have to select the options to install necessary packages such as the LuCI for showing the web page.

The wireless drivers ath9k and ath10k can be selected under “Kernel modules > Wireless Drivers”.

Picture3.png

Picture4.png

When you choose Save, the menu selection choices will be saved into the “openwrt/.config” text file.

After you have made your choices, please choose Exit and run make.

You may try time make to keep track of the baking process.

If the compilation fails because a certain dependent application was not installed, follow the instructions to install the required application. Then try running make again.

The first build may take several hours or up to a day because the source files have to be downloaded from the opensource OpenWRT and LuCI Subsignal websites.

During the first build of openwrt, about 300MB of various source files will be downloaded from the internet.

The downloaded files will be put in openwrt/dl.

You might see the following error message (by running make V=s)


http://downloads.openwrt.org/sources/u-boot-2014.04.tar.bz2
Resolving downloads.openwrt.org (downloads.openwrt.org)... failed: Connection timed out.
wget: unable to resolve host address `downloads.openwrt.org'
Download failed.
No more mirrors to try - giving up.


This means that the web server connection is slow/down. You could wait and try again.

Tip: If you or somebody had run make successfully for this Barrier Breaker version before, you can copy the contents of BarrierBreaker/openwrt/dl so that you do not need to download from the web server again. This could reduce the first build time to 45 minutes.

The compiled firmware is created in this directory path: BarrierBreaker/openwrt/bin/ar71xx/openwrt-ar71xx-generic-wpj558-squashfs-8M-factory.img

The board model e.g. wpj558 depends on your selection in the make menuconfig earlier.

For subsequent build

The directory must not be renamed or moved because the paths are hard coded into the cross compilation toolchain.

You may run the following commands in your Linux terminal.

 cd BarrierBreaker/openwrt
 make clean
 make

The process may take less than 10 minutes if there are few changes.

The command make -j4 is faster but may result in errors if there are many packages because of inter-dependencies between the threads.

Installing Firmware

For details, please refer to: CompexWRT Firmware Upgrade.


Resetting to factory default

Sometimes, the web page cannot show because error in the settings.

If the serial cable is still connected, you may run this shell command:

 mtd -r erase rootfs_data

This will reset the board to factory default, as defined by the firmware.

After Upgrading

After upgrading OpenWRT+ath10K firmware onto the board, please go to the default URL 192.168.1.1 to see the LuCI web page. From there, you can enable the radio(s), which become active as AP(s).

For example, on WPJ558 board + WLE900VX card, you would see the following:

Type iwinfo


root@OpenWrt:/# iwinfo
wlan0     ESSID: "OpenWrt"
          Access Point: 04:F0:21:0E:38:F4
          Mode: Master  Channel: 36 (5.180 GHz)
          Tx-Power: 17 dBm  Link Quality: unknown/70
          Signal: unknown  Noise: -48 dBm
          Bit Rate: unknown
          Encryption: none
          Type: nl80211  HW Mode(s): 802.11bgnac
          Hardware: 168C:003C 0000:0000 [Generic MAC80211]
          TX power offset: unknown
          Frequency offset: unknown
          Supports VAPs: yes  PHY name: phy0
wlan1     ESSID: "OpenWrt"
          Access Point: 04:F0:21:05:58:88
          Mode: Master  Channel: 11 (2.462 GHz)
          Tx-Power: 28 dBm  Link Quality: unknown/70
          Signal: unknown  Noise: -92 dBm
          Bit Rate: unknown
          Encryption: none
          Type: nl80211  HW Mode(s): 802.11bgn
          Hardware: unknown [Generic MAC80211]
          TX power offset: unknown
          Frequency offset: unknown
          Supports VAPs: yes  PHY name: phy1
root@OpenWrt:/#

wlan0 is the 11ac card radio and wlan1 is the on-board radio.


Type iw phy0 info

root@OpenWrt:/# iw phy0 info
Wiphy phy0
        max # scan SSIDs: 16
        max scan IEs length: 195 bytes
        Retry short limit: 7
        Retry long limit: 4
        Coverage class: 0 (up to 0m)
        Device supports AP-side u-APSD.
        Available Antennas: TX 0 RX 0
        Supported interface modes:
                 * IBSS
                 * managed
                 * AP
                 * AP/VLAN
                 * monitor
                 * P2P-client
                 * P2P-GO
        Band 1:
               Capabilities: 0x19e3
                       RX LDPC
                       HT20/HT40
                       Static SM Power Save
                       RX HT20 SGI
                       RX HT40 SGI
                       TX STBC
                       RX STBC 1-stream
                       Max AMSDU length: 7935 bytes
                       DSSS/CCK HT40
               Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
               Minimum RX AMPDU time spacing: 8 usec (0x06)
               HT TX/RX MCS rate indexes supported: 0-23
               Frequencies:
                       * 2412 MHz [1] (30.0 dBm)
                       * 2417 MHz [2] (30.0 dBm)
                       * 2422 MHz [3] (30.0 dBm)
                       * 2427 MHz [4] (30.0 dBm)
                       * 2432 MHz [5] (30.0 dBm)
                       * 2437 MHz [6] (30.0 dBm)
                       * 2442 MHz [7] (30.0 dBm)
                       * 2447 MHz [8] (30.0 dBm)
                       * 2452 MHz [9] (30.0 dBm)
                       * 2457 MHz [10] (30.0 dBm)
                       * 2462 MHz [11] (30.0 dBm)
                       * 2467 MHz [12] (disabled)
                       * 2472 MHz [13] (disabled)
                       * 2484 MHz [14] (disabled)
       Band 2:
               Capabilities: 0x19e3
                       RX LDPC
                       HT20/HT40
                       Static SM Power Save
                       RX HT20 SGI
                       RX HT40 SGI
                       TX STBC
                       RX STBC 1-stream
                       Max AMSDU length: 7935 bytes
                       DSSS/CCK HT40
               Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
               Minimum RX AMPDU time spacing: 8 usec (0x06)
               HT TX/RX MCS rate indexes supported: 0-23
               VHT Capabilities (0x338001b2):
                       Max MPDU length: 11454
                       Supported Channel Width: neither 160 nor 80+80
                       RX LDPC
                       short GI (80 MHz)
                       TX STBC
                       RX antenna pattern consistency
                       TX antenna pattern consistency
               VHT RX MCS set:
                       1 streams: MCS 0-9
                       2 streams: MCS 0-9
                       3 streams: MCS 0-9
                       4 streams: not supported
                       5 streams: not supported
                       6 streams: not supported
                       7 streams: not supported
                       8 streams: not supported
               VHT RX highest supported: 0 Mbps
               VHT TX MCS set:
                       1 streams: MCS 0-9
                       2 streams: MCS 0-9
                       3 streams: MCS 0-9
                       4 streams: not supported
                       5 streams: not supported
                       6 streams: not supported
                       7 streams: not supported
                       8 streams: not supported
               VHT TX highest supported: 0 Mbps
               Frequencies:
                       * 5180 MHz [36] (17.0 dBm)
                       * 5200 MHz [40] (17.0 dBm)
                       * 5220 MHz [44] (17.0 dBm)
                       * 5240 MHz [48] (17.0 dBm)
                       * 5260 MHz [52] (23.0 dBm) (no IR, radar detection)
                         DFS state: usable (for 1536 sec)
                         DFS CAC time: 60000 ms
                       * 5280 MHz [56] (23.0 dBm) (no IR, radar detection)
                         DFS state: usable (for 1536 sec)
                         DFS CAC time: 60000 ms
                       * 5300 MHz [60] (23.0 dBm) (no IR, radar detection)
                         DFS state: usable (for 1536 sec)
                         DFS CAC time: 60000 ms
                       * 5320 MHz [64] (23.0 dBm) (no IR, radar detection)
                         DFS state: usable (for 1536 sec)
                         DFS CAC time: 60000 ms
                       * 5500 MHz [100] (disabled)
                       * 5520 MHz [104] (disabled)
                       * 5540 MHz [108] (disabled)
                       * 5560 MHz [112] (disabled)
                       * 5580 MHz [116] (disabled)
                       * 5600 MHz [120] (disabled)
                       * 5620 MHz [124] (disabled)
                       * 5640 MHz [128] (disabled)
                       * 5660 MHz [132] (disabled)
                       * 5680 MHz [136] (disabled)
                       * 5700 MHz [140] (disabled)
                       * 5745 MHz [149] (30.0 dBm)
                       * 5765 MHz [153] (30.0 dBm)
                       * 5785 MHz [157] (30.0 dBm)
                       * 5805 MHz [161] (30.0 dBm)
                       * 5825 MHz [165] (30.0 dBm)
       valid interface combinations:
                * #{ AP } <= 8,
                  total <= 8, #channels <= 1, STA/AP BI must match
       HT Capability overrides:
                * MCS: ff ff ff ff ff ff ff ff ff ff
                * maximum A-MSDU length
                * supported channel width
                * short GI for 40 MHz
                * max A-MPDU length exponent
                * min MPDU start spacing
root@OpenWrt:/#

You would see that this radio has both 2.4GHz and 5GHz. At 5GHz, it supports 80MHz, which is 802.11ac.

Chaos Calmer

Please use: https://downloads.openwrt.org/chaos_calmer/15.05/ar71xx/generic/openwrt-15.05-ar71xx-generic-wpj344-16M-squashfs-sysupgrade.bin

The openwrt-15.05-ar71xx-generic-wpj344-16M-kernel.bin and openwrt-15.05-ar71xx-generic-wpj344-16M-rootfs-squashfs.bin are not needed.

The single line u-boot command to flash this firmware is:

tftp 0x80060000 
openwrt-15.05-ar71xx-generic-wpj344-16M-squashfs-sysupgrade.bin&&erase 
0x9f030000 +$filesize&&cp.b $fileaddr 0x9f030000 $filesize

The u-boot command to erase the old firmware kernel (u-boot will load old kernel if this is not done):

erase 0x9f680000 +0x10000

OpenWRT Build FAQ

Question 1. During the first build, we face issues that says that error: Couldn't resolve host 'github.com' while accessing https://github.com/kvalo/ath10k-firmware.git/info/refs?service=git-upload-pack fatal: HTTP request failed

Answer:

This meant that there are some issues with the internet connection, or the github.com might be down. Please check your internet connection or wait some time for the github.com to be back up.


Question 2. Is there any size limit, that the firmwares or root file system or kernel should not cross for WPJ344 or other boards?

Answer:

This file: openwrt\target\linux\ar71xx\image\Makefile is responsible for generating the final image.

There is a line in this file that specify the size limit of the kernel and rootfs: $(eval $(call SingleProfile,AthLzma,$(fs_64k),DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),1441792,6488064,RKuImage))

For eg. for a 8MB board, the max kernel size is 1441792, and the maximum rootfs size 6488064. If you have included packages that exceed the size, some of the packages would need to be removed.


Question 3. How to change the OpenWRT to make it work with 16MB board?

Answer:

Referring to question 2 above, the same file, you would need to change 2 lines.

8MB:

db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)

16MB:

db120_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,1536k(kernel),14528k(rootfs),64k(nvram),64k(art)ro,16064k@0x30000(firmware)

8MB:

$(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),RKuImage))

16MB:

$(eval $(call SingleProfile,AthLzma,64k,DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),KRuImage))


Question 4. How does these errors comes about? Q4 Q A.png

Answer:

Wrong files were flashed. There was error flashing kernel, because the size of 2228224 is too big. Normal kernel file is about 1MB. Also, the rootfs flashed is about 1MB, normal size should be greater than 2MB. Normally this is due to the files being renamed wrongly (as of Section on OpenWRT_Build_Instructions#Older_method_of_upgrading_the_firmware_into_the_board). Check again that the right files are properly named.


Question 5. I have the firmware up and running, but I cannot access the internet yet, what might have happened?

Answer:

It is most likely you have not configured /etc/config/network for internet access. You can set up WAN and LAN connection over there.


Question 6. How do I configure WAN/LAN with WPJ342’s OpenWRT firmware?

Answer:

To try out WAN and LAN with current openwrt firmware, run:


uci set network.lan.ifname=eth0.1
uci set network.wan=interface
uci set network.wan.ifname=eth0.2
uci set network.wan.proto=dhcp

uci add network switch
uci set network.@switch[0].name=eth0
uci set network.@switch[0].reset=1
uci set network.@switch[0].enable_vlan=1

uci add network switch_vlan
uci set network.@switch_vlan[0].device=eth0
uci set network.@switch_vlan[0].vlan=1
uci set network.@switch_vlan[0].ports="0t 2 3 4 5"

uci add network switch_vlan
uci set network.@switch_vlan[1].device=eth0
uci set network.@switch_vlan[1].vlan=2
uci set network.@switch_vlan[1].ports="0t 1"

uci commit network
reboot


Question 7. Is there a single image file that I can use with WPJ344?

Answer:

Openwrt default single file firmware for wpj344 is:

bin/ar71xx/openwrt-ar71xx-generic-db120-squashfs-sysupgrade.bin

IMPORTANT NOTE: This is not cpximg format firmware, so cpximg cannnot be used.

To flash this firmware (16MB version) using u-boot, run:

tftp 0x80060000 openwrt-ar71xx-generic-db120-squashfs-sysupgrade.bin
erase 0x9f030000 +$filesize
cp.b $fileaddr 0x9f030000 $filesize

To flash the 8MB firmware using u-boot, run:

tftp 0x80060000 openwrt-ar71xx-generic-db120-squashfs-sysupgrade.bin
erase 0x9f050000 +$filesize
cp.b $fileaddr 0x9f050000 $filesize

Note: The Openwrt firmware update function is meant for the original 8MB, it will not work for the 16MB firmware. Minor changes to SDK are required.

Alternatively, more changes to the SDK can be made to support building cpximg format firmware, and firmware update support for cpximg firmware.

Note: Compex supported “cpximg” in CompexWRT firmware, a firmware based on OpenWRT. We do not provide any support to “cpximg” in the original OpenWRT firmware.