333 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			333 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
<!doctype html>
 | 
						|
<html lang="de">
 | 
						|
		<meta charset="utf-8">
 | 
						|
 | 
						|
		<title>Einführung in Linux</title>
 | 
						|
 | 
						|
		<meta name="description" content="YALC - Yet Another Linux Course ">
 | 
						|
		<meta name="author" content="Daniel Schubert">
 | 
						|
 | 
						|
		<meta name="apple-mobile-web-app-capable" content="yes">
 | 
						|
		<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
 | 
						|
 | 
						|
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
 | 
						|
 | 
						|
		<link rel="stylesheet" href="css/reveal.css">
 | 
						|
		<link rel="stylesheet" href="css/theme/league.css" id="theme">
 | 
						|
		
 | 
						|
		<link rel="icon" href="img/openlogo-nd-25.png" type="img/png">
 | 
						|
 | 
						|
		<!-- Theme used for syntax highlighting of code -->
 | 
						|
		<link rel="stylesheet" href="lib/css/zenburn.css">
 | 
						|
 | 
						|
		<!-- Printing and PDF exports -->
 | 
						|
		<script>
 | 
						|
			var link = document.createElement( 'link' );
 | 
						|
			link.rel = 'stylesheet';
 | 
						|
			link.type = 'text/css';
 | 
						|
			link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
 | 
						|
			document.getElementsByTagName( 'head' )[0].appendChild( link );
 | 
						|
		</script>
 | 
						|
		<style type="text/css">
 | 
						|
			.reveal img{ max-height: 60vh}
 | 
						|
		</style>
 | 
						|
 | 
						|
	</head>
 | 
						|
 | 
						|
	<body>
 | 
						|
		<div class="reveal">
 | 
						|
			<!-- Any section element inside of this container is displayed as a slide -->
 | 
						|
			<div class="slides">
 | 
						|
 | 
						|
				<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom">
 | 
						|
					<h1>LINUX</h1>
 | 
						|
					<h3>Das universelle Betriebssystem</h3>
 | 
						|
					<p>Eine Einführung - Teil 14
 | 
						|
					<p> <small>Deutsche Angestellten Akademie</small> </p>
 | 
						|
					<aside class="notes">
 | 
						|
						Frage: Fragen zur letzten Stunde?
 | 
						|
					</aside>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section  data-transition="slide" data-background="#b5533c" data-background-transition="convex"> <h3>C und C-Compiler</h3> </section>
 | 
						|
 | 
						|
				<section>
 | 
						|
						Ein einfaches C-Programm
 | 
						|
 | 
						|
						<pre><code class="c">
 | 
						|
#include<stdio.h>
 | 
						|
int main() {
 | 
						|
	printf("Hello World\n");
 | 
						|
	return 0;
 | 
						|
}
 | 
						|
						</code></pre>					
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<img src="img/Compiler.gif">
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<p>Wir benötigen:
 | 
						|
						<ul>
 | 
						|
							<li class="fragment ">einen C-Compiler</li>
 | 
						|
							<li class="fragment ">diverse Bibliotheken</li>
 | 
						|
							<li class="fragment "><pre><code class="bash">~$ sudo apt install build-essential</code></pre></li>
 | 
						|
							<li class="fragment"><a href="https://packages.debian.org/stretch/build-essential">https://packages.debian.org/stretch/build-essential</a></li>
 | 
						|
						</ul>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					Code compilieren:
 | 
						|
					<pre><code class="bash">~$  gcc hello.c -o hello
 | 
						|
 | 
						|
# Programm ausführen
 | 
						|
~$ ./hello
 | 
						|
					</code></pre>	
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section style="font-size: .6em">
 | 
						|
					<h3>Begriffe</h3>
 | 
						|
					<table>
 | 
						|
						<tr>
 | 
						|
							<td>C</td>
 | 
						|
							<td>Programmiersprache - Der Linux-Kernel ist in „C“ geschrieben</td>
 | 
						|
						</tr>
 | 
						|
						<tr>
 | 
						|
							<td>Compiler</td>
 | 
						|
							<td>Übersetzt den Quellcode in Maschinencode</td>
 | 
						|
						</tr>
 | 
						|
						<tr>
 | 
						|
							<td>gcc</td>
 | 
						|
							<td>Gnu C-Compiler Collection</td>
 | 
						|
						</tr>
 | 
						|
						<tr>
 | 
						|
							<td>Bibliotheken</td>
 | 
						|
							<td>Fertige Funktionen, die in andere Programme eingebunden werden ( unter Windoes oft *.dll-Dateien )</td>
 | 
						|
						</tr>
 | 
						|
						<tr>
 | 
						|
							<td>make</td>
 | 
						|
							<td>arbeitet Regeln und Abhängigkeitsdefinitionen in „Makefile“ ab -> startet den gcc</td>
 | 
						|
						</tr>
 | 
						|
					</table>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section  data-transition="slide" data-background="#b5533c" data-background-transition="convex"> <h3>der Linux Kernel</h3></section>
 | 
						|
 | 
						|
				<section> <img src="img/Kernel_Layout.svg.png"> </section>
 | 
						|
				
 | 
						|
				<section>
 | 
						|
					<p>Befehle 
 | 
						|
						<ul>
 | 
						|
							<li class="fragment ">lsusb</li>
 | 
						|
							<li class="fragment ">lscpu</li>
 | 
						|
							<li class="fragment ">lspci</li>
 | 
						|
							<li class="fragment ">lsmem</li>
 | 
						|
							<li class="fragment ">lshw</li>
 | 
						|
							<h5>Kernelmodule</h5>
 | 
						|
							<li class="fragment ">lsmod</li>
 | 
						|
							<li class="fragment ">modprobe</li>
 | 
						|
						</ul>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<h4>Was zum?? ist ein Kernel Modul??</h4>
 | 
						|
					<ul>
 | 
						|
						<li class="fragment ">ein Stück kompilierten Codes, der zur Laufzeit in den Kernel eingefügt werden kann ( zb Treiber )</li>
 | 
						|
						<li class="fragment ">Erweitert d. Funktionalität d. Kernels</li>
 | 
						|
						<li class="fragment ">Reboot de Systems nicht nötig</li>
 | 
						|
						<li class="fragment ">Ohne Module müsste man Monolithische Kernel bauen und neue Funktionalität direkt ins Kernel Image integrieren </li>
 | 
						|
						<li class="fragment ">-> Kernel Image wird grösser sein</li>
 | 
						|
					</ul>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<ul>
 | 
						|
						<li class="fragment ">Die meisten Hardwarekomponenten in Ihrem Computer haben einen zugehörigen Treiber.</li>
 | 
						|
						<li class="fragment">Ein großer Teil eines laufenden Kernels ist Treibercode.</li>
 | 
						|
						<li class="fragment">Ein Treiber kann statisch in die Kerneldatei auf der Festplatte eingebaut werden.</li>
 | 
						|
					</ul>					
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<h3>Wir bauen ein Kernel-Modul</h3>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<p>Der Quellcode mit Beschreibung
 | 
						|
					<a href="https://github.com/usrbinnc/netcat-cpi-kernel-module">https://github.com/usrbinnc/netcat-cpi-kernel-module</a>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<h3>wir bauen uns einen Kernel</h3>
 | 
						|
					<ol>
 | 
						|
						<li class="fragment">Download der Kernel Quellen </li>
 | 
						|
						<li class="fragment">Installieren der build tools</li>
 | 
						|
						<li class="fragment">Kernel bauen ;-)</li>
 | 
						|
					</ol>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<p>Aktuelle Kernel Quellen herunterladen
 | 
						|
					<a href="https://www.kernel.org">https://www.kernel.org</a>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<pre><code class="bash">
 | 
						|
$ sudo apt-get install build-essential \ 
 | 
						|
	libncurses5-dev gcc libssl-dev bc
 | 
						|
 | 
						|
# für XXXXXXX entspr. Kernel Version einsetzen!
 | 
						|
$ cd ~/Downloads
 | 
						|
$ tar xvf linux-XXXXXXX.tar.xz
 | 
						|
 | 
						|
$ cd linux-XXXXXXX
 | 
						|
$ cp /boot/config-4.13-XXXXXXX .config
 | 
						|
 | 
						|
$ make menuconfig
 | 
						|
 | 
						|
					</code></pre>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section><img src="img/menu-1.png"></section>
 | 
						|
 | 
						|
				<section>Folgendes bitte zu Hause probieren::<pre><code class="bash"># Das dauert jetzt....
 | 
						|
# ca 90min auf einem Core i3 @2.4MHz
 | 
						|
# -j 4 -> Nutze 4 Kerne
 | 
						|
 | 
						|
~$ make -j4 deb-pkg  
 | 
						|
 | 
						|
#Kernel installieren:
 | 
						|
~$ sudo dpkg -i ../linux-*.deb
 | 
						|
 | 
						|
# reboot -> neuen Kernel wählen 
 | 
						|
				</code></pre>	</section>			
 | 
						|
				
 | 
						|
				<section>
 | 
						|
					<h3>grub - Grand Unified Boot Loader</h3>
 | 
						|
					<ul style="font-size: .6em"><li>Liest verschiedene <a href="/wiki/Dateisystem" title="Dateisystem">Dateisysteme</a>:
 | 
						|
<ul><li>GRUB Legacy (bis GRUB 0.9x): <a href="/wiki/Ext2" title="Ext2">ext2</a>, <a href="/wiki/Ext3" title="Ext3">ext3</a>, <a href="/wiki/Unix_File_System" title="Unix File System">UFS</a>, <a href="/wiki/Unix_File_System" title="Unix File System">UFS2</a>, <a href="/wiki/Reiser_File_System" title="Reiser File System">ReiserFS</a>, <a href="/wiki/File_Allocation_Table" title="File Allocation Table">FAT</a>, <a href="/wiki/Journaled_File_System" title="Journaled File System">JFS</a>, <a href="/wiki/Minix-Dateisystem" title="Minix-Dateisystem">Minix</a>, <a href="/wiki/Berkeley_Fast_File_System" class="mw-redirect" title="Berkeley Fast File System">FFS</a>, <a href="/wiki/XFS_(Dateisystem)" title="XFS (Dateisystem)">XFS</a>, mit distributionsspezifischen Erweiterungen auch weitere;</li>
 | 
						|
<li>GRUB2 (ab GRUB 1.9x) zusätzlich <a href="/wiki/Ext4" title="Ext4">ext4</a>, <a href="/wiki/ZFS_(Dateisystem)" title="ZFS (Dateisystem)">ZFS</a> und <a href="/wiki/Btrfs" title="Btrfs">btrfs</a>.</li></ul></li>
 | 
						|
<li>Bootet verschiedene Betriebssysteme per Auswahlmenü und automatischem Zeitablauf (Linux und Windows als <a href="/wiki/Multi-Boot-System" title="Multi-Boot-System">Multi-Boot-System</a>).</li>
 | 
						|
<li>Bootet Betriebssysteme von Festplatten, Disketten, CD- und DVD-Laufwerken sowie Flash-Disks.</li>
 | 
						|
<li>Verfügt über einen eingebauten <a href="/wiki/Kommandozeileninterpreter" title="Kommandozeileninterpreter">Kommandozeileninterpreter</a> (Shell).</li>
 | 
						|
<li>Ist relativ einfach konfigurierbar (Farben, Hintergrundbild, Struktur usw.).</li>
 | 
						|
<li>Kann mit einem <a href="/wiki/Passwort" title="Passwort">Passwort</a> gesichert werden.</li>
 | 
						|
<li>Kann über <a href="/wiki/Trivial_File_Transfer_Protocol" title="Trivial File Transfer Protocol">TFTP</a> bereitgestellte <a href="/wiki/Linux_(Kernel)" title="Linux (Kernel)">Linux-Kernel</a> booten.</li></ul> 
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					<pre><code class="bash">~$ lsblk
 | 
						|
 | 
						|
NAME                     MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
 | 
						|
sda                        8:0    0 223,6G  0 disk  
 | 
						|
├─sda1                     8:1    0   245M  0 part  /boot/efi
 | 
						|
├─sda2                     8:2    0   511M  0 part  /boot
 | 
						|
└─sda3                     8:3    0 222,9G  0 part  
 | 
						|
  └─sda3_crypt           253:0    0 222,8G  0 crypt 
 | 
						|
    ├─xubuntu--vg-root   253:1    0 215,1G  0 lvm   /
 | 
						|
    └─xubuntu--vg-swap_1 253:2    0   7,7G  0 lvm  
 | 
						|
 | 
						|
  </code></pre>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					Interessante Dateien:
 | 
						|
					<p>/etc/default/grub -> Anpassungen
 | 
						|
					<p>/etc/grub.d/ -> scripts die boot.cfg generieren
 | 
						|
 | 
						|
 | 
						|
						<pre><code class="bash">00_header*
 | 
						|
05_debian_theme*
 | 
						|
10_linux*
 | 
						|
20_linux_xen*
 | 
						|
20_memtest86+*
 | 
						|
30_os-prober*
 | 
						|
30_uefi-firmware*
 | 
						|
40_custom*
 | 
						|
41_custom*
 | 
						|
</code></pre>
 | 
						|
					<p>/boot/grub/grub.cfg -> nicht bearbeiten!
 | 
						|
 | 
						|
				</section>
 | 
						|
	
 | 
						|
				<section>
 | 
						|
					<p>/etc/default/grub
 | 
						|
					<pre><code class="bash">
 | 
						|
GRUB_DEFAULT=0
 | 
						|
GRUB_HIDDEN_TIMEOUT=0
 | 
						|
GRUB_HIDDEN_TIMEOUT_QUIET=true
 | 
						|
GRUB_TIMEOUT=10
 | 
						|
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
 | 
						|
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
 | 
						|
GRUB_CMDLINE_LINUX=""
 | 
						|
 | 
						|
GRUB_BACKGROUND="/usr/share/images/grub/050817-N-3488C-028.tga"
 | 
						|
 | 
						|
</code></pre>
 | 
						|
<a href="https://wiki.ubuntuusers.de/GRUB_2/Aussehen_-_einfache_Konfiguration/">Aussehen verändern</a>
 | 
						|
				<p>nach Änderung: <pre><code>sudo update-grub</code></pre>
 | 
						|
				</section>
 | 
						|
 | 
						|
				<section>
 | 
						|
					optional: grub-customizer
 | 
						|
 | 
						|
					<p><a href="https://answers.launchpad.net/grub-customizer/+faq/1397">grub-customizer aus quellen bauen</a>
 | 
						|
					<p><a href="https://launchpad.net/~danielrichter2007/+archive/ubuntu/grub-customizer">grub-customizer ppa</a>
 | 
						|
				</section>
 | 
						|
				<section>
 | 
						|
					<ul>
 | 
						|
						<li class="fragment ">mysql</li>
 | 
						|
						<li class="fragment ">LAMP</li>
 | 
						|
						<li class="fragment ">Multimedia</li>
 | 
						|
						<li class="fragment ">Gimp</li>
 | 
						|
					</ul>
 | 
						|
				</section>
 | 
						|
<!--
 | 
						|
				<section>
 | 
						|
					Übungen
 | 
						|
C 11.11 [3] Besorgen Sie sich eine geeignete Datei (etwa ein größeres tar -Ar-
 | 
						|
chiv mit Quellcode, vielleicht für den Linux-Kernel) und komprimieren Sie
 | 
						|
sie jeweils mit gzip , bzip2 und xz . Messen Sie dabei die Ausführungszeit
 | 
						|
durch ein vorgesetztes time . Wie verhalten die Laufzeiten und die Kompri-
 | 
						|
mierungsraten sich zueinander?
 | 
						|
C 11.12 [2] Experimentieren Sie mit der Datei aus der vorigen Aufgabe und
 | 
						|
vergleichen Sie die Laufzeit und die Größe des Resultats für xz mit verschie-
 | 
						|
denen Effizienz-Optionen. Was ist der Unterschied zwischen -1 und -6 und
 | 
						|
zwischen -6 und -9 ?
 | 
						|
				</section>
 | 
						|
			-->
 | 
						|
			</div>
 | 
						|
		</div>
 | 
						|
 | 
						|
		<script src="lib/js/head.min.js"></script>
 | 
						|
		<script src="js/reveal.js"></script>
 | 
						|
 | 
						|
		<script>
 | 
						|
 | 
						|
			// More info https://github.com/hakimel/reveal.js#configuration
 | 
						|
			Reveal.initialize({
 | 
						|
				controls: true,
 | 
						|
				progress: true,
 | 
						|
				history: true,
 | 
						|
				center: true,
 | 
						|
 | 
						|
				transition: 'slide', // none/fade/slide/convex/concave/zoom
 | 
						|
 | 
						|
				// More info https://github.com/hakimel/reveal.js#dependencies
 | 
						|
				dependencies: [
 | 
						|
					{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
 | 
						|
					{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
 | 
						|
					{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
 | 
						|
					{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
 | 
						|
					{ src: 'plugin/search/search.js', async: true },
 | 
						|
					{ src: 'plugin/zoom-js/zoom.js', async: true },
 | 
						|
					{ src: 'plugin/notes/notes.js', async: true }
 | 
						|
				]
 | 
						|
			});
 | 
						|
 | 
						|
		</script>
 | 
						|
 | 
						|
	</body>
 | 
						|
</html>
 |