Custom kernel linux

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
hatsu
Posts: 1
Joined: Mon Sep 05, 2016 7:19 am

Custom kernel linux

Post by hatsu »

hello everybody,
I am coming here because I've many problems.

many months ago, with a friend, we started to program a kernel.
Finally, after exploring the basic kernel programming, we chose to use a basic kernel Linux to develop our own OS.

But when we boot this kernel there are too few commands and we need especially fdisk to create a new partition and install the kernel.
We would like to know how to edit a kernel Linux to implement some commands before compiling. (Example: fdisk, gcc, etc...).

Cordially,
Hatsu
User avatar
Schol-R-LEA
Member
Member
Posts: 1925
Joined: Fri Oct 27, 2006 9:42 am
Location: Athens, GA, USA

Re: Custom kernel linux

Post by Schol-R-LEA »

None of those utilities are actually in the kernel itself, or strictly speaking the operating system at all. Nor are the shell interpreters, for that matter; if you are able to get a shell prompt, then you have already done everything you need vis a vis running a simple kernel, and you now need to install some applications - such as the GNU core utilities (fdisk, chmod, etc.), the binutils development toolchain (ld, gas. etc.), the Gnu Compiler Collection, and a simple editor such as nano.

While these are almost invariably bundled with the Linux operating system (that is, the kernel and set of drivers to let the kernel speak to the peripheral devices), that bundling is done by the distribution managers; those things aren't actually part of Linux, even if they are all needed to make Linux usable. The same is true of Windows and Mac OS, actually, but since they only are available as their manufacturers' bundled distribution, you would never normally see a Windows system without the desktop manager, for example (though the server versions can actually run without it). This is the main practical effect of Linux being FOSS for most users: they can get their toolchains a la carte, as it were, and pick the distro that sucks in the least painful way (every OS sucks, they just don't all suck the same ways).

I recommend reading through the OS-Dev Wiki, as you seem to have missed some important information. Also, you might want to look towards the Linux From Scratch project, since that's basically what you're doing even if you are modifying the kernel.

<boilerplate type="wiki links">
Getting Started
How To Ask Questions
FAQ

Required Knowledge
Beginner Mistakes (the "deadlines" section in particular)
What order should I make things in
Code Management

How kernel, compiler, and C library work together
Using Programming Languages other than C

Real Mode, especially the section on memory addressing, and Segmentation
Memory Map, Detecting Memory and A20 Line
BIOS, and Boot Sequence
Interrupts
Bootloader and Rolling Your Own Bootloader
FAT and SFS

While this is a lot of reading, it simply reflects the due diligence that any OS-devver needs to go through in order to get anywhere. OS development, even as a simple project, is not amenable to the Stack Overflow cut-and-paste model of software development; you really need to understand a fair amount of the concepts and principles before writing any code, and the examples given in tutorials and forum posts generally are exactly that. Copying an existing code snippet without at least a basic idea of what it is doing simply won't do. While learning itself is an iterative process - you learn one thing, try it out, see what worked and what didn't, read some more, etc. - in this case a basic foundation is needed at the start. Without a solid understanding of at least some of the core ideas before starting, you simply can't get very far in OS dev.
</boilerplate>
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Boris
Member
Member
Posts: 145
Joined: Sat Nov 07, 2015 3:12 pm

Re: Custom kernel linux

Post by Boris »

Hi,
If you want to have simples commands available after your kernel has booted, I suggest you to use an Initial Ram Disk containing Busy box.
You should be able to get compiled binaries of it for many platforms..

Here is a tutorial that will help you.
http://jootamam.net/howto-initramfs-image.htm
FusT
Member
Member
Posts: 91
Joined: Wed Sep 19, 2012 3:43 am
Location: The Netherlands

Re: Custom kernel linux

Post by FusT »

You seem to be mixing some concepts, as Schol-R-LEA points out.
Linux is the actual kernel (the thing you've got booting now) and doesn't contain any of the software you're describing. It is an OS kernel that handles memory access, device access (through drivers), etc. and nothing more. (See the wikipedia article on kernels)

The software you want to use on top of the Linux kernel is mostly GNU-software

The combination of these two, "Linux" as many people know it, is actually the Linux kernel + GNU and is distributed in distributions (hah! what a surprise!) like Ubuntu, Mint, Mandriva, etc.

You could in fact use GNU software on top of another UNIX kernel (or any other POSIX-compatible kernel for that matter) like the one in Apple's OSx or Minix.
MichaelPetch
Member
Member
Posts: 799
Joined: Fri Aug 26, 2016 1:41 pm
Libera.chat IRC: mpetch

Re: Custom kernel linux

Post by MichaelPetch »

FusT wrote:The combination of these two, "Linux" as many people know it
However, the combination of those 2 things should be referred to as GNU/Linux.
User avatar
jojo
Member
Member
Posts: 138
Joined: Mon Apr 18, 2016 9:50 am
Libera.chat IRC: jojo
Location: New York New York

Re: Custom kernel linux

Post by jojo »

Oh, hey, Stallman. I didn't know you posted here.
FusT
Member
Member
Posts: 91
Joined: Wed Sep 19, 2012 3:43 am
Location: The Netherlands

Re: Custom kernel linux

Post by FusT »

MichaelPetch wrote:
FusT wrote:The combination of these two, "Linux" as many people know it
However, the combination of those 2 things should be referred to as GNU/Linux.
That was indeed the point I was trying to make. Thank you for further clarifying it.
Post Reply