Skip to main content
Patrick’s Preoccupations
  • Contact
  • Notes
  • Projects
    • Hedgehog Camera
      • Installing OpenWRT

Hedgehog Camera contents

  • Hedgehog Camera
    • IR illuminator
    • Powering the router
    • Installing OpenWRT
    • Video capture
    • USB flash drive power
    • PIR motion detector
    • Webcam unreliability
    • Better automation
    • USB flash drive failure
    • Footage

Installing OpenWRT on a BT Home Hub 5 Type A

By Patrick Wigmore, May 2020, published: 16 July 2023, updated July 2023

OpenWRT

Out of the box, the BT Home Hub’s software doesn’t do very much except connect to BT Broadband services. This limits its usefulness as a wildlife camera, so I installed OpenWRT on it.

Connecting to the UART

After testing that the router worked and performing a factory reset (optional), it was time to connect to the serial UART.

You can do this without soldering, but I find soldering to be the easiest method. It is important to secure the wires using sticky tape or glue first. If you don’t secure them, they are liable to rip the copper pads off the board, causing irreparable damage.

We also need a connection to BOOT_SEL (boot select); not part of the UART; which is used to instruct the CPU to enter UART boot mode.

Others have written about the necessary connections, but the basic details are:

  • The pad adjacent to R77 is TX (transmit)
  • The pad adjacent to R78 is RX (receive)
  • The pad for BOOT_SEL is just above R45

We also need a ground, and there are plenty of places to get one. The outer shell of the USB connector is a common suggestion. I took my ground from an unpopulated component footprint, which was nearer to the other connections.

Having done this before, I keep a small wiring harness made up with the required wires soldered onto a pin header, in colours matching those used in my USB-to-UART adapter.

Installing the software

UART boot

On a computer, a software serial terminal can be attached to the UART. I like to use minicom.

The Hub connects at 115200k and requires flow control to be turned off. The other parameters are defaults in minicom, so I don’t remember those.

BOOT_SEL needs to be connected to ground, momentarily, while switching the Hub on. Don’t leave the short in place for longer than necessary.

On the serial terminal, some output should appear. If it contains the word “UART”, then it’s successfully entered UART boot mode. If the BOOT_SEL connection isn’t good, then sometimes you have to switch it off and try again.

Once in UART boot mode, another bootloader needs to be sent down the serial line into the router. The OpenWRT project makes one available, in a file named lede-lantiq-bthomehubv5a_ram-u-boot.asc.

To transfer the file into the router, it’s possible to simply cat it.

cat lede-lantiq-bthomehubv5a_ram-u-boot.asc > /dev/ttyUSB0

/dev/ttyUSB0 should be replaced by the name of the USB UART adaptor to which the Hub is connected. (E.g.: On my system, it is usually /dev/ttyUSB1.)

If the serial terminal software is connected at the same time as cating the bootloader across, then you’ll see the router outputting some asterisks to indicate that the data is being received.

Booting the installimage

Once the payload has been received, the router boots into it. After some time, this provides a bootloader terminal prompt on which commands can be run.

The router can then be connected via Ethernet to a computer running a TFTP server. The computer should be listening on the IP address 192.168.1.2 and hosting the required file: lede-lantiq-xrx200-BTHOMEHUBV5A-installimage-v1.0.bin.

To download the file onto the router and then boot it, the commands

tftpboot 0x81000000 lede-lantiq-xrx200-BTHOMEHUBV5A-installimage.bin
bootm 0x81000000

are used. tftpboot downloads the file into memory, and bootm boots it.

Unfortunately, when the CPU has been booted in UART boot mode, it runs at a quarter of its normal speed. So, booting the installimage file is a slow process. At one point, the words “Press Enter to activate this terminal” appear, but it is premature. Eventually, however, the lights on the front of the router stop flashing green and turn blue, indicating that the booting is complete.

Preparing for OpenWRT installation

Up to this point, nothing has been installed or uninstalled. The router’s flash memory has not been touched.

The existing firmware can be backed up onto a USB flash drive, plugged into the router. The flash drive will auto-mount and instructions will appear on the terminal detailing how to use the firmware backup tool. Amongst other things, the backup contains device-specific calibration and defaults that only exist on that specific router.

After altering the Hub’s default bootloader with

prepare

the router is ready to run sysupgrade, loading an OpenWRT installation image from the USB flash drive.

However, the CPU is still in UART mode, running at quarter speed. Rebooting without BOOT_SEL solves that. Thanks to prepare, the router now goes straight into a bootloader command prompt, this time loaded from the router’s internal flash.

This bootloader expects the TFTP server to have the IP address 192.168.2.10, which is different than before, so the computer with the TFTP server needs to be reconfigured.

The installimage can then be TFTP-booted using the same command as before.

Finally, the sysupgrade command can be used to install the latest version of OpenWRT from the appropriate “sysupgrade.bin” file.

In this case, I installed version 19.07.2 from the file “openwrt-19.07.2-lantiq-xrx200-bt_homehub-v5a-squashfs-sysupgrade.bin”. Once the process is complete, the router can once again be rebooted to prove that installation was successful.

Configuring OpenWRT

Once installed, OpenWRT is easy to configure. Just connect a computer to the router via Ethernet and let the router assign it an IP address using DHCP. The configuration can then be accessed at http://openwrt.lan/.

I configured SSH key-based authentication and set a hostname: “hedgehog-hh5a”. It occurred to me that I had just created the “Hedgehog Home Hub” or “HHHH” for short.

Next, I configured hedgehog-hh5a to connect to our existing WiFi network as a client. This is easily done in the “Wireless” section of the configuration interface.

I also set up firewall rules to allow access to hedgehog-hh5a’s configuration interface and SSH server from the network to which it connects as a client. This is, very sensibly, blocked by default. I also modified the existing rules so that the router’s Ethernet ports can only be used to configure the router and not to get online via our WiFi. It’s pretty unlikely that anyone untoward would sneak into the garden and plug in a laptop, but even so there’s no point leaving the door wide open.

Bright LEDs are not really ideal on a device that’s supposed to be covertly recording garden animals, so I configured all the LEDs to switch off once the router has booted.

Finally, I needed some software to capture video from the webcam, which is covered on the page about video capture.

© 2017-2023 Patrick Wigmore