diff options
| author | Manuel Traut <manut@linutronix.de> | 2015-07-09 13:28:05 +0200 |
|---|---|---|
| committer | Manuel Traut <manut@linutronix.de> | 2018-03-16 21:41:06 +0100 |
| commit | 513661a9933ba46efcb5b231c55c37fb1fc5a4a8 (patch) | |
| tree | 7e5bd5931964a9269daf566d2d7be62144881b29 | |
| parent | 279396d18e5c3a3dc2eefd5b1f22c9bd1964deac (diff) | |
update Prüfung 2015
Signed-off-by: Manuel Traut <manut@linutronix.de>
| -rw-r--r-- | README | 47 | ||||
| -rw-r--r-- | pruefung.tex | 246 |
2 files changed, 82 insertions, 211 deletions
@@ -1,4 +1,4 @@ -Linux Kernelprogrammierung - Sommersemester 2014 +Linux Kernelprogrammierung - Sommersemester 2015 ================================================ Manuel Traut <manut@mecka.net> @@ -7,13 +7,22 @@ Organisatorisch Termine: ~~~~~~~~ -17.03 -24.03 -31.03 -14.04 -28.04 -19.05 -30.06 +* 15.3. + +* 13.4. + +* 20.4. + +* 27.4. + +* 4.5. + +* 11.5. + +* 18.5. + +* evt. 29.6. + Prüfung: ~~~~~~~~ @@ -58,29 +67,11 @@ http://www.meinprof.de/uni/prof/51131 Exkursion: ~~~~~~~~~~ -Linuxtag Berlin 08. bis 10. Mai 2014 - http://linuxtag.de - -Anreise Di/Mi Fernbus ab ca. 08:30 Uhr FN - an ca. 18:30 Uhr Berlin - - ab ca. 21:00 Uhr FN - an ca. 07:00 Uhr Berlin -ca. 30 EUR - -Abreise So. Fernbus ab ca. 23:15 Uhr FN - an ca. 09:35 Uhr Berlin - - ab ca. 07:30 Uhr FN - an ca. 18:20 Uhr Berlin -ca. 30 EUR - -Uebernachtung im Hostel ca. 60 EUR -Messeeintritt: sponsored by ?? +21. - 22.3. 2015: -Zuschuss von HS: 100 EUR pro Person +http://chemnitzer.linux-tage.de/ --> Kosten ca. 50 EUR geplante Themen: ---------------- diff --git a/pruefung.tex b/pruefung.tex index ebb2232..c2d75d9 100644 --- a/pruefung.tex +++ b/pruefung.tex @@ -6,7 +6,7 @@ \firstpageheadrule \runningheadrule -\lhead{Manuel Traut\\Sommersemester 2014} +\lhead{Manuel Traut\\Sommersemester 2015} \chead{Hochschule Ravensburg-Weingarten\\Linux-Kernelprogrammierung} \rhead{MatrNr:\\Datum:} @@ -33,7 +33,7 @@ von \pointsonpage{\thepage} Punkten} \begin{titlepage} \title{Pr\"ufung Linux-Kernelprogrammierung} \author{Dozent: Manuel Traut} -\date{21. Juli 2014 08:00 Uhr} +\date{10. Juli 2015 08:00 Uhr} \maketitle \begin{center} Hochschule Ravensburg-Weingarten @@ -85,175 +85,99 @@ MatrNr:\enspace\hrulefill \section*{Entwicklungsmodell - Development process} -\question[7] Beschreiben Sie den Releasezyklus und die Versionierung des - Linuxkernel (seit v3.0). Verwenden Sie in diesem Zusammenhang die Begriffe: - 'stable Kernel', 'Release Candidate', 'merge window' -\begin{verbatim} -Describe the release cycle and version numbering of the Linux kernel -(since linux v3.0). Use the terms 'release candidate', 'merge window', -'stable kernel'. -\end{verbatim} +\question[4] Erkl\"aren Sie an einem Beispiel die Aufgaben eines Linux Kernel + Maintainers. -\question Im Linux Quellcode gibt es einen Ordner 'staging'. -\begin{verbatim} -There is a folder named 'staging' inside the linux source tree. -\end{verbatim} -\begin{parts} -\part[1] Was findet man in diesem Ordner? -\begin{verbatim} -What is stored in this folder? -\end{verbatim} -\part[2] Wann werden Dateien aus diesem Ordner gel\"oscht / verschoben? -\begin{verbatim} -What conditions needs to be met that a file from this folder will be -moved or deleted? -\end{verbatim} -\end{parts} +\question[4] Sie wollen Ihren eigenen Treiber in Mainline Linux integriert + haben. Was \"ubermitteln Sie auf welchem Weg wohin? + +\section*{Tools} \question Der Linux Kernel wird im Versionskontrollsystem git verwaltet. -\begin{verbatim} -The Linux kernel is maintained in the version control system git. -\end{verbatim} \begin{parts} \part[1] Welches Subkommando verwenden Sie um den Quellcode z.B. des Linux -Kernels auf Ihren PC zu \"ubertragen? -\begin{verbatim} -Which subcommand to you use to transfer e.g. the source code of the linux -kernel to your pc? -\end{verbatim} -\part[3] Was k\"onnen Sie mit dem Subkommando 'branch' alles machen? -\begin{verbatim} -What can be done with the subcommand 'branch'? -\end{verbatim} + Kernels auf Ihren PC zu \"ubertragen? +\part[6] Wie gehen Sie vor um mit Hilfe von git Ihre Änderungen auf eine neuere + Version des Kernels zu portieren? \end{parts} -\newpage - -\section*{Tools} - \question \begin{parts} \part[1] Welches Kommando f\"uhrt zu den Ausgaben auf folgendem Bild? -\begin{verbatim} -Which command was used to produce the following output? -\end{verbatim} \part[1] \"Uber welche Dateien wird der Inhalt / Struktur des Tools gesteuert? -\begin{verbatim} -What files are used to alter the content and layout of the tool? -\end{verbatim} \end{parts} \includegraphics[height=0.3\textwidth]{./images/kconfig.png} -\question[6] Ein von Ihnen entwickelter Kerneltreiber funktioniert nicht wie -erwartet. Welche Debugging M\"oglichkeiten haben Sie? - -Nennen Sie mindestens zwei und beschreiben Sie Vor- und Nachteile - -\begin{verbatim} -You developed a linux driver that doesn't work as expected. -What kind of debugging is available? - -Describe the advantages and disadvantages of two different methods. -\end{verbatim} - +\question In der Vorlesung haben wir etliche Funktionen des Kerneltracers + 'ftrace' kennen gelernt. +\begin{parts} + \part[1] Beschreiben Sie eine M\"oglichkeit den Trace zu starten/stoppen. + \part[2] Nennen Sie 2 Events oder Eventtypen welche getraced werden k\"onnen. + \part[1] Beschreiben Sie eine M\"oglichkeit wie man den Tracebuffer auslesen kann + \part[6] Erkl\"aren und Begr\"unden Sie die Einfl\"u\ss e von ftrace auf die + Systemperformance. +\end{parts} \section*{Rootfilesysteme - Rootfilesystems} -\question[2] Sie haben ein statisch gelinktes C Programm und wollen, dass der -Kernel dieses direkt anstartet. Wie erreichen Sie dies? -\begin{verbatim} -You have a staticly linked C application that should be started directly by -the kernel. What needs to be done? -\end{verbatim} - -\question[2] In welchen F\"allen macht es Sinn keine Linux Distribution -einzusetzen? -\begin{verbatim} -In which cases is it useful to avoid using a linux distribution? -\end{verbatim} +\question +\begin{parts} + \part[1] Nennen Sie einen Grund der gegen den Einsatz einer Linuxdistribution + spricht. + \part[4] Nennen Sie 4 Aufgaben die Sie bei einem 'Linux from scratch' (also + ohne Distribution) selber tun m\"u\ss en, welche aber klassischerweise von einer + Linuxdistribution gel\"ost w\"aren. +\end{parts} \newpage \section*{Programmierung - Programming} -\question Das Kernelsubsystem 'Userspace-IO' (UIO) kann zur Entwicklung eigener - Treiber verwendet werden. -\begin{verbatim} -The Userspace-IO (UIO) subsystem of the kernel can be used -to develop an own driver. -\end{verbatim} -\begin{parts} -\part[3] Welche Einschr\"ankungen gelten? -\begin{verbatim} -What limitations are given? -\end{verbatim} -\part[2] Mu\ss \space der Quellcode des Treibers ver\"offentlicht - werden? -\begin{verbatim} -Do you need to publish the source code of the driver? -\end{verbatim} -\part[1] F\"ur welche Hardware macht ein UIO Treiber keinen Sinn? -\begin{verbatim} -For what kind of hardware is an UIO driver non-sense? -\end{verbatim} -\end{parts} +\question[4] Sie starten ein Linuxsystem. Die letzten Ausgaben lauten: +'freeing memory, loading init' - Nennen Sie 4 m\"ogliche Ursachen. -\question Sie wollen Ihren eigenen Treiber in Mainline Linux integriert - haben. +\question[4] Beschreiben Sie mit eigenen Worten, was Sie folgender Kernelausgabe + entnehmen k\"onnen: \begin{verbatim} -You have developed an own driver and you want to get it -integrated into mainline linux. +CPU: 0 Not tainted (2.6.37 #9) +PC is at prepare_namespace+0x170/0x1d4 +LR is at do_unlinkat+0x10c/0x14c +pc : [<c0009378>] lr : [<c00df338>] psr: 80000013 +sp : c783dfc8 ip : c783df20 fp : c783dfe0 +r10: 00000000 r9 : 00000000 r8 : 00000000 +r7 : 00000013 r6 : c0054a1c r5 : c0022995 r4 : c03969a4 +r3 : 00000000 r2 : 00000000 r1 : c78c7000 r0 : 00000000 +Flags: Nzcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel +Control: 00093177 Table: 00004000 DAC: 00000017 +Process swapper (pid: 1, stack limit = 0xc783c260) +Stack: (0xc783dfc8 to 0xc783e000) +dfc0: c783dfd4 c0396940 c00084fc c783dff4 c783dfe4 c0008610 +dfe0: c0009214 00000000 00000000 c783dff8 c0054a1c c0008508 00000000 00000000 +Backtrace: +[<c0009208>] (prepare_namespace+0x0/0x1d4) from [<c0008610>] +(kernel_init+0x114/0x154) +r5:c00084fc r4:c0396940 +[<c00084fc>] (kernel_init+0x0/0x154) from [<c0054a1c>] (do_exit+0x0/0x660) +r4:00000000 +Code: e3500000 13a03601 15843000 e3a03000 (e5d31000) +---[ end trace 4ed5c061b76895d8 ]--- \end{verbatim} -\begin{parts} -\part[4] Was \"ubermitteln Sie auf welchem Weg wohin? -\begin{verbatim} -What do you transfer? How do you transfer it? And who is the recipient? -\end{verbatim} -\part[2] Wie wird die Qualit\"at Ihres Treibers gepr\"uft, wie reagieren Sie - gegebenenfalls auf Beanstandungen? -\begin{verbatim} -What will be done to check the quality of your driver? How do you react on -change requests? -\end{verbatim} -\end{parts} \newpage \question Die folgenden Fragen beziehen sich auf den Quellcode des Kernelmoduls im Anhang. -\begin{verbatim} -The following questions are related to the source code of the kernel module -in the appendix. -\end{verbatim} \begin{parts} \part[2] Welche Zeile Quellcode m\"u\ss en Sie l\"oschen damit der Code keine Funktion hat? -\begin{verbatim} -Which source-line needs to be deleted to disable the -functionality of the code? -\end{verbatim} \part[4] Welche 'virtuellen Dateien' werden von dem Code angelegt? -\begin{verbatim} -Which 'virtual files' are created by this code? -\end{verbatim} - -\part[2] In der probe Funktion wird eine major id ausgegeben. Was k\"onnen - Sie mit dieser Information anfangen? -\begin{verbatim} -The probe function reports a major id. -What can you do with this information? -\end{verbatim} \part[4] Sie wollen vom Userspace aus mittels des Kernelmoduls folgende Datei erstellen. Welche Kommandos oder Pseudo-C Code verwenden Sie? -\begin{verbatim} -You want to use the kernel module to generate the following file from the -userspace. Which commands or Pseudo-C code do you use? -\end{verbatim} [/tmp/huhu.txt] \begin{lstlisting} @@ -262,17 +186,9 @@ userspace. Which commands or Pseudo-C code do you use? \part[6] Suchen Sie sich drei Funktionen aus, erkl\"aren Sie jeweils wann die Funktion aufgerufen wird und was Sie tut. -\begin{verbatim} -Choose 3 functions. Explain for each function what triggers the call -and describe its job. -\end{verbatim} \part[4] Sie wollen dass der Code keine sysfs device Attribute mehr exportiert. Nennen Sie alle Bereiche, die gel\"oscht werden k\"onnen. -\begin{verbatim} -You want the code to avoid exporting sysfs device attributes. -Which lines/areas of the source-code can be removed? -\end{verbatim} \end{parts} \end{questions} @@ -288,7 +204,7 @@ Note: \begin{lstlisting} /* * Example driver for Linux - * Copyright (C) 2014, Manuel Traut <manut@mecka.net> + * Copyright (C) 2015, Manuel Traut <manut@mecka.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -316,19 +232,24 @@ static struct device hswgt_dev = { static ssize_t hswgt_show_ro(struct device *hswgt_dev, struct device_attribute *hswgt_attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", "show some cool value"); + memset(buf, 8, 4); + buf[4] = '\0'; + return 5; } static ssize_t hswgt_show_rw(struct device *hswgt_dev, struct device_attribute *hswgt_attr, char *buf) { - return scnprintf(buf, PAGE_SIZE, "%s\n", "write value, look at dmesg"); + printk(KERN_ERR "number of the beast?"); + memset(buf, 6, 3); + buf[3] = '\0'; + return 4; } static ssize_t hswgt_store_rw(struct device *hswgt_dev, struct device_attribute *hswgt_attr, const char *buf, size_t count) { - pr_notice("hswgt_store_rw: %s", buf); + printk(KERN_ERR "what's this good for?"); return count; } @@ -351,35 +272,6 @@ static const struct attribute_group *hswgt_dev_attr_groups[] = { NULL, }; -static int hswgt_char_open(struct inode *node, struct file *f) -{ - pr_notice("%s\n", __func__); - return 0; -} - -static ssize_t hswgt_char_read(struct file *f, char __user *buf, - size_t count, loff_t *pos) -{ - pr_notice("%s\n", __func__); - memset(buf, 8, count); - return count; -} - -static ssize_t hswgt_char_write(struct file *f, const char __user *buf, - size_t count, loff_t *pos) -{ - size_t i; - for (i = 0; i < count; i++) - pr_notice("%s[%d]: %x\n", __func__, (int)i, buf[i]); - return count; -} - -static const struct file_operations hswgt_fops = { - .open = hswgt_char_open, - .read = hswgt_char_read, - .write = hswgt_char_write, -}; - static int __init hswgt_init(void) { int ret = 0; @@ -399,19 +291,8 @@ static int __init hswgt_init(void) goto failed_dev; } - major = register_chrdev(0, "hswgt", &hswgt_fops); - if (major < 0) { - ret = major; - pr_err("%s register chrdev failed; %d\n", __func__, ret); - goto failed_char; - } - pr_notice("%s major device node %d\n", - __func__, major); - return 0; -failed_char: - unregister_chrdev(major, "hswgt"); failed_dev: device_del(&hswgt_dev); class_destroy(dummy); @@ -425,7 +306,6 @@ static void __exit hswgt_exit(void) device_del(&hswgt_dev); class_destroy(dummy); - unregister_chrdev(major, "hswgt"); } module_init(hswgt_init); |
