在 Pomera DM250{,XY?} 上安装 OpenBSD
Installing OpenBSD on the Pomera DM250{,XY?}

原始链接: https://jcs.org/2026/04/09/openbsd-dm250

## OpenBSD 在 Pomera DM250 上的安装摘要 本文档详细介绍了在日版 Pomera DM250 设备(DM250、DM250X、DM250XY)上安装 OpenBSD-current 的过程。**安装存在风险**,需要自定义内核和 U-Boot 镜像,因为完整的上游支持仍在开发中。风险包括潜在的电池问题,如果出现软件错误可能导致无法充电,以及如果启动失败则需要 USB 恢复(可能需要拆卸设备)。**请勿将这些说明用于美版 DM250US 型号。** 该过程涉及创建包含自定义 U-Boot、安装文件和必要固件(包括 Wi-Fi)的可启动 SD 卡。关键步骤包括使用 GPT 格式化 SD 卡,获取 OpenBSD 快照和自定义 U-Boot 镜像,并使用脚本备份现有固件并将新的 U-Boot 刷入 eMMC。 如果安装失败,则存在恢复选项,从通过串行控制台访问 U-Boot 到可能需要打开设备以访问 eMMC。强烈建议在开始之前完整备份 eMMC。安装后,可能需要手动配置 Wi-Fi 和 LED 功能。 **重要提示:** 避免完全耗尽电池,因为这可能会阻止启动和充电。详细说明和必要文件可在 [jcs.org/dm250](https://jcs.org/dm250) 找到。

对不起。
相关文章

原文

These are my notes and pre-built images for getting OpenBSD-current installed on the Japanese-model Pomera DM250, DM250X, and DM250XY.

Throat-clearing

Much of my work has not yet been committed upstream so installation currently requires a custom kernel and U-Boot image which are provided here. OpenBSD support is still improving and may not be stable at any given time. Install at your own risk. These risks include:

  • If the battery completely drains due to a software bug, the device may not power on correctly and will not be able to recharge its battery (see below).

  • If the device cannot boot properly into U-Boot, you may need to recover it through a USB cable which may also require having to open the device (see recovery).

Note: Do not use these instructions for the US-model DM250US yet. That device has a different power charging chip and keyboard layout.

Making a backup

This is optional but recommended. The tools and instructions at EKESETE.net should be used to make a full eMMC backup before doing anything.

Some DM250 hardware notes

  • The DM250's factory U-Boot detects Right Shift + Left Alt being pressed immediately after power-on and boots the recovery Linux kernel from its recovery_kernel partition instead of its normal kernel partition. The recovery kernel boots the initramfs image at the recovery_boot partition which mounts the SD card and executes any _sdboot.sh script found at its root directory.

  • If you hold Shift + Alt too long at power-on, it will instead boot its graphical factory hardware test program. The recovery kernel and script do not show any output on the console while they boot and run. Hold down Right Shift + Left Alt + Power and count 3 seconds, then let go and it should boot the recovery kernel and _sdboot.sh from the SD card.

  • Once the new U-Boot image is written to the eMMC (even before going through the OpenBSD installer), the DM250 will no longer be able to boot the original Linux kernel or recovery. You'll need to boot something via EFI to write the backup U-Boot image to eMMC to get back to the factory software. This can be done with the OpenBSD installation SD card created here by dropping to a shell.

  • The DM250 will not fully power off with a USB-C cable connected to power (even with the factory Linux software). This means even if you halt -p and it powers itself off, it will immediately power back on. My U-Boot detects if the lid is closed when it first boots and if it's closed, it will halt the boot process so it doesn't boot into OpenBSD while it's closed on your desk trying to charge (though it will still be powered up to U-Boot).

  • A working battery is required to be able to provide enough power even with a USB-C cable connected. If the battery is completely drained, it may not be able to boot up far enough to get to U-Boot for it to be able to tell the charging chip to go into a higher charge mode. By default it does a trickle charge but because it will always try to power on as soon as it has power connected, it may quickly drain the power it just added to the battery trying to boot. In short, don't let the battery drain completely.

Making an OpenBSD installation SD card

These instructions assume you're running OpenBSD (any architecture). You'll need an SD card of a few GB, which is assumed to be sd1 here.

  1. Format an SD card with a GPT partition layout, making an EFI partition of at least 100MB and giving the rest to an OpenBSD partition.

    # fdisk -ygb 204800 sd1
    # echo -e "a\n\n\n\n\nw\nx" | disklabel -E sd1
    # newfs /dev/rsd1a
    # newfs_msdos /dev/rsd1i
    # mount /dev/sd1i /mnt
    

    U-Boot and OpenBSD will use that EFI partition as its firmware partition, but the original Pomera recovery software will see it as a normal MSDOS partition and run the /_sdboot.sh script contained on it.

  2. Fetch the standard OpenBSD armv7 EFI bootloader to the SD card's EFI partition as /efi/boot/BOOTARM.EFI.

    # mkdir -p /mnt/efi/boot
    # cd /mnt/efi/boot
    # ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/armv7/{BOOTARM.EFI,SHA256.sig}
    # signify -C -x SHA256.sig BOOTARM.EFI
    
  3. Fetch my uboot.img to the EFI partition as /uboot.img. This U-Boot image has an embedded copy of the binary device-tree built from my Linux tree for the DM250 (JP).

    # cd /mnt
    # ftp https://jcs.org/dm250/uboot.img
    
  4. Fetch this installation script to the EFI partition as /_sdboot.sh. This will get executed by the factory recovery partition's boot system once the DM250 is booted into recovery mode. The script mounts the EFI partition of the SD card, backs up all of the firmware files from the eMMC to the SD card, makes a backup of the current eMMC U-Boot partition to the SD card, and then writes the new U-Boot image from the SD card to the eMMC.

    # ftp https://jcs.org/dm250/_sdboot.sh
    
  5. Switch to the OpenBSD partition of the SD card and fetch the latest OpenBSD armv7 snapshot disk images to it.

    # cd /
    # umount /mnt
    # mount /dev/sd1a /mnt
    # cd /mnt
    # ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/armv7/{SHA256.sig,base79.tgz,comp79.tgz,game79.tgz,man79.tgz,xbase79.tgz,xfont79.tgz,xserv79.tgz,xshare79.tgz}
    # signify -C -x SHA256.sig *.tgz
    
  6. Fetch the current bwfm firmware so you can have working Wi-Fi after installation.

    # ftp http://firmware.openbsd.org/firmware/snapshots/{SHA256.sig,bwfm-firmware-20200316.1.3p5.tgz}
    # signify -C -x SHA256.sig bwfm-firmware-*
    
  7. Fetch my bsd.rd ramdisk image and bsd kernel.

    # ftp https://jcs.org/dm250/bsd{,.rd}
    
  8. Your SD card is now ready to go. Unmount it.

    # cd /
    # umount /mnt
    

Installing OpenBSD

Insert the prepped SD card into the DM250. If it's plugged into power, unplug it. If it's powered up, power it down.

Hold down the Right Shift + Left Alt + Power buttons. As soon as the Pomera logo displays, wait about two seconds and let go. The Pomera logo will clear and the recovery kernel should now boot. It will execute the _sdboot.sh script on the SD card which will make a backup of the existing U-Boot partition to the SD card and write the new one. Nothing will be shown on the screen while it's working but it should only take about 30 seconds. Once it's done, it will reboot the device.

Note that in OpenBSD, the default keyboard layout matches the Japanese keyboard on the DM250. The _ key is to the left of the up arrow, + is to the right of L, @ is to the right of P, * is two over from L.

At this point it will boot the new U-Boot with EFI support and video and keyboard drivers for the DM250. If it detected the eMMC and SD card properly, it will boot the OpenBSD EFI bootloader.

No EFI variables loaded
Loading Boot0000 'mmc 0' failed
Booting: Label: mmc 1 Device path: /VenHw(...)/SD(1)/SD(0)
disks: sd0* sd1
>> OpenBSD/armv7 BOOTARM 1.23
boot>

Enter b bsd.rd to boot the installer.

boot> b bsd.rd
cannot open sd0a:/etc/random.seed: No such file or directory
booting sd0a:bsd.rd: ...

When prompted for the root disk, enter ? to see which is which. The eMMC should be sd1 showing 7.3G.

Note: When installing to the eMMC, you'll need to manually setup the GPT partition table putting the EFI partition after 16MB or so to leave room for U-Boot.

These manual fdisk steps will not be needed in the future once the installer is able to recognize the DM250.

Press Control + Z to get to a shell so you can manually fdisk.

Use (W)hole disk or (E)dit the MBR? [whole] ^Z
[1] + Suspended		/install
# cd /dev
# sh MAKEDEV sd1
# fdisk -e -g sd1
Do you wish to write the new GPT? [n] y
Writing GPT.
Enter 'help' for information
sd1: 1>

Edit partition 0 which was auto-created, changing it to an ef partition at offset 32768 with size 8192.

sd1: 1> e 0
   #: type                                 [       start:         size ]
------------------------------------------------------------------------
   0: OpenBSD                              [          64:     15269791 ]
Partition id ('0' to disable) [01 - FF, <uuid>]: [A6] ef
Partition offset [34 - 15269854]: [64] 32768
Partition size [1 - 15237087]: [15237087] 8192
Partition name: [OpenBSD Area] EFI
sd1*: 1>

Now create partition 1 as an OpenBSD (a6) type with the rest of the space.

sd1*: 1> e 1
   #: type                                 [       start:         size ]
------------------------------------------------------------------------
   1: Unused                               [           0:            1 ]
Partition id ('0' to disable) [01 - FF, <uuid>]: [00] (? for help) a6
Partition offset [34 - 15269854]: [40960]
Partition size [1 - 15228895]: [15228895]
Partition name: [] OpenBSD
sd1*: 1>

Print the table to make sure it matches, then w and q.

sd1*: 1> p
Disk: sd1	Usable LBA: 34 to 15269854 [15269888 Sectors]
   #: type                                 [       start:         size ]
------------------------------------------------------------------------
    : Free                                 [          34:        32734 ]
   0: EFI Sys                              [       32768:         8192 ]
   1: OpenBSD                              [       40960:     15228895 ]
sd1*: 1> w
Writing GPT.
sd1: 1> q
#

Now you can return to the installer, which is asking for disk info. Enter ? to get it to refresh disk information and it should now print out sd1. Enter e to edit the GPT (again).

# fg
install
?
Disk: sd1	Usable LBA: 34 to 15269854 [15269888 Sectors]
   #: type                                 [       start:         size ]
------------------------------------------------------------------------
    : Free                                 [          34:        32734 ]
   0: EFI Sys                              [       32768:         8192 ]
   1: OpenBSD                              [       40960:     15228895 ]
Use (W)hole disk or (E)dit the GPT? [whole] e

You'll now be back at fdisk, just q to quit.

You can accept the auto-allocated partition layout or just make one big root and a swap partition. When prompted for the location of the sets, specify disk and then respond no that it's not mounted, and enter sd0 (the SD card), then partition a. The pathname to the sets will be just /.

Continue installing, ignoring any errors from signify. The installer should automatically pick up the bwfm firmware and install it.

At the end it will try to re-link the kernel which is using the upstream kernel object files, so it's important you copy the custom kernel back over /bsd.

Exit to (S)hell, (H)alt or (R)eboot? [reboot] s
To boot the new system, enter 'reboot' at the command prompt.

# mount /dev/sd0a /mnt2
# cp /mnt2/bsd /mnt/bsd

You'll also need to disable reorder_kernel which will run at each boot so it doesn't revert the kernel back to the upstream version.

# mv /mnt/usr/libexec/reorder_kernel{,.disabled}
# echo "#!/bin/sh" > /mnt/usr/libexec/reorder_kernel
# chmod +x /mnt/usr/libexec/reorder_kernel

You can now reboot.

Post-Installation

The first boot will report an error about bwfm and loadfirmware. You'll need to copy the firmware/nvram_ap6212a.txt file that was backed up to the SD card's EFI partition when U-Boot was flashed.

# mount /dev/sd0i /mnt
# cp /mnt/firmware/nvram_ap6212a.txt /etc/firmware/brcmfmac43430-sdio.rockchip,pomera-dm250.txt
# umount /mnt

U-Boot is compiled with boot logo support, so you can put a bitmap in the EFI partition's root directory as logo.bmp to get it to show at boot. To make it show OpenBSD puffy, you can use this image.

# mount /dev/sd1i /mnt
# cd /mnt
# ftp https://jcs.org/dm250/logo.bmp
# cd /
# umount /mnt

The two LEDs near the USB-C port can be addressed once booted. Create an /etc/rc.securelevel that sets them up so they are accessible from a normal kern.securelevel:

# cat > /etc/rc.securelevel
#!/bin/sh
gpioctl -q gpio1 8 set out red_led
gpioctl -q gpio1 12 set out green_led
^D
#

After rebooting, they can be addressed with the gpioctl utility:

# gpioctl gpio1 8 1
pin 8: state 0 -> 1

Building a custom installation ramdisk

If you want to tinker beyond installing, you'll need a Git clone of my OpenBSD rk3128 tree, my U-Boot pomera-dm250 tree with video and keyboard drivers, and my Linux tree which contains the DTB source files.

This is optional and requires being able to compile on an armv7 machine (or cross-compile if you know how), or you can just download the latest image I've already built.

Fetch an existing bsd.rd, extract its installation filesystem, build the RAMDISK kernel from my rk3128 tree, and then insert the filesystem into the new kernel.

$ cd /tmp
$ ftp https://cdn.openbsd.org/pub/OpenBSD/snapshots/armv7/bsd.rd
$ rdsetroot -x bsd.rd root.fs

$ cd /usr/src/sys/arch/armv7/compile/RAMDISK
$ make config
$ make
$ cp -f obj/bsd /tmp/bsd.rd
$ rdsetroot /tmp/bsd.rd /tmp/root.fs

The /tmp/bsd.rd file is now a bootable installation image with a custom kernel.

Recovery

If things go wrong, you'll likely have a few options to recover.

If you end up in a dark room likely to be eaten by a grue, contact me and I will try to help get you back to a working device.

联系我们 contact @ memedata.com