S2E/guest-images

Name: guest-images

Owner: S2E

Description: Scripts to automatically create VM images

Created: 2017-04-14 12:32:01.0

Updated: 2017-11-07 04:31:10.0

Pushed: 2018-01-10 14:31:49.0

Homepage: null

Size: 60

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Automated Guest Image Creation Tools

This repository contains a Makefile that allows building guest images suitable for running in S2E. The creation process is fully automated.

Installing dependencies

 apt-get install libguestfs-tools genisoimage python-pip python-magic xz-utils docker.io p7zip-full pxz libhivex-bin fuse jigdo-file
 apt-get build-dep fakeroot linux-image$(uname -r)
 pip install jinja2

is is necessary for guestfish to work
 chmod +r /boot/vmlinuz*

-login after running these commands
 usermod -a -G docker $(whoami)
 usermod -a -G kvm $(whoami)

Building S2E

Build and install S2E into some folder (e.g., `/home/user/s2e/build/opt/`). Please refer to S2E build instructions for details.

Checking out the kernel repository

home/user
clone https://github.com/s2e/s2e-linux-kernel

Building Linux images

clone https://github.com/s2e/guest-images
home/user/s2e/guest-images

INSTALL_ROOT=/home/user/s2e/build/opt \
E_LINUX_KERNELS_ROOT=/home/user/s2e-linux-kernel \
ke linux -j3

The build should take around 30 minutes. The images will be placed in the `output` directory, which looks like this:

bian-8.7.1-i386/image.json
bian-8.7.1-i386/image.raw.s2e
bian-8.7.1-i386/image.raw.s2e.ready

bian-8.7.1-x86_64/image.json
bian-8.7.1-x86_64/image.raw.s2e
bian-8.7.1-x86_64/image.raw.s2e.ready

c_debian-8.7.1-i386/image.json
c_debian-8.7.1-i386/image.raw.s2e
c_debian-8.7.1-i386/image.raw.s2e.ready

Each build is composed of a json file that describes how to run the image, the image itself, as well as a “ready” snapshot.

The build process also creates `.stampsand ``.tmp-output```. The first contains stamp files to keep track of which parts have been built, while the second contains intermediate build output (e.g., kernel images and ISO files).

Building Windows images

First, you need to get the ISO file for the Windows version that you want to install. You can download these images from MSDN. The hash and the name of the ISO is specified in the images.json file. You can use the hash to make sure that you downloaded the right version. Place the downloaded file in the iso folder.

Do not forget to update the product_key value in the images.json file. Some versions of Windows require one for installation (e.g., XP). Other versions install without one. You should not need to activate Windows once a snapshot is taken (time is frozen and the guest has no Internet access). Make sure you have the required licenses to install and use Windows this way.

The images.json file lists all Windows versions that S2E officially supports. Other images may work too but we have not tested them. If you want to add support for new images, you may need to also update s2e.sys in the guest-tools repository in order to support the different kernels. This may not be needed if the Windows version you need uses the exact same kernel as an already supported one. Please refer to the documentation in guest-tools.

home/user/s2e/guest-images

r iso && cd iso
wnload Windows ISO images (e.g., from MSDN)
e images.json for details.
 ...
.

INSTALL_ROOT=/home/user/s2e/build/opt \
E_LINUX_KERNELS_ROOT=/home/user/s2e-linux-kernel \
ke windows -j3

The installation process takes periodic screenshots that are stored in .tmp-output and output folders. Run find . -name *.png in order to locate them. Screenshots are useful for debugging, especially if you are adding custom images.

You may add additional applications to the Windows images by following these steps:

Customization and debugging

If something goes wrong, you may want to turn on graphics output. Open the makefile and comment out the `GRAPHICS` variable.

You may add additional packages to the base image by customizing the `Linux/bootcd/preseed.cfg` file.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.