Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

c - How can the Linux kernel compile itself?

I don't quite understand the compiling process of the Linux kernel when I install a Linux system on my machine.

Here are some things that confused me:

  1. The kernel is written in C, however how did the kernel get compiled without a compiler installed?
  2. If the C compiler is installed on my machine before the kernel is compiled, how can the compiler itself get compiled without a compiler installed?

I was so confused for a couple of days, thanks for the response.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The first round of binaries for your Linux box were built on some other Linux box (probably).

The binaries for the first Linux system were built on some other platform.

The binaries for that computer can trace their root back to an original system that was built on yet another platform.

...

Push this far enough, and you find compilers built with more primitive tools, which were in turn built on machines other than their host.

...

Keep pushing and you find computers built so that their instructions could be entered by setting switches on the front panel of the machine.

Very cool stuff.

The rule is "build the tools to build the tools to build the tools...". Very much like the tools which run our physical environment. Also known as "pulling yourself up by the bootstraps".


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...