Hi, Suppose I get a Kernel source code and try to compile it on Linux which is not having gcc compiler then it will not get compiled for sure b'coz kernel needs gcc for compilation. My question is then how a Linux gets installed on raw hard disk which in not having gcc pre-installed. I also believe gcc can't be installed on raw hard disk (not sure and never tried). So, it is also not the case that Linux installs gcc first and then do the rest later. Can any one explain how the thing works from lower level point of view. |
As per my understanding of Linux installation on any hard drive is very easy. If we see the installation process carefully then we'll find that installation comes into two phases. First phase of installation provides one pre compiled kernel and initial ramdisk. Ramdisk contains all those module necessary to work with file system and kernel starts booting process and the second stage provides all the softwares to be installed as part of OS. If we are using CD/DVD rom then we can easily see precompiled kernel and ramdisk under images folder in the installtion CD/DVD. If we are using PXE boot then we first provide these two through tftp server. I hope this is a logical answer. |
Er... Actually, the Linux kernel doesn't really need GCC specifically. Not anymore. These days there are plenty of compilers avalable. And you don't even need GCC specifically to build anything on Linux. As for which came first, GCC did, although it is frequently debated about its quality before Linux came along. That, of course, is not a subject for this web site. I think it'd serve well to point out that almost everything in the GNU toolchain has a comparable non-GNU Free/Open Source replacement available. GCC is replaced commonly with EGCS, for example, and HAS replaced GCC as the default in systems such as Debian. |
what is your linux platform ??? |
For most distros when you install Linux everything is already pre-compiled so you don't need gcc at all to install the kernel or anything else. You only need gcc if you want to compile source code into binary yourself. In fact Ubuntu didn't used to install a compiler at all (I presume it still doesn't) by default.
(29 Apr '10, 10:01)
Amos
|
i think what he was asking was "what came first, the chicken or the egg?" The answer is the compiler. Linux kernel compiled originally on another system. Don't know what system Torvalds used. He compiled the first kernel and installed it. Gcc is older than Linux. It was originally done at Berkley. If you can read this message, you have a machine that will compile. Not sure why. You can use Gcc on Windows, Linux, Solaris, ATT Unix, Mac, BSD etc.... |
For the newbies who come here, thinking this was actually a question on how to install Linux, go check out the following versions of Linux: Both will autoinstall, autodetect and configure all your hardware. Bliss. |
Hi, Thanks all for your answers.Ya, gcc came much earlier then Linux. Still I have some question like while we put Installation media say DVD and start installation process. What it does first of all. Is it install gcc and go for kernel installation process or it does something else. Also can we install gcc on a raw disk. 1
Installing an OS doesn't at all requires a compiler, it is just a matter of laying out the disk and copying files. And what an installation disk does first is booting an operating system that is present on the installation media. About installing gcc on a raw disk, that doesn't makes sense. gcc needs an OS to run and need an filesystem to be installed in and to work with.
(16 Apr '10, 12:57)
jlliagre
Even Gentoo which features specially compiled applications for your specific machine, requires a base system before you are able to do any compilation.
(29 Apr '10, 10:00)
Amos
|
Don't forget, linux is really just the kernel, and gcc doesn't necessarily need the linux kernel to run. You could for example recompile the gcc compiler for Windows, and then from Windows cross compile the linux kernel. The build environment does not need to be the same as the environment you are trying to build. |
gcc was available before linux. you may wish to read http://en.wikipedia.org/wiki/Linux_kernel and links from there :) that answers it all :)
(15 Apr '10, 13:49)
Titus
|
Please accept an answer so the question/answer can be finished.