Homework 6
Overview
Documentation (Human Language)
A non-technical assignment is to write documentation and answer questions. You can use either English oder German while working on technical assignments. The suggestion is to use English for practicing purposes and to avoid awkward mixins of English technical terms with German ;-)
hw6/QnA.md Question Boxes
Throughout the document you will find several question boxes.
These questions are meant to help you think through what you did and how you can solve the current part of the assignment.
Please keep a protocol for answering these questions in your project repository at $REPO_DIR/hw6/QnA.md
.
The file must contain the questions with brief answers written in your own words.
hw6/README.md (optional)
You can use this document to make the following notes:
- difficulties throughout the homework
- design decisions that are necessary to explain or you think are important to emphasize
Assignments
webserver
The webserver should start automatically with your system and should be forwarded by qemu similar to SSH.
Examples for inspiration or to use http://blog.manula.org/2011/05/writing-simple-web-server-in-c.html
Sysinfo
Use any method you want to establish a webpage on port 8001 which prints the output from your previous application sysinfo
if a user calls with its webbrowser http://127.0.0.1:8001/sysinfo the content should look like this:
Hostname: <hostname> Uptime: <uptime in seconds> Process count: <number of processes> Total RAM: <RAM size in bytes> Byte Free RAM: <Free RAM sizse in bytes> Byte Page size: <memory unit size in bytes> Byte
Filesystem counter
Your webserver should listen on Port 8000 and provide a counting interface via http://localhost:8000/FScounter
The counter is saved on your system in a file.
- When a user open the webpage it should display a number.
- the number gets increased by one everytime a user loads the page.
- the number should be written in a file.
- flush the file with fflush() and sync the file system with sync().
Memory counter
Your webserver should listen on Port 8000 and provide a counting interface via http://localhost:8000/MEMcounter
The counter is saved in the application in memory.
- When a user open the webpage it should display a number.
- the number gets increased by one everytime a user loads the page.
- the number should NOT be written in a file.
Performance
connect with a script 10.000 times to your webserver from within qemu. Meassure how much time it costs with either the Filesystem Counter or the memory counter. Which one is faster?
Kernel Debugging
Make sure that the option CONFIG_DEBUG_INFO
in the linux kernel is enabled.
Start qemu for your system with the options -S
and -gdb tcp::1234
start gdb-multiarch and issue the following commands:
set architecture aarch64
target remote tcp:127.0.0.1:1234
symbol-file sourcecode/linux-4.11/vmlinux
b start_kernel
c
- What do both mentioned commandline options do?
- What do the Commands in gdb do?
- What is a breakpont?
- would you have needed the debugger earlier?
Go to the qemu commandline and press ctrl-a and the c to enter the qemu monitor mode.
issue the command info registers
in qemu-Monitor and in gdb.
Which registers are displayed by qemu? which by gdb? What is the use of those registers? (Shorten the answers by summing things together. e.G. RAX-RDX, RDI,RSI, R8-R15 - General Purpuose, ST0-ST7 - FPU, XMM0 - XMM15 SSE ...
when info is entered in qemu you can use tab-Completion to find more information objects. which other Information object are there?
Result To Be Submitted (tracked by Git)
This section gives you information which files are part of the submission for this homework. Results for bonus assignments are not covered within this section.
Documentation files
(not shown in the above tree) Please include the documentation files that are explained in the beginning.
Build Instructions (hw6/hw6.sh)
A shell script that reproduces the final result of your homework. This shell script will be used to verify your results, and does not need to include commands that run the interactive menuconfig. However, you may implement such functionality for working conveniently within your homework repository.
Arguments and Script behavior
Arguments | Function |
---|---|
(called without any arguments) | Build all artifacts starting with just the files that are checked in to git |
qemu | Run qemu-system-aarch64 , booting your system with the initrd and network |
ssh_cmd | Connect to the VM via SSH session as the root user and pass remainder arguments as the SSH command |
clean | Remove all files not tracked by git |
ssh_cmd [cmd [args...]] | Establish a connection to the VM's SSH server via authorized_key authentication. It runs the specified command with all arguments inside the VM. An example would be ssh_cmd "echo Hello, World" , as found in the CI scripts. |