Xen ARM with Virtualization Extensions/Chromebook: Difference between revisions

From Xen
Jump to navigationJump to search
No edit summary
Line 41: Line 41:


And follow the guide to [[Xen_ARMv7_with_Virtualization_Extensions#Building_Xen_on_ARM|build Xen on ARM]] with the dtb found at linux.git/arch/arm/boot/exynos5250-snow.dtb (add CONFIG_DTB_FILE=/path/to/exynos5250-snow.dtb to make command line).
And follow the guide to [[Xen_ARMv7_with_Virtualization_Extensions#Building_Xen_on_ARM|build Xen on ARM]] with the dtb found at linux.git/arch/arm/boot/exynos5250-snow.dtb (add CONFIG_DTB_FILE=/path/to/exynos5250-snow.dtb to make command line).

(The branch "master" is a bit more recent and might contain useful commits, but don't expect it to work any better.)


=== mkimage ===
=== mkimage ===

Revision as of 17:12, 13 January 2014

Icon Ambox.png This page contained outdated information regarding Xen on ARM on the Chromebook, use them at your own risk of frustration of nothing works. Anyway, valuable information might be found for a developer and feel free to update the page.


Getting Xen on the Chromebook is not an easy task, there is no serial port easily accessible. This page will try to get you to run Xen on the Samsung ARM Chromebook.

You should probably take a look at the Xen ARM with Virtualization Extensions wiki page to get most of the information needed to develop on ARM.

For some reason, the chromebook keyboard does not work yet, when running Linux under Xen, the reason is not clear. So you will need an external USB keyboard once dom0 have booted.

Running a simple Linux distribution

We should start with running a simple Linux on a SD card (not ChromeOS). There is plenty of doc on the internet, show your <your-favorite-search-engine>-skill. To simplify the Xen development, make sure to have 2 kernel partitions on your sd-card, so you will be able to switch between the Xen kernel and the Linux kernel with more ease.

There is some information about the ChromeOS Developer Mode and the boot sequence on their wiki page Samsung ARM Chromebook.

Compilation

To compile both Linux and Xen, you will need a cross compile environment.

Linux

http://xenbits.xen.org/gitweb/?p=people/aperard/linux-chromebook.git

Tree based on the kernel tree from the ChromiumOS project.

You can find a .config file here.

You probably want to check the bootargument given to dom0. It's in arch/arm/boot/dts/cros5250-common.dtsi, and search for xen,dom0-bootargs, check in particular for the rootfs path.

 git clone git://xenbits.xen.org/people/aperard/linux-chromebook.git
 # cd to the tree and get the .config
 export CROSS_COMPILE=arm-unknown-linux-gnueabi-
 export ARCH=arm
 make zImage
 make dtbs

Xen

http://xenbits.xen.org/gitweb/?p=people/aperard/xen-arm.git

Branch: chromebook-2013-03-22

And follow the guide to build Xen on ARM with the dtb found at linux.git/arch/arm/boot/exynos5250-snow.dtb (add CONFIG_DTB_FILE=/path/to/exynos5250-snow.dtb to make command line).

(The branch "master" is a bit more recent and might contain useful commits, but don't expect it to work any better.)

mkimage

To start a kernel, the Chromebook need the kernel image to build in a specific manner.

So put the following "script" in a file, and replace the few paths to Xen and Linux images:

 /dts-v1/;
 / {
   description = "Chrome OS kernel image with one or more FDT blobs";
   #address-cells = <1>;
   images {
     kernel@1 {
       data = /incbin/("$path_to_xen_tree/xen/xen");
       type = "kernel";
       arch = "arm";
       os = "linux";
       compression = "none";
       load = <0x80200000>;
       entry = <0x80200000>;
     };
     kernel@2 {
       data = /incbin/("$path_to_linux_tree/arch/arm/boot/zImage");
       type = "kernel_noload";
       arch = "arm";
       os = "linux";
       compression = "none";
       load = <0>;
       entry = <0>;
     };
     fdt@1 {
       description = "exynos5250-arndale.dtb";
       data = /incbin/("$path_to_linux_tree/arch/arm/boot/exynos5250-snow.dtb");
       type = "flat_dt";
       arch = "arm";
       compression = "none";
       hash@1 {
         algo = "sha1";
       };
     };
   };
   configurations {
     default = "conf@1";
     conf@1 {
       kernel = "kernel@1";
       fdt = "fdt@1";
     };
   };
 };

Note that before commit 47d1a51 (xen: arm: make zImage the default target which we install) it was necessary to use "$path_to_xen_tree/xen/xen.bin instead of "$path_to_xen_tree/xen/xen for kernel@1.

Then:

 mkimage -f "$path_to_the_previous_script" output_dir/xen-chromebook-image

In order to be validated, the image needs to be signed, which we will do using the developper keys. The most simple way is to do that under ChromeOS:

 vbutil_kernel --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk  --vmlinuz output_dir/xen-chomebook-image --arch arm --pack output_dir/signed-xen-chromebook-image

This long line have two arguments to be changed:

  • output_dir/xen-chomebook-image is the image previously made by mkimage.
  • output_dir/signed-xen-chromebook-image is where you want your signed image to be copied.

Once done, dd the image to the kernel partition you've dedicated to Xen (dd if=output_dir/signed-xen-chromebook-image of=/dev/mmcblk1pX).

Next step, ask the Chromebook to start Xen. You probably know about cgpt after you've installed your own linux:

 cgpt add -i X -P 15 -S 0 -T 1 /dev/mmcblk1

Here, we ask to start the Xen kernel partition, we set the highest priority (15), and it will be only started once (-S success=0, -T tries=1). On a reboot, your linux should be back.

Debug

Getting debug output from Xen on the Chromebook is not an easy task, there is no serial port that we can use (for early output), and Xen does not know how to drive the screen. But there is a workaround! We can write to a specific memory space from Xen, read it back from Linux!

There is a memory region that is not erased across reboot and it's used by ChromeOS to collect kernel OOPS, it's also called RAMOOPS.

The Xen tree provided earlier have got some commits to write its log to this area.

To retrieve thoses logs, you will need to reboot the Chromebook under Linux and

 mount -t pstore xenlog /mnt

You will have all does /mnt/dmesg-ramoops-? file which will contain Xen logs, hopefully. (This have been done only using the ChromeOS kernel.)

On the chromebook, there is no button to hard-reboot and the way to do it is by pressing the to key "reload"+"power". If you power off and boot the Chromebook, the log in the RAMOOPS area will be corrupted.

Another way, using chained u-boot

TO WRITE

Ressource

The ChromiumOS project.

http://www.chromium.org/chromium-os/how-tos-and-troubleshooting/using-an-upstream-kernel-on-snow

http://chromeos-cr48.blogspot.co.uk/, but not sure which posts are relevant.