18 Sep 2025
------------

Finally there is some progress after the last attempt. The only way to do
something properly is to read the manual!

Tried to look for a suitable U-boot, and that pointed me to a wiki site by
Rockchip that has details about how to build a working U-boot for different
Rockchip SoCs. Some more searching led me to the rkbin project that has pre-
built binaries like BL31, which are the loaders and trusted platform thingy
that are required to make a workable image.

It was very lucky that I tried building it on the WSL of my Windows work PC,
in a boring night during business trip. The build process, I assume, is quite
easy on Linux but I doubt it will be as smooth on at least my OpenBSD home PC.
But once the make is done, there is just one binary that I will need which is
the "u-boot-rockchip.bin", the same name as the file I can find on the OpenBSD
ARM64 installation guideline.

The binary has already got the idbloader and stuffs bundled, so what I did was
simply flash again the miniroot to the E20C, then flash the U-boot binary into
the box with an offset of 0x40 (64 in decimal so matches with the expected
offset in the OpenBSD guide). The E20C then actually booted up!

The only thing is...even the miniroot is an installation program! So to make
it the final working image, I think I have to connect it to the network via a
LAN cable, install the system to an SD card, then move the installed image to
the eMMC.

I have never compiled a U-boot image before, so this is a great experience. I
also learned that there are some pre-built U-boot packages in OpenBSD Ports,
will be very helpful if one day I want to do something funny with my ASUS
Tinker Board 2S that has the offical Android in it and collecting dust.


27 Aug 2025
------------

I think this date thing makes less and less sense, especially when I tend to
do my fun stuffs past midnight. But then I thought "oh, but if I don't put it
in I won't remember when I did what after a month", so I will just put it in.

In the end I decided to figure out what's happening with the compilation of
the rkdeveloptool. It happened to me too many times - something I thought
would be very time consuming turned out to be very simple, so I learnt to try
before asking. A simple web search has already pointed me to the answer: I
didn't have GNU Automake in my system...

So I installed Automake and Autoconf, exported the 2 environment variables,
and whoosh, the autoreconf -> configure -> make finished in no time.

I re-read what the flashing guide was saying, and it seems it has nothing to
do with loading the SPI loader in. It is purely for readying the board to work
with rkdeveloptool. So I flashed the miniroot77.img into the eMMC again, still
didn't work. I did download as well the stock OS, or iStoreOS as they call it.
Same procedure, different result - the router worked again, booted up with
iStoreOS.

Now, if I believe that the OpenBSD kernel is really working on the E20C, what
I will have to do is flashing the right images according to the pre-defined
partitioning of the board, so probably a Rockchip first stage loader, then a
working U-Boot, then the kernel image and lastly the userland filesystem.

Reminds me of the Palm Pre Plus that I used to have. The bootloader, called
"bootie", was so easy to work with so that I just needed to put an updated
Linux kernel into the boot sector, then create my own rootfs and done...

One more thing before I forget...I have my highest gratitude for you all:

   - dd(1)
   - usbdevs(8)
   - cu(1)
   - fdisk(8)
   - newfs(8)
   - disklabel(8)
   - vnconfig(8)
   - mount(8) and umount(8)

   - /dev/zero for helping to zero out the disks
   - /dev/cuaU0 for linking up with the serial device
   - /dev/vnd0 for managing .img files for me

Thank you thank you thank you!


26 Aug 2025
------------

Not going smooth but it's only myself to blame. :(

When I was imagining the plan, I assumed that the board will take the SD card
as the boot media. It doesn't! I guess the SD card option is simply for mass
storage. So what happened was..

   - The board has...
       > Two RJ-45 ports for WAN and LAN
       > One USB-C port just for power
       > One USB-C port that is actually USB-to-UART, serial port for TTY or
         flash tools
   - So, first you have to trust the board to be able to boot up
   - Connect to the serial output via the debug port (another handy thing
     about OpenBSD - it has cu(1) out-of-the-box)
   - If it boots into the stock OS (iStoreOS), you will see the TTY
   - If it doesn't, probably it is in MaskROM mode

Rockchip provided a tool called "rkdeveloptool" that helps flashing ROMs into
the eMMC, but the catch is that it is pre-built only for the popular OSs.

Fair enough, I will build it myself...It uses Autoconf...failed miserably...

Just wanted to cross check if the tool is actually compiling, so I did it with
my work computer's Debian WSL. The process was completely painless...the tool
got compiled in an instant, no struggles at all...

I searched for alternatives and came across a suggestion with a pakcage called
pv (pipe viewer). It is available in OpenWrt and the iStoreOS is actually
based on OpenWrt, so the package manager opkg is available as well as pv. The
idea is simply reading the image on the mass storage (i.e., SD card) and pipe
it to DD, write directly to your current disk. So...rewire your brain with
your brain...

But it sounded okay, so I gave it a try. I took the SD card out to re-format
it into FAT-32, a bit of search online but glad that I now also know how to do
it in OpenBSD. I then downloaded the miniroot image, installed pv on the E20C
and executed the command.

The board failed to boot up. From the official guide there is an SPI loader,
the bootloader that should be put in front of the OS image. I didn't put it in
but now I think I should.

Now there are 2 options...

   1) Figure out how to compile the "rkdeveloptool" in OpenBSD
   2) Use my spare Raspberry Pi Zero 2W to do the work

The Raspberry Pi 4B would be a better fit for option 2, I guess. But because
my Google Photo's storage space has been used up, I urgently appointed it as
my new photo server, installed Immich and uploaded all the photos to it in the
past 2 days. My little one loves watching videos of his even younger self. My
wife said those are his precious memories that we should keep access for him,
and I agree. Finally put some good use in the 4B board, and now planning to
setup a DDNS for it so that we can access it from Internet, as well as an SFTP
for my dad to download his grandkid's photo. More tinkering then...I think I
am quite good at finding unending, high-effort-low-return works to do just to
kill time.

I am in favour of option 1 while option 2 seems rational...But when time isn't
a constraint, fun is what that matters.


19 Aug 2025
------------

Just in a hurry to do the justice - I just followed what was on DD man page
and wrote the image to the SD card. DD is essentially the same, though I did
not put "sync=xxx oflag=xxx" switches.

The device to write on was /dev/rsd1c. I am (super slowly) reading "OpenBSD
Mastery: Filesystems", by Michael W Lucas, on my very small Woxter 195S and
it feels magical to be able to understand why there is an "r" and why it is
the "c" partition to be written on.

I read another book from the same author, "Ed Mastery". Not too long but
covers the essentials. Very good for beginners like me. I have "Httpd and
Relayd Mastery" as well, and plan to buy more later.

Anyways, I didn't procrastinate! It was a remarkable triumph in the history of
my home network!


18 Aug 2025
------------

The Radxa E20C, together with a Liberty (Paw Patrol) plush doll, arrived
yesterday. Sounds dramatic to write a long passage for a typically 5-minutes
job but I will put it into the log for completeness.

While I was washing the dishes, I was thinking "let's just put OpenBSD into
the box and call it a day". After everything, kiss the kid goodnight, I found
an old 32 GB SD card that should be working to get started.

Turned on my PC. I have a Perixx keyboard with 2 USB ports, which helps make
things easier for me. I plugged the USB card reader in, at the same time went
to download a 7.7 image from the FTP.

I used to DD a lot on Linux because of the Raspberry Pis and an ASUS Tinker
Board, but all in a sudden I realised that I haven't done that yet on OpenBSD,
not even once. My guilty call is that my PC couldn't even complete a dump(8)
process, so I have never plugged a USB thumb drive in and move files. The AVR
ATtiny45 chip that makes me happy also has been keeping the USB ports busy to
justify for having them.

I always know there is no "lsblk" in OpenBSD, and you figure out the device by
looking at dmesg. But I just searched online anyway, and got the same answer.
I looked at the dmesg log which showed "sd1". Makes sense. Now do I know how
to use DD? Seems not so sure...I went to the man page, but also was thinking
about a better way to find out the USB device name. I used "man -k", a trick
I learned from Daemon Forums, but could only find "usbdevs" - the command that
I used to check if the ATtiny45 chip's USB programmer could be detected, then
forgot about its existence.

I didn't finish reading the DD man page. I think it is procrastination, but I
just fell asleep on the sofa for a few minutes. Woke up, decided to go to bed
earlier, I didn't write the OpenBSD image to the SD card yet.

There is always tomorrow! (feeling guilty)


15 Aug 2025
------------

My Router (to be).

Probably because I have been self-hosting quite a few things for daily use, I
am a believer of what some cybersecurity experts said - the big tech products
like stock Google Android, iOS, etc., are usually more secure than alternative
solutions.

I think I get it. They are not saying that alternatives, sometimes even open
source solutions, are insecure by nature. They are more talking about how easy
users can make holes in a perfectly waterproof sheet to render it useless.

I don't have too many experiences hosting online services, and all my self-
hosted services are for either myself or my few friends, so my opinion is
never authoritative. I have my own VPN, SSH to the cloud server of course,
then a few web services for my daily needs, self-hosted bare-bones Git repos,
and a few more that aren't always on but mainly for learning purpose, such as
XMPP, Matrix, etc. Every time when I set up something new on my cloud server,
I try to make it as secure as I can. I may miss something but I keep thinking,
hopefully to prevent as many online threats as possible. But if I think it is
too risky to go self-hosted/self-built, I will use proven products in the
market, even they are proprietary or from big techs.

I am using an old Eero mesh router. It works quite well. The setup was easy,
done through an app. But then I saw a Lemmy thread about de-Amazon. I am not
too against big techs so normally I will just move on. But this time I was
thinking "why shouldn't I build my own router?".

Be it for fun or for work in future, I think this is what I will do (alongside
with loads of WIP personal projects). I plan to use OpenBSD and PF. I have
ordered, ironically from Amazon, a Radxa E20C which is the latest supported
hardware in OpenBSD 7.7. One great piece of info I found on Internet is that
Eero routers have a bridge mode which can be used as access points. I plan to
buy a powerful access point later, so the current Eero set will work for now.

I will leave this phlog as a live log on the progress, partly to force myself
to not be lazy...