[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] Mirage on Xen/ARM status



On 4 Jun 2014, at 13:33, Thomas Leonard <talex5@xxxxxxxxx> wrote:

> An update on the Mirage/ARM port:
> 
> I have mirage-platform upgraded to the new Mini-OS (plus openlibm and
> no libc). Networking is working again on x86_64 (I can telnet to the
> mirage-skeleton/network service and send it a message), but not on ARM
> yet.

Good to have x86_64 back!  It's probably a good idea to CC me and Dave
on the patchbombs to xen-devel, as I only sample the list these days
due to mail volume.

> This required some changes to Mini-OS to expose the grant table
> details and to stop Mini-OS's xenbus from stealing the event
> notifications. I need this clean this up.

To be clear, this is networking using lwIP on ARM isnt it?  For Mirage,
the MiniOS Xenbus should be disabled entirely since our own OCaml
Xenstore will handle everything.

> OCaml's Random currently tries to open /dev/urandom, which fails.
> Looks like it falls back to using gettimeofday in that case. It logs a
> message to the console ("Attempt to open(/dev/urandom)!"), so
> hopefully we'll remember to fix it eventually.

Is this initialised forcibly anywhere, or only when someone calls
a Random.self_init()?  We need to deprecate this module in Mirage and
ensure that we have a randomfront/back model, or risk introducing
poor entropy.  This hasn't mattered so far, but will be critical when
we activate the OCaml TLS library that Hannes and David are working on.

> Networking doesn't work on ARM as the code wants to use start_info,
> which doesn't exist. I might try making a fake start_info page on ARM
> rather than modifying everything else.

Yep, sounds like a good plan to ease x86/ARM transition.

> 
> 
> My current plan is:
> 
> - Upstream Karim's initial ARM support to Xen. I split the original
> patch into three smaller ones and submitted them, but they want it
> broken up further, which is fair enough.
> 
> - Upstream my patches to build a libminios.a library, plus some other
> fixes to the build system.
> 
> - Make some changes to Mini-OS to work unmodified with Mirage
> (specifically: expose grant table details, disable interrupt-based
> event handlers, and allow linking only the features we need).
> 
> - Add a proper string library to mirage-platform to replace Mini-OS's
> limited sprintf.
> 
> - Upstream my patches to mirage-platform and mirage to build using the
> new libminios and openlibm (these are on github in my forks).
> 
> - Upstream my Mini-OS ARM patches to Xen.
> 
> - Add a start_info structure on ARM, or find some other way to expose
> those details to Mirage.
> 

Ack!

> 
> There are various other bits that would be nice to have:
> 
> - Use a proper virtual memory mapping on ARM, including a stack guard
> page and a non-mapped page zero. I should probably find out what it
> does on x86 and make them consistent too.
> 
> - Allow running C code in Mirage in a restricted sandbox (non-privileged 
> mode).
> 
> - Use ctypes to replace current stubs.
> 
> - Replace all the unimplemented stubs (lseek, etc) to check nothing is
> relying on them.
> 
> - Import the FreeBSD hardware float support code so we can use
> hardware floating point. Currently, everything is soft-float.

Agreed that all these are nice-to-have but not essential to a first
merge of the rest.  Note that ctypes 0.3 is now out, so we have a stable
baseline with stub generation.

cheers,
Anil

> 
> 
> On 16 May 2014 17:41, Thomas Leonard <talex5@xxxxxxxxx> wrote:
>> Good news for Mirage on Xen/ARM: mirage-skeleton/console is now working!
>> 
>> It needs tidying up, but currently to run you need:
>> 
>> 1. mirage-platform/arm-hacks3:
>> https://github.com/talex5/mirage-platform/tree/arm-hacks3
>> 
>> This has been updated for the new Mini-OS. dietlibc is gone (we no
>> longer need a C library). libm is also gone, but you'll need to
>> replace it with something else (see below). There's a new libxencaml
>> with the separated-out Mini-OS OCaml bindings.
>> 
>> I had to make some changes to the Mirage API, because on ARM Xen
>> doesn't provide start_info. Also, I switched the timer stuff to use
>> mini-os's block_domain call, which handles ARM correctly.
>> 
>> 2. mirage-console/master (modified to avoid using start_page)
>> https://github.com/talex5/mirage-console/commits/master
>> 
>> 3. openlibm/arm-hacks (disables all long double support, which ARM
>> doesn't have and OCaml doesn't need)
>> https://github.com/talex5/openlibm/tree/arm-hacks
>> 
>> 4. Mini-OS/devel (can now be installed as a library, libminios.a - use
>> "make install-ocamlfind")
>> https://github.com/talex5/xen/tree/devel
>> 
>> 
>> You'll also need a *soft-float* ARM build machine. Hard-float would
>> require extra support from Mini-OS. You can cross-compile the C code
>> easily enough, but OCaml can't cross compile, even from armhf to armel
>> (the -ffpu option just gives a silly error message). I got mine with:
>> 
>>  debootstrap --arch armel testing /mnt
>> 
>> Finally, you'll also need to modify mir-console's Makefile, because I
>> didn't update mirage to generate it properly. This worked for me:
>> 
>> KERNEL_DIR = $(shell ocamlfind query minios-kernel)
>> PLATFORM_DIR = $(shell ocamlfind query mirage-xen)
>> 
>> build: main.native.o
>>        ld -d -static -nostdlib -T $(KERNEL_DIR)/link.lds \
>>                --start-group  \
>>                /usr/lib/gcc/arm-linux-gnueabi/4.8/libgcc.a \
>>                  $(PLATFORM_DIR)/libocaml.a \
>>                  $(PLATFORM_DIR)/libxencaml.a \
>>                  ~/lib/libopenlibm.a \
>>                  $(KERNEL_DIR)/libminios.a -o mir-console.elf \
>>                  _build/main.native.o \
>>          --end-group
>>        objcopy -O binary mir-console.elf mir-console.xen
>> 
>> The next steps are to make this all a bit easier to install and clean
>> up the branches so they can be merged. Also, some things are broken
>> (printf doesn't accept %f, for example, because we're just using
>> Mini-OS's version).
>> 
>> 
>> --
>> Dr Thomas Leonard        http://0install.net/
>> GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
>> GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA
> 
> 
> 
> -- 
> Dr Thomas Leonard        http://0install.net/
> GPG: 9242 9807 C985 3C07 44A6  8B9A AE07 8280 59A5 3CC1
> GPG: DA98 25AE CAD0 8975 7CDA  BD8E 0713 3F96 CA74 D8BA
> 
> _______________________________________________
> MirageOS-devel mailing list
> MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


_______________________________________________
MirageOS-devel mailing list
MirageOS-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/mirageos-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.