Foreword

Please be aware that any modification to your gateway, in particular a modification of U-Boot, may permanently brick your device and is not covered by warranty.

Compiling the Software

Obtaining the Source Code

The source code of this project is maintained with git.

git clone --recurse-submodules <repository>
cd smart-garden-gateway-public

Optionally, specific versions can be checked out (7.8.1 in this case):

git checkout release/linux-system-7.8.1

Older versions of the build system can be found in the history. However, only for the most recent master we intend to ensure that the build works.

Source code packages for all distributed versions can be found here.

Prerequisites

Build Instructions

Article Number 19005 (MediaTek MT7688)

scripts/bbwrapper.sh mt7688 gardena-image-foss-bnw linux-yocto-tiny

Article Number 19000 (Atmel AT91SAM)

scripts/bbwrapper.sh at91sam gardena-image-foss-bnw linux-yocto-tiny

Repository Layout

  • / Top level project.
    • /yocto/bitbake – the Bitbake build tool
    • /yocto/openembedded-core – OpenEmbedded core layer
    • /yocto/meta-distribution – our own distribution (specifies packages to install)
    • /yocto/meta-gardena – our own code (testing, WiFi provisioning, etc.)
    • /yocto/meta-openembedded – Collection of layers for the OE-core universe
    • /yocto/meta-readonly-rootfs-overlay – Writable rootfs overlay on top of a read-only rootfs
    • /yocto/meta-swupdate – Update mechanism software

Getting access

On both versions of the gateway, the UART port can be found on J7. Settings are 115200 8N1, the level is 3.3V.

Once connected, simply follow the instructions printed during startup.

Alternatively, right after powering up a gateway, pressing the 'X' key will grant access to the U-Boot shell.

Art. No. 19005

PCBA

Art. No. 19000

PCBA

Flashing

Installing a Custom Image

The easiest way to install a self-built kernel and rootfs is to fetch the images over the network from within U-Boot, using TFTP.

Ideally, the TFTP server (e.g. tftp-hpa) and the DHCP server (e.g. dnsmasq) run on the same machine, allowing the following steps to work:

  • Select the other boot slot: run do_toggle_bootslot

  • Write environment to flash storage: env save

  • Fetch kernel and rootfs over TFTP and write it to flash storage:

    Article Number 19005 (MediaTek MT7688)

    ubi part nand
    dhcp fitImage-gardena-sg-mt7688.bin && ubi write ${fileaddr} kernel${bootslot} ${filesize}
    dhcp gardena-image-foss-bnw-gardena-sg-mt7688.squashfs-xz && ubi write ${fileaddr} rootfs${bootslot} ${filesize}
    

    Article Number 19000 (Atmel AT91SAM)

    ubi part ubi
    dhcp fitImage-gardena-sg-at91sam.bin && ubi write ${fileaddr} kernel${bootslot} ${filesize}
    dhcp gardena-image-foss-bnw-gardena-sg-at91sam.squashfs-xz && ubi write ${fileaddr} rootfs${bootslot} ${filesize}
    
  • Restart the gateway: reset

Adding the Proprietary Bits

It is possible to install the proprietary packages via OPKG by doing the following in the Linux shell:

  • Update the OPKG feeds: opkg update
  • Install the packages:
    opkg install \
        accessory-server \
        cloudadapter \
        fwrolloutd \
        gateway-config-backend \
        gateway-config-frontend \
        lemonbeatd \
        lwm2mserver
  • Reboot gateway: reboot

Note

The read-write filesystem is (currently) not large enough to contain all the above packages. It is possible to resize the UBI volumes. However, that must be done with great care.

Restoring the Official Image

Unless the above instructions have been performed multiple times, reverting back to the official image is as simple as booting the previously used boot slot (from Linux):

fw_setenv bootslot $(( 1 - $(fw_printenv -n bootslot) ))
reboot

To install the official image through TFTP, fetch the files for the latest release from our server, e.g.

and follow the instructions in Installing a Custom Image. But, make sure you reference the correct rootfs file as the names differ.