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.

asked 15 Apr '10, 04:37

Anonymous's gravatar image

Anonymous
3113
accept rate: 0%

edited 15 Apr '10, 09:36

Web31337's gravatar image

Web31337
317111

Please accept an answer so the question/answer can be finished.

(20 Apr '11, 13:42) rfelsburg ♦



12next »

gcc was available before linux. you may wish to read http://en.wikipedia.org/wiki/Linux_kernel and links from there :)

link

answered 15 Apr '10, 12:30

Web31337's gravatar image

Web31337
317111
accept rate: 11%

that answers it all :)

(15 Apr '10, 13:49) Titus

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....

link

answered 17 Apr '10, 17:50

portamenteff's gravatar image

portamenteff
311
accept rate: 0%

Hi,

Ok, this one is easy...but first: welcome to the pack. If you ask THIS question, you're possibly V-E-R-Y new to Linux, so, again: welcome!

Installing Linux...the easy way.

Get a distro. Flip to this page (ftp://ftp.belnet.be/mirror/) and select one. I use Fedora, but you are free to choose. If you are that new, though, go for Ubuntu. Download the ISO's. Can you burn a DVD? Cool, get the one big one. No DVD's? Like me, then, get one ISO per CD-rom. Burn the CD-s/DVD. Any package can do that. Install. Put the DVD/first CD in the drive and reboot, follow instructions.

It seems that what you are trying to do is build a Lambo from scratch. Well, "Linux from scratch" lets you do just that, but it IS tuff, be warned. Better just use what's already out there, most of us do...

Now, however, you are on the right path here assuming gcc is needed somewhere. It is. To recompile a kernel. Wanna give that a whack? No sweat, it is easy, just follow the steps outlined here : http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html and you're off. But Linux needs to have been installed already...

At install, the installer will ask to prep the drive, let it use the pre-configured settings, they "fit most sizes" - it will (re) format the drive for you. If there is no surface at all - then you'll need to low-level format the thing first.

Let the pack know how this turns out!! Happy to have you in the group!!

Thor

link

answered 15 Apr '10, 09:31

Thor's gravatar image

Thor
7615
accept rate: 20%

Thanks but my question is how it gets installed not how to install.

(15 Apr '10, 10:32) Anonymous

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.

link

answered 18 Apr '10, 14:44

fancylad's gravatar image

fancylad
211
accept rate: 0%

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

You need a LiveCD to be able to build linux kernel & coreutils, etc from sources. LiveCD has all above. I prefer using either Gentoo Install CD or Slackware DVD for that(last one is easy for me because I already have it on disc) for that.

Also I am a Gentoo Linux user, I've built it from stage 3(meaning I have gcc, coreutils and some other basic soft already compiled), my current kernel is 2.6.33.2 from kernel.org.

link

answered 15 Apr '10, 09:32

Web31337's gravatar image

Web31337
317111
accept rate: 11%

You may also wish to see LFS project site: * http://www.linuxfromscratch.org/ * http://www.linuxfromscratch.org/livecd/

(15 Apr '10, 09:34) Web31337

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.

link

answered 15 Apr '10, 14:07

Paul's gravatar image

Paul
211
accept rate: 0%

Linus Torvalds based his Linux kernel on Minix. He wasn't actually working on a blank-no-software-installed computer (or even just one machine for that matter)...

link

answered 17 Apr '10, 17:43

jdackle's gravatar image

jdackle
112
accept rate: 0%

I think question was how it all started :) . How linus installed first linux. when he did not have gcc how he compiled linux :).

link

answered 15 Apr '10, 10:04

Titus's gravatar image

Titus
1
accept rate: 0%

Hi, I am not asking about the installation process etc ........ As Titus already pointed out I am more into how it all started ?? The question can be generalised for any OS. I tried to look into ULK for system startup but it only talks about how system gets bootup not installed

link

answered 15 Apr '10, 10:34

Anonymous's gravatar image

Anonymous
3113
accept rate: 0%

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.

link

answered 16 Apr '10, 06:44

Anonymous's gravatar image

Anonymous
3113
accept rate: 0%

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
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×90
×10
×4
×3
×2

Asked: 15 Apr '10, 04:37

Seen: 4,796 times

Last updated: 20 Apr '11, 13:42

powered by OSQA