Skip to content
Anton Burtsev edited this page Mar 23, 2021 · 14 revisions

Prerequisites

Make sure you have all the required tools installed. You can install them all with:

sudo apt-get install build-essential nasm clang cmake libelf-dev ncurses-dev docbook-utils gawk

You may also need to apt-get install linux-headers-$(uname -r)

Cloning LCDs Kernel

You can get all the source by

git clone --recursive https://github.com/mars-research/xcap-capability-linux

If that works, you can skip to Configuring the kernel

However, if you encounter

fatal: clone of 'git@gitlab.flux.utah.edu:xcap/xcap-async-module git

then you're gonna have to open the repo up by hand and look at the commit hashes:

git clone --recursive https://github.com/mars-research/xcap-capability-linux xcap
cd xcap/lcd-domains
git clone https://gitlab.flux.utah.edu/xcap/libcap libcap
cd libcap
git checkout $(git log -1 --format="%H")
cd ..
git clone https://gitlab.flux.utah.edu/xcap/xcap-async-module libasync
cd libasync
git checkout $(git log -1 --format="%H")
git clone https://gitlab.flux.utah.edu/ramstore/fast-ipc-module fast-ipc-module
cd fast-ipc-module
git checkout $(git log -1 --format="%H")m

Configuring the kernel

Go to the project root and run make menuconfig.

From there, turn the following on:

  • Private data pools (Processor type and features-->Private data pool to use with LCDs).
  • CONFIG_LCD_TRACE_BUFFER (main menu-->Kernel Hacking-->Trace ring buffer for LCD debugging )

Make sure you turn the following things off:

  • Stack Protectors (menu-->General Setup-->Stack Protector buffer overflow detection (set to "none"))
  • Tracers (main menu-->Kernel Hacking-->Tracers)

If you want to be clear on versions, go to menu-->General Setup-->local versions and give your kernel a name like "lvd". That will suffix it onto your build files.

Building and installing the kernel

It should be as simple as make && make modules-install && make install followed by a reboot. When prompted by grub, go into "Advanced options for Ubuntu", and select "Ubuntu, with Linux 4.8.4".

you should probably use "make -j#" instead, where # is the # of threads your machines has (you can do this trivially by calling alias make='make -j#' from bash)

If you plan on rebooting often, it's worth changing the grub defaults instead of selecting. Use vim to look at /boot/grub/grub.cfg. Find the submenu an option like "Advanced options for Ubuntu", and find the menuentry under it that matches with your kernel build. Then use vim to go to /etc/default/grub and change GRUB_DEFAULT to "menu>submenu". ie. it should look something like "Advanced options for Ubuntu>Ubuntu, with Linux 4.8.4".

Building the LCDs

Go back to where you cloned the kernel and run the following:

cd lcd-domains/module_init_tools
aclocal -I m4 && automake --add-missing --copy && autoconf
./configure --prefix=/ --program-prefix=lcd-
make
make install

(If it complains about md5 or man 5/8, go into lcd-domains/modules_init_tools/build/Makefile and comment out the lines about Man5 and 8 (should be around line 420)) Then, it's as simple as going to the lcd-domains folder and calling make.

Building bareflank

  1. Create a directory for building Bareflank (I'll call it dir, it doesn't have to be related to the lcd folder).
  2. In there, make 2 directories, build and cache. Then clone Bareflank from https://github.com/mars-research/bflank into a directory (I'll call it bflank).
  3. Copy the config.cmake file from the repo to dir. Then, from the build folder, call cmake ../bflank
    • This should pull dependencies into dir/cache and put build files into dir/build.
  4. After it's finished, use make to compile it all.

After it's compiled, Bareflank is ready to use.

  • Run make driver-quick to install the driver,
  • Run make quick to bring up the VMM.
    • Once it's up, you can use make ack to ping it and see if it's up.

Here is what that might look like:

mkdir build
mkdir cache
git clone https://github.com/mars-research/bflank blfank
cp bflank/config.cmake .
cd build && cmake ../blank
make
make driver-quick
make quick
make ack

Run the LCD code

Go back to your lcd folder and just run scripts/insmk followed by the scripts/loadex MOD, where MOD is the module you want to install.