LinkedIn Sourceforge

Vincent's Blog

Pleasure in the job puts perfection in the work (Aristote)

OpenBSD 6.8 cannot boot on some intel boards: a solution

Posted on 2020-10-31 12:16:00 from Vincent in OpenBSD

Since OpenBSD 6.8, boot process does not work on my ASRock J5005-ITX board. The root cause is the kernel size. In this blog, I present you 2 possible solutions


Introduction

I'm running OpenBSD on my ASRock J5005 ITX board since 2019. In May 2020 I've successfully upgrade from 6.6 to 6.7.

In October 2020, after the upgrade process to OpenBSD 6.8, my board is no more willing to boot.

The error message says on the screen:

entry point at 0x1001000

Then the machine is totally locked.

You can see it on this small video

Root cause

After looking at the OpenSD mailing list, we can see quite quickly that the problem is not unique. mailing list discussions

At first, it pops up that the kernel's size could be the culprit.

Following a discussion on the OpenBSD group on Mastodon, it was said that the boot system of OpenBSD cannot support kernel's size above +-19MB.

Reduce the kernel size

I'll not detail all required steps, but by recompiling the kernel with less drivers, I was able to boot the board.

In fact, the kernel 6.8 has a size just above 20MB. On the other side, the RamDisk kernel with 10MB boot perfectly and my modified kernel with 16MB boots too.

-rw-r--r--   1 root  wheel  20957876 Oct 23 12:38 bsd68.mp
-rw-r--r--   1 root  wheel  10393418 Oct 23 12:39 bsd68.rd
-rw-r-----   1 root  wheel  16650684 Oct 24 18:48 mybsd68
-rwx------   2 root  wheel  18771139 Oct 22  2019 bsd67.mp

Booting with mybsd68.mp or with bsd68.rd works perfectly.

You can see the dmesg of this adapted kernel here.

So the size is clearly the culprit.

Solutions

Recompiling the kernel with less drivers is not a future's proof solution. But on October 30rd, 2020 a definitive solution has been posted by kettnis on the OpenBSD source.

You can see the diff here

It consist mainly to increase the size:

-#define    KERN_LOADSPACE_SIZE (32 * 1024 * 1024)
+#define    KERN_LOADSPACE_SIZE (64 * 1024 * 1024)

Implementation

There is no need to recompile the whole Openbsd sources to have this change ;-).

The easiest solution will be to take the BOOTX64.EFI programs from the OpenBSD snapshots. You can then copy it to your EFI filesystem.

Here after I describe the actions you have to perform on your setup. To perform those actions, you either boot with the bsd-6.8 ram disk (bsd.rd) or you boot with old 6.7 kernel.
In my case the disk where the boot reside is sd0, please adapt to your case. Should I say that you must be root ?

If you are in the upgrade process, just execute the following steps before the reboot.

mkdir /mnt/efi
mount /dev/sd0i /mnt/efi

In my case I have this:

#mount
/dev/rd0a on / type ffs (local)
/dev/sd0a on /mnt type ffs (local, wxallowed)
/dev/sd0i on /mnt/efi type msdos (local)
#df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/rd0a      3.5M    3.0M    425K    88%    /
/dev/sd0a     11.8G    3.8G    7.4G    34%    /mnt
/dev/sd0i      460K    272K    188K    59%    /mnt/efi

Then you can do the following:

ftp -o /tmp/bootx64.efi https://cdn.openbsd.org/pub/OpenBSD/snapshots/amd64/BOOTX64.EFI
cp /tmp/bootx64.efi /mnt/efi/efi/boot/

Optional, but strongly reminded, I propose you to copy it also to /usr/mdec. Thus, if you are booting your machine with the RamDisk, you have to perform the following:

cp /tmp/bootx64.efi /mnt/usr/mdec/BOOTX64.EFI

Conclusion

Simple tricks to still perform the upgrade to 6.8.

This extra manipulation will no more be required for upgrade to 6.9.



45, 43
displayed: 15242
Comments:

1. From pirmd on Tue Nov 3 13:25:25 2020

Thanks you Vincent as usual : helpful, clear, straight to the point and effective !

2. From Vincent on Tue Nov 3 14:02:47 2020

Thanks it helps

3. From Norman Normal on Tue Jan 12 16:10:11 2021

Thank you so mich, Vincent! I really apreciate this post! OpenBSD 6.8 was my first OpenBSD Installation and I got this error at Every boot. I saw some post in mailing lists but they Werke all hard to understand. Except that I had bit trouble realising that I was using sd2i instead of sd0i your post was super easy to understand! ~Norman Normal

4. From Vincent on Thu Jan 14 07:55:14 2021

@norman. Great that it helps. And welcome in the OpenBSD community.




What is the second letter of the word Moon?