Use a USB flash drive to install OpenBSD 7.6 on an SD card for a Raspberry Pi 4!

Contents:


Preparing the Raspberry Pi 4

To begin, we need to set up the Raspberry Pi 4 to boot on the USB flash drive, which contain the files for installing OpenBSD on an SD card. We will use the raspi-config tool to complete this configuration. raspi-config is a tool from Raspberry Pi OS to configure our Raspberry Pi.

First of all, we will install Raspberry Pi OS on the Raspberry Pi and then use the raspi-config tool. To do this, download the latest image of Raspberry Pi OS (the version of Raspberry Pi OS used here is "2024-11-19-raspios-bookworm-armhf.img.xz") from the official Raspberry Pi website.

Once we have downloaded the Raspberry Pi OS image, we must verify its integrity using the sha256sum command. Then, we can comparing the output with the expected hash provided on the Raspberry Pi website.

sha256sum 2024-11-19-raspios-bookworm-armhf.img.xz

To install Raspberry Pi OS, we write the Raspberry Pi OS on an SD card. We can use a special tool called Raspberry Pi Imager. However, for the sake of learning, we will write the OS to the SD card manually.

First, extract the img file from the 2024-11-19-raspios-bookworm-armhf.img.xz file.

xz -dv 2024-11-19-raspios-bookworm-armhf.img.xz

Now that we have the img file, 2024-11-19-raspios-bookworm-armhf.img, we can write it to the SD card (note that this process will erase all the date on the SD card). On Linux an SD card is called mmcblkX.

sudo dd if="path to 2024-11-19-raspios-bookworm-armhf.img" of="path to the SD card" status=progress && sync

Once the Raspberry Pi is booted with the SD card containing Raspberry Pi OS, we can quickly install the operating system. After the installation of Raspberry Pi OS will be completed, we will launch the raspi-config tool on our Raspberry Pi (the version of raspi-config used here is "Version: 20241119").

sudo raspi-config

Navigate to the "6 Advanced Options" menu in raspi-config. Then select "A5 Bootloader Version" and make sure to use "E1 Latest Use the latest bootloader image". Press "Yes" when the raspi-config tool ask you to "Reset bootloader to default configuration".

Now go back to "6 Advanced Options" menu, then select "A4 Boot Order" and choose "B2 NVMe/USB Boot Boot from NVMe before trying USB and then SD Card"

You can reboot the Raspberry Pi to apply the changes and then shut it down.

Preparing the OpenBSD installation media (USB flash drive)

Our Raspberry Pi is now configured to boot the USB flash drive before the SD card. We can now proceed to prepare the USB flash drive with the OpenBSD 7.6 file sets.

Just like we did with Raspberry Pi OS, we will download the OpenBSD image (install76.img for arm64) and verify its integrity.

Then, we can proceed to create the install media, which is the USB flash drive. We will use again the dd and sync tools (being careful to select the correct media as all data on the USB flash drive will be erased).

sudo dd if="path to install76.img" of="path to the USB flash drive" status=progress bs=1m && sync

Now, our install media is ready to be booted on the Raspbeery Pi!

Booting the OpenBSD installation media on the Raspberry Pi 4

Plug the USB flash drive into the Raspberry Pi (the SD card should also be present in the Raspberry Pi) and boot the device.

The installation of OpenBSD on the Raspberry Pi will be done through a keyboard and a monitor.

As soon as you see the "boot>" prompt, press the "Esc" key and type "set tty fb0", then press the "Enter" key.
Next type "boot" in the "boot>" prompt and press the "Enter" key again.

The aim of this manipulation is to display the console on the monitor.

Where is the image?

Installing OpenBSD on the Raspberry Pi 4

Now proceed with the installation of OpenBSD 7.6 on the Raspberry Pi 4.

During the installation process, we you will be prompted to select a disk for the root disk.

Type "?" and choose the SD card according the displayed informations. In your case, it is "sd0".

Note also than the install media is located on "sd1" in this case.

Once the installation of OpenBSD on the Raspberry Pi is done:

Where is the image?
Where is the image?

Conclusion

Our Raspberry Pi will now run on OpenBSD 7.6!

Enjoy! OpenBSD is a very cool OS with many features!