Loading...

OpenWRT on ARM-based platform (Raspberry PI 2)

Vrijdag, Maart 27, 2015
Volgens alle artikels
The OpenWrt project started in January 2004. The first OpenWrt versions were based on Linksys GPL sources for WRT54G and a buildroot from the uclibc project. This version was known as OpenWrt "stable release" and was widely in use. There are still many OpenWrt applications, like the Freifunk-Firmware or Sip@Home, which are based on this version.
Now we are using Barrier Breaker version 14.07 (started in October 2014).

In this article we will show how to start OpenWRT on Raspberry PI 2 (with Broadcom BCM2836, ARM Cortex-A7 Quad core).

Raspberry PI 2 board

We are using Ubuntu 14.04.2 LTS (64-bit) for building SD card image.
Link to image file for RPI2 below.

Step 1: Preparing Ubuntu:
sudo apt-get update
sudo apt-get install git-core build-essential libssl-dev
sudo apt-get install subversion mercurial


Step 2: Download the OpenWRT with git:
git clone git://git.openwrt.org/openwrt.git

this creates a directory 'openwrt', which is the OpenWrt Buildroot build-directory
the OpenWrt toolchain "OpenWrt Buildroot" is included.

Step 3: Download and install all available "feeds":
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a

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

Step 5: Setup Wi-Fi kernel modules for WiPi USB stick (optional):

openwrt-menuconfig-wireless.jpg
Also do not forget to build wpa_supplicant and wi modules.

Step 6: If you need to build LuCI Web interface for OpenWRT so please set component in LuCI->Collections. Also possible to install LuCI later with opkg.
Step 7: Save and exit from menuconfig
Step 8: Start building process:
make
or the build process can be accelerated by running multiple concurrent job processes using the -j-option ()
make -j 3
  • Use the standard formula <your number of CPU cores + 1>
  • If this produces random build errors try compiling again without the -j-option
  • If for some reason the build fails, the easiest way to spot the error is to do:
make V=s 2>&1 | tee build.log | grep -i error

Step 9: Go to the openwrt/bin/brcm2708 and you will find openwrt-brcm2708-bcm2709-sdcard-vfat-ext4.img file. Use dd to copy it to SD card:
sudo dd if=openwrt-brcm2708-bcm2709-sdcard-vfat-ext4.img of=/dev/sdX bs=2M conv=fsync
  • sdX - put your SD card dev (sdb, sdc, ..).
  • Don't forget to unmount SD partitions with umount and make sync after dd will done.
Step 10: Insert SD to your Raspberry PI 2, connect UART-USB cable, insert WiPi stick (if you need) and connect power.

Raspberry PI 2 GPIO header pinout:
Raspberry PI 2 GPIO ext

Step 11
: First configuration: in UART-USB console write passwd to set a new password for the user root:
passwd

Step 12
: Reboot RPI 2:
reboot

Step 13: If you need to install LuCI (not install from menuconfig):
vi /etc/opkg.conf

fix opkg.conf file with correct link:
http://downloads.openwrt.org/snapshots/trunk/brcm2708/generic/packages/base

opkg update
opkg install luci
opkg install luci-ssl
opkg list | grep luci-i18n-
/etc/init.d/uhttpd start
/etc/init.d/uhttpd enable

Now LuCI will boot each time after RPI 2 will boot.

Open your browser and connect to the router at its default address (usually 192.168.1.1). Login using username root with root password.

If you need Wi-Fi connection to Access Point:
mkdir /etc/wpa_supplicant
vi /etc/wpa_supplicant/wpa_supplicant.conf

put in /etc/wpa_supplicant/wpa_supplicant.conf file:
update_config=1
network={
        ssid="AP name"
        psk="your key"
        scan_ssid=1
        proto=WPA RSN
        key_mgmt=WPA-PSK
        group=CCMP TKIP
        pairwise=CCMP TKIP
        priority=5
}

Start Wi-Fi connection in background task:
wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant/wpa_supplicant.conf & 

Put name resolving server in /etc/resolv.conf file:
vi /etc/resolv.conf

nameserver <put your router IP here>
nameserver 8.8.8.8

Save file.

Add default router:
route add default gw <put your router IP here>