Wednesday, June 8, 2016

How to build Jailhouse on Intel host

Until I set up Jailhouse starting cell, I underwent trial and error.
Actually, There are many instructions at Jailhouse Github, articles and google group. If you use AMD host, check instruction at jailhouse github.

https://github.com/siemens/jailhouse

http://www.linuxjournal.com/content/jailhouse

https://groups.google.com/forum/#!forum/jailhouse-dev/join

In my case, It cost lots of time to build Jailhouse.
I hope that everyone who read this build Jailhouse easily.

Check your host that support VT-d and VT-x and 4 cores.

http://virt-tools.org/learning/check-hardware-virt/

It requires latest Linux distro and QEMU, kernel to patch guest and Jailhouse.

I use Intel i5-2500 for host.

I use Ubuntu 16.04 LTS for host and guest ( I recommend same linux for host and guest ), QEMU 2.6.0 version, kernel 4.7-rc2 and Jailhouse master.
-- you can get a config file at google group -- 14th June 2016

First, install Ubuntu 16.04 LTS for host.

change your CMDLINE_LINUX at /etc/default/grub.
 
CMDLINE_LINUX="kvm-intel.nested=1 intel_iommu=off intremap=off"
  
#update-grub
#reboot
#modprobe kvm
#modprobe kvm-intel
#cat /sys/module/kvm_intel/parameters/nested
Y

Second, install QEMU version 2.6.0 with default configuration.

qemu-system-x86_64 -machine q35 -m 1G -enable-kvm -smp 4 \
    -cpu kvm64,-kvm_pv_eoi,-kvm_steal_time,-kvm_asyncpf,-kvmclock,+vmx \
    -drive file=yourlinux.img,format=raw,id=disk,if=none \
    -device ide-hd,drive=disk -serial stdio -serial vc \
    -device intel-hda,addr=1b.0 -device hda-duplex

Never change anything.
yourlinux.img is created by qemu-img create yourlinux.img ubuntu.iso 20G.

after starting QEMU and installing Ubuntu for QEMU guest, change your CMDLINE_LINUX at /etc/default/grub.

CMDLINE_LINUX="memmap=66M$0x3b000000"
#update-grub
#reboot

Check cat /proc/cmdline -> memmap=66M$0x3b000000

and download jailhouse.


#apt-get update
#apt-get install git python-mako 
#git clone https://github.com/siemens/jailhouse
#make
#make firmware_install
#make install
#insmod driver/jailhouse.ko
#jailhouse enable configs/qemu-vm.cell
#jailhouse cell create configs/apic-demo.cell
#jailhouse cell load apic-demo inmates/demos/x86/apic-demo.bin -a 0xf0000
#jailhouse start apic-demo

If you get error, join Jailhouse google group.
There are talks about error.
If you don't get error, you can explore Jailhouse.

No comments:

Post a Comment