LEDE in RPI3 with 64-Bit kernel

Linux Embedded Development Environment in short LEDE is a fork of openwrt which is perhaps the most widely used open source project for WiFi routers. Openwrt has wide spread support for many WiFi routers from industry leading vendors and it even has a web interface by the name LUCI which helps us to configure the router with different configurations.

Why LEDE ?

For people who want to know why LEDE pls read the below link:
https://lwn.net/Articles/686767/

In one line, the fork is mostly for political reasons. Let us leave it right there and proceed to build LEDE for RPI3 with 64-bit linux kernel.

Why This blog

Sometimes lot of people want to rip open their WiFi router and modify the firmware for various reasons but afraid to do so. But at a time like this where getting a development board is not that much difficult. If the development board has USB port then we are pretty much covered with what we want to do. Now with RPI3 which is cheap, has inbuilt WiFi support and great community support we can pretty much do anything we want to do. That is one of the primary reasons in the first place to create this blog itself. And the other reason is that it is really simple to load LEDE into RPI3.

Get the source code

The source code is maintained using git and we can clone the code using the below command.

kasi@Vostro:/Sourcefiles/git$ git clone https://git.lede-project.org/source.git lede

Since we got the source code let us proceed further and configure it for RPI3.

Time to configure

This step is very simple as we just need to select target system, sub target and target profile. We can play around with the whole configuration but initially we just want to build LEDE for RPI3 and make sure it works as expected.

kasi@Vostro:/Sourcefiles/git$ cd lede

kasi@Vostro:/Sourcefiles/git/lede$ make menuconfig

The below screen shot shows the options chosen for target system, sub-target system and target profile.

menuconfig

Pls note that for target profile we have chosen 64-bit as we want LEDE to build a 64-bit kernel. Save the config from the menuconfig menu and exit.

We can now start the build with a simple make command.

kasi@Vostro:/Sourcefiles/git/lede$ make
make[1] world
make[2] tools/compile
make[3] -C tools/flock compile
make[3] -C tools/sed compile
make[3] -C tools/xz compile
make[3] -C tools/tar compile
make[3] -C tools/patch compile
make[3] -C tools/m4 compile
make[3] -C tools/autoconf compile
make[3] -C tools/pkg-config compile
make[3] -C tools/automake compile
make[3] -C tools/missing-macros compile
make[3] -C tools/libtool compile
make[3] -C tools/gmp compile
make[3] -C tools/mpfr compile
make[3] -C tools/mpc compile
make[3] -C tools/libelf compile
make[3] -C tools/expat compile
make[3] -C tools/flex compile
make[3] -C tools/bison compile
make[3] -C tools/mklibs compile
make[3] -C tools/sstrip compile
make[3] -C tools/make-ext4fs compile
make[3] -C tools/e2fsprogs compile
make[3] -C tools/mtd-utils compile
make[3] -C tools/libressl compile
make[3] -C tools/mkimage compile
make[3] -C tools/firmware-utils compile
make[3] -C tools/patch-image compile
make[3] -C tools/findutils compile
make[3] -C tools/quilt compile
make[3] -C tools/padjffs2 compile
make[3] -C tools/mm-macros compile
make[3] -C tools/cmake compile
make[3] -C tools/scons compile
make[3] -C tools/bc compile
make[3] -C tools/gengetopt compile
make[3] -C tools/patchelf compile
make[3] -C tools/mtools compile
make[3] -C tools/dosfstools compile
make[3] -C tools/lzma compile
make[3] -C tools/squashfs4 compile
make[2] toolchain/compile
make[3] -C toolchain/binutils compile
make[3] -C toolchain/gcc/initial compile
make[3] -C toolchain/kernel-headers compile
make[3] -C toolchain/musl compile
make[3] -C toolchain/gcc/final compile
make[3] -C toolchain/fortify-headers compile
make[2] target/compile
make[3] -C target/linux compile
make[2] diffconfig
make[2] package/cleanup
make[2] package/compile
make[3] -C package/libs/libubox host-compile
make[3] -C package/system/opkg host-compile
make[3] -C package/libs/toolchain compile
make[3] -C package/libs/libnl-tiny compile
make[3] -C package/libs/libjson-c compile
make[3] -C package/utils/lua compile
make[3] -C package/libs/libubox compile
make[3] -C package/system/ubus compile
make[3] -C package/system/uci compile
make[3] -C package/network/config/netifd compile
make[3] -C package/firmware/linux-firmware compile
make[3] -C package/firmware/prism54-firmware compile
make[3] -C package/kernel/linux compile
make[3] -C package/system/ubox compile
make[3] -C package/libs/ncurses host-compile
make[3] -C package/libs/ncurses compile
make[3] -C package/utils/util-linux compile
make[3] -C package/system/fstools compile
make[3] -C package/system/fwtool host-compile
make[3] -C package/system/fwtool compile
make[3] -C package/system/procd compile
make[3] -C package/system/usign host-compile
make[3] -C package/utils/jsonfilter compile
make[3] -C package/system/lede-keyring compile
make[3] -C package/system/usign compile
make[3] -C package/base-files compile
make[3] -C package/kernel/brcm2708-gpu-fw compile
make[3] -C package/firmware/b43legacy-firmware compile
make[3] -C package/network/services/hostapd compile
make[3] -C package/network/utils/iw compile
make[3] -C package/kernel/mac80211 compile
make[3] -C package/libs/mbedtls compile
make[3] -C package/libs/ustream-ssl compile
make[3] -C package/libs/uclient compile
make[3] -C package/network/utils/iptables compile
make[3] -C package/network/config/firewall compile
make[3] -C package/network/ipv6/odhcp6c compile
make[3] -C package/network/services/dnsmasq compile
make[3] -C package/network/services/dropbear compile
make[3] -C package/network/services/odhcpd compile
make[3] -C package/libs/libpcap compile
make[3] -C package/network/utils/linux-atm compile
make[3] -C package/network/utils/resolveip compile
make[3] -C package/network/services/ppp compile
make[3] -C package/network/utils/iwinfo compile
make[3] -C package/system/mtd compile
make[3] -C package/system/opkg compile
make[3] -C package/utils/busybox compile
make[2] package/install
make[3] package/preconfig
make[2] target/install
make[3] -C target/linux install
make[2] package/index
make[2] checksum
kasi@Vostro:/Sourcefiles/git/lede$

This build was done on a Ubuntu Mate machine. If the build has errors or it doesn’t build as expected then check for issues related to packages available in the host machine. But mostly those things can be resolved using a simple “sudo apt-get install <pkg-name>” command.

Check the build images

As we didn’t specify any target image types the final image is a simple gzipped image. We can check the built images in the build space at the location “bin/targets/brcm2708/bcm2710/

kasi@Vostro:/Sourcefiles/git/lede$ ls -l bin/targets/brcm2708/bcm2710/
total 7884
-rw-r–r– 1 kasi kasi 19458 Jul 6 18:49 config.seed
-rw-r–r– 1 kasi kasi 2271 Jul 6 19:20 lede-brcm2708-bcm2710-device-rpi-3.manifest
-rw-r–r– 1 kasi kasi 8039347 Jul 6 19:20 lede-brcm2708-bcm2710-rpi-3-ext4-sdcard.img.gz
drwxr-xr-x 2 kasi kasi 4096 Jul 6 19:20 packages
-rw-r–r– 1 kasi kasi 301 Jul 6 19:20 sha256sums
kasi@Vostro:/Sourcefiles/git/lede$

Unzip & load into Micro SD card

As we have successfully built the LEDE image for RPI3 we can now unzip it and load it into an Micro SD card ( 4GB Micro SD card was enough for this purpose). Let us first unzip the image with the below command.

kasi@Vostro:/Sourcefiles/git/lede$ cd bin/targets/brcm2708/bcm2710/

kasi@Vostro:/Sourcefiles/git/lede/bin/targets/brcm2708/bcm2710$ gunzip lede-brcm2708-bcm2710-rpi-3-ext4-sdcard.img.gz

The above command gives us the actual image which needs to be loaded into the Micro SD card. Insert the Micro SD card into the build machine and note down how it is being mounted along with the mount location.

kasi@Vostro:/Sourcefiles/git/lede/bin/targets/brcm2708/bcm2710$ sudo dd if=lede-brcm2708-bcm2710-rpi-3-ext4-sdcard.img of=/dev/mmcblk0 bs=4M

kasi@Vostro:/Sourcefiles/git/lede/bin/targets/brcm2708/bcm2710$ sync

After successfully executing the above command we can insert this MicroSD card into RPI3 and power it up.

Few things to note in the setup we have used

  1. No serial cable is connected to RPI3.
  2. No DHCP support too i.e no routers to provide IP as RPI3 is directly connected to the development host (Ubuntu Mate).

Let us use one of the great functionalities provided by IPv6 to connect to the RPI3. In short, let us use RPI3’s IPv6 link local address to connect to it. To know the IPv6 address of RPI3, wireshark can be used to monitor the network for neighbour advertisement and solicitation packets (this filter can be used ipv6 && icmpv6.type == 135). With link local address of RPI3 identified we will be able to ssh into it. This approach is a little bit different but it goes to show one more way to get access to RPI3. One issue with this approach is that if the bootloader or kernel crashes we may not be able to identify where it has crashed and we need to use the alternate methods (mostly use a serial cable) to identify the issue and then fix it. Since this build can be trusted this approach pretty much should work.

LEDE in RPI3

As said above RPI3 was connected through SSH using the IPv6 link local address and below are the details.

 

login_clean
RPI3 accessed through SSH

In the next blog let us enable LUCI, the web interface provided by LEDE in the build and access RPI3 through webpage.

 

2 thoughts on “LEDE in RPI3 with 64-Bit kernel

Leave a comment