B6 User Mode Linux
UML (User-Mode Linux) is a port of Linux to Linux itself. The kernel runs on a Linux box as a userspace process — a setup that is not without a certain beauty.
This facilitates many applications that would be difficult or impossible to implement with a classic Linux kernel on genuine hardware, above all the ability to successively test new kernel features without the need for dozens of time-consuming restarts.
UML also supports the use of debuggers, either of the built-in, console-based type or as external programs. This section briefly describes how ddd can be used in conjunction with UML to provide versatile options for analyzing the kernel and its data structures. As with KGDB, breakpoints can be set and variables can be changed in memory; however, only a single system is needed.
ARCH=um must be specified in the command line to indicate that the kernel is to be generated for UML and not for the local processor (CROSS_COMPILE need not be set as would otherwise be necessary for genuine cross-compilation.) For example:
To compile UML on an AMD64 architecture, you also need to add SUBARCH=i3 8 6. The default configuration of UML is a reasonable setup for most purposes and need not be modified.
The compilation result is an executable file called linux that is located in the main directory of the kernel sources. This file contains Linux as a user process.
You can debug UML in the same way as a normal Linux process. As Figure B-9 shows, it is also possible to set breakpoints.
UML offers many other options; for example, shared use of a filesystem with the host for ease of data exchange, or a setup of network connections between the host and UML (and even between several UML
processes). Refer to the UML documentation for a detailed description of these options. Also notice that the designer of UML has written a book solely devoted to this topic[Dik06].
Continue reading here: B7 Summary
Was this article helpful?