Hi, OpenBSD / Orange PI Zero friends.

I was able to successfully install OpenBSD 6.7 on my Orange PI Zero - and
thought that for future reference, and for anyone else who may be interested
and searches this list, I should post the steps I followed.

# Step 1: Get a 3.3V USB to TTL adapter and connect to the 3 serial pins

I used a PL2303HX and 3 female-to-female DuPont cables. Connect the 3 cables
to the TX/RX/GND on the PL2303HX adapter, and the corresponding 3 pins for
RX/TX/GND on the Orange PI Zero. The 3 pins are on the PCB on their own,
next to the Ethernet jack - and going from the outside of the PCB towards
the inside, they are GND, RX and TX.

Once you plug your PL2303HX in your PC, you should get a new serial port.
Under Linux, it will be accessible via something like /dev/ttyUSB0;
and you can interact with it with any serial monitor program - e.g.

    minicom -D /dev/ttyUSB0 -b 115200

...or...

    picocom -b 115200 /dev/ttyUSB0

etc.

# Step 2: Preparing an SD card with the proper Orange PI Zero image

Since there's no specific image for Orange PI Zero, we need to do some
modifications to the "miniroot-cubie-67.fs" image provided by the OpenBSD
team.
I chose to do this from within OpenBSD, and to do it in a way that will work
for any host OS - via QEMU.

So I downloaded the i386 "cd67.iso" from an OpenBSD mirror, and...

    $ qemu-img create -f qcow2 example.img 1000M
    $ qemu-system-i386 -cdrom cd67.iso -hda example.img -boot d -m 2048

I proceeded to install OpenBSD, following all the default options.
After rebooting into the freshly installed i386 "machine", QEMU assigned
IP 10.0.2.15 to the Ethernet interface in it - so I could SSH to it,
and use SSH to copy stuff in/out of it.

# Step 3: Copy the dependencies inside the VM

Now download the "miniroot-cubie-67.fs" image from the 6.7/armv7 folder,
and rename it to "miniroot-orangepizero-67.fs".

In addition, from the 6.7/packages/i386 folder get "dtb-5.6.tgz" and
"u-boot-arm-2020.01p3.tgz". From these two, extract these two files:

    $ tar xpvf dtb-5.6.tgz \
         share/dtb/arm/sun8i-h2-plus-orangepi-zero.dtb
    $ tar xpvf u-boot-arm-2020.01p3.tgz \
         share/u-boot/orangepi_zero/u-boot-sunxi-with-spl.bin

These two files and the miniroot image can now be copied into the VM,
via SSH:

    $ tar cpf - ./* | ssh openbsd_account@10.0.2.15 'tar xpvf -'

And from within the VM, you can now create the Orange PI Zero image:

    $ ssh openbsd_account@10.0.2.15

    $ su -
    # vnconfig vnd0 ./miniroot-orangepizero-67.fs

    # mount /dev/vnd0i /mnt/

    # ls -l /mnt/
    total 64
    drwxr-xr-x  1 root  wheel   4096 May 10 00:10 efi
    -rw-r--r--  1 root  wheel  25597 May 10 00:10 sun7i-a20-cubieboard2.dtb

    # cp sun8i-h2-plus-orangepi-zero.dtb /mnt/

    # rm /mnt/sun7i-a20-cubieboard2.dtb

    # umount /mnt

    # dd if=u-boot-sunxi-with-spl.bin of=/dev/vnd0c bs=1024 seek=8
    436+1 records in
    436+1 records out
    447072 bytes transferred in 0.084 secs (5272426 bytes/sec)

    # vnconfig -u vnd0

Now copy across this modified image - and write it on the SD card.
In the example below, lsblk has shown that my SD card is at /dev/sdc:

    $ ssh openbsd_account@10.0.2.15 \
        'cat mini*' >  ./miniroot-orangepizero-67.fs
    $ dd if=miniroot-orangepizero-67.fs bs=1M  \
         oflag=sync iflag=fullblock status=progress of=/dev/sdc

That's it. Put the SD card in your Orange PI Zero, launch minicom or
picocom,
and you will be able to install OpenBSD in your Orange PI Zero.

# Step 3

After installation (on the SD card itself), both the Ethernet and the USB
are fully operational. This allowed me to connect an additional
USB-to-Ethernet dongle (with an ASIX chip - OpenBSD used the axe driver
for it) and have a fully operational firewall for my home LAN.

That's all.
Hope this mini-guide helps someone!

Cheers,
Thanassis.

--
https://www.thanassis.space
--
P.S. Many thanks to Philip Plane - his site is no longer there,
but most of the stuff above I figured out from a Google cache
of his page.

Reply via email to