Thursday, June 23, 2016

About mid term evaulation of GSoC

1. Planned progress vs. real progress according to the original project plan.

> planned progress for mid term is to show demo executing rtems as jailhouse "inmate" on x86 with appropriate tutorial to guide users.

> real progress
write tutorials how to build jailhouse, how to execute jailhouse cell and how to build patched rtems for jailhouse.
Next step is to execute rtems as jailhouse "imate". I should write a config file for rtems about executing jailhouse cell.
  
2. In case there is a divergence from planned/real, then what are the reasons?
A config file is needed to execute rtems as jailhouse "inmate".
When I started the project, mentor said that he was collecting materials about existed rtems demo. But after building rtems and jailhouse, I need to write a config file for rtems demo.

3. Updated plan for the second half of the GSoC period.
There is little difference but planned progress would be completed at the end.

4. Code produced so far.
Not thing. But I completed patching rtems by mentor's patch files.

5. What are the current blocking points?
I am studying about how rtems boots for writing a config file.

6. What is realistic to achieve finally?
As I suggested, I will also show RTEMS demo as jailhouse "inmate" on arm and write a documentation for users.

7. Which external help do you expect.
To execute jailhouse on arm, I need a bananaPi board. could you support about buying bananaPi board?

Wednesday, June 15, 2016

How to build patched RTEMS for Jailhouse

If you want to make a rtems cell for jailhouse, you should patch rtems.

I got five patch files from Jan Kiszka. ( jan.kiszka@siemens.com )
The patch files are involved with apic, ioapic, pic, memory etc for jailhouse to support rtems.

I got rtems and rtems-source-builder from git.
I checkout rtems and rtems-source-builder.

rtems baseline is commit f334847.
rtems-source-builder baseline is commit 04aadb6.
I matched rtems and rtems-source-builder by date of commit.

If you use rtems-source-builder master, you would get some error when you install i386-rtems by sb-set-builder.

Joel Sherrill will clone RTEMS for this old version issue.

After patching rtems, I installed rtems with command for jailhouse.
# ../rtems_git_dir/configure USE_COM1_AS_CONSOLE=1 CLOCK_DRIVER_USE_TSC=1 \
>    CLOCK_DRIVER_USE_8254=0 BSP_PRESS_KEY_FOR_RESET=1 --target=i386-rtems4.11 \
>    --enable-networking --enable-tests=samples --disable-posix --disable-multiprocessing \
>    --disable-cxx --enable-rtemsbsp=pc386 --prefix=~/rtems_build_dir \
>     BSP_PRINT_EXCEPTION_CONTEXT=1

And then, you can use hello.bin for jailhouse in testsuites.

Now I am writing config file for jailhouse to create cell for rtems.

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.