
Cross-compiling MINIX 1.1 on a modern host (pre-ANSI, K&R C)
I've recently purchased a physical copy of Tanenbaum's original "Operating Systems: Design and Implementation" (first edition), downloaded the companion MINIX 1.1 source code and spent a few weeks setting up a cross-platform toolchain so that I can build the pre-ANSI C codebase, targeting the 8086/8088, from my modern machine. The toolchain is based on Bruce's C Compiler (bcc) and the dev86 project, which is vendored into the project to keep things stable.
So far I've learned a ton and had to deal with a few interesting problems trying to get such an old C codebase compiling:
- Porting the original PC/IX assembly code to dev86's as86.
- Adding some numeric compiler routines from bcc libc to the MINIX libc library.
- Tweaking the MINIX C runtime (
crtso) to work with bcc and the MINIX exec syscall. - Fixed a couple of bcc compiler bugs to allow passing structs by value: a bug in the optimiser was trashing the stack and a bug in the codegen logic was clobbering a register. I've since learned that passing structs by value wasn't supported in the original K&R book or Ritchie's original reference manual, but the code for the MINIX shell requires it and it was a common compiler extension.
Further details in the project changelog.
Anyway, thought I'd share this here because it's been a lot of fun bringing this historical codebase and OS back to life and I want others to know that there's still a lot of fun/learning to be had exploring the original MINIX OS.