Xen ARM with Virtualization Extensions/Chromebook: Difference between revisions

From Xen
Jump to navigationJump to search
(Add categories)
m (typo)
Line 3: Line 3:
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.
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 develope on ARM.
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.


== Running a simple Linux distribution ==
== 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 internet, show your <your-favorite-search-engine>-skill. To simplify the Xen developpement, 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.
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 [http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices/samsung-arm-chromebook Samsung ARM Chromebook].
There is some information about the ChromeOS Developer Mode and the boot sequence on their wiki page [http://www.chromium.org/chromium-os/developer-information-for-chrome-os-devices/samsung-arm-chromebook Samsung ARM Chromebook].


== Compilation ==
== Compilation ==
Line 40: Line 40:
=== mkimage ===
=== mkimage ===


To start a kernel, the chromebook need the kernel image to build in a specific manner.
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:
So put the following "script" in a file, and replace the few paths to Xen and Linux images:


/dts-v1/;
/dts-v1/;
Line 91: Line 91:
mkimage -f "$path_to_the_previous_script" output_dir/xen-chromebook-image
mkimage -f "$path_to_the_previous_script" output_dir/xen-chromebook-image


In order to be validated, the image need to be signed, which will do using the developper keys. The most simple way is to do that under ChromeOS:
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 --config=$file_linux_cmdline --vmlinuz output_dir/xen-chomebook-image --arch arm --pack output_dir/signed-xen-chromebook-image
vbutil_kernel --keyblock /usr/share/vboot/devkeys/kernel.keyblock --version 1 --signprivate /usr/share/vboot/devkeys/kernel_data_key.vbprivk --config=$file_linux_cmdline --vmlinuz output_dir/xen-chomebook-image --arch arm --pack output_dir/signed-xen-chromebook-image


This long line have three to be change:
This long line have three arguments to be changed:
- $file_linux_cmdline is a file with a linux command line. The command line is not used by Xen, but I never tried without.
- <code>$file_linux_cmdline</code> is a file with a linux command line. The command line is not used by Xen, but I never tried without.
- output_dir/xen-chomebook-image is the image priviously made by mkimage.
- <code>output_dir/xen-chomebook-image</code> is the image previously made by <code>mkimage</code>.
- output_dir/signed-xen-chromebook-image is where you want your signed image to be copied.
- <code>output_dir/signed-xen-chromebook-image</code> 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).
Once done, <code>dd</code> the image to the kernel partition you've dedicated to Xen (<code>dd if=output_dir/signed-xen-chromebook-image of=/dev/mmcblk1pX</code>).


Next step, ask the chromebook to start Xen. You probably know about cgpt after you've installed your own linux:
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
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 will hopefully start.
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 ==
== Debug ==


Getting debug output from Xen on the chromebook is not an easy task, there is serial port that we can use (for early output), and Xen does not know how to drive the screen. But there is a workaround! Write to a specific memory space from Xen, read it back from Linux!
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! Write to a specific memory space from Xen, read it back from Linux!


There is a memory region that is not erase across reboot and it's used by ChromeOS to collect kernel OOPS, it's also called RAMOOPS.
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.
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
To retrieve thoses logs, you will need to reboot the Chromebook under Linux and
mount -t pstore xenlog /mnt
mount -t pstore xenlog /mnt
You will have all does <code>/mnt/dmesg-ramoops-?</code> file which will contain Xen logs, hopefully.
You will have all does <code>/mnt/dmesg-ramoops-?</code> file which will contain Xen logs, hopefully.

Revision as of 17:23, 11 April 2013

Icon Info.png This page is in work in progress


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.

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.

 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

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.bin");
       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-arndale.dtb");
       type = "flat_dt";
       arch = "arm";
       compression = "none";
       hash@1 {
         algo = "sha1";
       };
     };
   };
   configurations {
     default = "conf@1";
     conf@1 {
       kernel = "kernel@1";
       fdt = "fdt@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 --config=$file_linux_cmdline --vmlinuz output_dir/xen-chomebook-image --arch arm --pack output_dir/signed-xen-chromebook-image

This long line have three arguments to be changed: - $file_linux_cmdline is a file with a linux command line. The command line is not used by Xen, but I never tried without. - 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! 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.

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.