pygrub: always append --args
PATCH 1/1 pygrub: always append --args
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1346945306 -7200
# Node ID 8a2eef481d3ab3ca5692dd0083c95cf314fe1da3 # Parent 19d367bf07b7687b831c212a57a70e73ea14d3b7
pygrub: always append --args
If a bootloader entry in menu.lst has no additional kernel command line options listed and the domU.cfg has 'bootargs="--args=something"' the additional arguments from the config file are not passed to the kernel. The reason for that incorrect behaviour is that run_grub appends arg only if the parsed config file has arguments listed.
Fix this by appending args from image section and the config file separatly. To avoid adding to a NoneType initialize grubcfg['args'] to an empty string. This does not change behaviour but simplifies the code which appends the string.
tools/pygrub/src/pygrub +4 -2
@@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg): except IndexError: img = g.cf.images[0] - grubcfg = { "kernel": None, "ramdisk": None, "args": None } + grubcfg = { "kernel": None, "ramdisk": None, "args": "" } grubcfg["kernel"] = img.kernel[1] if img.initrd: grubcfg["ramdisk"] = img.initrd[1] if img.args: - grubcfg["args"] = img.args + " " + arg + grubcfg["args"] += img.args + if arg: + grubcfg["args"] += " " + args return grubcfg
Quoted 13 lines · Olaf Hering
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1346945306 -7200
# Node ID8a2eef481d3ab3ca5692dd0083c95cf314fe1da3# Parent19d367bf07b7687b831c212a57a70e73ea14d3b7
pygrub: always append --argsIf a bootloader entry in menu.lst has no additional kernel command line options listed and the domU.cfg has 'bootargs="--args=something"' the additional arguments from the config file are not passed to the kernel. The reason for that incorrect behaviour is that
run_grubappends arg only if the parsed config file has arguments listed.
Quoted 6 lines
Fix this by appending args from image section and the config file separatly. To avoid adding to a NoneType initialize grubcfg['args'] to an empty string. This does not change behaviour but simplifies the code which appends the string.
Signed-off-by Olaf Hering <[email protected]>
This has to be 4.3 at this point.
Quoted 5 lines
diff -r
19d367bf07b7-r8a2eef481d3atools/pygrub/src/pygrub
tools/pygrub/src/pygrub def run_grub(file, entry, fs, arg): · line 623
Quoted 10 lines
tools/pygrub/src/pygrub +1
-1@@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg): except IndexError: img = g.cf.images[0] - grubcfg = { "kernel": None, "ramdisk": None, "args": None } + grubcfg = { "kernel": None, "ramdisk": None, "args": "" } grubcfg["kernel"] = img.kernel[1] if img.initrd: grubcfg["ramdisk"] = img.initrd[1] if img.args:
With the above change isn't this always true?
It probably should have read
if img.args is not None
in the first place.
Quoted 13 lines
tools/pygrub/src/pygrub +3
-1- grubcfg["args"] = img.args + " " + arg + grubcfg["args"] += img.args + if arg: + grubcfg["args"] += " " + args return grubcfg_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 6 lines · Ian Campbell
Quoted 6 lines
except IndexError: img = g.cf.images[0]tools/pygrub/src/pygrub +1
-1- grubcfg = { "kernel": None, "ramdisk": None, "args": None } + grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
Quoted 6 lines
Quoted 4 lines
grubcfg["kernel"] = img.kernel[1] if img.initrd: grubcfg["ramdisk"] = img.initrd[1] if img.args:With the above change isn't this always true?
img.args comes from img = g.cf.images[sel]?
Olaf
Quoted 8 lines · Olaf Hering
Quoted 6 lines · Ian Campbell
Quoted 6 lines
except IndexError: img = g.cf.images[0]tools/pygrub/src/pygrub +1
-1- grubcfg = { "kernel": None, "ramdisk": None, "args": None } + grubcfg = { "kernel": None, "ramdisk": None, "args": "" }
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
grubcfg["kernel"] = img.kernel[1] if img.initrd: grubcfg["ramdisk"] = img.initrd[1] if img.args:With the above change isn't this always true?
img.args comes from img = g.cf.images[sel]?
Oh sorry, for some reason I did s/grubcfg/img/ in my head in that assignment.
Ian.
Quoted 28 lines · Olaf Hering
# HG changeset patch
# User Olaf Hering <[email protected]>
# Date 1346945306 -7200
# Node ID8a2eef481d3ab3ca5692dd0083c95cf314fe1da3# Parent19d367bf07b7687b831c212a57a70e73ea14d3b7
pygrub: always append --argsIf a bootloader entry in menu.lst has no additional kernel command line options listed and the domU.cfg has 'bootargs="--args=something"' the additional arguments from the config file are not passed to the kernel. The reason for that incorrect behaviour is that
run_grubappends arg only if the parsed config file has arguments listed.Fix this by appending args from image section and the config file separatly. To avoid adding to a NoneType initialize grubcfg['args'] to an empty string. This does not change behaviour but simplifies the code which appends the string.
Signed-off-by Olaf Hering <[email protected]>diff -r
19d367bf07b7-r8a2eef481d3atools/pygrub/src/pygrubtools/pygrub/src/pygrub +0
-1@@ -615,13 +615,15 @@ def run_grub(file, entry, fs, arg): except IndexError: img = g.cf.images[0] - grubcfg = { "kernel": None, "ramdisk": None, "args": None }
tools/pygrub/src/pygrub def run_grub(file, entry, fs, arg): · line 626
Quoted 10 lines
tools/pygrub/src/pygrub +4
-1+ grubcfg = { "kernel": None, "ramdisk": None, "args": "" } grubcfg["kernel"] = img.kernel[1] if img.initrd: grubcfg["ramdisk"] = img.initrd[1] if img.args: - grubcfg["args"] = img.args + " " + arg + grubcfg["args"] += img.args + if arg: + grubcfg["args"] += " " + args
I don't imagine any kernel would care about the potential leading space here so:
and applied, thanks.
Quoted 8 lines
tools/pygrub/src/pygrub +0
-0return grubcfg_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel