by jschwartzi · 6y ago · 0 comments
The Linux kernel can execute a shell script as PID1 from the initramfs, meaning that you can just execute the minimal commands needed to mount the main root filesystem and then use pivot-root to change from the linuxrc script in your initramfs to the main init process supplied in your main root filesystem.
You might have to get really creative with compression and static linking as the linker/loader clocks in at a few-hundred kilobytes, plus the gcc support library and the glibc for another few megabytes. Alternatively you could find a way to make the system calls directly and bypass the libc. Busybox will also fit on that disk and it ships with a mount command too, so you could get up and running with that pretty easily.
https://www.debian.org/releases/stable/i386/ch02s01.en.html#...
https://www.zdnet.com/article/good-bye-386-linux-to-drop-sup...
From that link:
x86, 386 removal: Remove CONFIG_CMPXCHG
x86, 386 removal: Remove CONFIG_XADD
x86, 386 removal: Remove CONFIG_BSWAP
x86, 386 removal: Remove CONFIG_INVLPG
x86, 386 removal: Remove CONFIG_X86_WP_WORKS_OK
x86, 386 removal: Remove CONFIG_X86_POPAD_OKThey dropped 386 support, but a 486 still works.
So even if you compiled it with strict -march i486 you'd end up with unsupported instructions. Modern GCC also doesn't like emitting strict i386 or i486 code anymore so you'd be likely to end up with unsupported instructions even without any inline assembly.
Doing some googling... 486 had cmpxchg, that's good.
Seems it didn't have rdtsc. It's not out of the question, I might say even pretty common, for user mode code to use that one via inline asm to implement a timer.
Obviously no SIMD instructions. If they say they're supporting 686 or better they might have some compiler flags that depend on mmx or similar? SSE came late to P6.