From 8a4b3a6b657c1942244ec75c5fec3f764df84301 Mon Sep 17 00:00:00 2001 From: Dongliang Mu Date: Fri, 1 Mar 2019 00:29:44 -0500 Subject: tweak create-image.sh script and modify document about its deployment (#1022) --- .../setup_ubuntu-host_qemu-vm_x86-64-kernel.md | 34 ++++++++++++---------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'docs/linux/setup_ubuntu-host_qemu-vm_x86-64-kernel.md') diff --git a/docs/linux/setup_ubuntu-host_qemu-vm_x86-64-kernel.md b/docs/linux/setup_ubuntu-host_qemu-vm_x86-64-kernel.md index 8e9634351..71fe881f3 100644 --- a/docs/linux/setup_ubuntu-host_qemu-vm_x86-64-kernel.md +++ b/docs/linux/setup_ubuntu-host_qemu-vm_x86-64-kernel.md @@ -111,32 +111,36 @@ Install debootstrap: sudo apt-get install debootstrap ``` -Use [this script](https://github.com/google/syzkaller/blob/master/tools/create-image.sh) to create a minimal Debian-stretch Linux image. -The result should be `$IMAGE/stretch.img` disk image. +Create a Debian-stretch Linux image: +``` +cd $IMAGE/ +wget https://raw.githubusercontent.com/google/syzkaller/master/tools/create-image.sh -O create-image.sh +chown +x create-image.sh +./create-image.sh +``` -Sometimes it's useful to have some additional packages and tools available in the VM even though they are not required to run syzkaller. -The instructions to install some useful tools are below. -They should obviously be executed before packing the `.img` file. +By default, this script will create a minimal Debian-stretch Linux image. The result should be `$IMAGE/stretch.img` disk image. -To install other packages (not required to run syzkaller): +If you would like to generate wheezy debian image, instead of stretch, just add one option of the script ``` bash -sudo chroot stretch /bin/bash -c "apt-get update; apt-get install -y make sysbench git vim tmux usbutils" +./create-image.sh --distribution=wheezy ``` -To install Trinity (not required to run syzkaller): +Sometimes it's useful to have some additional packages and tools available in the VM even though they are not required to run syzkaller. +The instructions to install some useful tools are below. + +To install other packages, like `make sysbench git vim tmux usbutils` (not required to run syzkaller): ``` bash -sudo chroot stretch /bin/bash -c "mkdir -p ~; cd ~/; wget https://github.com/kernelslacker/trinity/archive/v1.5.tar.gz -O trinity-1.5.tar.gz; tar -xf trinity-1.5.tar.gz" -sudo chroot stretch /bin/bash -c "cd ~/trinity-1.5 ; ./configure.sh ; make -j16 ; make install" +./create-image.sh --feature=full ``` To install perf (not required to run syzkaller): ``` bash -cp -r $KERNEL stretch/tmp/ -sudo chroot stretch /bin/bash -c "apt-get update; apt-get install -y flex bison python-dev libelf-dev libunwind8-dev libaudit-dev libslang2-dev libperl-dev binutils-dev liblzma-dev libnuma-dev" -sudo chroot stretch /bin/bash -c "cd /tmp/linux/tools/perf/; make" -sudo chroot stretch /bin/bash -c "cp /tmp/linux/tools/perf/perf /usr/bin/" -rm -r stretch/tmp/linux +./create-image.sh --add-perf ``` +Note: remember to set `$KERNEL` before installing perf + +For additional options of `create-image.sh`, please refer to `./create-image.sh -h` ## QEMU -- cgit mrf-deployment