PDA

View Full Version : Looking at source code


setoguro
07-30-2003, 10:19 PM
How do I look at the source code of my distro? Do I open a certain file on the CD and decompile it? Well that's the other matter what do I use to decompile the a file with? I'm running Mandrake 9.0.

pave_spectre
07-31-2003, 01:22 AM
If you got the full multiple Cds( i think with mandrake its the 7 CD version) the later CDs (6&7) contain a whole lot of source code files.

During a normal install uncompiled kernel sources specifically for the purpose of editing and recompiling for personal preferences may be available as an installation option (i know it is with red hat), which means somewhere on one of the cds the kernel sources should be able to be found, possibly as a *.c or *.cpp (since i believe they are written in c)

setoguro
07-31-2003, 07:47 PM
Thanks
I was curious about it. Don't understand what I'm looking at yet just thought that I would poke it with a stick a little and see. Now I'm more curious and have to start reading. The process has started. :)

pave_spectre
07-31-2003, 10:51 PM
If you do recompile the kernel all you need to do is edit your bootloader to add an option pointing to the newly compiled kernel then try a rebbot and see if it runs.
I try not to poke things too much in case they get up and try and bite me on the ass.:D

bokonon
08-01-2003, 05:22 AM
Originally posted by setoguro
How do I look at the source code of my distro? Do I open a certain file on the CD and decompile it? Well that's the other matter what do I use to decompile the a file with? I'm running Mandrake 9.0.

Hello Setoguro,

A linux distribution is made of many separate programs. Each of these programs will have its own source code. They may already be installed on
your system, look in /usr/src and /usr/local/src. Was anything there?

If not, it only means that your system doesn't have any source code installed. (yet)

If so, you will see a directory for each of the various programs that make up the system as a whole. In the directories you will see various files
and other directories. these are the source code. take a look at a file
ending in ".c" that is the "C" language, which most of the system is written in. The source for the whole system runs to the tens of thousands of files and millions of lines of code.

You don't need to decompile anything, just use a text editor to view the files. (the two most popular text editors are called "emacs" and "vi" just pick one you like)

Now, if the source code isn't already installed on your system, you will need to install some to look at. I am afraid I won't be much help here,
as I have never used Mandrake or Redhat, and both of those package various parts of the system using a tool called rpm, which I know vary little about. What I do know is that it is fairly simple to use rpm to
install source code, I just don't know the particular incantation off the top of my head.

Have Fun!

setoguro
08-02-2003, 01:57 AM
Thanks
I looked at some files using vi. Made no sense to me what so ever. But that's ok. Now I'm reading up on vi and got some stuff on C. Maybe some of this stuff will sink in and one day I'll even be able to write some code if I don't melt my little brain. :)

pave_spectre
08-02-2003, 09:25 AM
If you want some code for learning you might want to try learning python. It takes some syntax from C/C++ and Java so its supposed to be a good language for learning programming.