This commit is contained in:
Daniel Schubert 2019-02-25 12:12:05 +01:00
parent 1c4187f0d7
commit 621effd9ca
1 changed files with 143 additions and 94 deletions

237
14.html
View File

@ -49,6 +49,125 @@
</aside>
</section>
<section data-transition="slide" data-background="#b5533c" data-background-transition="convex"> <h3>Der Boot Prozess</h3> </section>
<section>
<h4>Boot Ablauf</h4>
<ul>
<li class="fragment ">efi ( bios ) lädt bootloader ( grub2 )</li>
<li class="fragment ">bootloader lädt kernel</li>
<li class="fragment ">Kernel ist modularisiert -> Keine Dateisystemtreiber!!</li>
<li class="fragment ">Lösung: Kernel bindet initrd als RAM-Disk ein</li>
<li class="fragment ">initrd -> enthält zum Systemstart notwendige Module ( zB Dateisystemtreiber, damit Kernel root Partition einbinden kann )</li>
<li class="fragment ">System startet.</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>
<p>Der Bootloader wohnt in /boot/efi
</section>
<section>
<p>Inhalt von /boot
<pre><code class="bash">
root@workhorse:/boot# ls
config-4.9.0-7-amd64 initrd.img-4.9.0-7-amd64 System.map-4.9.0-8-amd64
config-4.9.0-8-amd64 initrd.img-4.9.0-8-amd64 vmlinuz-4.9.0-7-amd64
grub System.map-4.9.0-7-amd64 vmlinuz-4.9.0-8-amd64
</code></pre>
<p>initrd angucken:<pre><code class="bash">~$ lsinitramfs /boot/initrd.img-$(uname -r)</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>
<aside class="notes">
https://de.wikipedia.org/wiki/Grand_Unified_Bootloader
</aside>
</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>
<img src="img/uefi-vs-bios.png">
<small style="font-size: .4em">Quelle: https://www.makeuseof.com/tag/bootkit-nemesis-genuine-threat/</small>
</section>
<section>
<h4>Secure Boot</h4>
<ul>
<li class="fragment">bootet ausschliesslich Signierte Kernel. Einzige mögliche Signatur: kommt von Microsoft......
<li class="fragment">Microsoft stellt Linux-Distributoren Key zur Verfügung -> ein paar Distrib. unterstützen Secure Boot.
<li class="fragment">Debian zur Zeit nicht.
<li class="fragment">Secure Boot verhindert Starten von selbst kompilierten Kerneln
<li class="fragment">Microsoft kontrolliert also auf ALLEN Mainboards welche Betriebssysteme bei aktiviertem Secure Boot starten können. Auf ALLEN.
</ul>
</section>
<section data-transition="slide" data-background="#b5533c" data-background-transition="convex"> <h3>C und C-Compiler</h3> </section>
<section>
@ -115,7 +234,7 @@ int main() {
<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>
@ -124,9 +243,12 @@ int main() {
<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>
<h5 class="fragment ">Kernelmodule</h5>
<li class="fragment ">lsmod - listet geladene KM</li>
<li class="fragment ">modprobe - laden und löschen v. KM</li>
<li class="fragment ">insmod - lädt KM ohne Abhängigkeiten</li>
<li class="fragment ">rmmod - löscht KM ohne Abhängigkeiten</li>
</ul>
</section>
@ -143,12 +265,25 @@ int main() {
<section>
<ul>
<li class="fragment ">Die meisten Hardwarekomponenten in Ihrem Computer haben einen zugehörigen Treiber.</li>
<li >Die meisten Hardwarekomponenten in eurem 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>
Moderne Linuxe bieten umfangreichen Treiber-Support, manuelles Laden von KM ist praktisch nie nötig.
<p>Gegenbeispiel:<p> NVIDIA Treiber f. Gaming GraKas<br> manche Drucker ( jaaa, immer noch... )
</section>
<section>
<h3>Manuelle Konfiguration von KM</h3>
<pre><code class="bash">/etc/modprobe.d/*.conf</code></pre>
<h3>Liste der Kernelmodule</h3><pre style="font-size: .5em"><code class="bash">~$ basename -s ".ko" $(find /lib/modules/$(uname -r) \
-type f -name "*.ko") </code></pre></li>
</section>
<section>
<h3>Wir bauen ein Kernel-Modul</h3>
</section>
@ -202,97 +337,11 @@ $ make menuconfig
~$ sudo dpkg -i ../linux-*.deb
# reboot -> neuen Kernel wählen
</code></pre> </section>
</code></pre>
<a href="https://debian-handbook.info/browse/stable/sect.kernel-installation.html">Debian Handbbok - Installing a kernel</a></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>
<aside class="notes">
https://de.wikipedia.org/wiki/Grand_Unified_Bootloader
</aside>
</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>
<img src="img/uefi-vs-bios.png">
</section>
<section>
<h4>Secure Boot</h4>
<ul>
<li class="fragment">bootet ausschliesslich Signierte Kernel. Einzige mögliche Signatur: kommt von Microsoft......
<li class="fragment">Microsoft stellt Linux-Distributoren Key zur Verfügung -> ein paar Distrib. unterstützen Secure Boot.
<li class="fragment">Debian zur Zeit nicht.
<li class="fragment">Secure Boot verhindert Starten von selbst kompilierten Kerneln
<li class="fragment">Microsoft kontrolliert also auf ALLEN Mainboards welche Betriebssysteme bei aktiviertem Secure Boot starten können. Auf ALLEN.
</ul>
</section>
<!--
<section>
<ul>