summaryrefslogtreecommitdiffstats
path: root/index.md
blob: 5fb77a4b59d6d7cd485fe24059c5ead5bb3aa114 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
% WTF is Linux


> What I cannot create, I do not understand.
>
> --- <cite>Richard Feynman, 1988</cite>

TODO: reference a mono font in the CSS

TODO: have a POSIX / UNIX / Linux section

TODO: have a QEMU section

TODO: specify dependencies

TODO: Add a plan checklist?

TODO: Link manpages

TODO: Add pretty pictures

Goal of this course and this document
-------------------------------------

In this course, we will attempt to create a GNU/Linux file system from scratch.

The objective is to deeply understand the Linux ecosystem: how it boots, what
are the different pieces, how do they integrate with one-another, what are the
different choices available to us when building such a system, etc.

Even though it's very rare to build these kinds of things "manually," I do
think it's better to do it this way for educative purposes.

However, in the practical work part, we will build a Linux system in an
automated fashion, using [Buildroot](https://buildroot.org/), a well-known
software in the industry for building embedded Linux systems.

This document is intended to serve several functions:

- As notes, if I talk too fast, or if you don't like to take
  notes[^take-notes], or miss classes.
- It's likely that this website is going to be more detailed than the course,
  so it's useful you want to go further. You can also follow the links to go
  even further.
- Should I miss some things while talking, this website should fix it.

[^take-notes]:
	{-} You really should be taking notes, it does help remember.

The Linux command-line
----------------------

Main article: [CLI](cli.md)

When we say "command-line interface," we usually mean the text-based program
whose main purpose is to execute other commands. You input a program name, enter
its arguments, press enter, and it will execute the said program with said
arguments.

In reality, the UNIX command-line is more complicated than that, but that also
makes it much more powerful. See the main article if you want to unlock this
power.

<!--
A shell is a programming language whose main goal is to launch other
programs. It also usually provides a command-line interpreter: a text-based
program that executes (interprets) the shell code you input.
-->

The Linux Kernel
----------------

Main article: [kernel](kernel.md)

The Linux kernel is the glue between the hardware and the user space
programs.

Each time a user program needs to access the hardware (for example, hard
drives, network card), it has to go through the kernel through system calls
(for example, read/write on a file, `sendto`/`recvfrom` on a socket).

It also decides how processes are run, and is in charge of enforcing
security.

The file system
---------------

Main article: [file system](file-system.md)

A file system is a way of organizing data in the form of files and
directories. Put another way, since hard drives store only bytes, it's the
responsibility of the file system to organize these bytes such that the kernel
can interpret them as files and directories and present them to the user.

Init
----

Main article: [init](init.md)

The init program is the first user-space program that the kernel
launches on boot. Every other program is launched either by init or a
child of init (direct child or transitive child). Since init is the
first program launched, it always has a PID of 1.

TODO: link to first steps to "user-space booting"

Special file systems
--------------------

Some file systems aren't used to store data, but instead to communicate
with the kernel. This allows doing various things using only the
`read`, `write`, and other file-related system calls.

For example, you can list USB devices by listing the content of the
directory `/sys/bus/usb/devices/`.

More info in the [file system](file-system.md#special-file-systems) article.

Networking
----------

TODO: quickly explain static IP vs DHCP, networking interfaces