gpsTime

I think there is nothing more pleasing than having extremely precise measurements at your fingertips. Like time. While in the past it was quite problematic to measure time accurately (not talking about sundials, but... why not? ;)) - mankind has created one precise time source as the byproduct (read: "waste") for usage in accurate navigation: GNSS and their different kinds like GPS, Glonass, Galileo, BaiDou and others.

Taping into this time source and providing it to your local computer network via NTP has been done by countless people and is an extreme rewarding task. Is it necessary? Maybe not. Is it really cool? Yes. And now it is even easier as you don't need to configure it yourself, but can use the balenaHub and the preconfigured gpsTime project.

We do not waste time on fancy logos 😉

Basically you just need an RPi B+ (2/3/4), Micro SD Card, Powersupply and 3v3 TTL Level GPS Module with PPS Output. The rest is just done by going on the balenaHub entry shown above, creating a free account and flashing balenaOS onto your SD card, booting the RPi on the internet for the first time and let it get the needed containers. Afterwards you can use the RPi offline and still enjoy your precise time source.

A watterott CQM-M8Q Breakout and an good old RPi 2B+ are more than powerful enough

More details can be found in the Github Repo and you can work and improve that project to your hearts content. I am probably going to do an PiAndMore talk about it - and use the project myself as a block for precise timing in some support equipment.

NFS Benchmarking RPi 3B, RPi 3B+ & BPi

3-14, PiDay. Sadly the day Stephen Hawking passed away - and the day the new Raspberry Pi 3B Plus was unveiled.
Some days later, I got a small package:

With that small thing at hand, I was looking through the list of changes:

  • Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz
  • 2.4GHz and 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2, BLE
  • Gigabit Ethernet over USB 2.0 (maximum throughput 300 Mbps)
  • Power-over-Ethernet (PoE) support (requires separate PoE HAT)

Ok, CPU bumped from 1.2 to 1.4 GHz, new WiFi with 802.11ac (and 5 GHz support), BLE 4.2, PoE "support" - and Gigabit over USB 2.0.
Well, not too bad.
One of the biggest downsides of the RPi - since its release - was the design choice to add Ethernet over USB 2.0 - while sharing the one and only USB 2.0 lane of the BCM with all the other USB sockets of the RPi. While this choice leads to lower production costs, it also limits the speed of Ethernet / USB especially in case where people tried to implement NAS or File sharing applications with an added USB Drive over Ethernet. To see how much the new design improved that old problem, I decided to Benchmark an "old" RPi 3B with the latest RPi 3B+ in the discipline of NFS.

Test setup:

  • Raspbian Stretch Lite (March 2018 / 2018-03-13 / Kernel 4.9)
  • WD PiDrive 314 GB as HDD via USB
  • Gigabit Ethernet Switch
  • Benchmarking system: Windows 10 with MS NFS Client, Crystal Disk Mark 4.0.3 and Gigabit Ethernet
  • NFS Exports Options: (rw,sync,no_subtree_check,all_squash,anonuid=65534,anongid=65534)

The benchmark started with the old RPi 3B and no surprises:

The RPi 3B is lacking throughput at its USB 2.0 lane.

Next up, was the new RPi 3B+:


And - yes - the new design really showed some improvement, to say the least.

However, I was wondering: What would happen if I added an SBC with a real USB 2.0 connection and real Gigabit Ethernet to the test?
Well - I did that. Welcome the now 4 years old Banana Pi 1:

We are talking here about a 1 GHz Dual Core A20 processor with 1 GB RAM which is - i need to repeat - 4 years old - releases just 2 months before the Raspberry Pi 1 B+ came out - I direct competitor of the RPi 1st Generation. But, what happens if we use the SATA port - which is also included on the BPi? With... lets say... some Samsung 850 EVO 250 GB SSD - which I had laying around? 😉

And what happens if I plug that in via USB?

Ok. Thats a bit confusing, to say the least. Could be that the SATA port is actually just coupled via USB to the BPi - however, I saw benchmarks on which the SATA port performed a lot better on the BPi. For this benchmark, I used ARMBIAN:

ARMBIAN Debian Server mainline Kernel
Armbian_5.38_Bananapi_Debian_stretch_next_4.14.14
Welcome to ARMBIAN 5.38 stable Debian GNU/Linux 9 (stretch) 4.14.18-sunxi

So, bundling an SSD with some old SBC board will not give you the needed freedom to just drop buying expensive storage for your datacenters and replacing them with small boards - sadly ;). However, we could see that the new RPi 3B+ improved a lot in one of its weak points - but still gets beaten by an very old - and still very feisty rival.

Running resin balena on Raspberry Pi 3

Just two days ago, resin.io announced balena their new, moby based container engine. Basically, it is a Docker-dropin-replacement for IoT Devices: It is compatible with Docker and Docker Hub, gains a lot of stabilty with atomic pulls, more conservative flash memory use - as well as smaller updates due to true container delta pulls. Also, it comes bundled as single file, is smaller in size and as easy to use as Docker. So - a very good bundle.

However, this comes with the disadvantage of losing Plugin support, Swarm, Cloud logging, Overlay networking and Non-boltdb backed stores - which is a small price to pay, as none of these features are really needed in an IoT scenario.

balena is going to replace Docker in resin.io and resinOS in the near future - but I wanted to testdrive it right now, which ended up in me pluggin my Raspberry Pi 3 inflight from Zurich to Copenhagen and getting it "flying" ;).

To get it working, little is needed :):

1.) Download and install the latest Raspbian image (Stretch Lite should do the trick)

2.) Login to the RPi and run the installer: curl -sfL https://balena.io/install.sh | sh

(Always check the file before running it to shell, to be sure nothing bad happens!)

3.)

sudo balenad &

4.) Now you can use balena like docker with the command sudo balena

The whole thing works pretty good - this short scrible is just to get it working for using it in a hackish way - a real tutorial will come as soon as I get the time to make it really persistent and auto-starting... But.. Well ;). Living on the edge comes with sacrifices :).

If you're on Docker Con and want to meet up, just send me a message via Twitter, E-Mail or the Hallway Track - see you soon ;)!

[resinOS] Build resinOS from scratch

As the time of writing, resinOS is available for Download at Version 2.0.6+rev3.dev for Raspberry Pi 3. This build, however, is nearly 2 weeks old and in the meantime, something great happend: Docker has finally updated to Version 17.03.1 - upgraded from the old ~10 (ten-ish) version - which was not that cool (and without Swarm ;)). So, it is a good idea to get to know how to build your own resinOS in case you really want to live on the bleeding edge ;).

Install Dependencies (Ubuntu 16.04 LTS)

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
     build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
     xz-utils debianutils iputils-ping libsdl1.2-dev xterm

goto /, because this build will create very long filenames

cd /

clone the repo, maybe some root power is needed here 😉

git clone https://github.com/resin-os/resin-raspberrypi
cd resin-raspberrypi
git submodule update --init --recursive

you would be done here and could build your own resinOS with the build command,
however, if you really want to pull the latest upgrades...

cd layers/meta-resin
git checkout master
git pull
cd ../..

finally build resinOS for Raspberry Pi 3

./resin-yocto-scripts/build/barys -r --shared-downloads $(pwd)/shared-downloads/ --shared-sstate $(pwd)/shared-sstate/ -m raspberrypi3                       

after quite some time, you'll find the image in

build/tmp/deploy/images/raspberrypi3/resin-image-raspberrypi3.resinos-img

 

There is quite a lot of stuff you can change on your resinOS, so be sure to check out https://resinos.io/docs/custombuild/ for more documentation on that topic. Have fun :)!

[RaspPi] How To Compile OpenWRT Trunk with latest Raspberry Pi Kernel 3.10 for the RPi on Ubuntu 12.04

EDIT: This post is from 30.09.2013 and should be the "how to" to this post. However, I never released it for a now unknown reason. Because of the interest in this topic, I still will publish it today so that it can stand as some kind of documentation of what I did back then. However, I might not work anymore.

This is the latest Guide.

What are we doing here?
Building OpenWRT Trunk with the offical RPi 3.10 (next) Kernel.

Packages:
You can use some packages of the offical OpenWRT 12.09 Attitude Adjustment repo.
However, most kernel modules and stuff has to be built but yourself, as I
got no repo. Sorry!

Dependencies needed

sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip

Prepare Enviroment (Trunk)

cd ~
mkdir rpi_openwrt
cd rpi_openwrt
git clone git://git.openwrt.org/openwrt.git
cd openwrt
mkdir dl

Install Packages

./scripts/feeds update -a
./scripts/feeds install -a

Check Enviroment

make defconfig
make prereq

Download Kernel and Prepare:

cd /tmp

wget https://github.com/raspberrypi/linux/archive/rpi-3.10.y.tar.gz

tar xfvz rpi-3.10.y.tar.gz
mv linux-rpi-3.10.y linux-3.10.13
tar -cJvf linux-3.10.13.tar.xz linux-3.10.13/
mv linux-3.10.13.tar.xz ~/rpi_openwrt/openwrt/dl/

Prepare Target

cd ~/rpi_openwrt/openwrt/target/linux/brcm2708/

Remove the RPi Kernel specific patches

we don't need them because we use the ORIGINAL kernel

- and not some retailored standard kernel!

mv patches-3.10 patches-3.10.bkp
mkdir patches-3.10

check wheter the makefile does try to catch the right kernel version

vi Makefile

change LINUX_VERSION to LINUX_VERSION:=3.10.13

Prepare Generic Patches

cd ../generic/patches-3.10

Normally it should be ok to just remove some of the patches like this.

if make target/linux/{clean,prepare} V=99 does fail in patching stage

you would need to remove another patch here

but for the time beeing, lets kill these files which are known to

wreck it:

rm 063-arm-fix-fiq-vivt.patch
rm 880-gateworks_system_controller.patch

#Make
cd ~/rpi_openwrt/openwrt/
make menuconfig # Choose BCM2708 Chipset, Raspberry Pi Board, Exit and Save
make target/linux/{clean,prepare} V=99 # does extract kernel and patch it
make kernel_oldconfig # builds some tools
make kernel_menuconfig # configures kernel
make menuconfig # to change RPi Patterns, i.e.:

Packages rep:

Image configuration -> Version configuration options -> Release Repo to:

http://downloads.openwrt.org/attitude_adjustment/12.09/%T/generic/packages

Main Partition Size from 48 to 64:

Target Options -> Root File System Size, change from 48 to 64 MB or more

Exit and Save

make V=99 -j 3

Files are in ~/rpi_openwrt/openwrt/bin/brcm2708
( i.e. openwrt-brcm2708-sdcard-vfat-ext4.img )
New build:
make kernel_menuconfig
make menuconfig
make V=99 -j 3