blob: f2bd56e857caffa237906be91e812da1510c52d1 (
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
|
(is_xen) enable to detect if we run under XEN
(should better check through cpuid...)
(hasCPU_virt_support) detect whether we've HW support for virt or not
(_is_kernelServer_supported) split it out of _is_kernelServer_needed()
(_bestKernelXEN_extensions) select kernel-server or kernel-xen-pvps
when running under XEN (depending on virt HW support presence)
(_bestKernel_extensions) use _bestKernelXEN_extensions() in order to
select the proper kernel for XEN
diff -up ./detect_devices.pm.tv ./detect_devices.pm
--- ./detect_devices.pm.tv 2012-01-09 10:33:40.946242888 +0100
+++ ./detect_devices.pm 2012-01-09 10:40:47.668522223 +0100
@@ -1213,6 +1213,10 @@ sub is_vmware() {
any { $_->{driver} =~ /Card:VMware/ } detect_devices::pci_probe();
}
+sub is_xen() {
+ -f '/proc/xen/capabilities';
+}
+
sub is_netbook_nettop() {
my @cpus = getCPUs();
(any { $_->{'model name'} =~ /(\bIntel\(R\) Atom\(TM\)\B)/i } @cpus) ||
@@ -1254,6 +1258,10 @@ sub hasCPUMicrocode() {
return $hasCPUMicrocode;
}
+sub hasCPU_virt_support() {
+ has_cpu_flag('svm') || has_cpu_flag('vmx');
+}
+
sub hasCPUFreq() {
require cpufreq;
to_bool(cpufreq::get_modules())
diff -up ./install/pkgs.pm.tv ./install/pkgs.pm
--- ./install/pkgs.pm.tv 2012-01-09 10:30:32.527118304 +0100
+++ ./install/pkgs.pm 2012-01-09 10:44:48.727700307 +0100
@@ -105,12 +105,19 @@ sub packageByName {
$best;
}
-sub _is_kernelServer_needed() {
+sub _is_kernelServer_supported() {
# forbid selecting kernel-server if not having PAE since PAE support is mandatory for kernel-server:
- return if !detect_devices::has_cpu_flag('pae');
+ detect_devices::has_cpu_flag('pae');
+}
+sub _is_kernelServer_needed() {
+ return if !_is_kernelServer_supported();
arch() =~ /i.86/ && detect_devices::dmi_detect_memory() > 3.8 * 1024 || detect_devices::isServer();
}
+sub _bestKernelXEN_extensions() {
+ _is_kernelServer_supported() && detect_devices::hasCPU_virt_support() ? '-server' : '-xen-pvps';
+}
+
sub _bestKernel_extensions {
my ($o_match_all_hardware) = @_;
@@ -118,6 +125,7 @@ sub _bestKernel_extensions {
$o_match_all_hardware ? (arch() =~ /i.86/ ? '-desktop586' : '-desktop') :
detect_devices::is_xbox() ? '-xbox' :
detect_devices::is_i586() ? '-desktop586' :
+ detect_devices::is_xen() ? _bestKernelXEN_extensions() :
_is_kernelServer_needed() ? '-server' :
'-desktop';
}
|