[Vm-dev] Cog Rump Xen unikernel

Eliot Miranda eliot.miranda at gmail.com
Fri Dec 11 19:09:20 UTC 2015


Ben,

    great to hear you're working on this!  I'm watching with bated breath!
BTW, you might find that Docker is easier and more general; I believe
there's no Xen for ARM for example, and ARM is increasingly interesting
with up coming extremely cheap 64-bit versions of Pi and PINE.  Good luck!!

On Fri, Dec 11, 2015 at 10:27 AM, Ben Coman <btc at openinworld.com> wrote:

>
> I got curious about following up these two threads making Cog a
> unikernel...
>
> Cog in the cloud
> http://forum.world.st/Cog-in-the-cloud-td4796514.html
>
> Hosting the Pharo VM on MirageOS
> http://forum.world.st/Hosting-the-Pharo-VM-on-MirageOS-td4799424.html#none
>
>
> One path forward is to use rumpkernel, which "provides a means to run
> existing POSIX applications as unikernels on Xen"
>
> https://blog.xenproject.org/2015/08/06/on-rump-kernels-and-the-rumprun-unikernel/
>
> Deploying real-world software today as unikernels on Xen with Rumprun
>
> http://events.linuxfoundation.org/sites/events/files/slides/xdps15-talk-final_0.pdf
>
>
> So I thought I would try the "Building Rumprun Unikernels" tutorial here...
>
> https://github.com/rumpkernel/wiki/wiki/Tutorial:-Building-Rumprun-Unikernels
> which I report here in case it was interest.  The tutorial is based on
> QEMU (and I think I saw a comment somewhere that Cog doesn't run so
> well on QEMU and needs Bochs), so after that I adapted it from QEMU to
> Xen.
>
>
> 64-BIT DEBIAN 8 JESSIE & XEN
>
> So first I installed Debian 8 Jessie 64-bit on my new laptop
> $ uname -a
> >> ...x86_64
>
> Then installed Xen and after a reboot could choose it from the boot menu.
> $ apt-get update
> $ apt get install xen-system-amd64 libxen-dev
>
> REBOOTED
>
> Tested manual selection from menu to boot into Xen dom0.
> Checked Xen was operating with...
> $ xl info
>
>
> 32-BIT DEBIAN 8 JESSIE & XEN
>
> However later I hit some complications determining whether the rump
> unikernel was being compiled 32-bit or 64-bit in order to mix in with
> 32-bit Pharo, so to simplify things I did a complete reinstall of my
> system as 32-bit.
> $ uname -a
> >> ...686-pae
>
> Then installed Xen again  Xen only has a 64-bit hypervisor, but this
> was not immediately available under 32-bit OS.  I can't exactly
> remember but I think I just needed to add multiarch before it would
> find the Xen package.
> $ apt-get update
> $ apt-get install multiarch
> $ apt get install xen-system-amd64 libxen-dev
> Otherwise it may have needed something like "dpkg --add-architecture ..."
>
> REBOOTED
>
> First test, manually selected to boot into Xen dom0, after which as
> root the following checked Xen was operating...
> $ xl info
>
> Then set it to automatically boot into Xen...
> $ dpkg-divert --divert /etc/grub.d/08_linux_xen --rename
> /etc/grub.d/20_linux_xen
> $ update-grub
> REBOOTED
>
>
> ====================================
> DID THE QUICK START TUTORIAL
> USING GENERIC HW ON QEMU
>
> 0. Installed support tools and libs
>
> $ apt-get install build-essential git-core cmake
>
> 1. Built the rumprun platform
>
> $ mkdir -p ~/Repos/rumprun-hw
> $ cd ~/Repos/rumprun-hw
> $ git clone http://repo.rumpkernel.org/rumprun
> $ cd rumprun
> $ git submodule update --init
> $ CC=cc ./build-rr.sh hw
> Took note of this output needed later...
> >> toolchain tuple: i486-rumprun-netbsdelf
> >> cc wrapper: i486-rumprun-netbsdelf-gcc
>
> $ echo $(pwd)
>     /Users/ben/Repos/rumpkernel-hw/rumprun
> $ export PATH="${PATH}:$(pwd)/rumprun/bin"
>
>
> 2. Built a toy application
>
> $ mkdir -p test
> $ cd test
> $ cat > helloer.c << EOF   ....
> $ cc -o helloer helloer.c
> $ i486-rumprun-netbsdelf-gcc -o helloer-rumprun helloer.c
> $ rumprun-bake hw_generic helloer-rumprun.bin helloer-rumprun
>
>
> 3. Ran the toy application
>
> $ su
>
> $ rumprun qemu -i helloer-rumprun.bin
>
> In another terminal, check its running
> $ xl list
> >> Name                                    ID  Mem  ...etc
> >> Domain-0                              0    7583
> >> rumprun-hellor-rumprun.bin  1        64
>
> The app takes over the terminal its run from, so from another terminal...
> $ xl destroy rumprun-hellor-rumprun.bin
>
>
> ====================================
> ADAPTED THE QUICK START TUTORIAL
> FOR XEN PARAVIRTUALIZATION
>
> 0. Started a new terminal to get an environment with a clean PATH
>
> 1. Built the rumprun platform
>
> $ mkdir -p ~/Repos/rumprun-xen
> $ cd ~/Repos/rumprun-xen
> $ git clone http://repo.rumpkernel.org/rumprun
> $ cd rumprun
> $ git submodule update --init
> $ CC=cc ./build-rr.sh xen   #<<<<
> Took note of this output needed later...
> >> toolchain tuple: i486-rumprun-netbsdelf
> >> cc wrapper: i486-rumprun-netbsdelf-gcc
>
> $ echo $(pwd)
>     /Users/ben/Repos/rumpkernel-xen/rumprun
> $ export PATH="${PATH}:$(pwd)/rumprun/bin"
>
>
> 2. Built a toy application
>
> $ mkdir -p test
> $ cd test
> $ cat > helloer.c << EOF   ....
> $ cc -o helloer helloer.c
> $ i486-rumprun-netbsdelf-gcc -o helloer-rumprun helloer.c
> $ rumprun-bake xen_pv helloer-rumprun.bin helloer-rumprun
>
>
> 3. Ran toy application
>
> $ cd ..
> $ su
> $ export PATH="${PATH}:`pwd`/rumprun/bin
> $ cd test
> $ rumprun xen -i helloer-rumprun.bin
> $ xl list
> >> Name                                    ID  Mem  ...etc
> >> Domain-0                              0    7583
> >> rumprun-hellor-rumprun.bin  1        64
>
> This took over that terminal, so from another terminal...
> $ xl destroy rumprun-hellor-rumprun.bin
>
>
> ====================================
> TRIED IT USING CMAKE
>
> $ cat > CMakeLists.txt << EOF see this link for text...
>
> https://github.com/rumpkernel/wiki/wiki/Tutorial:-Building-Rumprun-Unikernels
>
> $ mkdir host_bld
> $ cd host_bld
> $ cmake -G "Unix Makefiles" ..
> $ make
> $ ./helloer
>
> $ cd ..
> $ mkdir rumprun_bld
> $ cd rumprun_bld
>
> Now with the given cmake line I got an error message:
>    Could not find toolchain file:
> ../../rumprun/rumprun/share/x86_64-rumprun-netbsd-toolchain.cmake
>
> $ find ../.. -name x86_64-rumprun-netbsd-toolchain.cmake
> found it, so that the following worked...
>
> $ cmake -G "Unix Makefiles"
>
> -DCMAKE_TOOLCHAIN_FILE=../../rumprun/rumprun-x86_64/share/x86_64-rumprun-netbsd-toolchain.cmake
> ..
> $ make
> $ rumprun-bake xen_pv helloer.bin helloer
> $ rumprun-bake hw_generic helloer.bin helloer
> $ rumprun xen -i helloer.bin
>
> Next I'll report on initial steps to get Cog working on Xen as a Rump
> unikernel...
>
> cheers -ben
>



-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20151211/36945335/attachment.htm


More information about the Vm-dev mailing list