Sign in to follow this  

linux-kernel-and-bash-sources

This topic is 4663 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just downloaded the Linux Kernel 2.6 and Bash 3.0 sources. THERE HUGE!!! That's a whole lot of source files and other things to study. Why do I feel I will never get done? I also downloaded a ton of Linux docs too. I hope to learn more about Linux by programming and hacking around with it. I'd like to make a few modes to the Kernel to produce a custom Kernel for Intel based machines. I have an Athlon XP but it's still Intel (i386) based. I want to be able to feel comfortable working with Linux. I sort of feel that I won't feel comfortable until I can program the Kernel decently. I've though about creating my own type of shell that is part of the Kernel. I want the Kernel to be independent but configurable. Basically, I want it to use my shell if no other is specified. I also want to use my custom configuration script that's similar to CFG or INI mixed with a javascript dialect. I want my own custom Linux with supporting software. This is the only way that I know how to get it done. It may sounds stupid to you, but I think it will be that best for me and at least I will be able to program Linux. I have a lot of work ahead of me. I was looking for the Unix kernel because I wanted to start with something really small and powerful. Which I heard the Unix Kernel is.

Share this post


Link to post
Share on other sites
There's an O'Reilly book on developing with the Linux kernel. I suggest that you read it. Your proposed project suggests that you don't have a full understanding of what it means to "program the kernel", and the book helps teach you about that, walking you through the process of programming a simple kernel module. Most of the features you suggest here should not be implemented by the kernel, but in userspace instead. Your understanding of the kernel will be best advanced by modifying it in a way that makes sense within that framework.

Share this post


Link to post
Share on other sites
Quote:

I've though about creating my own type of shell that is part of the Kernel. I want the Kernel to be independent but configurable. Basically, I want it to use my shell if no other is specified.

The kernel has nothing to do with any of these things. The linux kernel basically just sets up the essential things and then runs the init process. From there, any number of things can be run*. The shell only comes into play when you use a login manager--the default console one being aptly named login. It checks the username and password that you provide and executes the shell for the specific user by looking in /etc/passwd.
* I did skip quite a lot of things that happen at startup, such as the initscripts and hotplug.
Quote:

I also want to use my custom configuration script that's similar to CFG or INI mixed with a javascript dialect.

This is possible, just not very practical. Most of the apps that use configuration files are just that: user-level applications. Seeing as how there are so many user-level applications that one might have in a linux distribution, rewriting all of them to use a different configuration file format would be impractical, let alone a huge waste of time.

If you really want to learn how to program for linux, dig around in the source of some widely known linux applications and make little practice programs illustrating what you learned. You might also want to look into Linux From Scratch, or LFS.

Have fun!
~bytecoder

Share this post


Link to post
Share on other sites
Well, I wasn't planning on rewriting a bunch of programs to use my type of script configuration. I was only thinking about editing the programs that I use. Besides, a lot of the programs that come with linux distros are a waste of space. So I will probebly not be using a tons of them, just the basics to get my own custom Linux up and running.

Like, I only need interfaces for using the host hardware but what I don't need are stupid email programs and messaging crap. I'm mainly interested in programming or re-writing hardware stuff. I plan on programming interfaces for them using a lot of the code already provided. But I don't think it will be a waste of my time to completely customize my own Linux.

I just have a very good idea on how I want a Linux. A lot of Linux distros (I think is) add tons of crap that I have a problem telling what is what and what I really need. So I'll dump everything and go straight back to a pure command line OS with good hardware support. I'm also going to add quite a few things that make it more portable. Eventually I want to run it off a CD.

A lot of you may think this is stupid, but I actually like the idea of going through all the source and studying it. I'll get a ton of knowlege from doing that. I also think that it would b fun writing a lot of that stuff myself. I write fast and learn at a pretty decent speed. I also have a tons of time on my hands. For me, any time I spend with Linuix is not wasted, regardless of what other people think.

I want it the way I want it so I must write it my self. The I will love ir more.

Share this post


Link to post
Share on other sites
That doesn't sound too unreasonable. Either way, it doesn't look like any of us is going to stop you. You should know, though, that most of the code I've seen for open source apps is horrible *cough* sendmail *cough*.

Share this post


Link to post
Share on other sites
Quote:
Original post by sakky
Well, I wasn't planning on rewriting a bunch of programs to use my type of script configuration. I was only thinking about editing the programs that I use. Besides, a lot of the programs that come with linux distros are a waste of space. So I will probebly not be using a tons of them, just the basics to get my own custom Linux up and running.

Bear in mind that this is not universal to all distributions. Gentoo requires very, very little cruft to get a base system up and running. If you're really hard core, go LFS ...

In any case, this has nothing to do with the kernel (which, by the way, is pretty damn configurable already—compiling it is even user friendly, thanks to menuconfig.

Quote:

Like, I only need interfaces for using the host hardware but what I don't need are stupid email programs and messaging crap.

Distro specific. See above.

Quote:
I'm mainly interested in programming or re-writing hardware stuff. I plan on programming interfaces for them using a lot of the code already provided. But I don't think it will be a waste of my time to completely customize my own Linux.

I just have a very good idea on how I want a Linux. A lot of Linux distros (I think is) add tons of crap that I have a problem telling what is what and what I really need. So I'll dump everything and go straight back to a pure command line OS with good hardware support. I'm also going to add quite a few things that make it more portable. Eventually I want to run it off a CD.

There are lots of Linux LiveCDs, many of which are command-line only.

Quote:

A lot of you may think this is stupid, but I actually like the idea of going through all the source and studying it. I'll get a ton of knowlege from doing that. I also think that it would b fun writing a lot of that stuff myself. I write fast and learn at a pretty decent speed. I also have a tons of time on my hands. For me, any time I spend with Linuix is not wasted, regardless of what other people think.

Sounds like a great time, though I'm not entirely sure what you're planning to do—or perhaps I'm not sure that you quite know what you're getting into. However, once you start doing your research I expect you will figure it out, so either way, it should prove a learning experience!

Share this post


Link to post
Share on other sites
I'll be honest, I don't really know that much about Linux. I really only have experience working with RedHat, SUSE, Gentoo and Mandrake distros. RedHat, SUSE and Mandrake I've had decent luck with (except my reason experiences if any of you remember). I really want my own system wrote the way I write (which is pretty (not to sound like a fag or anything)).

So, all I'm starting off with for now is a simple command line OS like DOS. I'll rewrite a lot of the Kernel files to my standards (mainly cleaning them up) and also get rid of a lot of things that I don't need such a support for non Intel based computers. I won't be working on anything other then Intel or AMD so I don't need all that crap!

I want to have access to my hardware (CDR, DVD, Ethernet, Sound, Video, Modem, USB, Serial, Parallel, PS2, Floppy.*, etc..) so I can use them. I'll probably wind up using some distros implementation for these type of interfaces and rewrite them by clean them up and include them with the OS. It's a lot of work, but I will never quite understand the things I want to until I do this.

I wanted the OS to be small and powerful. Something that can be taken and ran anywhere (as long as it's Intel based). So I figured after I got all the OS complete and tested it, I could burn it to a CD. This way I can take it with me anywhere and just put it in and run it. Keep in mind the computer must have "Boot from CD" enabled. When it boots I want it to give the option to boot the Linux CD or boot the default OS.

I think this is pretty secure too. No system content can be edited or messed with because it's on a CD. If a virus infects a running process it will die as soon as the system is rebooted. The OS should load the needed modules and kernel into memory and run from there. This is where I will get a lot of speed from. I want to implement a user configured settings saving routine that will save the user settings to a floppy or HDA if the OS detects a Linux partition.

The OS may boot slow, but after it gets done booting it'll kick some ass. This is why I don't want a whole lot of junk programs. I only want core system and hardware interfaces.

The hard part if figuring out what I will do with this OS once I get it built. IT seams most of the fun is spent building, tweaking and working it out. Once that's done I'll have may own Linux OS, but what's next?

Share this post


Link to post
Share on other sites
This Linux architecture is something else. My first glance at it I though it was sort of stupid and way to complex. But now, the more I look at it and read on it I'm starting to grow fond of it.

I've downloaded some good doc on Kernel programming but they are just that. Not actual Kernel programming but module programming. So I've been fallowing the docs as best as I can snooping around the Kernel source looking for .o or .ko files. Then I remembered, "This best has to be compiled first dummy, what the hell are trying to find?"

So I started looking in more places that I would find source to modules and I found some cool USB and or peripherals module sources in /drivers. This is cool to me because now I get learn the real cool stuff about interfacing with all that. The modules do look ugly though. I wonder who writes these things, don't they care about decent looking source?

Auf, I guess I'll just clean them up my self. This will give me a good chance to study the Kernel & modules more. HOW FUN!!

Share this post


Link to post
Share on other sites
I'm not sure if this is what you mean, but it would be quite nice to have a "shell" in kernel. If for some reason my system hangs because of some buggy video driver (or some app decides to grab my keyboard, mouse and screen and not give them back), I could press the magic SysRq key to get the kernel shell which would allow me to kill processes, load/unload modules and that sort of simple tasks. I'm not sure if this would help againts buggy modules.. perhaps shell could automagically switch to vga text mode.. just an idea without a clue if it is even implementable.

Share this post


Link to post
Share on other sites
Actually that is what I had in mind. I shell in the kernel and no other. It would make use of the kernels system routines instead of launching other programs to do it. Which is what I think Linux does.

I'm shooting for something more similar to Microsoft's architecture. Don't get me wrong, but I think Linux could use a good face lift. All those modules that I've been reading through and looking at seam to be a waste. I really don't need support for touch-screens or stuff like that. If I did want that support, then I would like to be able to install a library that the Kernel could use. The library would have to register it's self with the kernel via "I am a driver for this type of device" type of thing. And then any application the request this type of device interfaces will communicate with the library. Of course the Kernel supervises all this. But that's the just of it.

I would like to remove all the modules from the Kernel and make them external opposed to internal. The modules can be kept in libraries that the Kernel could load and use when it needs. But special types of functions like FS routines and stuff like that should be compiled with it.


I'm still reading lot and learning a lot too, but I think I could do with out 10,000 source files just for a Kernel. I don't think the Kernel should be that complicated at all. If I were to remove a lot of modules I bet the Kernel might even run faster. There's only so many things that you really need, the rest is just junk that is there just in case you wanted to use it (in my opinion).

But I would like the Kernel and shell together as one. I bet a lot of the module interfaces could be generalized to save space and things could even work more efficient. Who knows, I might be talking out my ass and not making any sense, but I'm learning as I go.

Share this post


Link to post
Share on other sites
One really cool thing I can do right now is experiment with shells. I can compile applications that emulate and them. I'm just tryingto find the right type of shell to base mine off of.

-Linux joke I made: She sells C-Shell's by the sea shore

Share this post


Link to post
Share on other sites
I think I'll hold off on the custom shell until I learn about the Kernel more. Because I really don't know that much(at all really) system commands that I can utilize in a shell. SO don't think making a wrapper or shell for the Kernel is such a good idea right now because I would run into wall after wall. I'll stick with a shell that's already been tested and used. I'm really not to fond of bash because I'm not experienced with it. I've been researching on Linux shells and came across a few that I would like to look into. Those would include Korn Shell and C-Shell. I've learned Korn Shell is own by AT&T, so I would have to pay them for it. However, C-Shell isn't and it's free. And since I'm a C fan at heart, I think I might like it.

I've learned so far the Kernel really isn't that big. A lot of it is wrote in C and the few parts that need to be; are wrote in assembly. Most of the Kernel source contains modules that run a user's hardware. One of the most interesting parts I came across is the USB modules because I was recently studying USB devices; which I still am. Studying the Kernel is giving me more of an experience and I'm learning Linux more quickly. If only I knew this before I would probably be past this point and on to more advanced topics and projects.

I'm getting tired of reading and my fingers are starting to ich. I so badly want to jump into coding. These documents have got mw drooling. But I know I need to have a good understanding before I code anything so I must research more. There's a lot of information to cover here!

I'll probably start off with making modifications to the kernel instead of rewriting it completely. This way I know it still works and I can just undo what I've done; unless of course I really screwed something up. Who knows, I may even be able to make my own distribution out of this project.

I know this topic really isn't geared for game programming or isn't game related, but to me it is. It is because I'll use the knowledge I learn here in developing a game of some sort. Do you see that most really good application architectures fallow an operating system's architecture as I do? Besides that, learning more about a system will give me the advantage of taking advantage of what it has to offer.

So far, I've decided that I want Intel & IBM as the supported platforms for the OS. I don't care for support on such weird devices like touch screens but I do care for support on other devices like mice, keyboard, sound & video cards and all that type of stuff. I would like to use either KDE or 3D-Desktop as the desktop environment. I'm also shooting for a Desktop & Client / Server OS. I want the ability to share files easily with friends among little networks or workgroups and maybe host small HTTP/FTP servers. Linux supports a lot of this type of functionality already so I don't really have to much to worry about. Also, I'm looking for power! I want the OS to be specially geared for multi-media and have support for all types; one thing I know Linux can do.

That's about as far as I've got for now. So what do you think? Think I can pull this off? If I do, would any of you care to use my little OS? Or would you point and laugh!

Share this post


Link to post
Share on other sites
I'm learning about Linux files systems and FSSTND. This is quite interesting and reassuring. I wanted to do my own architecture that ran by my own rules. But now I think that FSSTND is a good ting to stick with. After all, if I were to make this OS and it became popular, chances are the existing Linux users may assume that the FS structure is that of most other Linux distributions. If I changed it, I could through off more then just users but programs that depend on things like that too.

I was going to add support in the shell for most of the utilities that are in /bin. But I just realized something. What if a user wanted to re code on of those utilities to there liking? They couldn't if I implemented it into the shell. If I leave those things how they are them other users may do with them as they want. However, I can rewrite some of them to add a few colorful things that might seem cool to some users and provide them with the source. If I did this, I must also provide the original copy so that users could revert back to the original if they didn't like what I made for them. But the utilities do a good job with out me fooling around with them.

There's not to much to Linux & friends that I can do that really change anything it seams like. Just adding a few modifications here and there is all. IT seams like Linux isn't so big and bad as I though it once was. Meaning, I use to picture it as a huge hassle that I would never understand and be constantly flabergasted about. Every time I looked at Linux I thought "What king of shenanigans are going on here?".

Wait I just thought of something. What if I made a Linux distribution called Shenanigans? It would be sort of cool wouldn't it?

Share this post


Link to post
Share on other sites
Quote:
Original post by sakky
Don't get me wrong, but I think Linux could use a good face lift. All those modules that I've been reading through and looking at seam to be a waste. I really don't need support for touch-screens or stuff like that.

So don't compile them into the kernel.

Quote:
If I did want that support, then I would like to be able to install a library that the Kernel could use. The library would have to register it's self with the kernel via "I am a driver for this type of device" type of thing. And then any application the request this type of device interfaces will communicate with the library. Of course the Kernel supervises all this. But that's the just of it.

Sounds a lot like kernel modules.

Quote:

I would like to remove all the modules from the Kernel and make them external opposed to internal. The modules can be kept in libraries that the Kernel could load and use when it needs. But special types of functions like FS routines and stuff like that should be compiled with it.

I'm not sure what manner of change you envision here (and I'm no Linux guru, either); what is the difference between your proposed scheme and the present module loading architecture? Do you know how it works?

Perhaps what you're aiming for is something more like a microkernel; microkernels are very nice in theory, but in practice tend to be complex and rather inefficient. I'm not aware of any significantly used OS that uses a real microkernel.

Quote:

I'm still reading lot and learning a lot too, but I think I could do with out 10,000 source files just for a Kernel. I don't think the Kernel should be that complicated at all. If I were to remove a lot of modules I bet the Kernel might even run faster. There's only so many things that you really need, the rest is just junk that is there just in case you wanted to use it (in my opinion).

But so what if the source files are there? Who cares? I manually select (via make menuconfig) exactly what modules I want to compile in (actually, since I know exactly what I need, I compile it all into my kernel rather than as loadable modules). I don't have modules for hundreds of device drivers that I don't need—but I'm glad that there are device drivers for hundreds of devices in the kernel sources, so that I could compile them in if I needed them. Good hardware support is imperative for any operating system.

Quote:
But I would like the Kernel and shell together as one.

Why? What's the benefit? (Not intended as a snip; I'm curious to hear your intent.)

Share this post


Link to post
Share on other sites
When I want to compile the Kernel, I want to leave out a lot of things. I'm still learning what I need to keep. I need to know how the "Makefile" works. I've been reading parts of them and it looks like script that a compiler uses (if one it to be found to be used) to build the modules and keren l executable.

I really don't care for BTFX support on Linux(because I have WindowXP ) or any other Microsoft based file systems. I also want the NVIDIA driver compiled with the Kernel. I have a MSI motherboard with VIA and intergrated sound. KDE likes to turn the sound off a lot via no volume but the card works. So I only want hardware support for hardware that I have. I don't have any printers or do I use any, so no printer support is needed.

So help me out here guys, how do I use the Makefiles to compile a special Kernel for my system? I could give you my system specs if you needed them.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
look at the menuconfig program that someone else mentioned.
then look at the makefiles it generates.

Share this post


Link to post
Share on other sites
Quote:
Original post by sakky
When I want to compile the Kernel, I want to leave out a lot of things. I'm still learning what I need to keep. I need to know how the "Makefile" works. I've been reading parts of them and it looks like script that a compiler uses (if one it to be found to be used) to build the modules and keren l executable.

I really don't care for BTFX support on Linux(because I have WindowXP ) or any other Microsoft based file systems. I also want the NVIDIA driver compiled with the Kernel. I have a MSI motherboard with VIA and intergrated sound. KDE likes to turn the sound off a lot via no volume but the card works. So I only want hardware support for hardware that I have. I don't have any printers or do I use any, so no printer support is needed.

So help me out here guys, how do I use the Makefiles to compile a special Kernel for my system? I could give you my system specs if you needed them.


In the directory where the kernel source is located :

make menuconfig

and then just uncross what you don't need. No need to go mucking around in the bloody makefiles.

Share this post


Link to post
Share on other sites
I feel like trolling this poor fellow... but I'll help instead :/

Something you might be interested in is BusyBox, it is... well... something you should find interesting.

It allows you to eliminate a lot of the external applications and have them all in one place.

Share this post


Link to post
Share on other sites
Quote:
Original post by sakky
When I want to compile the Kernel, I want to leave out a lot of things. I'm still learning what I need to keep. I need to know how the "Makefile" works. I've been reading parts of them and it looks like script that a compiler uses (if one it to be found to be used) to build the modules and keren l executable.

Sounds to me like you need to learn how to install a kernel, not write one. [grin]

Quote:

I really don't care for BTFX support on Linux(because I have WindowXP ) or any other Microsoft based file systems.

... Again, just don't compile it in. My kernel is compiled only with the filesystems I need.

Quote:
I also want the NVIDIA driver compiled with the Kernel.

The proprietary NVIDIA driver is not distributed with the kernel because it's not Free (only free as in beer).

Quote:
I have a MSI motherboard with VIA and intergrated sound. KDE likes to turn the sound off a lot via no volume but the card works. So I only want hardware support for hardware that I have. I don't have any printers or do I use any, so no printer support is needed.

... And again, support for compiling only what you want is already in the kernel.

Quote:

So help me out here guys, how do I use the Makefiles to compile a special Kernel for my system? I could give you my system specs if you needed them.

Assuming that you have your kernel sources and a symlink at /usr/src/linux pointing to the correct version,

mount /boot
cd /usr/src/linux
make menuconfig
# configure your kernel to your liking
make
make install
make modules_install

should about do it. Just be careful that you don't exclude things that you do need. Mind half asleep, I once accidentally left out ReiserFS support, with my / filesystem being Reiser ... not fun! (Thankfully I'm cautious enough to provide a boot entry for the last working kernel, so fixing it was trivial.)

Share this post


Link to post
Share on other sites
Sign in to follow this