GithubHelp home page GithubHelp logo

eightb1ts / eudyptula-boot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vincentbernat/eudyptula-boot

0.0 0.0 0.0 157 KB

Boot a Linux kernel in a VM without a dedicated root filesystem.

Shell 100.00%

eudyptula-boot's Introduction

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

Alternatives

Similar projects exist:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.