Windows 10 to target Linux 0.11!
Sadly that ancient line program only runs ELF binaries, so that won’t work to test.
As I mentioned gcc doesn’t work. I need to tear more into DJGPP
to see how they did it or just use it’s gcc driver to run this.
In the test directory I’ve mimic’d what a Linux 0.11 install does when compiling
a single file into an exe.
simply run:
c_ hello
and it’ll compile hello.c into hello.
C:\aoutgcc>..\bin\cpp -v -I../include-0.12 -undef -D__GNUC__ -Dunix -Di386 -Dlinux -D__unix__ -D__i386__ -D__linux__ hello.c C:\Users\neozeed\AppData\Local\Temp\001.cpp
GNU CPP version 1.40
C:\aoutgcc>..\bin\cc1 C:\Users\neozeed\AppData\Local\Temp\001.cpp -quiet -dumpbase hello.c -version -o C:\Users\neozeed\AppData\Local\Temp\001.s
GNU C version 1.40 (80386, BSD syntax) compiled by GNU C version 5.1.0.
default target switches: -m80387
C:\aoutgcc>..\bin\a386 -o hello.o C:\Users\neozeed\AppData\Local\Temp\001.s
C:\aoutgcc>..\bin\ld -o hello ../lib/crt0.o hello.o ../lib/libc.a
Wasn’t that fun?
The ‘best’ way I can think of to test is to tar the exe like this:
C:\aoutgcc>..\bin\tar.exe hello.tar hello
And then run it with the Linux 0.11 on Qemu which can be found here:
qemu -L pc-bios -hda linux-0.11-devel-060625.qcow2 -no-reboot -m 16 -k en-us -fda hello.tar
Then once Linux boots, do this:
tar -xvf /dev/fd0
chmod +x hello
./hello
Fun?!
For anyone who wants to play at home, here is the complete sources, and binaries.