Subject: Re: [vserver] Adding openrisc architecture support
From: Herbert Poetzl <herbert@13thfloor.at>
Date: Thu, 5 Mar 2015 20:23:14 +0100

On Thu, Mar 05, 2015 at 11:40:53AM -0300, Marco Carnut wrote:
> Hi,

Hello Marco!

> What would be needed to support the OpenRISC
> architecture? I managed to compile a a 
> 3.18.0-vs2.3.7.3 kernel quite easily adding
> this:

> #define __NR_vserver \
>     (__NR_arch_specific_syscall + 1) \
>     __SYSCALL(__NR_vserver, sys_vserver)

This is a good start and probably should suffice
from the kernel side to get something running.

> to arch/openrisc/include/uapi/asm/unistd.h

> Does anything else needs being done in the
> kernel side?

Some modifications regarding kernel logging might
not be properly adapted, but that shouldn't stop
Linux-VServer from working.

It was designed to be architecture agnostic.

> Currently, it's util-vserver that's giving me
> a hard time. I tweaked the #defines to coerce
> util-vserver to use musl's syscall functions,
> made NR_vserver agree with the above, forced
> things a bit to make util-vserver believe musl
> is dietlibc and the thing apparently compiled
> just fine. However, I get errors like: 

I would first try to execute one of the simple
syscall switch commands from userspace, just to
verify that everything is working as expected
on the kernel side.

You can use the vcmd command for that.

http://vserver.13thfloor.at/Experimental/TOOLS/

>   can not change context: migrate kernel
>   feature missing and 'compat' API disabled:
>   Function not implemented

> If I recompile util-vserver with the compat API,
> I get vc_s_new_context(): function not implemented.

Don't compile in the compat API, it is neither
used nor properly supported on recent kernels.

My best guess is that the userspace syscall
wrapper doesn't work properly, so I would double
and triple check that first, with vcmd and strace
which has some support for Linux-VServer.

> Can anyone point me to the right direction?
> I may be able to set up a test rig via SSH for
> joint work if anyone else is interested in this.

If I remember correctly, QEMU supports OpenRISC,
so I would suggest to create a simple virtual
environment which has the necessary native
compilers and allows for booting a cross compiled
kernel (which you can also supply to get started).

All the best,
Herbert

> Thanks in advance,

> -Marco.