diff options
Diffstat (limited to '2020-09-08.md')
-rw-r--r-- | 2020-09-08.md | 398 |
1 files changed, 398 insertions, 0 deletions
diff --git a/2020-09-08.md b/2020-09-08.md new file mode 100644 index 0000000..fa96eaa --- /dev/null +++ b/2020-09-08.md | |||
@@ -0,0 +1,398 @@ | |||
1 | --- | ||
2 | title: WTF is Linux | ||
3 | author: Rémi Nicole <remi.nicole@smile.fr> | ||
4 | date: 2020-09-08 | ||
5 | slide-level: 2 | ||
6 | aspectratio: 169 | ||
7 | |||
8 | theme: metropolis | ||
9 | colortheme: owl | ||
10 | beameroption: "show notes on second screen=right" | ||
11 | |||
12 | toc: true | ||
13 | highlightstyle: breezedark | ||
14 | lang: en-US | ||
15 | |||
16 | bibliography: ../bibliography.bib | ||
17 | --- | ||
18 | |||
19 | # The Project | ||
20 | |||
21 | ## Building a Linux system manually | ||
22 | |||
23 | - This is the Course (You are Here) | ||
24 | - Using just normal commands | ||
25 | |||
26 | ::: notes | ||
27 | |||
28 | Hello | ||
29 | |||
30 | ::: | ||
31 | |||
32 | ## Building a Linux system automatically | ||
33 | |||
34 | - Practical Work | ||
35 | - Buildroot | ||
36 | |||
37 | |||
38 | ## Why | ||
39 | |||
40 | - Linux is everywhere in embedded software | ||
41 | - Linux is everywhere in the server space | ||
42 | |||
43 | |||
44 | # History | ||
45 | |||
46 | ## 17th century to 1970s | ||
47 | |||
48 | :::: columns | ||
49 | |||
50 | ::: column | ||
51 | ![Human computer at NACA [@wikimedia:human_computer]](../res/Human Computer.jpg){ height=80% } | ||
52 | ::: | ||
53 | ::: column | ||
54 | ![Katherine Johnson working as a Human computer at NASA [@wikimedia:katherine_johnson_human_computer]](../res/Katherine Johnson at NASA.jpg){ height=80% } | ||
55 | ::: | ||
56 | |||
57 | :::: | ||
58 | |||
59 | ::: notes | ||
60 | |||
61 | - NACA: National Advisory Committee for Aeronautics | ||
62 | - "Computer" referred to the person that did mathematical computation | ||
63 | / verification | ||
64 | - Verify trajectories for putting men into Earth orbit | ||
65 | - Katherine Johnson on the right | ||
66 | - You can watch the movie "Hidden Figures" | ||
67 | |||
68 | ::: | ||
69 | |||
70 | ## 1930s-1940s | ||
71 | |||
72 | ![Bletchley Park Bombe [@wikimedia:bletchley_park_bombe]](../res/Bletchley Park Bombe.jpg){ width=45% height=80% } | ||
73 | |||
74 | ::: notes | ||
75 | |||
76 | - You can watch the movie "The Imitation Game" | ||
77 | |||
78 | ::: | ||
79 | |||
80 | ## 1950s | ||
81 | |||
82 | ::: columns | ||
83 | |||
84 | :::: column | ||
85 | ![IBM 704 Mainframe [@wikimedia:ibm_704_mainframe]](../res/IBM 704 mainframe.jpg){ height=80% } | ||
86 | :::: | ||
87 | |||
88 | :::: column | ||
89 | ![IBM 709 Mainframe [@ibm:ibm_709_mainframe]](../res/IBM 709 mainframe.jpg){ height=80% } | ||
90 | :::: | ||
91 | |||
92 | ::: | ||
93 | |||
94 | ::: notes | ||
95 | |||
96 | - There are lights and switches | ||
97 | - Back in the day, there were used to inspect and modify memory / registries or | ||
98 | see the executed instructions | ||
99 | - Already two influential programming languages existed: | ||
100 | - FORTRAN (formula translation) | ||
101 | - Lisp | ||
102 | - We can see: | ||
103 | - The Operator's Console | ||
104 | - The Central Processing Unit (CPU) | ||
105 | - The Punch card reader | ||
106 | - The Magnetic Tape Unit (for long term storage) | ||
107 | - Very few "professional programmers" | ||
108 | |||
109 | ::: | ||
110 | |||
111 | ## 1950s---The line printer | ||
112 | |||
113 | ![IBM 716 Line Printer [@ibm:ibm_716_line_printer]](../res/IBM 716 line printer.jpg){ height=80% } | ||
114 | |||
115 | ::: notes | ||
116 | |||
117 | - Really shaped the terminal as we know today | ||
118 | |||
119 | ::: | ||
120 | |||
121 | ## 1969 | ||
122 | |||
123 | :::: columns | ||
124 | |||
125 | ::: column | ||
126 | |||
127 | Things were pricey: | ||
128 | |||
129 | - Disk 180MB -> 32,000$ | ||
130 | - Commercial compiler -> 100,000$ | ||
131 | ::: | ||
132 | |||
133 | ::: column | ||
134 | ![Boot [@needpix:boot]](../res/boot.png){ height=80% } | ||
135 | ::: | ||
136 | |||
137 | :::: | ||
138 | |||
139 | ::: notes | ||
140 | |||
141 | - You could buy a very nice house for 32,000$ | ||
142 | |||
143 | ::: | ||
144 | |||
145 | |||
146 | ## 1970s---UNIX {.allowframebreaks} | ||
147 | |||
148 | ![Ken Thompson (sitting) and Dennis Ritchie working together at a PDP-11 [@wikimedia:ken_thompson_dennis_ritchie]](../res/Ken Thompson and Dennis Ritchie at PDP-11.jpg){ height=67% } | ||
149 | |||
150 | ::: notes | ||
151 | |||
152 | - He is actually coding using the teletypewriter | ||
153 | |||
154 | ::: | ||
155 | |||
156 | \framebreak | ||
157 | |||
158 | - Smaller, for one person[@fosdem:fifty_years_of_unix] | ||
159 | - They actually used their own operating system | ||
160 | - Invented C a bit later (1972) | ||
161 | - Definitely not "free", barely "open": | ||
162 | 160,000 $ per CPU | ||
163 | |||
164 | Berkeley university made BSD out of it (was called Berkeley UNIX) | ||
165 | |||
166 | ::: notes | ||
167 | |||
168 | - Targeted at big companies | ||
169 | |||
170 | ::: | ||
171 | |||
172 | \framebreak | ||
173 | |||
174 | - Same OS, different computers | ||
175 | - Compiler took care of the difference in architecture. | ||
176 | |||
177 | ::: notes | ||
178 | |||
179 | - Big advantages when compared to other solutions | ||
180 | - This made UNIX popular, and by extension the C programming language too | ||
181 | |||
182 | ::: | ||
183 | |||
184 | \framebreak | ||
185 | |||
186 | Invented over the years by contributions: | ||
187 | |||
188 | - shell (command interpreter) | ||
189 | - pipes and filters in shell commands | ||
190 | - Network file system (NFS) | ||
191 | - Client/Server Windowing System | ||
192 | - etc. | ||
193 | |||
194 | ## 1980s---GNU (Richard Stallman) | ||
195 | |||
196 | 1983: | ||
197 | : GNU project annouced | ||
198 | |||
199 | 1985: | ||
200 | : Created the Free Software Foundation (helps funding) | ||
201 | |||
202 | 1989: | ||
203 | : Created GNU General Public License (GPL) | ||
204 | |||
205 | Created: | ||
206 | |||
207 | - Text editor (Emacs) | ||
208 | - Compiler suite | ||
209 | - Lots of utilities | ||
210 | |||
211 | People could use these tools in different operating system | ||
212 | |||
213 | ::: notes | ||
214 | |||
215 | - Frustrated by his printer | ||
216 | - Internet was widely used in academia | ||
217 | |||
218 | ::: | ||
219 | |||
220 | ## 1990s---POSIX | ||
221 | |||
222 | - Lots of different "UNIX-like" operating system existed | ||
223 | - There was no proper definition of what "UNIX-like" meant | ||
224 | |||
225 | ## 1991--The Linux kernel (Linus Torvalds) | ||
226 | |||
227 | - Just for fun | ||
228 | - Needed a license | ||
229 | |||
230 | ::: notes | ||
231 | |||
232 | - Got an Intel i386 processor for Christmas | ||
233 | - Wasn't happy with the OS (he wanted page-based memory) | ||
234 | - Started writing a kernel, just for fun | ||
235 | - He was 21 years old | ||
236 | - The current situation made it possible: | ||
237 | - Powerful "cheap" computers | ||
238 | - "Faster" internet where you could find information about operating system | ||
239 | and hardware architecture | ||
240 | |||
241 | ::: | ||
242 | |||
243 | ## 1994--Windows NT | ||
244 | |||
245 | Bleurgh | ||
246 | |||
247 | ::: notes | ||
248 | |||
249 | - Made the "personal computer" popular | ||
250 | - Based on a shitty technology from IBM called DOS | ||
251 | |||
252 | ::: | ||
253 | |||
254 | ## 1990s--Linux gaining popularity | ||
255 | |||
256 | - Free | ||
257 | - More choice for architecture | ||
258 | - Real TCP/IP stack | ||
259 | |||
260 | |||
261 | ::: notes | ||
262 | |||
263 | - Wow, you want to connect to the internet?! | ||
264 | |||
265 | ::: | ||
266 | |||
267 | # Command-line primer | ||
268 | |||
269 | ## Most commands | ||
270 | |||
271 | ```console | ||
272 | Copies the file "file_1.txt" into "file_2.txt" | ||
273 | user@host:~$ cp file_1.txt file_2.txt | ||
274 | ^^ ^^^^^^^^^^ ^^^^^^^^^^ | ||
275 | | | | | ||
276 | | '-------------'- arguments | ||
277 | | | ||
278 | '---------------------- command name (verb) | ||
279 | ``` | ||
280 | |||
281 | ## The prompt | ||
282 | |||
283 | ```console | ||
284 | ,------ username you are logged in as | ||
285 | | | ||
286 | | ,---- directory you are in, | ||
287 | | | '~' means your user directory | ||
288 | vvvv v | ||
289 | user@host:~$ | ||
290 | ^^^^ ^ | ||
291 | | | | ||
292 | | '--- '$' if you are a normal user, | ||
293 | | '#' if you are the root user | ||
294 | | | ||
295 | '--- name of the machine you are on | ||
296 | ``` | ||
297 | |||
298 | ## POSIX & GNU conventions | ||
299 | |||
300 | ```console | ||
301 | ,-------------- long option / flag | ||
302 | | | ||
303 | | ,-- short option / flag | ||
304 | | | | ||
305 | vvvvvvvvvvvvvvvvvvvvv vv | ||
306 | $ git commit --message="My commit" -S src/main.cpp | ||
307 | ^^^ ^^^^^^ ^^^^^^^^^^^^ | ||
308 | | | | | ||
309 | | '----------------------------- subcommand or argument | ||
310 | | | ||
311 | '---------------------------------- command name | ||
312 | ``` | ||
313 | |||
314 | # The kernel | ||
315 | |||
316 | ## Role | ||
317 | |||
318 | Well, it depends on the kernel | ||
319 | |||
320 | ::: notes | ||
321 | |||
322 | Some kernel are very small, some | ||
323 | |||
324 | ::: | ||
325 | |||
326 | --- | ||
327 | |||
328 | { height=80% } | ||
329 | |||
330 | ## The Linux kernel | ||
331 | |||
332 | - Monolithic kernel: | ||
333 | - Drivers are in the kernel | ||
334 | - File-systems (ext4, fat32, etc.) are in the kernel | ||
335 | - Lots of other things | ||
336 | |||
337 | |||
338 | ## Communicating with the Linux kernel | ||
339 | |||
340 | - System calls | ||
341 | |||
342 | ::: notes | ||
343 | |||
344 | - They look like functions in C code, but that's a lie, it's a hardware feature | ||
345 | using interrupts | ||
346 | |||
347 | - That's it | ||
348 | - Kinda | ||
349 | - We can't have one system call for everything | ||
350 | - Different system calls for different types of hardware | ||
351 | |||
352 | ::: | ||
353 | |||
354 | . . . | ||
355 | |||
356 | - Everything is a file | ||
357 | |||
358 | ::: notes | ||
359 | |||
360 | - We have special files and special file-systems | ||
361 | - They look like files, but that's a lie | ||
362 | - Reading / Writing to it does *not* read / write to storage | ||
363 | - Instead it's like calling a function of the kernel | ||
364 | - Example with `/proc/cpuinfo` | ||
365 | |||
366 | ::: | ||
367 | |||
368 | ## Compiling a kernel | ||
369 | |||
370 | Let's do it | ||
371 | |||
372 | ## Linux boot process | ||
373 | |||
374 | |||
375 | ``` | ||
376 | Boot loader | ||
377 | | | ||
378 | | loads | ||
379 | v | ||
380 | Linux kernel | ||
381 | | | ||
382 | | launches | ||
383 | v | ||
384 | init (first user process) | ||
385 | | | ||
386 | | does whatever it wants | ||
387 | v | ||
388 | ????? | ||
389 | ``` | ||
390 | |||
391 | ::: notes | ||
392 | |||
393 | - We're not going to talk about the boot loader | ||
394 | - Example with `htop` | ||
395 | |||
396 | ::: | ||
397 | |||
398 | # References | ||