After trying NetBSD and OpenBSD on my DMP EBOX 3300A-H with a Vortex86DX CPU, I was curious to see how FreeBSD would fare on such constrained systems these days.

For more information and background about the hardware, please refer to my previous article.

Attempting to install FreeBSD 13.0 failed early when loading the kernel, and both supported releases from the FreeBSD 12 series (12.2 and 12.3) also exhibit the same issue.

int=00000006  err=00000000  efl=00000002  eip=013d1651
eax=01fe26b0  ebx=0008274c  ecx=00000000  edx=01fe8b77
esi=01d8c3d8  edi=019b20c8  ebp=019b2038  esp=00000000
cs=0008  ds=0010  es=0010    fs=0010  gs=0010  ss=0010
cs:eip=0f 45 f0 a1 88 20 9b 01-85 c0 0f 45 f0 81 c6 ff
       ff 3f 00 81 e6 00 00 c0-ff 89 35 d4 ad d8 01 8d
ss:esp=f3 ee 00 f0 f3 ee 00 f0-c3 e2 00 f0 f3 ee 00 f0
       f3 ee 00 f0 54 ff 00 f0-4f 07 00 f0 f7 06 00 f0
BTX halted

FreeBSD 13.0 release notes mention that the default CPUTYPE for the i386 architecture is now 686 (instead of 486), and have details on the rationale behind this change.

After digging a bit, it turns out some Vortex86 CPUs lack support for the Conditional Move (CMOV) instruction, and code targetting i686 will fail on those models.

Using objdump to disassemble the kernels for the 12.2, 12.3, and 13.0 releases revealed that they were indeed using CMOV. Performing the same checks on the kernels from FreeBSD 12.0 and 12.1 releases did not show any CMOV instructions use.

The FreeBSD 12.1 installation process completed successfully and I could reboot into the installed system without issues. This version is not supported anymore but it doesn’t matter in this case as it’s more of a one-off thing for the purpose of writing this post, the machine being too constrained for any real world usage in this day and age.

For installing pkg and binary packages, I had to modify the url directive in /etc/pkg/FreeBSD.conf to:

url: "pkg+http://pkg.FreeBSD.org/${ABI}/release_2",

Indeed, quarterly packages and release_3 packages are apparently targetting i686 and their binaries contain CMOV instructions.

Attempting to run i686 binaries result in the following error:

Illegal instruction (core dumped)

We can verify that the culprits are indeed CMOV instructions with the following program:

.section .text

.globl _start

_start:
	cmovl	%eax, %ebx

Let’s assemble, link, and run it:

as cmov.s -o cmov.o
ld cmov.o -o cmov
./cmov
Illegal instruction (core dumped)

With this out of the way, we now have a fully functioning FreeBSD 12.1 installation on this machine.

On a freshly booted system, 16 processes are running and most of the RAM is unused.

last pid:   787;  load averages:  0.30,  0.30,  0.13  up 0+00:02:12    09:55:29
16 processes:  1 running, 15 sleeping
CPU:  6.2% user,  0.0% nice, 10.1% system,  2.1% interrupt, 81.6% idle
Mem: 6556K Active, 1028K Inact, 28M Wired, 16M Buf, 181M Free
Swap: 2752M Total, 2752M Free

  PID USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND
  751 root          1  22    0  5268K  2616K wait     0:00   0.00% login
  759 root          1  20    0  6192K  3108K pause    0:00   0.00% csh
  581 root          1  20    0  4588K  2112K select   0:00   0.00% syslogd
  692 root          1  20    0  8772K  5360K select   0:00   0.00% sendmail
  699 root          1  24    0  4588K  2104K nanslp   0:00   0.00% cron
  787 root          1  23    0  5868K  2592K RUN      0:00   0.00% top
  752 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  756 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  758 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  753 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  757 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  754 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  755 root          1  52    0  4276K  1908K ttyin    0:00   0.00% getty
  695 smmsp         1  52    0  8548K  4848K pause    0:00   0.00% sendmail
   94 root          1  52    0  4152K  1688K pause    0:00   0.00% adjkerntz
  421 root          1  20    0  3864K  1108K select   0:00   0.00% devd

Here is the result of the md5 -t benchmark:

MD5 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 766a2bb5d24bddae466c572bcabca3ee
Time = 20.719989 seconds
Speed = 46.026777 MiB/second

And this is the result of the sha1 -t benchmark:

SHA1 time trial. Digesting 100000 10000-byte blocks ... done
Digest = 02522491d7a8253fcab708560acfa84b2fb7ef1c
Time = 54.165445 seconds
Speed = 17.606692 MiB/second

For the record, OpenSSL speed benchmark results are available here.

Finally, here is a dmesg for reference purposes:

Copyright (c) 1992-2019 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.1-RELEASE r354233 GENERIC i386
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
VT(vga): resolution 640x480
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
CPU: PentiumUnknown (1000.02-MHz 586-class CPU)
  Origin="Vortex86 SoC"  Id=0x522
real memory  = 268435456 (256 MB)
avail memory = 225300480 (214 MB)
random: unblocking device.
stray irq7
Timecounter "TSC" frequency 1000023008 Hz quality 800
random: entropy device external interface
kbd1 at kbdmux0
[ath_hal] loaded
module_register_init: MOD_LOAD (vesa, 0x14d9fb0, 0) error 19
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
ACPI: Table initialisation failed: AE_NOT_FOUND
ACPI: Try disabling either ACPI or apic support.
vtvga0: <VT VGA driver> on motherboard
cryptosoft0: <software crypto> on motherboard
pcib0 pcibus 0 on motherboard
pir0: <PCI Interrupt Routing Table: 12 Entries> on motherboard
pci0: <PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0xdf80-0xdfff mem 0xf8000000-0xfbffffff,0xfefc0000-0xfeffffff at device 3.0 on pci0
vgapci0: Boot video device
isab0: <PCI-ISA bridge> at device 7.0 on pci0
isa0: <ISA bus> on isab0
vte0: <RDC R6040 FastEthernet> port 0xde00-0xdeff mem 0xfefbb400-0xfefbb4ff irq 10 at device 8.0 on pci0
miibus0: <MII bus> on vte0
rdcphy0: <R6040 10/100 media interface> PHY 1 on miibus0
rdcphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
vte0: Ethernet address: 00:1b:eb:22:16:5c
ohci0: <OHCI (generic) USB controller> mem 0xfefb9000-0xfefb9fff irq 11 at device 10.0 on pci0
usbus0 on ohci0
ehci0: <EHCI (generic) USB 2.0 controller> mem 0xfefbb800-0xfefbb8ff irq 11 at device 10.1 on pci0
usbus1: EHCI version 1.0
usbus1 on ehci0
ohci1: <OHCI (generic) USB controller> mem 0xfefba000-0xfefbafff irq 11 at device 11.0 on pci0
usbus2 on ohci1
ehci1: <EHCI (generic) USB 2.0 controller> mem 0xfefbbc00-0xfefbbcff irq 11 at device 11.1 on pci0
usbus3: EHCI version 1.0
usbus3 on ehci1
atapci0: <Generic ATA controller> port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xef00-0xef0f irq 14 at device 12.0 on pci0
ata0: <ATA channel> at channel 0 on atapci0
ata1: <ATA channel> at channel 1 on atapci0
cpu0 on motherboard
unknown: <PNP0c01> can't assign resources (memory)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
attimer0: <AT timer> at port 0x40-0x43 irq 0 pnpid PNP0100 on isa0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
atrtc0: <AT realtime clock> at port 0x70-0x71 irq 8 pnpid PNP0b00 on isa0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
atkbdc0: <Keyboard controller (i8042)> at port 0x60,0x64 irq 1 pnpid PNP0303 on isa0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
orm0: <ISA Option ROM> at iomem 0xc0000-0xc7fff pnpid ORM0000 on isa0
fdc0: No FDOUT register!
ppc0: parallel port not found.
unknown: <PNP0c01> can't assign resources (memory)
Firmware Error (ACPI): A valid RSDP was not found (20181213/tbxfroot-369)
Timecounters tick every 1.000 msec
usbus0: 12Mbps Full Speed USB v1.0
usbus1: 480Mbps High Speed USB v2.0
ugen0.1: <(0x17f3) OHCI root HUB> at usbus0
uhub0: <(0x17f3) OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus0
ugen1.1: <(0x17f3) EHCI root HUB> at usbus1
uhub1: <(0x17f3) EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
usbus2: 12Mbps Full Speed USB v1.0
usbus3: 480Mbps High Speed USB v2.0
ugen2.1: <(0x17f3) OHCI root HUB> at usbus2
uhub2: <(0x17f3) OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus2
ugen3.1: <(0x17f3) EHCI root HUB> at usbus3
uhub3: <(0x17f3) EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus3
uhub0: 2 ports with 2 removable, self powered
uhub2: 2 ports with 2 removable, self powered
Trying to mount root from ufs:/dev/da0s1a [rw]...
Root mount waiting for: usbus3 usbus1
uhub1: 2 ports with 2 removable, self powered
uhub3: 2 ports with 2 removable, self powered
Root mount waiting for: usbus3 usbus1
ugen0.2: <vendor 0x0d8c C-Media USB Audio Device> at usbus0
ugen2.2: <Lenovo ThinkPad Compact USB Keyboard with TrackPoint> at usbus2
ukbd0 on uhub2
ukbd0: <Lenovo ThinkPad Compact USB Keyboard with TrackPoint, class 0/0, rev 2.00/3.30, addr 2> on usbus2
kbd2 at ukbd0
Root mount waiting for: usbus3
Root mount waiting for: usbus3
ugen3.2: <Generic USB Storage> at usbus3
umass0 on uhub3
umass0: <Generic USB Storage, class 0/0, rev 2.00/2.20, addr 2> on usbus3
umass0:  SCSI over Bulk-Only; quirks = 0xc100
umass0:2:0: Attached to scbus2
mountroot: waiting for device /dev/da0s1a...
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <Generic STORAGE DEVICE 0220> Removable Direct Access SCSI device
da0: 40.000MB/s transfers
da0: 61120MB (125173760 512 byte sectors)
da0: quirks=0x3<NO_SYNC_CACHE,NO_6_BYTE>
lo0: link state changed to UP
vte0: link state changed to DOWN
uaudio0 on uhub0
uaudio0: <vendor 0x0d8c C-Media USB Audio Device, class 0/0, rev 1.10/1.00, addr 2> on usbus0
uaudio0: Play: 48000 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Play: 44100 Hz, 2 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 48000 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: Record: 44100 Hz, 1 ch, 16-bit S-LE PCM format, 2x8ms buffer.
uaudio0: No MIDI sequencer.
pcm0: <USB audio> on uaudio0
uaudio0: HID volume keys found.
ums0 on uhub2
ums0: <Lenovo ThinkPad Compact USB Keyboard with TrackPoint, class 0/0, rev 2.00/3.30, addr 2> on usbus2
ums0: 6 buttons and [XYZT] coordinates ID=1