You are not logged in.

#1 2010-03-05 13:12:05

LiteHacker
Member
Registered: 2008-11-27
Posts: 38
Website

Building new Linux distribution.. where to go?

Hey guys. I am looking forward to building a Linux distribution that is made extremely custom to my ideas of how an OS should run. (I have some previous history of writing up Operating Systems in assembly language in both 16 and 32 bit.)

I have gained a bit of knowledge around how Linux operates and used Arch Linux for some time to familiar myself with some of the controls and directories in Linux. I tried using LFS (Linux from Scratch), and found that what it accomplishes is essentially a very slow way of doing the same as Arch Linux's package manager.

However I don't understand how to do a few specific things, which I think are central to building a new distribution:

1. What is the very most base required for Linux to run? With both LFS and Arch Linux, if you want to install the kernel, you have to install a whole bunch of other things, like bash, init, readline, kernel-headers, etc. as dependencies.
From what I understand however, the Linux kernel can run without most of these packages.
For example, I may want to have Linux boot up to turn on only one program (lets say a mysql server) and that's it. No bash or shell of any kind, no man pages, no utility commands like "rm" or "cd"
So, what is the very base minimum requirement for a Linux kernel? How do I isolate it from everything else? In theory if I have only the very base, it should take up less than a megabyte. (ie, I should be able to fit it on a floppy disk.)

2. How do I choose exactly what type of features I want from a Linux kernel? Slackware seems to give these general "hughsmp", "generic", "hugh", etc. versions of Linux. How do I choose any options available for Linux? ie being able to read ext2 or fat, or both.. Being able to execute ELF or a.out, or both.
To be able to include some features in Linux, for example handling TCP connections.. I might want to remove these if I am not using a network.

3. This might be a bit more advanced, but I didn't see how to do this anywhere: How do I detect which devices are connected to the computer? For example, if I want to detect what type of network card you have so that I can install the appropriate driver, what do I do? Is it just scanning "lspci" and "lsusb"? Or is there a way to do it without those programs?

Offline

#2 2010-03-05 18:07:40

extofme
Member
From: here + now
Registered: 2009-10-10
Posts: 174
Website

Re: Building new Linux distribution.. where to go?

i too have been investigating building a new distro (however, my ambitions are geared toward socializing/distributing both the entire development process, and the community itself.  see here: http://bbs.archlinux.org/viewtopic.php?id=90970)

1) as far a i understand, the kernel requires next to nothing to "run".  the kernel when finished initializing itself and the devices will launch a program called "/sbin/init" on the root device, unless otherwise specified on the kernel boot line.  if the root device is not available (its on an encrypted device for example), then the kernel decompresses a temporary filesystem into ram (initramfs/ramfs), and launches "/init".  that process than takes over from there;  the kernel itself pretty much does nothing concerning booting the system.

the rm/cd/etc. commands are part of the GNU coreutils package... the bottom most basic tools on and GNU derived system.  you can set up any kind of system you like with any mixture of apps.  to make it fit in a megabyte you would need a heavily stripped kernel and no initramfs i would think.

2) all the features for the kernel are determined at compile time by the ".config" file.  it's basically a tremendous list of key value pairs, in a kind of hierarchy.  try "make menuconfig" or "make xconfig" with no existing .config file to see everything.  you can compile many things directly into the kernel (y), or as loadable modules (m).

3) current way of device detection is thru a system called uevents/udev.  i wont get into it too heavily, but uevent datagrams are fired off by the kernel containing information about devices/etc. and a userspace daemon (udevd) collects these datagrams and does appropriate things (create device nodes, whatever).  im not sure as much here, but i think sysfs is created by running drivers, and has nothing/little to do with udev.


what am i but an extension of you?

Offline

#3 2010-03-05 21:05:20

Peasantoid
Member
Registered: 2009-04-26
Posts: 928
Website

Re: Building new Linux distribution.. where to go?

LiteHacker wrote:

1. [...] For example, I may want to have Linux boot up to turn on only one program (lets say a mysql server) and that's it. No bash or shell of any kind, no man pages, no utility commands like "rm" or "cd"
So, what is the very base minimum requirement for a Linux kernel? How do I isolate it from everything else? In theory if I have only the very base, it should take up less than a megabyte. (ie, I should be able to fit it on a floppy disk.)

2. How do I choose exactly what type of features I want from a Linux kernel? Slackware seems to give these general "hughsmp", "generic", "hugh", etc. versions of Linux. How do I choose any options available for Linux? ie being able to read ext2 or fat, or both.. Being able to execute ELF or a.out, or both.
To be able to include some features in Linux, for example handling TCP connections.. I might want to remove these if I am not using a network.

1) You can accomplish this with the init=... boot option. Normally it is /sbin/init, which as the name implies is the first user-space program (someone verify this?) that gets run. When I briefly experimented with LFS, I set it to /bin/bash for a *very* minimal recovery distro sort of thing.

2) $(make ...config) in kernel source tree ($(make help) to see the available *config options). Or edit .config by hand if you're that hardcore, though I suspect you are not.

** Oh, I see extofme already wrote the above. Pah.

Last edited by Peasantoid (2010-03-05 21:06:24)

Offline

Board footer

Powered by FluxBB