OrangePi 4G-IoT Complete Pack

Since Andorid 8.1 is quite slow on the OrangePi 4G-IoT, I decided to give Andorid 6 a try. also provides for these packages, which is quite inconvenient… Here is a torrent, that contains all stuff for the 4G-IoT. In many torrent clients, you can choose, which files should be downloaded…

I’ve repackaged the tars, since xz is more dense than gz. It saves around 50% of space and traffic.

Enjoy the 4G-IoT 😉

Compile Ceph (master) on ARM (32-Bit)

TODO: Test this all on a virgin armhf system (raspberry, odroid hc1/2/XU4,…) and complete the TODOs for openssl and phantomjs (and the sass-dependency). Maybe with the new master tree, it is not needed to build it outside the ceph repo.

First install prerequisites:

sudo apt install python-pip build-essential libgmp-dev \
libmpfr-dev libmpc-dev reprepro

Install nodejs from

curl -sL | sudo -E bash - sudo apt-get install -y nodejs
sudo npm install -g npm

Then prepare a swap partition (you will need it 😉 )

dd if=/dev/zero of=/<some-hdd-path>/swapfile \
bs=1M count=8192 progress=status
mkswap /<some-hdd-path>/swapfile
swapon /<some-hdd-path>/swapfile

Then we should install some dependencies

sudo apt install libgmp-dev libmpfr-dev libmpc-dev ruby

Now install a new GCC that supports C++17.

tar xfJ gcc-8.2.0.tar.xz
cd gcc-8.2.0
./configure # for armhf
# ./configure --disable-multilib # for x86_64/arm64

Building ceph with do_cmake, building a debian package with or simply build packages using another compiler than the debian default one (6.3.0) requires you to change the default compiler e.g. to gcc-8.2.0 for the whole system:

sudo update-alternatives --install /usr/bin/cc cc /usr/local/gcc-8.2/bin/gcc-8.2 50
sudo update-alternatives --install /usr/bin/c++ c++ /usr/local/gcc-8.2/bin/g++-8.2 50

Checkout OpenSSL-1.0.2-stable (seems also necessary for armhf), PhantomJS, compile and install it:

cd /opt/GIT
git clone
cd openssl
git checkout OpenSSL-1_0_2-stable
# Following seems only necessary on arm
# (or all platforms wihtout precompiled binary)
cd /opt/GIT
git clone
cd phantomjs
sudo LD_LIBRARY_PATH=/opt/openssl_build_stable/lib/ \
deploy/ --bundle-libs

Add the following to (at L:244, just after PlatformOptions.extend)

phantom_openssl = os.getenv("PHANTOM_OPENSSL_PATH", "")
if phantom_openssl != "":
openssl = os.putenv("OPENSSL_LIBS", "-L" + phantom_openssl + "/lib -lssl -lcrypto")
openssl_include = "-I" + phantom_openssl + "/include"
openssl_lib = "-L" + phantom_openssl + "/lib"
platformOptions.extend([openssl_include, openssl_lib])
print("Using OpenSSL at %s" % phantom_openssl)

Then install it to /opt

Build and compile Ceph

git clone
cd ceph
git checkout wip-32-bit-arm-fixes
./ # for armhf
# ./ # for x86_64/amd64 or arm64
cd build
make -j4
# if it gets really slow due to swapping, break an do make -j1
# or use the scheduler-script from link below

Here you can find a rudimentary (but working) script that suspends compilers processes based on total compilers memory consumption. Running it through ‚watch‘-tool you can start e.g. 8 tasks and when memory limit is reached, it will suspend (kill -TSPT) the youngest tasks in sense of user space runtime.

Now do…

cd ..   # Back to ceph base dir
./ # for armhf
# ./ # fox x86_64/amd64 or arm64

If you encounter problems with setuptools (Exception –> TypeError: unsupported operand type(s) for -= ‚Retry‘ and ‚int‘) try to get a more recent version of python pip with the following commands and rerun

apt-get remove python-pip python3-pip

If I forgot anything to make it work, feel free to write some comment…

Compiling Software on RAM-limited Multi-Core Systems

Since I often compile stuff on embedded ARM targets that are well equipped with processing power (Exinos Octa-Core), but are neglected regarding RAM (2G), I often facing the trade-off between running multiple or only a single/few compilation jobs (make -j8 vs. make -j1). If you start too many jobs and if you have large compilation units (e.g. with the Ceph Project sources), the system will feel like jam, as soon as it begins swapping.

I feel, that deciding the job count at the very beginning is (was) a trade-off, I was not willing to accept. Therefore, I decided to write a little script to suspend compile processes, that cross a certain memory limit. This way, the suspended processes get moved to swap and the still runnig processes get a comfortable amount of RAM. This way, the kernel is not forced to move pages around with every scheduling round. Instead, it will move it once on swap for suspended processes, when it needs RAM for the running ones and as soon as the processes with large memory footprint finish, the supended ones get back to live.

Welp, I decided to base the priority on the time the processes ate up user space processing time, so the older ones (often the most memory hungy ones) get processed first. This scheduling scheme proofed to be a optimal descision, that is also not hard to implement as a bash script.

Here you can find the little script, that needs to be run within a loop or simply with the watch-tool (maybe with sudo).

watch scripts/linux/bash/

Happy compiling!

Google ChromeCast’s (Smartphone) Independance Day

Have you ever been upset about your chromecast heavy depency on a smarthphone. So, nor do I, but my wife complained, since she always drops her phone somewhere else around the house… What could you do about it? Chromecast hardly has other input options and writing against it’s API is not an easy task.

I’d not be an embedded electronics engineer, if I would not have a solution to that… My house currently runs an EQ-3 (former part of ELV, now two somehow independent companies) homematic smart home and around 80 nodes connected to it, anything from simple wireless switches to RGBW-Led-Stripes. If you put an Odroid HC-x beside with iobroker running on it, connecting the world is not enough :-). But EQ-3 also offers nice modules for makers like the HM-MOD-EM-8 for just a few bucks. Equipped with that module and some Bread-Board, there is nothing as easy as building a 8-Button HMI. Since it is not a hard task (only a few wires and some buttons), I decided to give ALLPCB a try, sketched a shematic and a PCB within KiCAD (for my first time) and ordered it from ALLPCB. Since I plan to distribute some more of these gadgets around my house, I ordered 30 for just $1.50/piece.

Here is the result:

Now, just install the iobroker.scenes and iobroker.chromecast plugin and feel free to connect your buttons to scenes. Your Chomecast is now free like Willi 😉

And here are the KiCad-Design files: