Some Linux Questions

Page 1 of 1

6 Replies - 923 Views - Last Post: 25 May 2008 - 10:08 PM

#1 DominationXVI   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 74
  • Joined: 02-February 08

Some Linux Questions

Post icon  Posted 23 May 2008 - 02:38 PM

How do I execute the a.out file that my compiler spit out? On unix i just typed a.out and hit return, and it executed; apparently this method won't work here.
Where do I get the source code for the kernel? For some reason I was thinking it would be on my system somewhere, I don't think i'm right tho. I just want to look at (and possibly modify) some of the code for learning purposes. Thanks in advance guys.
Is This A Good Question/Topic? 0
  • +

Replies To: Some Linux Questions

#2 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: Some Linux Questions

Posted 23 May 2008 - 02:41 PM

View PostDominationXVI, on 23 May, 2008 - 05:38 PM, said:

How do I execute the a.out file that my compiler spit out? On unix i just typed a.out and hit return, and it executed; apparently this method won't work here.

Chances are, the directory that you compiled it to is not in your path. So you will need to supply a preceding dot slash to the file.
./a.out
You should also verify with ls -l that the file is executable.

View PostDominationXVI, on 23 May, 2008 - 05:38 PM, said:

Where do I get the source code for the kernel? For some reason

On the systems I've used it is under /usr/src/linux, which should be a symbolic link to your source directory. If you did not install the source with your distro, you can download the newest kernel from kernel.org
Was This Post Helpful? 0
  • +
  • -

#3 DominationXVI   User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 74
  • Joined: 02-February 08

Re: Some Linux Questions

Posted 23 May 2008 - 03:52 PM

Thanks no2, you were right about the a.out thing. I don't understand why this happened tho, I was in the same directory in which the a.out is stored when I tried to execute. The a.out is stored in the same directory as the source it is compiled from (which is the one I'm in) - if i ls, it shows the a.out within the directory, and it is executable.

Anyway, my /usr/src directory doesn't contain a linux directory - does this mean I need to dl the source code? the only things i see in that directory is some linux header file stuff.
Was This Post Helpful? 0
  • +
  • -

#4 no2pencil   User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6968
  • View blog
  • Posts: 31,958
  • Joined: 10-May 07

Re: Some Linux Questions

Posted 23 May 2008 - 10:59 PM

View PostDominationXVI, on 23 May, 2008 - 06:52 PM, said:

I don't understand why this happened tho

The current directory is not part of the path. When you make a request to launch the binary executable a.out, & give it no path, then the shell will check the path directory. Since a.out does not exist in any of the directories in the shell variable for path, then nothing is launched.

View PostDominationXVI, on 23 May, 2008 - 06:52 PM, said:

Anyway, my /usr/src directory doesn't contain a linux directory - does this mean I need to dl the source code?


What distro are you using? I would guess so, but it doesn't hurt to research the distribution on the net 1st.
Was This Post Helpful? 0
  • +
  • -

#5 Tom9729   User is offline

  • Segmentation fault
  • member icon

Reputation: 181
  • View blog
  • Posts: 2,642
  • Joined: 30-December 07

Re: Some Linux Questions

Posted 24 May 2008 - 07:57 AM

Usually /usr/src/linux is just a symbolic link. Look for a folder called /usr/src/linux-source-2.<something>.

Also with some distros installing the kernel source just drops a tarball into the /usr/src directory. You'll have to extract it yourself.
Was This Post Helpful? 0
  • +
  • -

#6 MorphiusFaydal   User is offline

  • D.I.C Lover
  • member icon

Reputation: 44
  • View blog
  • Posts: 1,376
  • Joined: 12-May 05

Re: Some Linux Questions

Posted 25 May 2008 - 04:46 AM

And many distros don't even install the kernel source. What distro are you running? We can track down which kernel package to install.

But yeah. Vanilla kernel source since the original 0.01 kernel is on the kernel.org website.
Was This Post Helpful? 0
  • +
  • -

#7 Tom9729   User is offline

  • Segmentation fault
  • member icon

Reputation: 181
  • View blog
  • Posts: 2,642
  • Joined: 30-December 07

Re: Some Linux Questions

Posted 25 May 2008 - 10:08 PM

If you really just want to read the Linux source code, I highly recommend the 0.1 release (honestly). It's not necessarily very practical today, but it's way smaller than the current release. There's a version modified to compile under GCC 4 floating around somewhere.

Some of the comments are pretty funny. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1