Jump to content
  • Advertisement
Sign in to follow this  
sakky

linux-kernel-and-bash-sources

This topic is 4973 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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!