GitXplorerGitXplorer
v

eudyptula-boot

public
118 stars
6 forks
1 issues

Commits

List of commits on branch master.
Unverified
c5db697c7f6adc0b3f200319c4ea1ec6a7b39b1f

nix: add a flake for use from Nix

vvincentbernat committed 6 days ago
Unverified
6e5e4f0a037f57399999ce45ecc61cacb5e1813e

minimal-configuration: add PCI serial console

vvincentbernat committed 7 days ago
Unverified
05dae39bee6b6a2bf28a0c34483f46d0a5c0db69

config: do not require SERIAL_8250_PCI

vvincentbernat committed 7 days ago
Unverified
2e9be601170c3c1737778e7bcc4c039dcd705e9b

config: use IKCONFIG if no external configuration file found

vvincentbernat committed 7 days ago
Unverified
bafc2adf8378e6dacd95092ef0e705995c308388

feat: add method for check kernel version

aalcelafranque committed 7 days ago
Unverified
72918990e1b5c9eeed76b0131e0b5c165ef2e667

mount: add symlink from /dev/fd to /proc/self/fd

vvincentbernat committed 2 months ago

README

The README file for this repository.

eudyptula-boot

eudyptula-boot boots a Linux kernel in a VM without a dedicated root filesystem. The root filesystem is the underlying root filesystem (or some pre-built chroot). This is a convenient way to do quick tests with a custom kernel.

The name comes from Eudyptula which is a genus for penguins. This is also the name of a challenge for the Linux kernel.

This utility is aimed at development only. This is a hack. It relies on AUFS/overlayfs and 9P to build the root filesystem from the running system.

Also see this blog post for a quick presentation of this tool.

Usage

It is preferable to have a kernel with AUFS or OverlayFS enabled. Ubuntu and Debian kernels are patched to support AUFS. Since 3.18, vanilla kernels have OverlayFS built-in. Ubuntu kernels also come with OverlayFS support. Check you have one of those options:

CONFIG_AUFS_FS=y
CONFIG_OVERLAY_FS=y
CONFIG_OVERLAYFS_FS=y

Ensure you have the following options enabled (as a module or builtin):

CONFIG_9P_FS=y
CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_PCI=y
CONFIG_VIRTIO_CONSOLE=y

To get a somewhat minimal configuration, have a look at the minimal-configuration script.

Once compiled, the kernel needs to be installed in some work directory:

$ make modules_install install INSTALL_MOD_PATH=$WORK INSTALL_PATH=$WORK

Then, boot your kernel with:

$ eudyptula-boot --kernel $WORK/vmlinuz-3.15.0~rc5-02950-g7e61329b0c26

Use --help to get additional available options.

Before booting the kernel, the path to GDB socket will be displayed. You can use it by running gdb on vmlinux (which is somewhere in the source tree):

$ gdb vmlinux
GNU gdb (GDB) 7.4.1-debian
Reading symbols from /home/bernat/src/linux/vmlinux...done.
(gdb) target remote /path/to/vm-eudyptula-gdb.pipe
Remote debugging using /path/to/vm-eudyptula-gdb.pipe
native_safe_halt () at /home/bernat/src/linux/arch/x86/include/asm/irqflags.h:50
50  }
(gdb)

If you have modules, you also need to manually load debug symbols for them. In guest:

$ grep . /sys/module/vxlan/sections/{.text,.data,.bss}
/sys/module/vxlan/sections/.text:0xffffffffc0370000
/sys/module/vxlan/sections/.data:0xffffffffc0378000
/sys/module/vxlan/sections/.bss:0xffffffffc0378900

In GDB:

(gdb) add-symbol-file /usr/lib/debug/lib/modules/$(uname -r)/kernel/drivers/net/vxlan.ko \
                      0xffffffffc0370000 \
             -s .data 0xffffffffc0378000 \
             -s .bss  0xffffffffc0378900

This can be automated with lx-symbols command if you source vmlinux-gdb.py from a compiled kernel.

A serial port is also exported. It can be convenient for remote debugging of userland processes. More details can be found in this blog post (which also covers debugging the kernel).

QEMU monitor is also attached to a UNIX socket. You can use the following command to interact with it:

$ socat - UNIX:/path/to/vm-eudyptula-console.pipe
QEMU 2.0.0 monitor - type 'help' for more information
(qemu)

You can also get something similar to guestfish:

$ eudyptula-boot --qemu="-drive file=someimage.qcow2,media=disk,if=virtio"

With --extra-gettys, you can allocate additional consoles. To access one of them, use:

$ socat STDIO,echo=0,icanon=0 UNIX:/tmp/tmp.oCshB5ryj4/getty-1.pipe

Usage with Nix

You can also run eudyptula-boot with the following command if you have Nix installed:

$ nix run github:vincentbernat/eudyptula-boot

If you want to add arguments, separate them with --:

$ nix run github:vincentbernat/eudyptula-boot -- --net -m 4G

To run minimal-configuration, use:

$ nix run github:vincentbernat/eudyptula-boot#minimal-configuration

Alternatives

Similar projects exist: