4 ms·
One thing I have never understood (and haven't looked into) is how can Linux be so portable, when it was specifically built with x86 in mind?
by copperx 6y ago
One thing I have never understood (and haven't looked into) is how can Linux be so portable, when it was specifically built with x86 in mind?
- jhbadger 6y agoThe first versions weren't. It wasn't until people wanted to port it to the DEC Alpha architecture in 1995 that the changes that they proposed ended up removing a lot of the X86 dependencies. That made further ports much easier.
- LukeShu 6y ago> It wasn't until people wanted to port it to the DEC Alpha architecture in 1995 that the changes that they proposed ended up removing a lot of the X86 dependencies. The m68k port started in 1993 when people wanted to run Linux on their Amiga computers, and Linux/m68k was under lively development in 1994, supporting Amiga and Atari computers.
- jmclnx 6y agoAnd I believe DEC gave Linux a 1 or 2 alpha systems to work on the port
- jlokier 6y agoBeing mostly written in C was key. Though it was written for x86 initially, it was nearly all C, with GCC extensions and macros/inline functions containing a tiny bit of inline assembly where x86 instructions were needed. That made it easy to port to other architectures as soon as someone was motivated, by replacing macro/inline definitions, the bootloader, entry/exit/interrupt paths, and simple architecture-specific device drivers such as keyboard and console. If Linus had said no, it would have been difficult, as there were many changes that needed to be maintained for each new architecture, and internal APIs that needed changing to help them perform well. Luckily Linus was happy to accommodate new architecture changes as people did the ports, and over many years the internal APIs gradually shed their x86-flavoured semantics to become more portable.
- swiley 6y agoIt's something that turned out to be easy and legal to hack on (with businesses that otherwise wouldn't share code being compelled to.) So the answer is: because people wanted it to be portable.
- guenthert 6y agoBSD Unix was originally written for the DEC VAX, which left its mark on e.g. the virtual memory subsystem. Just because it was written for a specific architecture, doesn't mean it cannot be ported to other (at least similar) architectures.