 PV-GRUB (not to be confused with the pygrub crutch) is a GRUB 0.9x-based boot loader for Xen para-virtual machines, which allows you to load the OS kernel directly from the DomU (guest) environment, which adds significant independence from the host system to the guest launch process. One of the largest implementations can be considered Amazon EC2 cloud hosting, which also uses the Xen hypervisor and allows customers to use PV-GRUB to download any custom kernel ( Use your own kernel with Amazon EC2 ) for paravirtual systems.
 PV-GRUB (not to be confused with the pygrub crutch) is a GRUB 0.9x-based boot loader for Xen para-virtual machines, which allows you to load the OS kernel directly from the DomU (guest) environment, which adds significant independence from the host system to the guest launch process. One of the largest implementations can be considered Amazon EC2 cloud hosting, which also uses the Xen hypervisor and allows customers to use PV-GRUB to download any custom kernel ( Use your own kernel with Amazon EC2 ) for paravirtual systems.$ wget http://bits.xensource.com/oss-xen/release/4.1.4/xen-4.1.4.tar.gz $ tar xzf xen-4.1.4.tar.gz
stubdom directory. Run the bootloader assembly:$ make grub
$ XEN_TARGET_ARCH = x86_32 make grub
In file included from xc_core.c: 69: 0: xc_core.h: 26: 35: fatal error: xen / libelf / elfstructs.h: No such file or directory compilation terminated
$ find .. -type f -name xc_core.h ../tools/libxc/xc_core.h
 #include "xen/libelf/elfstructs.h"  #include "xen/elfstructs.h" make grub again, there are several more like this:xc_dom.h: 17: 31: fatal error: xen / libelf / libelf.h: No such file or directory xc_hvm_build.c: 34: 31: fatal error: xen / libelf / libelf.h: No such file or directory ../../xen/common/libelf/libelf-private.h:70:31: fatal error: xen / libelf / libelf.h: No such file or directory
 #include <xen/libelf/libelf.h>  #include <xen/libelf.h> gzip -f -9 -c /home/user/xen-4.1.4/stubdom/mini-os-x86_64-grub/mini-os> /home/user/xen-4.1.4/stubdom/mini-os-x86_64 -grub / mini-os.gz make [1]: Leaving directory `/home/user/xen-4.1.4/extras/mini-os'
mini-os-x86_64-grub/mini-os.gz can be renamed to a more understandable pv-grub-x86_64.gz (or pv-grub-x86_32.gz if compiled under x86_32), and then put into the /usr/lib/xen-4.1/boot directory /usr/lib/xen-4.1/boot your your Dom0, where it hvmloader same is true for Debian with the xen-utils-4.1 package installed, there is a hvmloader in the same hvmloader )./boot directory) will be available to the bootloader for reading. I have already stepped on a rake in the process of completing the quest described here: despite the theoretically existing backward compatibility of Ext4 with Ext2, there are quite a few different extensions (features) that completely eliminate this compatibility, especially if you didn’t think about it when creating your Ext4 section. Before creating a separate partition under /boot , I didn’t have a special need. Now, the solution could be just to remove the above-mentioned starting trio to the micro-partition (I think, double the volume from the current contents of /boot will be quite enough), formatted in Ext2. Do not forget to edit /etc/fstab your DomU, adding there /boot section and changing the names of the block devices of the other partitions, if necessary. The same applies to the disk configuration of the virtual machine itself.mount -t ext2 elementary.update-grub will create a bootloader menu file, adding kernels to the boot list.$ mkdir / boot / grub $ update-grub Searching for GRUB installation directory ... found: / boot / grub Probing devices to guess BIOS drives. This may take a long time. Boot for default file ... Searching for GRUB installation directory ... found: / boot / grub Testing for an existing GRUB menu.lst file ... Generating /boot/grub/menu.lst Searching for splash image ... none found, skipping ... Found kernel: /vmlinuz-3.2.0-4-amd64 Updating /boot/grub/menu.lst ... done
/boot/grub/menu.lst / /boot/grub/menu.lst / /boot/grub/menu.lst :title Debian GNU / Linux, kernel 3.2.0-4-amd64 root (/ dev / xvda1) kernel /vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro initrd /initrd.img-3.2.0-4-amd64 title Debian GNU / Linux, kernel 3.2.0-4-amd64 (single-user mode) root (/ dev / xvda1) kernel /vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro single initrd /initrd.img-3.2.0-4-amd64
root option, substituting the disk and partition names of the block device instead of the understandable GRUB . When selecting these menu items, GRUB will simply swear at the wrong option value./boot /boot/grub/menu.lst adding the groot option with an explicit indication of the sequence number of the boot "disk", which is subsequently mounted as /boot (since there are no full disks with the partition table in the paravirtual environment):groot = (hd0)
## timeout sec # Set a timeout, in SEC seconds, before automatically booting the default entry # (normally the first entry defined). timeout 1
groot value to be correctly perceived by the update-grub configuration generator, we will additionally create the /boot/grub/device.map file, where we will enter a single line relating to the mentioned boot partition:(hd0) / dev / xvda1
update-grub should generate the correct menu file, which will also not be broken if you want to update the version of the main kernel or add additional ones.title Debian GNU / Linux, kernel 3.2.0-4-amd64 root (hd0) kernel /vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro initrd /initrd.img-3.2.0-4-amd64 title Debian GNU / Linux, kernel 3.2.0-4-amd64 (single-user mode) root (hd0) kernel /vmlinuz-3.2.0-4-amd64 root = UUID = f5731cf7-420a-4094-acf7-bec5976a0b62 ro single initrd /initrd.img-3.2.0-4-amd64
extra option, this can be done by modifying kopt in the same / kopt .kernel option. If the boot loader image is in the default directory (in the same place as the hvmloader ), then the full path is not required. The extra option specifies the partition and path to the GRUB menu file.kernel = 'pv-grub-x86_64.gz' extra = '(hd0) /grub/menu.lst'
ramdisk and root options.xm start -c ). If everything is done correctly, you will see the GRUB menu and the subsequent kernel boot process with mounting the root partition.Do you need to support the construction of a jail box?
Source: https://habr.com/ru/post/178581/
All Articles