1 |
slords |
1.1 |
From c6d9aa996e86db33e66c411153de3425527fb24f Mon Sep 17 00:00:00 2001 |
2 |
|
|
From: Shad L. Lords <slords@mail.com> |
3 |
|
|
Date: Mon, 26 Oct 2009 22:20:13 -0600 |
4 |
|
|
Subject: [PATCH] Pick correct kernel |
5 |
|
|
|
6 |
|
|
--- |
7 |
|
|
bootloaderInfo.py | 29 ++++++++++++++++++++++++++++- |
8 |
|
|
1 files changed, 28 insertions(+), 1 deletions(-) |
9 |
|
|
|
10 |
|
|
diff --git a/bootloaderInfo.py b/bootloaderInfo.py |
11 |
|
|
index 3668ee8..36aa6ae 100644 |
12 |
|
|
--- a/bootloaderInfo.py |
13 |
|
|
+++ b/bootloaderInfo.py |
14 |
|
|
@@ -732,10 +732,37 @@ class x86BootloaderInfo(bootloaderInfo): |
15 |
|
|
f.write("# initrd %sinitrd-version.img\n" % (cfPath)) |
16 |
|
|
f.write("#boot=/dev/%s\n" % (grubTarget)) |
17 |
|
|
|
18 |
|
|
+ import isys |
19 |
|
|
+ nthreads = isys.acpicpus() |
20 |
|
|
+ if nthreads == 0: |
21 |
|
|
+ # this should probably be table driven or something... |
22 |
|
|
+ ncpus = isys.smpAvailable() or 1 |
23 |
|
|
+ nthreads = isys.htavailable() or 1 |
24 |
|
|
+ ncores = isys.coresavailable() |
25 |
|
|
+ |
26 |
|
|
+ if ncpus == 1: # machines that have one socket |
27 |
|
|
+ nthreads = nthreads; |
28 |
|
|
+ else: # machines with more than one socket |
29 |
|
|
+ nthreads = (int(nthreads / ncores) or 1) * ncpus |
30 |
|
|
+ |
31 |
|
|
+ xenkernel = 0 |
32 |
|
|
+ if os.path.exists("/proc/xen/capabilities"): |
33 |
|
|
+ xenkernel = 1 |
34 |
|
|
+ |
35 |
|
|
# get the default image to boot... we have to walk and find it |
36 |
|
|
# since grub indexes by where it is in the config file |
37 |
|
|
if defaultDev == rootDev: |
38 |
|
|
- default = 0 |
39 |
|
|
+ for kernel in range(0, len(kernelList)): |
40 |
|
|
+ default=kernel |
41 |
|
|
+ version=kernelList[kernel][2] |
42 |
|
|
+ if version.find('xen') >= 0: |
43 |
|
|
+ if xenkernel: |
44 |
|
|
+ break |
45 |
|
|
+ elif version.find('smp') >= 0: |
46 |
|
|
+ if not xenkernel and nthreads > 1: |
47 |
|
|
+ break |
48 |
|
|
+ else: |
49 |
|
|
+ break |
50 |
|
|
else: |
51 |
|
|
# if the default isn't linux, it's the first thing in the |
52 |
|
|
# chain list |
53 |
|
|
-- |
54 |
|
|
1.5.5.6 |
55 |
|
|
|