14
This commit is contained in:
		
							
								
								
									
										170
									
								
								14.html
									
									
									
									
									
								
							
							
						
						
									
										170
									
								
								14.html
									
									
									
									
									
								
							@@ -49,23 +49,179 @@
 | 
			
		||||
					</aside>
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section  data-transition="slide" data-background="#b5533c" data-background-transition="convex"> <h3>C und C-Compiler</h3> </section>
 | 
			
		||||
 | 
			
		||||
				<section  data-transition="slide" data-background="#b5533c" data-background-transition="convex">
 | 
			
		||||
					<h3>der Linux Kernel</h3>
 | 
			
		||||
					<h4>Kernel Module</h4>
 | 
			
		||||
				<section>
 | 
			
		||||
						Ein einfaches C-Programm
 | 
			
		||||
 | 
			
		||||
						<pre><code class="c">
 | 
			
		||||
#include<stdio.h>
 | 
			
		||||
int main() {
 | 
			
		||||
	printf("Hello World\n");
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
						</code></pre>					
 | 
			
		||||
				</section>
 | 
			
		||||
 | 
			
		||||
				<section>
 | 
			
		||||
					https://github.com/usrbinnc/netcat-cpi-kernel-module
 | 
			
		||||
					<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 mit 2.4 MhZ
 | 
			
		||||
# -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>
 | 
			
		||||
					<ul>
 | 
			
		||||
						<li class="fragment ">mysql</li>
 | 
			
		||||
						<li class="fragment ">LAMP</li>
 | 
			
		||||
						<li class="fragment ">kernelmodule</li>
 | 
			
		||||
						<li class="fragment ">kernel kompilieren</li>
 | 
			
		||||
						<li class="fragment ">Multimedia</li>
 | 
			
		||||
						<li class="fragment ">Gimp</li>
 | 
			
		||||
					</ul>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user