LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Looking for good distro to learn internals of Linux (https://www.linuxquestions.org/questions/linux-newbie-8/looking-for-good-distro-to-learn-internals-of-linux-4175460089/)

songlian 04-29-2013 09:26 PM

Looking for good distro to learn internals of Linux
 
Hello,

I'm an absolute beginner looking for a distro to learn programming and the internals of Linux, from the ground up. Linux From Scratch is my first choice, but I can't decide whether this is the best distro to start with. Larger more user-friendly distros like Ubuntu and Linux Mint are easy to use, but I'm looking for a distro that won't do everything for me.

Where do I begin?

lleb 04-29-2013 11:08 PM

then take a look at the following distros:

http://fedoraproject.org/

http://www.slackware.com/

http://www.debian.org/

avoid Ubuntu if you want to learn Linux. If you want to get nuts then look at the following:

http://www.gentoo.org/

or check out a fork of gentoo called sabyon:

http://www.sabayon.org/

Sabyon is a fork of Gentoo that is semi pre-packaged and faster to install and update then raw gentoo.

Timothy Miller 04-29-2013 11:15 PM

LFS will definitely accomplish what you want, although it's not exactly quick to get running, nor is it easy to get running since it's 100% made by you.

If you really want to learn the system but don't want to take a million years just to get it RUNNING, I'd suggest Slackware.

btmiller 04-29-2013 11:35 PM

I rather like Arch Linux or Slackware. Both of them require you to set up the system pretty much from nothing, but without the need to spend quite a lot of time watching stuff compile. That being said, if you're interested in development, building the toolchain (linker, compiler, assembler etc.) and kernel from source can be a very enlightening experience in terms of seeing how the system is put together at a very low level. This is only really super useful if you're interested in low-level system programming, though.

I've personally built LFS twice, and while it's an interesting experience I don't feel like it's at all necessary to become a low level system guru. Even Ubuntu can teach you what you need to know if you're willing to look away from the pretty GUI and start poking around with some of the low level system tools.

Erik_FL 04-30-2013 12:42 AM

Quote:

Originally Posted by songlian (Post 4941539)
Hello,

I'm an absolute beginner looking for a distro to learn programming and the internals of Linux, from the ground up. Linux From Scratch is my first choice, but I can't decide whether this is the best distro to start with. Larger more user-friendly distros like Ubuntu and Linux Mint are easy to use, but I'm looking for a distro that won't do everything for me.

Where do I begin?

You've covered a lot of ground with your question. There are many different kinds of Linux programming.
  • Linux kernel modules and drivers
  • Linux shell applications
  • Shell scripts
  • GNOME graphical applications
  • KDE graphical applications
  • Web applications
  • Database applications

Since you mentioned Linux internals, I'm assuming that you want to learn about writing kernel modules and drivers.

I don't think that the distro will matter very much for learning about the Linux kernel. The distro will affect how much effort is involved in getting a programming environment set up and running. Slackware is a good choice because it comes with a lot of software and programming utilities already installed. If you are interested in writing applications for GNOME, you will have to install that on Slackware or use a different distro.

If you are interested in Linux internals, you will have to do some reading. There are many online articles about the internal design of Linux. Keep in mind that it changes with each version of Linux. Some concepts are easier to understand if you learn to use Linux before exploring the internals.

You might want to write some applications before you try to write kernel modules or drivers. Applications use system calls, and those are part of the kernel. Depending on the programming language, some or all of the system calls may be hidden in the library for the programming language.

To write Linux kernel modules and drivers you will need to understand programming in C. To write Linux applications you will need to know C++ and possibly some other programming languages. There are also some programming utilities like "make" that you will need to understand.

Depending on your background, I recommend learning about C programming first. Then learn at least a little bit about assembly language programming for the Intel X86 CPUs. You can find some documentation on the Intel web site that covers the instructions and system programming. To understand some parts of the kernel you will need those documents. If you already have a good background in C programming and assembly language then you can dive right into the Linux kernel.

It may help to study some operating system design concepts first.
  • Executives and task context switching
  • Interrupts and interrupt handlers
  • Scheduling
  • Deferred procedure calls
  • Synchronization, mutual exclusion semaphores, spin locks, queues
  • Memory management
  • File systems
  • Plug and Play
  • PCI and PCIe busses
  • Advanced Configuration and Power Management
  • Chipsets
  • Direct memory access
  • Time calculation and time synchronization
  • Exception handling
  • Signals
  • Pipes
  • Communication protocols, IPv4, TCP, IPv6

Understanding the internals of the Linux kernel is not a trivial job. What I suggest is that you set some short term goals for yourself, such as learning C programming, or learning about writing shell applications. Don't set goals that are too ambitions, like writing a driver, until you have done some simpler programming projects.

There are a lot of great programming sites with examples and specific articles on programming techniques. Take advantage of the programming community. As you learn, consider writing a few of your own articles.

shivaa 04-30-2013 02:04 AM

Here is a test you can appear for. Based on your choices and recommendations given by this test, you can choose a distro. Meanwhile, in my opinion you should go with debian, which will be more suitable for you.
http://www.debian.org/
http://www.debian.org/distrib/

kooru 04-30-2013 03:05 AM

Hi and welcome to LQ!
My 2 cents: start with slackware ;)
Use it, explore it, learn it.

JWJones 04-30-2013 06:38 AM

Slackware

Habitual 04-30-2013 09:35 AM

Quote:

Originally Posted by songlian (Post 4941539)
...I'm looking for a distro that won't do everything for me.

There very definition of Slackware.

theNbomr 04-30-2013 09:54 AM

Several distros. Install one such as Ubuntu, as a virtual host OS, and then install some of the likely candidates listed above as guest OS's. Do it in parallel, so you can use each as an example of the numerous ways to do things, and chose the way that suits your preference. Comparing and contrasting different methods is a great way to learn not only the 'what must be done', but the different methods, reasons, and emphases used to accomplish the goals. Seeing contrasting methods early on helps you avoid the syndrome of viewing your first-learned system as the One True Linux, and all others being pretenders.

--- rod.

normanlinux 04-30-2013 10:44 AM

Slackwarre would be good, but Arch is enjoyable.
As for prgramming, while I agree thaat many modern languages owe their syntax to Denis Ritchie's great work in C I am not sure that this is necessarily the best starting place. I love C and its derivatives but, as has already been said, it depends on what you wish to program. Unless yo wish to learn to tinker with kernel code I would uggest an enjoyable start would be one of the modern scripting languages such as python or - my favourite - ruby.

/* controversy mode on */
I don't recommed starting to program for gnome. why would wnybody want to use C macros all over th place instead od using c++?
/* controversy mode off - and I admit that I haven't looked at gnome programming since encountering the aforementioned horrors many years ago. Perhaps gnome DOES use c++ now? */

DavidMcCann 04-30-2013 11:06 AM

As ever, most people suggest their own distro: it must be perfect, or they wouldn't be using it!

You can learn the details of Linux, and programming, with any distro. Linus himself has always used 'easy' ones, saying that he wants to spend his time developing, not fiddling with the distro. As for Linux From Scratch, you need to know about Linux first: otherwise, you'll either be following the instructions blindly, or spending ages on working out what each stage does. I'd suggest picking a good reliable distro like Mint or PCLinuxOS and getting really familiar with it: you'll learn more that way than if you install more than one or go distro-hopping.

For programming, Python is a good choice to start. Many distros use it for their installers and housekeeping tools, so there are lots of example programs to examine.

Erik_FL 04-30-2013 01:08 PM

Quote:

Originally Posted by DavidMcCann (Post 4941972)
You can learn the details of Linux, and programming, with any distro. Linus himself has always used 'easy' ones, saying that he wants to spend his time developing, not fiddling with the distro.

I agree with DavidMcCann. You probably do want to avoid distros like GENTOO and Linux From Scratch that require a lot of complicated steps to install. That still leaves a lot of distros.

Take a look at the "Wiki" and documentation for the distro you are considering. That will also make a big difference in how easily you can install the distro and get it configured.

You may want to start by running Linux in a virtual machine program such as VirtualBox. Then you can easily install different distros in separate virtual disks and experiment until you find the one that you like. If you make a mistake partitioning the disk or installing Linux in a virtual machine you won't hurt your real (host) operating system.

junior-s 04-30-2013 01:12 PM

Quote:

Originally Posted by songlian (Post 4941539)
Hello,

I'm an absolute beginner looking for a distro to learn programming and the internals of Linux, from the ground up. Linux From Scratch is my first choice, but I can't decide whether this is the best distro to start with. Larger more user-friendly distros like Ubuntu and Linux Mint are easy to use, but I'm looking for a distro that won't do everything for me.

Where do I begin?

Well I guess you know something about computers. If Ubuntu is easy (and it really is), try openSUSE, or if you're more confident you can try ArchLinux following this guide, the learning curve is HUGE on Arch.


All times are GMT -5. The time now is 05:03 PM.