summaryrefslogtreecommitdiff
path: root/2014-pruefung.tex
diff options
context:
space:
mode:
Diffstat (limited to '2014-pruefung.tex')
-rw-r--r--2014-pruefung.tex442
1 files changed, 442 insertions, 0 deletions
diff --git a/2014-pruefung.tex b/2014-pruefung.tex
new file mode 100644
index 0000000..ebb2232
--- /dev/null
+++ b/2014-pruefung.tex
@@ -0,0 +1,442 @@
+\documentclass[addpoints,12pt]{exam}
+
+\usepackage{ngerman}
+\usepackage{listings,color}
+\usepackage{graphicx}
+
+\firstpageheadrule
+\runningheadrule
+\lhead{Manuel Traut\\Sommersemester 2014}
+\chead{Hochschule Ravensburg-Weingarten\\Linux-Kernelprogrammierung}
+\rhead{MatrNr:\\Datum:}
+
+\firstpagefootrule
+\runningfootrule
+\firstpagefooter{Page \thepage\ of \numpages}
+{}
+{Punkte: \makebox[.5in]{\hrulefill}\\
+von \pointsonpage{\thepage} Punkten}
+
+\runningfooter{Page \thepage\ of \numpages}
+{}
+{}
+
+\pagestyle{headandfoot}
+
+\pointsinrightmargin
+\pointpoints{Punkt}{Punkte}
+
+\begin{document}
+
+
+\begin{coverpages}
+\begin{titlepage}
+\title{Pr\"ufung Linux-Kernelprogrammierung}
+\author{Dozent: Manuel Traut}
+\date{21. Juli 2014 08:00 Uhr}
+\maketitle
+\begin{center}
+Hochschule Ravensburg-Weingarten
+\vspace{1cm}
+
+Dauer: 60 Minuten, erlaubte Hilfsmittel: handschriftliche Mitschriebe/Notizen
+\end{center}
+
+\vspace{2cm}
+Name:\enspace\hrulefill
+\vspace{2cm}
+MatrNr:\enspace\hrulefill
+\begin{center}
+\begin{lstlisting}
+ a8888b.
+ d888888b.
+ 8P"YP"Y88 (((((((())))))))))
+ 8|o||o|88 ||VIEL ERFOLG !!||
+ 8' .88 ((((((((((((()))))
+ 8`._.' Y8.
+ d/ `8b.
+ .dP . Y8b.
+ d8:' " `::88b.
+ d8" `Y88b
+ :8P ' :888
+ 8a. : _a88P
+ ._/"Yaa_ : .| 88P|
+ \ YP" `| 8P `.
+ / \._____.d| .'
+ `--..__)888888P`._.'
+\end{lstlisting}
+\end{center}
+\end{titlepage}
+\end{coverpages}
+
+\lstset{ %
+ basicstyle=\scriptsize, % the size of the fonts that are used for the code
+ breaklines=true, % sets automatic line breaking
+ frame=single, % adds a frame around the code
+ language=C, % the language of the code
+ numbers=left, % where to put the line-numbers;
+ numbersep=5pt, % how far the line-numbers are from the code
+ numberstyle=\tiny, % the style that is used for the line-numbers
+ tabsize=8, % sets default tabsize to 2 spaces
+}
+
+
+\begin{questions}
+
+\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 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 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}
+\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}
+
+
+\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}
+
+\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 Sie wollen Ihren eigenen Treiber in Mainline Linux integriert
+ haben.
+\begin{verbatim}
+You have developed an own driver and you want to get it
+integrated into mainline linux.
+\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}
+8888
+\end{lstlisting}
+
+\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}
+
+\vspace{1cm}
+Punkte: \_\_\_\_ von \numpoints
+\hspace{1cm}
+Note:
+
+\newpage
+
+\begin{appendix}
+\begin{lstlisting}
+/*
+ * Example driver for Linux
+ * Copyright (C) 2014, 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
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/device.h>
+#include <linux/fs.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/slab.h>
+#include <linux/types.h>
+
+#define DEVICE_NAME "hswgt"
+static int major;
+
+static struct class *dummy;
+
+static struct device hswgt_dev = {
+ .init_name = DEVICE_NAME,
+};
+
+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");
+}
+
+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");
+}
+
+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);
+ return count;
+}
+
+
+static DEVICE_ATTR(hswgt_ro, S_IRUGO, hswgt_show_ro, NULL);
+static DEVICE_ATTR(hswgt_rw, S_IWUSR|S_IRUGO, hswgt_show_rw, hswgt_store_rw);
+
+static struct attribute *hswgt_dev_attrs[] = {
+ &dev_attr_hswgt_ro.attr,
+ &dev_attr_hswgt_rw.attr,
+ NULL,
+};
+
+static struct attribute_group hswgt_dev_attr_group1 = {
+ .attrs = hswgt_dev_attrs,
+};
+
+static const struct attribute_group *hswgt_dev_attr_groups[] = {
+ &hswgt_dev_attr_group1,
+ 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;
+
+ pr_notice("%s\n", __func__);
+
+ dummy = class_create(THIS_MODULE, "dummy");
+ device_initialize(&hswgt_dev);
+ hswgt_dev.parent = NULL;
+ hswgt_dev.bus = NULL;
+ hswgt_dev.class = dummy;
+ hswgt_dev.groups = hswgt_dev_attr_groups;
+
+ ret = device_add(&hswgt_dev);
+ if (ret) {
+ pr_err("%s device_add failed: %x\n", __func__, ret);
+ 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);
+
+ return ret;
+}
+
+static void __exit hswgt_exit(void)
+{
+ pr_notice("%s\n", __func__);
+
+ device_del(&hswgt_dev);
+ class_destroy(dummy);
+ unregister_chrdev(major, "hswgt");
+}
+
+module_init(hswgt_init);
+module_exit(hswgt_exit);
+
+MODULE_AUTHOR("Manuel Traut");
+MODULE_DESCRIPTION("dummy test driver");
+MODULE_VERSION("3");
+MODULE_LICENSE("GPL");
+\end{lstlisting}
+\end{appendix}
+
+
+\end{document}