segfaultreloaded
Posts: 5
Joined: Wed Jun 28, 2017 2:02 pm

Booting Xen on RPi 3B

Wed Jun 28, 2017 2:19 pm

I am trying to run Xen. I cloned the Xen source from raspbian-packages and it builds to the point that there is a Xen image in /boot. I tried simple modifications to config.txt but that just dies, not even a blinking green light.

I have not been able to find any documentation about booting Xen on Raspberry Pi. Xen ARM is designed to boot by being part of the device tree. The Xen ARM documentation states that Xen should already be in the standard device tree for current Linux distros. I am thinking the device trees for Raspbian do not contain nodes for Xen.

Unless someone can suggest a better idea, I plan to write a Xen overlay as my next attempt.

Has anyone booted Xen on an RPi 3B?

segfaultreloaded
Posts: 5
Joined: Wed Jun 28, 2017 2:02 pm

Re: Booting Xen on RPi 3B

Thu Jul 06, 2017 2:48 pm

Status update, as of 6 July 2017:

I am testing a Xen device tree overlay. I don't have enough familiarity with the RPi boot loader to know if I succeeded. My situation is that it looks like Xen booted but I cannot confirm it. Can some please tell me if the RPi 3B has a boot feature that automatically boots a default image if config.txt is wrong?

Here is the state:

1. The Xen overlay is in /boot/overlays. I have tested that it loads correctly, without booting Xen, using the command line utility.
2. The default kernel.img file no longer exists in /boot.
3. A Xen image is in /boot, as /boot/xenpi-4.8.1.
4. The config.txt file contains the commands:
dtoverlay=xen
kernel=xenpi-4.8.1
5. When I cold boot, the above setup does not crash but shows me the typical Raspbian UI; ssh works, etc. That would be the case if Xen were running and working.
6. On an x86 Xen, I should see stuff in /proc/xen and be able to use the Xen tools to communicate with the hypervisor. Right now on the RPi, there is no /proc/xen, so I can't query to see if Xen is really running.

segfaultreloaded
Posts: 5
Joined: Wed Jun 28, 2017 2:02 pm

Re: Booting Xen on RPi 3B

Tue Jul 18, 2017 12:42 pm

Status update as of 18 July 2017:

I have learned that Xen will not boot on RPi 3B unless it has code specific to the bcm2837 added to it. I have also learned the basic design pattern for this code. That pattern is based on code in the Linux kernel that serves a similar purpose. What I do not know is what the corresponding Raspbian code would be. I am correct in assuming Raspbian is built as a 32-bit arm image and thus would be using code from linux/arch/arm/mach-bcm for initialization?

LdB
Posts: 568
Joined: Wed Dec 07, 2016 2:29 pm

Re: Booting Xen on RPi 3B

Tue Jul 18, 2017 3:43 pm

This is the baremetal section AKA no O/S at all and you are asking and telling us Raspbian linux stuff.

There might be some on here that play with linux but many of us don't. You might be better off asking the question on the Raspbian linux forum or even a general forum.

BrewHo
Posts: 3
Joined: Sat Sep 02, 2017 2:56 am

Re: Booting Xen on RPi 3B

Sat Sep 02, 2017 3:41 am

LdB wrote:
Tue Jul 18, 2017 3:43 pm
This is the baremetal section AKA no O/S at all and you are asking and telling us Raspbian linux stuff.

There might be some on here that play with linux but many of us don't. You might be better off asking the question on the Raspbian linux forum or even a general forum.
I disagree, and wonder who appointed you board police?

The OP was asking about a requirement for BCM2837 specific code in order to boot, how much more bare metal can you get?

Maybe I'm being a little harsh, but your post came across as harsh too. Maybe you were trying to be helpful, but it seems to me that a more helpful approach would have been to focus on the BCM2837-specific code, maybe asking why it was needed. It is undoubtedly involved in the o/s interaction with the bare metal silicon, so you might've learned something new, from a different perspective.

I'm also a bit annoyed because it looks like you might've chased the OP away entirely (no other posts that I can find), and I came here looking for info to help me port a different o/s to the Pi. Qubes is based on Xen so this thread is very pertinent, and it distresses me to find it was blown up before the port was successful. I'm still hoping the OP will come back with some additional updates (hint, hint)...

LdB
Posts: 568
Joined: Wed Dec 07, 2016 2:29 pm

Re: Booting Xen on RPi 3B

Sat Sep 02, 2017 6:38 pm

BrewHo wrote:
Sat Sep 02, 2017 3:41 am
I disagree, and wonder who appointed you board police?
The OP was asking about a requirement for BCM2837 specific code in order to boot, how much more bare metal can you get?
I simply suggested he is in the wrong forum and still say that is the case. You are welcome to disagree but I only do baremetal I can't understand a single thing you guys are talking about. How do you expect us to answer what we do not understand and you have asked nothing about BCM2837 code?

So let me give you my problems
1.) We don't have directories in baremetal all files are in root, we have no O/S so we have no choice.
2.) So our kernel.img, kernel7.img, kernel8-32.img etc files are always in root
3.) No idea what an overlay file is
4.) dtoverlay=xen that will be a text entry that appears as a atag at code boot point. What linux does with it no idea.
5.) Then a pile of linux explicit stuff about Xen and /proc/xen
BrewHo wrote:
Sat Sep 02, 2017 3:41 am
It is undoubtedly involved in the o/s interaction with the bare metal silicon, so you might've learned something new, from a different perspective.
None of what you are asking me is anything about bare metal silicon, you are asking about directories and entries none of which baremetal has.Here let me show you the four files on a baremetal SD card (on occasion we might carry config.txt)

Image
BrewHo wrote:
Sat Sep 02, 2017 3:41 am
I'm also a bit annoyed because it looks like you might've chased the OP away entirely (no other posts that I can find), and I came here looking for info to help me port a different o/s to the Pi. Qubes is based on Xen so this thread is very pertinent, and it distresses me to find it was blown up before the port was successful. I'm still hoping the OP will come back with some additional updates (hint, hint)...
More than happy to help and not chasing anyone away but you are going to have to turn what you are asking into a question that we can understand.

So you have seen our 4 files we have on our SD card and here is the boot sequence and it should be obvious why we have only 4/5 files .. so try to frame your question to that. Now my guess is your are asking stuff beyond that in the third stage linux loader and if so you are on the wrong forum, the linux O/S forums would be more appropriate. From there we launch into our code and why I suspect we can't understand the question. A few on here might play with linux (Ultibo I know does) but for the rest of us what you are asking is like a foreign language.
Image

BrewHo
Posts: 3
Joined: Sat Sep 02, 2017 2:56 am

Re: Booting Xen on RPi 3B

Mon Sep 04, 2017 5:33 am

Hey thanks for the very useful chart. I'm not entirely sure yet, have not researched this specific case, but from general o/s kernels and bootloaders I've worked on in the past I expect the processor specific code is likely to be needed in the first or second stages. That would be to set the processor to the condition the o/s expects. Could be in the third stage, to conform to the conditions already set in the earlier stages, but my cynical expectations about the norm for product developers makes me think that would be too well structured an approach to be likely in reality. I'll have to do some reading of those early stages to get up to speed on this environment. I'm new to the Pi but I was writing bare metal code for a living before Linus Torvalds shipped his first driver so I don't expect it will be too hard to get a handle on it. So I'll probably be heads-down for a little while, especially if my day job continues to be as busy as usual. Thanks again for the pointers!
- BrewHo

LdB
Posts: 568
Joined: Wed Dec 07, 2016 2:29 pm

Re: Booting Xen on RPi 3B

Mon Sep 04, 2017 7:15 am

The thing on the Pi is the ARM processor is a co-processor to the GPU. They share memory but it is the GPU that starts first and runs all the loaders in the above. Once the GPU has loaded the image file into the right place it has setup a small stub program and releases the ARM reset.

So there is a multi-stage loader but it is on the GPU not the ARM. The ARM runs thru the stub and then delivers out to address 0x8000 in HYP_MODE which is where we place our code to start execution. So if you are looking for an ARM bootloader there isn't one.

This is the stub, its main job is to hit some registers that must be set, setup a clock and park core 1,2,3 into a know location. Core 0 continues on to boot.
https://github.com/raspberrypi/tools/bl ... armstub7.S

Return to “Bare metal”

Who is online

Users browsing this forum: No registered users and 6 guests