├── README.md ├── build-times.md └── rpi4-dmesg.txt /README.md: -------------------------------------------------------------------------------- 1 | # OpenBSD 6.8 on RaspberryPi 4 B 2 | 3 | The following notes capture the process I followed to get OpenBSD 6.8 running on a Raspberry Pi 4 (8GB). 4 | There is working X11 support (without hardware acceleration) on top of the framebuffer and the framebuffer console does work via HDMI with the latest EEPROM and UEFI as per below. 5 | 6 | Supposedly it's possible to boot directly from usb without needing an sdcard for the UEFI but I have not had success with that yet. 7 | 8 | Update: As of 4/17/2021, there has been some cleanup and improvements to the Raspberry Pi 4 boot process on OpenBSD 6.9 without requiring all the extra steps involving UEFI firmware, see more details below: 9 | 10 | https://marc.info/?l=openbsd-cvs&m=161869438709739&w=2 11 | 12 | https://marc.info/?l=openbsd-cvs&m=161869450909798&w=2 13 | 14 | 15 | ## Update EEPROM via Raspberry Pi OS 16 | 17 | 1. Boot Raspberry Pi OS on an sdcard 18 | 2. Run updates: 19 | 20 | ``` 21 | apt update && apt upgrade -y 22 | 23 | rpi-eeprom-update 24 | ``` 25 | 26 | 27 | ## Load the latest UEFI onto an sdcard (or USB drive) 28 | 29 | Follow these steps: https://github.com/pftf/RPi4#installation 30 | 31 | ### 2021-04-11 Update: 32 | * Release v1.21 is *confirmed working*: https://github.com/pftf/RPi4/releases/tag/v1.21 33 | * v1.25 is currently broken: [details on reddit thread](https://old.reddit.com/r/openbsd/comments/moilsj/openbsd_install_on_rpi4_keeps_rebooting/) 34 | * v1.22 - v1.24: I have not tested yet. 35 | 36 | ## Set UEFI settings for OpenBSD compatability 37 | 38 | * Boot with hdmi monitor and keyboard attached 39 | * Press ESC to enter UEFI settings 40 | * Device Manager -> Raspberry Pi Configuration -> Advanced Configuration -> 41 | * Limit RAM to 3 GB: *Disabled* 42 | * System Table Selection: *Devicetree* 43 | * Device Manager -> Raspberry Pi Configuration -> SD/MMC Configuration -> 44 | * uSD/eMMC Routing: *eMMC2 SDHCI* 45 | 46 | Save the above with F10 and Reset from the main UEFI menu. 47 | 48 | You can also try to set the boot order to have your USB drive first but I found that this setting would never actually save and take effect upon a reboot. 49 | 50 | 51 | ## Install OpenBSD 52 | 53 | * Read the docs: https://www.openbsd.org/arm64.html 54 | * And more docs: https://ftp.openbsd.org/pub/OpenBSD/6.8/arm64/INSTALL.arm64 55 | (In particular the section: 'Install on Raspberry Pi 4:') 56 | 57 | ### Load miniroot onto a usb drive 58 | 59 | ``` 60 | # from an OpenBSD machine 61 | dd if=miniroot68.img of=/dev/rsdXc bs=1m status=progress 62 | 63 | # Or from a linux machine 64 | dd if=miniroot68.img of=/dev/sdX bs=1M status=progress 65 | ``` 66 | 67 | ### Boot the OpenBSD installer (serial console NOT required) 68 | 69 | * Boot with hdmi monitor and keyboard attached 70 | * Press ESC to enter UEFI settings 71 | * Boot Manager -> Select your USB drive and press ENTER 72 | * OpenBSD bootloader should start: 'OpenBSD/arm64 BOOTAA64 1.3' 73 | * QUICKLY Interrupt it with a letter keypress 'asdf etc' 74 | * Backspace whatever you typed 75 | * Set the tty to use the framebuffer instead of the serial port: 76 | * set tty fb0 77 | * Thanks Christopher Solskogen: https://marc.info/?l=openbsd-arm&m=160683302013161&w=2 78 | * Now do a normal OpenBSD install (over the top of the same USB drive if desired). 79 | * Wifi firmware is missing from the installer so this is easiest with ethernet plugged in for the install. Wifi firmware is automatically installed on first boot if ethernet is available. 80 | * Set framebuffer as default console (as per Christopher Solskogen's note) 81 | * `echo "set tty fb0" >> /etc/boot.conf` 82 | * Enable X11 83 | * `rcctl enable xenodm` 84 | -------------------------------------------------------------------------------- /build-times.md: -------------------------------------------------------------------------------- 1 | # Rough benchmarks of building openbsd base from source on a Raspberry Pi 4 B 2 | 3 | The rpi is not in a case, has a heatsink attached and a small fan. 4 | 5 | 6 | # Running off a SanDisk Ultra Fit 64GB usb stick 7 | 8 | umass0 at uhub0 port 2 configuration 1 interface 0 "SanDisk Ultra Fit" rev 3.00/1.00 addr 5 9 | sd1 at scsibus1 targ 1 lun 0: removable serial.078155838107bba6d9db 10 | 11 | *Used `make -j 4 build` for all builds* 12 | 13 | ## Default (SLOW) mounting options 14 | This was without softdep and with atime ON by default: 15 | 16 | * Kernel: 17 | * Approx 12mins from memory (Should probably test again) 18 | * Base: 19 | * `652m52.11s real 1980m49.01s user 283m24.25s system` 20 | 21 | 22 | ## With softdep and noatime on all fstab mounts 23 | 24 | * Base: 25 | * `630m36.32s real 1976m35.38s user 296m55.71s system` 26 | 27 | # Running off a memfs ramdisk 28 | 29 | ``` 30 | # 2GB in a count of 512byte sectors 31 | # expr 1024 \* 1024 \* 1024 \* 2 / 512 32 | # 4194304 33 | 34 | umount /usr/src 35 | umount /usr/obj 36 | 37 | mount_mfs -s 4194304 swap /usr/src 38 | mount_mfs -s 4194304 swap /usr/obj 39 | 40 | git clone --depth 1 https://github.com/openbsd/src /usr/src 41 | 42 | 43 | ``` 44 | 45 | * Kernel: 46 | * `13m12.05s real 36m38.53s user 12m27.78s system` 47 | * Base: 48 | * `625m19.66s real 1963m11.83s user 314m59.17s system` 49 | -------------------------------------------------------------------------------- /rpi4-dmesg.txt: -------------------------------------------------------------------------------- 1 | OpenBSD 6.8-current (GENERIC.MP) #945: Sun Dec 20 23:14:16 MST 2020 2 | deraadt@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP 3 | real mem = 8373202944 (7985MB) 4 | avail mem = 8083574784 (7709MB) 5 | random: good seed from bootblocks 6 | mainbus0 at root: Raspberry Pi 4 Model B Rev 1.4 7 | psci0 at mainbus0: PSCI 1.1, SMCCC 1.2 8 | cpu0 at mainbus0 mpidr 0: ARM Cortex-A72 r0p3 9 | cpu0: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache 10 | cpu0: 1024KB 64b/line 16-way L2 cache 11 | cpu0: CRC32 12 | cpu1 at mainbus0 mpidr 1: ARM Cortex-A72 r0p3 13 | cpu1: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache 14 | cpu1: 1024KB 64b/line 16-way L2 cache 15 | cpu1: CRC32 16 | cpu2 at mainbus0 mpidr 2: ARM Cortex-A72 r0p3 17 | cpu2: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache 18 | cpu2: 1024KB 64b/line 16-way L2 cache 19 | cpu2: CRC32 20 | cpu3 at mainbus0 mpidr 3: ARM Cortex-A72 r0p3 21 | cpu3: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache 22 | cpu3: 1024KB 64b/line 16-way L2 cache 23 | cpu3: CRC32 24 | efi0 at mainbus0: UEFI 2.7 25 | efi0: https://github.com/pftf/RPi4 rev 0x10000 26 | smbios0 at efi0: SMBIOS 3.3.0 27 | smbios0: vendor https://github.com/pftf/RPi4 version "UEFI Firmware v1.21" date 11/13/2020 28 | smbios0: Raspberry Pi Foundation Raspberry Pi 4 Model B 29 | apm0 at mainbus0 30 | "system" at mainbus0 not configured 31 | "axi" at mainbus0 not configured 32 | simplebus0 at mainbus0: "soc" 33 | bcmclock0 at simplebus0 34 | bcmmbox0 at simplebus0 35 | bcmgpio0 at simplebus0 36 | bcmaux0 at simplebus0 37 | ampintc0 at simplebus0 nirq 256, ncpu 4 ipi: 0, 1: "interrupt-controller" 38 | bcmtmon0 at simplebus0 39 | bcmdmac0 at simplebus0: DMA0 DMA2 DMA4 DMA5 DMA6 DMA7 DMA8 DMA9 40 | "timer" at simplebus0 not configured 41 | bcmirng0 at simplebus0 42 | pluart0 at simplebus0 43 | com0 at simplebus0: ns16550, no working fifo 44 | "local_intc" at simplebus0 not configured 45 | bcmdog0 at simplebus0 46 | simplebus1 at simplebus0: "firmware" 47 | "clocks" at simplebus1 not configured 48 | "gpio" at simplebus1 not configured 49 | "power" at simplebus0 not configured 50 | "mailbox" at simplebus0 not configured 51 | sdhc0 at simplebus0 52 | sdhc0: SDHC 3.0, 250 MHz base clock 53 | sdmmc0 at sdhc0: 4-bit, sd high-speed, mmc high-speed 54 | "gpiomem" at simplebus0 not configured 55 | "fb" at simplebus0 not configured 56 | "vcsm" at simplebus0 not configured 57 | "clocks" at mainbus0 not configured 58 | "phy" at mainbus0 not configured 59 | simplebus2 at mainbus0: "emmc2bus" 60 | sdhc1 at simplebus2 61 | sdhc1: SDHC 3.0, 100 MHz base clock 62 | sdmmc1 at sdhc1: 8-bit, sd high-speed, mmc high-speed, ddr52, dma 63 | "arm-pmu" at mainbus0 not configured 64 | agtimer0 at mainbus0: tick rate 54000 KHz 65 | simplebus3 at mainbus0: "scb" 66 | bcmpcie0 at simplebus3 67 | pci0 at bcmpcie0 68 | ppb0 at pci0 dev 0 function 0 "Broadcom BCM2711" rev 0x10 69 | pci1 at ppb0 bus 1 70 | xhci0 at pci1 dev 0 function 0 "VIA VL805 xHCI" rev 0x01: intx, xHCI 1.0 71 | usb0 at xhci0: USB revision 3.0 72 | uhub0 at usb0 configuration 1 interface 0 "VIA xHCI root hub" rev 3.00/1.00 addr 1 73 | bse0 at simplebus3: address dc:a6:32:d6:1a:39 74 | brgphy0 at bse0 phy 1: BCM54210E 10/100/1000baseT PHY, rev. 2 75 | "dma" at simplebus3 not configured 76 | "hevc-decoder" at simplebus3 not configured 77 | "rpivid-local-intc" at simplebus3 not configured 78 | "h264-decoder" at simplebus3 not configured 79 | "vp9-decoder" at simplebus3 not configured 80 | "leds" at mainbus0 not configured 81 | "sd_io_1v8_reg" at mainbus0 not configured 82 | "fixedregulator_3v3" at mainbus0 not configured 83 | "fixedregulator_5v0" at mainbus0 not configured 84 | simplebus4 at mainbus0: "v3dbus" 85 | "clk-108M" at mainbus0 not configured 86 | "sd_vcc_reg" at mainbus0 not configured 87 | simplefb0 at mainbus0: 1920x1080, 32bpp 88 | wsdisplay0 at simplefb0 mux 1: console (std, vt100 emulation) 89 | wsdisplay0: screen 1-5 added (std, vt100 emulation) 90 | scsibus0 at sdmmc1: 2 targets, initiator 0 91 | sd0 at scsibus0 targ 1 lun 0: removable 92 | sd0: 14772MB, 512 bytes/sector, 30253056 sectors 93 | uhub1 at uhub0 port 1 configuration 1 interface 0 "VIA Labs USB2.0 Hub" rev 2.10/4.21 addr 2 94 | bwfm0 at sdmmc0 function 1 95 | manufacturer 0x02d0, product 0xa9a6 at sdmmc0 function 2 not configured 96 | manufacturer 0x02d0, product 0xa9a6 at sdmmc0 function 3 not configured 97 | uhidev0 at uhub1 port 3 configuration 1 interface 0 "Cypress Semiconductor Convertible 2 TKL" rev 2.00/0.00 addr 3 98 | uhidev0: iclass 3/1 99 | ukbd0 at uhidev0: 8 variable keys, 6 key codes, country code 33 100 | wskbd0 at ukbd0: console keyboard, using wsdisplay0 101 | uhidev1 at uhub1 port 3 configuration 1 interface 1 "Cypress Semiconductor Convertible 2 TKL" rev 2.00/0.00 addr 3 102 | uhidev1: iclass 3/0, 2 report ids 103 | uhid0 at uhidev1 reportid 1: input=2, output=0, feature=0 104 | uhid1 at uhidev1 reportid 2: input=1, output=0, feature=0 105 | uhidev2 at uhub1 port 4 configuration 1 interface 0 "Logitech Gaming Mouse G303" rev 2.00/95.02 addr 4 106 | uhidev2: iclass 3/1 107 | ums0 at uhidev2: 16 buttons, Z and W dir 108 | wsmouse0 at ums0 mux 0 109 | uhidev3 at uhub1 port 4 configuration 1 interface 1 "Logitech Gaming Mouse G303" rev 2.00/95.02 addr 4 110 | uhidev3: iclass 3/0, 17 report ids 111 | ukbd1 at uhidev3 reportid 1: 8 variable keys, 6 key codes 112 | wskbd1 at ukbd1 mux 1 113 | wskbd1: connecting to wsdisplay0 114 | uhid2 at uhidev3 reportid 3: input=4, output=0, feature=0 115 | uhid3 at uhidev3 reportid 4: input=1, output=0, feature=0 116 | uhid4 at uhidev3 reportid 16: input=6, output=6, feature=0 117 | uhid5 at uhidev3 reportid 17: input=19, output=19, feature=0 118 | umass0 at uhub0 port 2 configuration 1 interface 0 "SanDisk Ultra Fit" rev 3.00/1.00 addr 5 119 | umass0: using SCSI over Bulk-Only 120 | scsibus1 at umass0: 2 targets, initiator 0 121 | sd1 at scsibus1 targ 1 lun 0: removable serial.078155838107bba6d9db 122 | sd1: 58680MB, 512 bytes/sector, 120176640 sectors 123 | vscsi0 at root 124 | scsibus2 at vscsi0: 256 targets 125 | softraid0 at root 126 | scsibus3 at softraid0: 256 targets 127 | root on sd1a (b60bda332fe253eb.a) swap on sd1b dump on sd1b 128 | WARNING: clock lost 38 days 129 | WARNING: CHECK AND RESET THE DATE! 130 | gpio0 at bcmgpio0: 58 pins 131 | bwfm0: address dc:a6:32:d6:1a:3b 132 | hw.sensors.bcmtmon0.temp0=55.99 degC 133 | --------------------------------------------------------------------------------