Cross Compiling 386BSD 0.1pl23 from Windows 10

I bumped the version to *current year*

Oh yes, this will be a thing!

Sure I can cross compile Linux, but what about 386BSD?  This had long been a thorn in my side, as the GCC/Binutil toolchain that is used in this early era is not GNU pure, they had been modified in all kinds of ways.  One of which was a builtin memcpy that doesn’t work the same as a normal memcpy, and the other being that the C compiler & pre-processor rely in YACC to build the tokens.  I had been using bison before, however even though bison didn’t generate any errors it build the compiler wrong enough that the majority of the kernel wouldn’t compile.

As it stands right now, the only things that do not compile is locore

to post process the kernel, symorder is used along with dbsym, although neither do any processing to the kernel file itself, so they aren’t needed to get a working system.

386BSD Release 0.1 by William and Lynne Jolitz.
Copyright (c) 1989,1990,1991,1992 William F. Jolitz. All rights reserved.
Based in part on work by the 386BSD User Community and the
BSD Networking Software, Release 2 by UCB EECS Department.
386BSD 0.1.2018 (GENERICISA) 02/02/18 15:01

Other than that, yeah it’s great, compile a kernel in under 15 seconds.

Anyone that cares, the initial release is here: 386bsd01.7z

 

5 thoughts on “Cross Compiling 386BSD 0.1pl23 from Windows 10

    • Disclaimer: I’ve never done it, either. Your best bet would be to start with http://gunkies.org/wiki/Installing_386BSD_on_BOCHS and then compile 2.0 using that setup.

      The 386BSD 2.0 source (https://github.com/386bsd/386bsd) does have an installation program (/install), but it seems that it expects a very specifically formatted filesystem. There is no documentation on how to set up a system that can make use of the installer, much less from scratch on a non-386BSD system.

      I spent about an hour and got 386BSD disklabel to do something useful-ish on a modern GNU/Linux and wrote bootstrap code to a floppy. Then I decided I didn’t care anymore when I realized that (a) probably QEMU’s shoddy floppy emulation would give me trouble again, and (b) even if I got newfs to work as well, I’d still have no way to actually fill the filesystem with the data required to get anywhere.

  1. 把386bsd 0.1 的wdbootblk.c加上:
    /* step 5 load remaining 15 sectors off disk */
    dodisk:
    mov $0x1f6,%edx
    inb %dx,%al
    andb $~0x40,%al #clear LBA bit
    NOP
    outb %al,%dx

    可以在QEMU 2.8.1(debian 1:2.8+dfsg-6 + deb9ut)运行

Leave a Reply