Re: [Xen-devel] [stage1-xen (RFC) PATCH 09/10] build/fedora: Add `RUNNING_STAGE1_XEN.md`

2017-08-23 Thread Stefano Stabellini
On Mon, 21 Aug 2017, Rajiv Ranganath wrote:

This is a great and well detailed document. I have a few suggestions
below to provide some info for people that wants to do it manually.


> ---
>  build/fedora/RUNNING_STAGE1_XEN.md |  383 
> 
>  1 file changed, 383 insertions(+)
>  create mode 100644 build/fedora/RUNNING_STAGE1_XEN.md
> 
> diff --git a/build/fedora/RUNNING_STAGE1_XEN.md 
> b/build/fedora/RUNNING_STAGE1_XEN.md
> new file mode 100644
> index 000..705e7e4
> --- /dev/null
> +++ b/build/fedora/RUNNING_STAGE1_XEN.md
> @@ -0,0 +1,383 @@
> +# Running Stage1 Xen on Fedora
> +
> +This document outlines the steps to get started with stage1-xen on Fedora. 
> They are 
> +
> + * [Preparing your machine and installing minimal 
> Fedora](#preparing_your_machine_and_installing_minimal_fedora)
> + * [Booting into Xen](#booting_into_xen)
> + * [Launching Xen services](#launching_xen_services)
> + * [Setting up Xen networking](#setting_up_xen_networking)
> + * [Running stage1-xen](#running_stage1-xen)
> +
> +
> +## Preparing your machine and installing minimal Fedora
> +
> +On x86 platform there are two ways to start an operating system or a 
> hypervisor. They are 
> +
> + * Legacy BIOS Mode
> + * EFI Mode
> +
> +Latest operating systems and hypervisors including Fedora and Xen has 
> support for EFI mode. If you are unfamiliar with EFI we recommend checking 
> out this [article](http://www.rodsbooks.com/efi-bootloaders/principles.html).
> +
> +By default, most BIOS now boot using EFI Mode. In your BIOS menu, there 
> might be an option to toggle _Legacy BIOS Mode_. Do not toggle that option.
> +
> +### Enable VT-x and VT-d
> +
> +Please ensure that you have enabled VT-x and if available VT-d.
> +
> +### Disable Secure Boot
> +
> +As we will be booting a custom build of Xen, we need to disable secure boot. 
> You will find an option in your BIOS menu to disable secure boot.
> +
> +### Installing minimal Fedora
> +
> +The default Fedora installation installs packages that we do not require 
> when running Xen. We recommend doing a minimal Fedora as follows.
> +
> + 1. Download Net Install image
> +
> + 2. Prepare a USB drive
> +
> + 3. Do a minimal Fedora Install
> +
> +You can download the Fedora net install image 
> [here](https://alt.fedoraproject.org/). You can select either the Fedora 
> Server or Fedora Workstation image, it doesn't really matter.
> +
> +After downloading the net install images, please copy the raw image onto a 
> USB drive. Please see 
> [this](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-making-usb-media.html)
>  link on how to prepare USB drive.
> +
> +EFI BIOS comes with a _BIOS Boot Menu_ using which you can select the device 
> to boot from. Insert the USB drive, then go into your BIOS Boot Menu and boot 
> using the USB drive. This should start the Fedora Network Installer.
> +
> +In the Fedora Installer, there is a section for under _SOFTWARE_ called 
> _SOFTWARE SELECTION_. In this section please **select** either _Minimal 
> Install_ or _Basic Desktop_, **without** any add-ons. 
> +
> +**Note:** If there is existing data on the hard disk, please ensure that 
> _INSTALLATION DESTINATION_ under _SYSTEM_ section is appropriately 
> configured. 
> +
> +Then click on _Begin Installation_ to complete the installation.
> +
> +Once the installation is complete, please disable SELinux by editing 
> `/etc/selinux/config`.
> +
> +You now have a minimal Fedora Installation, which is good for working with 
> Xen.
> +
> +
> +## Booting into Xen
> +
> +Log into Fedora as root and copy over `stage1-xen-build.tar.gz`. Extract 
> `stage1-xen-build.tar.gz` into `/opt` directory.

The doc is good. As for other patches in this series, I spend a couple
of words on the build without a Docker container. In this case, I would
say:

  "Build and Install Xen and stage1-xen. Please see buildroot-README.md on
  how to do it. If you follow the automatic build with Docker, then copy
  over `stage1-xen-build.tar.gz`. Extract `stage1-xen-build.tar.gz` into
  `/opt` directory."


> +```shell
> +[root@localhost ~]# tar zxvf stage1-xen-build.tar.gz -C /opt
> +
> +[root@localhost ~]# ls /opt
> +qemu-unstable  stage1-xen  xen-unstable  xen-unstable-runit
> +```
> +
> +This will extract all the build artifacts into `/opt` directory.
> +
> +Next we will create a BIOS Boot Menu entry to boot `xen-4.10-unstable.efi`. 
> This will start Xen hypervisor. Xen will then start Fedora as Dom-0 guest.
> +
> +On Fedora, EFI system partition (ESP) is usually mounted at `/boot/efi`. 
> This is a `vfat` partition. You can check if EFI system partition is mounted 
> as follows 
> +
> +```shell
> +[root@localhost ~]# mount | grep '\/boot\/efi'
> +/dev/sda1 on /boot/efi type vfat 
> (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
> +```
> +
> +Create a directory for Xen under 

[Xen-devel] [stage1-xen (RFC) PATCH 09/10] build/fedora: Add `RUNNING_STAGE1_XEN.md`

2017-08-21 Thread Rajiv Ranganath

---
 build/fedora/RUNNING_STAGE1_XEN.md |  383 
 1 file changed, 383 insertions(+)
 create mode 100644 build/fedora/RUNNING_STAGE1_XEN.md

diff --git a/build/fedora/RUNNING_STAGE1_XEN.md 
b/build/fedora/RUNNING_STAGE1_XEN.md
new file mode 100644
index 000..705e7e4
--- /dev/null
+++ b/build/fedora/RUNNING_STAGE1_XEN.md
@@ -0,0 +1,383 @@
+# Running Stage1 Xen on Fedora
+
+This document outlines the steps to get started with stage1-xen on Fedora. 
They are 
+
+ * [Preparing your machine and installing minimal 
Fedora](#preparing_your_machine_and_installing_minimal_fedora)
+ * [Booting into Xen](#booting_into_xen)
+ * [Launching Xen services](#launching_xen_services)
+ * [Setting up Xen networking](#setting_up_xen_networking)
+ * [Running stage1-xen](#running_stage1-xen)
+
+
+## Preparing your machine and installing minimal Fedora
+
+On x86 platform there are two ways to start an operating system or a 
hypervisor. They are 
+
+ * Legacy BIOS Mode
+ * EFI Mode
+
+Latest operating systems and hypervisors including Fedora and Xen has support 
for EFI mode. If you are unfamiliar with EFI we recommend checking out this 
[article](http://www.rodsbooks.com/efi-bootloaders/principles.html).
+
+By default, most BIOS now boot using EFI Mode. In your BIOS menu, there might 
be an option to toggle _Legacy BIOS Mode_. Do not toggle that option.
+
+### Enable VT-x and VT-d
+
+Please ensure that you have enabled VT-x and if available VT-d.
+
+### Disable Secure Boot
+
+As we will be booting a custom build of Xen, we need to disable secure boot. 
You will find an option in your BIOS menu to disable secure boot.
+
+### Installing minimal Fedora
+
+The default Fedora installation installs packages that we do not require when 
running Xen. We recommend doing a minimal Fedora as follows.
+
+ 1. Download Net Install image
+
+ 2. Prepare a USB drive
+
+ 3. Do a minimal Fedora Install
+
+You can download the Fedora net install image 
[here](https://alt.fedoraproject.org/). You can select either the Fedora Server 
or Fedora Workstation image, it doesn't really matter.
+
+After downloading the net install images, please copy the raw image onto a USB 
drive. Please see 
[this](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-making-usb-media.html)
 link on how to prepare USB drive.
+
+EFI BIOS comes with a _BIOS Boot Menu_ using which you can select the device 
to boot from. Insert the USB drive, then go into your BIOS Boot Menu and boot 
using the USB drive. This should start the Fedora Network Installer.
+
+In the Fedora Installer, there is a section for under _SOFTWARE_ called 
_SOFTWARE SELECTION_. In this section please **select** either _Minimal 
Install_ or _Basic Desktop_, **without** any add-ons. 
+
+**Note:** If there is existing data on the hard disk, please ensure that 
_INSTALLATION DESTINATION_ under _SYSTEM_ section is appropriately configured. 
+
+Then click on _Begin Installation_ to complete the installation.
+
+Once the installation is complete, please disable SELinux by editing 
`/etc/selinux/config`.
+
+You now have a minimal Fedora Installation, which is good for working with Xen.
+
+
+## Booting into Xen
+
+Log into Fedora as root and copy over `stage1-xen-build.tar.gz`. Extract 
`stage1-xen-build.tar.gz` into `/opt` directory.
+
+```shell
+[root@localhost ~]# tar zxvf stage1-xen-build.tar.gz -C /opt
+
+[root@localhost ~]# ls /opt
+qemu-unstable  stage1-xen  xen-unstable  xen-unstable-runit
+```
+
+This will extract all the build artifacts into `/opt` directory.
+
+Next we will create a BIOS Boot Menu entry to boot `xen-4.10-unstable.efi`. 
This will start Xen hypervisor. Xen will then start Fedora as Dom-0 guest.
+
+On Fedora, EFI system partition (ESP) is usually mounted at `/boot/efi`. This 
is a `vfat` partition. You can check if EFI system partition is mounted as 
follows 
+
+```shell
+[root@localhost ~]# mount | grep '\/boot\/efi'
+/dev/sda1 on /boot/efi type vfat 
(rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=ascii,shortname=winnt,errors=remount-ro)
+```
+
+Create a directory for Xen under `/boot/efi/EFI` and copy over 
`xen-4.10-unstable.efi`.
+
+```shell
+[root@localhost ~]# mkdir -p /boot/efi/EFI/xen
+[root@localhost ~]# cp 
/opt/xen-unstable/boot/efi/EFI/xen/xen-4.10-unstable.efi /boot/efi/EFI/xen/
+```
+
+Inspect `/boot/efi/EFI/fedora/grub.cfg`. Under section `### BEGIN 
/etc/grub.d/10_linux ###` you will find `menuentry` for Fedora kernel and 
initrd. Look for `linuxefi` and `initrdefi`. Copy over the `vmlinuz` and 
`initramfs` files that you want to use for your Dom-0 into `/boot/efi/EFI/xen` 
directory.
+
+```shell
+[root@localhost ~]# cp /boot/vmlinuz-A.B.C-D.fcXX.x86_64 /boot/efi/EFI/xen/
+
+[root@localhost ~]# cp /boot/initramfs-A.B.C-D.fcXX.x86_64.img 
/boot/efi/EFI/xen/
+```
+
+Now in `/boot/efi/EFI/xen/` you should have the following files.
+
+```shell
+[root@localhost ~]# ls