Attempt to setup Helios4 OS. Doing configuration on local machine to avoid the need to login via the serial interface.

The original instructions are here: https://wiki.kobol.io/install/

Step 1. Download image

As per helios4 instructions.

The exact image used here is:

https://cdn.kobol.io/files/Armbian_5.91_Helios4_Debian_stretch_default_4.14.135.7z

Step 2. Extract to a local raw file system image

Using a 16GB SDCard on /dev/sdb.

Get the size with blockdev.

$ sudo blockdev --report /dev/sdb
RO    RA   SSZ   BSZ   StartSec            Size   Device
rw   256   512  4096          0     15931539456   /dev/sdb
$ sudo blockdev --getsz /dev/sdb
31116288

Extract the image:

$ 7z x Armbian_5.91_Helios4_Debian_stretch_default_4.14.135.7z 

Inspect the image:

$ fdisk -l Armbian_5.91_Helios4_Debian_stretch_default_4.14.135.img
Disk Armbian_5.91_Helios4_Debian_stretch_default_4.14.135.img: 1 GiB, 1107296256 bytes, 2162688 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xa2bbe6c4

Device                                                    Boot Start     End Sectors Size Id Type
Armbian_5.91_Helios4_Debian_stretch_default_4.14.135.img1       8192 2162687 2154496   1G 83 Linux

Create an image of the sdcard on the local filesystem. The ‘count’ parameter matches the output of ‘blockdev -getsz ‘. First make a blank raw image, then copy the OS image over this.

$ dd if=/dev/zero of=sdcard.img bs=512K count=$[31116288 / 1024]
$ dd if=Armbian_5.91_Helios4_Debian_stretch_default_4.14.135.img bs=1M seek=0 of=sdcard.img conv=notrunc

Find the next free loopback device (-f). Setup a loopback device with partitions (-P).

$ sudo losetup -f
/dev/loopX
$ sudo losetup -P /dev/loopX sdcard.img 
$ umount /dev/loopXp1 

Use GParted to resize the root ext4 filesystem.

$ gparted /dev/loopX

Step 3. Login and setup image

Mount the image.

$ mkdir rootfs
$ sudo mount /dev/loopXp1 rootfs/

Setup QEMU userspace emulation.

$ update-binfmts --display | grep arm
qemu-arm (enabled):
 interpreter = /usr/bin/qemu-arm-static
qemu-armeb (enabled):
 interpreter = /usr/bin/qemu-armeb-static
$ sudo cp /usr/bin/qemu-arm-static rootfs/usr/bin/

Login to the helios4 OS image.

$ sudo mount -o bind /dev rootfs/dev
$ sudo mount -o bind /dev/pts rootfs/dev/pts
$ sudo mount -o bind /proc rootfs/proc
$ sudo mount -o bind /sys rootfs/sys
$ sudo chroot rootfs usr/bin/env -i \
    HOME=/root                  \
    TERM="$TERM"                \
    PS1='HELIOS4 \u:\w\$ '              \
    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
    /bin/bash --login +h

Control-C after adding user account xxxx.

Log in again. Change root passwd. Add new user xxxx to sudo group.

$ passwd
$ usermod -a -G sudo xxxx

Exit and unmount.

Control-C
$ sudo umount rootfs

Write to SDCARD inserted to /dev/sdX.

sudo dd if=sdcard.img of=/dev/sdX bs=64M status=progress
sudo fsck /dev/sdb1

Insert and powerup. Use router to find ip address assigned by DCHP. Log in.

$ ssh 192.168.1.9
The authenticity of host '192.168.1.9 (192.168.1.9)' can't be established.
ECDSA key fingerprint is SHA256:5Y5Z3Nuriy7R52ZS3ZrQVOUbJAHkIOlRP9E+GQImIVg.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.9' (ECDSA) to the list of known hosts.
xxxx@192.168.1.9's password: 
 _   _      _ _           _  _   
| | | | ___| (_) ___  ___| || |  
| |_| |/ _ \ | |/ _ \/ __| || |_ 
|  _  |  __/ | | (_) \__ \__   _|
|_| |_|\___|_|_|\___/|___/  |_|  
                                 
Welcome to Debian Stretch with Armbian Linux 4.14.135-mvebu
System load:   0.91 0.34 0.12  	Up time:       1 min		
Memory usage:  2 % of 2018MB 	IP:            192.168.1.9
CPU temp:      41°C           	Ambient temp:  23°C           	
Usage of /:    7% of 15G    	

[ 0 security updates available, 1 updates total: apt upgrade ]
Last check: 2019-08-02 11:07

[ General system configuration (beta): armbian-config ]

New to Armbian? Check the documentation first: https://docs.armbian.com

My next step was to setup the OLED display.

https://wiki.kobol.io/i2c/#sys-oled-application