summaryrefslogtreecommitdiff
path: root/pcr/xen/xen.install
blob: 2c03573e7b93ab97efda12d324063a1d5e4526ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
xen_boot() {
    cat << __EOF__
You are not running xen unless you boot xen.
Possible Xen boot paths:
EFI boot -> grubx64.efi -> multiboot2 -> [xen.gz, vmlinuz, ramdisk]
BIOS boot -> grub -> multiboot(2) -> [xen.gz, vmlinuz, ramdisk]

EFI boot -> xen.efi

##########
grub multiboot2 preparation:
Install grub: https://wiki.parabola.nu/index.php/GRUB

At this time, some modifications are needed to 20_linux_xen.
These are included in this package as 21_linux_xen

Set the values needed for your configuration in /etc/default/grub
Detailed here: https://www.gnu.org/software/grub/manual/html_node/Simple-configuration.html
Needed:
GRUB_CMDLINE_XEN
GRUB_CMDLINE_LINUX_XEN_REPLACE
These values are not required but can be used; they are appended to the previous values, then this is used for the non-recovery (default) entry:
GRUB_CMDLINE_XEN_DEFAULT
GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT

run grub-mkconfig

To boot xen as default:
suggested: inspect and use this config to boot with. Check if the xen entry works as expected
find the id of the xen entry and set this as DEFAULT in /etc/default/grub.
This may look something like:
GRUB_DEFAULT="xen-gnulinux-simple-a-unique-id-from-your-grub-goes-here"

run grub-mkconfig

##########
Direct EFI boot preperation:
Create a xen.cfg file in the same directory as xen.efi.
These need to be in ESP, or in a directory accessible from you EFI bootloader.
Put settings relevant to your system into xen.cfg
Detailed here: https://xenbits.xen.org/docs/4.9-testing/misc/efi.html
Needed:
kernel
ramdisk
Add the xen.efi file to your EFI bootloader (such as Refind).
And / or add the xen.efi file to you EFI boot options (efibootmgr).
__EOF__
}

install_msg() {
    cat << __EOF__
===> IMPORTANT NOTICES:

In order to complete the installation, and enable Xen,
at the very least you must:

1. Configure your bootloader to boot Xen:
__EOF__
    xen_boot
    cat << __EOF__
2. Issue the following commands to allow you to create and start VMs:

    systemctl enable xen-qemu-dom0-disk-backend.service
    systemctl enable xen-init-dom0.service
    systemctl enable xenconsoled.service

   Other optional services are:
    systemctl enable xen-watchdog.service

3. If you want some domains to automatically start up/shutdown, run the following:
    systemctl enable xendomains.service

For more information refer to the Wiki:
    https://wiki.parabola.nu/index.php/Xen

__EOF__
}

upgrade_msg() {
    cat << __EOF__
Xen 4.9
Release notes
http://wiki.xen.org/wiki/Xen_Project_4.9_Release_Notes
Feature list
http://wiki.xen.org/wiki/Xen_Project_4.9_Feature_List
__EOF__
}

upgrade_msg_grub_multiboot2() {
    cat << __EOF__
##########
Xen 4.9 can now use grub>=2.02 multiboot2.
If you previously booted using xen.efi, you have an alternative.
If you previously relied on the packaged 09_xen for grub-mkconfig:
It is now removed.
You will need to do the following under grub multiboot2 preparation:
##########
__EOF__
    xen_boot
}

post_install() {
    install_msg
    upgrade_msg
    systemd-tmpfiles --create
}

post_upgrade() {
    if [[ "$2" < 4.9.0 || "$2" == *'4.9.0rc'* ]]; then
        upgrade_msg
    fi
    if [[ "$2" < 4.9.0 || "$2" == *'4.9.0rc'* ]]; then
        upgrade_msg_grub_multiboot2
    fi
    systemd-tmpfiles --create
}

pre_remove() {
   systemctl stop xendomains.service
   systemctl stop xen-watchdog.service
   systemctl stop xenconsoled.service
   systemctl stop xen-init-dom0.service
   systemctl stop xen-qemu-dom0-disk-backend.service

   systemctl disable xendomains.service
   systemctl disable xen-watchdog.service
   systemctl disable xenconsoled.service
   systemctl disable xen-init-dom0.service
   systemctl disable xen-qemu-dom0-disk-backend.service
}

post_remove() {
    cat << __EOF__
===> IMPORTANT NOTICE:

In order to finish removing Xen, you will need to modify
your bootloader configuration files to load your Linux-libre
kernel instead of Xen kernel.
__EOF__
}