Skip to content
bifferos edited this page Aug 31, 2021 · 2 revisions

Why 2.6.37.6?

This was an (at the time) fairly popular kernel, and it shipped with Slackware 13.37 IIRC. Patrick Volkerding always has an eye for quality, so if you're going to pick a kernel to standardise on, this isn't a bad bet. I used a slightly later 3.XX kernel for NFS root systems because 2.6.37 wasn't quite mature enough for that but I don't do any NFS root stuff now.

Here are the changes relevant to the Bifferboard.

Biffnor

Probably the most important change was to add a NOR flash driver for writing firmware. This replaces the firmware image. Make sure you use the correct device, /dev/biffkernel.

crw-rw----    1 root     root       10, 162 Aug  7 04:02 /dev/biffkernel

Simply cat your file into the device and it will program the board. Updates on progress will appear in the dmesg output.

cat bzImage > /dev/biffkernel

Biffupgrade

For updating the bootloader, use the /dev/biffboot device.

crw-rw----    1 root     root       10, 162 Aug  7 04:02 /dev/biffboot

Simply cat your file into the device and it will program the bootloader.

cat biffboot-ffffffffffff-v3_11_community.bin > /dev/biffboot

Updates on progress will appear in the dmesg output. Please don't mix up this device with /dev/biffkernel. You could consider removing this device if you know you don't need to update your bootloader. I've got JTAG setup, so all my images have this.

For programming a new biffboot some checks are made before it starts. Biffnor won't let you program random garbage over the bootloader, as it will for the kernel.

PIT_TICK_RATE

For some inexplicable reason, the timer runs at a different frequency on the RDC chips. This needs correcting in the kernel sources, and there is, alas, no dynamic way to configure this (it would be hard to make it so), so we need to compile a different value in. For the original IBM PC the value 1193182ul would be used and that's in the mainline kernel. At one point there was a kernel CONFIG value in the mainline kernel to switch this at compile time if RDC hardware was selected but the kernel maintainers decided at some point that RDC are not popular enough chips to warrant this, and they moved to dynamic CPU detection of as many CPU features as they could, so this define had to go. Shame really.

R6040 Network interface

The Bifferboard only has a single NIC, but the CPU itself has provision for two. You only get a single PHY on the Bifferboard so there is no possibility to add another NIC (unless you're handy with BGA rework), but the Linux Kernel still enumerates all NICs on the internal PCI bus in the S3282, leading to some ugly error messages. A single line change sorts this problem out.

Kexec

Although the the 2.6.37.6 kernel was fully compatible with 486SX CPUs in most respects they didn't bank on users of such CPUs needing the Kexec feature, so they included some Pentium instructions in the Kexec implementation. In relocate_kernel_32.S they reference CR4 in various places, but it's only available on Pentium CPUs and later causing illegal instruction exception on the S3282. Fortunately the fix is simply to remove those instructions and everything works. There is no CR4 to save, so you can just skip saving it. Making the detection at run-time and submitting it as a patch to the kernel maintainers is non-trivial so I didn't bother. Kexec on the Bifferboard is more handy than you might think, because you could, for instance patch the running kernel on a remote system. You could also use the kernel as a bootloader for 1MB systems, e.g. have a barebones 2.6.37.6, and then kexec load from USB or an http site something much more recent for better driver support.

x86 Compatibility

Many x86 architectures are compiled into a 486 kernel. There is no point including them, so they've been hacked out. This had to be done manually but it saves about 10k.

FPU support

The software emulation of FPU is so slow on the Bifferboard (it's not the fastest of CPUs to begin with) that there's little point in having it just so software 'works'. It has been removed. Normally the kernel refuses to boot if it doesn't find either a real FPU or the emulation code, but that detection code has been removed as well. If you require an FPU your code will crash on the Bifferboard, but the slow emulation will make your code unusable anyhow.

Perl version

The kernel compilation process includes Perl and unfortunately Perl (even now) doesn't stand still, so the syntax changed. On modern systems the older kernels need a minor hack to compile.

<       if (!@val) {
---
>       if (!defined(@val)) {