Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

How can Linux run on different microprocessors? Is the Linux kernel being compiled at installation each time?

share|improve this question
add comment

migrated from stackoverflow.com Sep 30 '09 at 7:07

This question came from our site for professional and enthusiast programmers.

4 Answers

Usual steps to get linux working on particular platform:

  • Download kernel sources
  • Download specific platform patches (for example, for Atmel's AT91RM9200 ARM CPU)
  • Apply official/non-official/your patches
  • Download crosstool-ng or similar tool & build your crosscompiler/libraries
  • Build your kernel
  • Assembly/update/build your root manually or using scripts/toolies
  • Transfer your kernel & root FS to your platform using either bootloader/JTAG/copying/other methods.
  • Done

Repeat for each platform.

share|improve this answer
    
Clarification: this isn't something that would be done by the end user, but by someone porting Linux to a new kind of system. –  pjc50 Jan 24 '12 at 10:47
add comment

It is normally compiled before installing. But yes it's compiled for each platform separately.

share|improve this answer
    
Actually, it's always compiled before installing. How would you install it without compiling it ;-) ? –  sleske Sep 30 '09 at 11:03
add comment

Each compiled/installed kernel image is built for one specific microprocessor (or microprocessor family usually).

The source code is partly hardware-independent (= many drivers, schedulers, ...) and partly platform specific (= low-level interaction with hardware, ...), but the resulting binary is always specific for one architecture.

share|improve this answer
add comment

Linux kernel is, as each compiled program, platform dependent.

Kernel hackers are very skilled coders, so a huge part of the kernel code is written in a platform-aware way (by the use ho pre-processor macro for example), the remaining part has to be architecture dependent either for performance issues or because is is bounded to some hardware feature not present on other archs, and so on.

This is not generally a limit in the ability of compiling a kernel on arch A and produce a kernel that will run on arch B, this process is known as cross-compilation, and is made by means of a cross-compiler

So the answer is that it has not to be compiled at installation time, because it can be compiled or cross-compiled by your distro vendor. You could re-compile it on your own machine if you need to customize it, of couse.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.