Skip to contentSkip to conversation

Bug#617538: update-grub (mk-grubconfig) does not support old "xenkopt"

DISCUSSION Colin Watson 2 participants 2 messages Mar 9, 2011 – Mar 23, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 12 lines · Ian Jackson

The grub 2 config generator does not appear to support an equivalent to the "xenkopt" option from old (grub 1) update-grub.

This is used to provide kernel command line arguments that apply only when booting the kernel under Xen. For example, a pvops kernel which can boot dom0 vs. baremetal, and where a serial console is in use, would normally want
kopt="console=ttyS0,115200,8n1"
xenkopt="console=hvc0"
since when booting under Xen the kernel needs to use the Xen console rather than direct access to the serial port.

Quoted 6 lines

I suggest adding two variables
GRUB_CMDLINE_LINUX_XEN
GRUB_CMDLINE_LINUX_XEN_DEFAULT
which when specified /override/ the values of
GRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX_DEFAULT

Seems reasonable, although I think the naming is confusing; it's not necessarily obvious that GRUB_CMDLINE_LINUX_XEN overrides GRUB_CMDLINE_LINUX while GRUB_CMDLINE_XEN appends to it. How about GRUB_CMDLINE_LINUX_XEN_REPLACE and GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT? They're a bit long, but ...

(CCing patch to grub-devel.)

2011-03-09 Colin Watson <[email protected]>

* util/grub.d/20_linux_xen.in: Honour GRUB_CMDLINE_LINUX_XEN_REPLACE and GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT, which replace GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT (complementing the existing options which append).
* docs/grub.texi (Simple configuration): Document new options.

=== modified file 'docs/grub.texi'

grub.texi +8 -2
@@ -1114,8 +1114,14 @@ NetBSD.
 
 @item GRUB_CMDLINE_XEN
 @itemx GRUB_CMDLINE_XEN_DEFAULT
-As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
-Linux and Xen.
+The values of these options are appended to the values of
+@samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux
+and Xen menu entries.
+
+@item GRUB_CMDLINE_LINUX_XEN_REPLACE
+@item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
+The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
+and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
 
 @item GRUB_DISABLE_LINUX_UUID
 Normally, @command{grub-mkconfig} will generate menu entries that use

=== modified file 'util/grub.d/20_linux_xen.in'

grub.d/20_linux_xen.in +8 -0
@@ -51,6 +51,14 @@ else
   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
 fi
 
+# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
+if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
+  GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
+fi
+if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
+  GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
+fi
+
 linux_entry ()
 {
   os="$1"
Signature · 1 line
Colin Watson                                       [[email protected]]
#2 lore raw

The patch is ok after 1.99.

Quoted 78 lines · Colin Watson
Quoted 12 lines · Ian Jackson

The grub 2 config generator does not appear to support an equivalent to the "xenkopt" option from old (grub 1) update-grub.

This is used to provide kernel command line arguments that apply only when booting the kernel under Xen. For example, a pvops kernel which can boot dom0 vs. baremetal, and where a serial console is in use, would normally want
kopt="console=ttyS0,115200,8n1"
xenkopt="console=hvc0"
since when booting under Xen the kernel needs to use the Xen console rather than direct access to the serial port.

Quoted 7 lines

I suggest adding two variables
GRUB_CMDLINE_LINUX_XEN
GRUB_CMDLINE_LINUX_XEN_DEFAULT
which when specified /override/ the values of
GRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX_DEFAULT

Seems reasonable, although I think the naming is confusing; it's not necessarily obvious that GRUB_CMDLINE_LINUX_XEN overrides GRUB_CMDLINE_LINUX while GRUB_CMDLINE_XEN appends to it. How about GRUB_CMDLINE_LINUX_XEN_REPLACE and GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT? They're a bit long, but ...

(CCing patch to grub-devel.)

2011-03-09 Colin Watson <[email protected]>

* util/grub.d/20_linux_xen.in: Honour GRUB_CMDLINE_LINUX_XEN_REPLACE and GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT, which replace GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT (complementing the existing options which append).
* docs/grub.texi (Simple configuration): Document new options.

=== modified file 'docs/grub.texi'

grub.texi +8 -2
@@ -1114,8 +1114,14 @@ NetBSD.
 
 @item GRUB_CMDLINE_XEN
 @itemx GRUB_CMDLINE_XEN_DEFAULT
-As @samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT}, but for
-Linux and Xen.
+The values of these options are appended to the values of
+@samp{GRUB_CMDLINE_LINUX} and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux
+and Xen menu entries.
+
+@item GRUB_CMDLINE_LINUX_XEN_REPLACE
+@item GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT
+The values of these options replace the values of @samp{GRUB_CMDLINE_LINUX}
+and @samp{GRUB_CMDLINE_LINUX_DEFAULT} for Linux and Xen menu entries.
 
 @item GRUB_DISABLE_LINUX_UUID
 Normally, @command{grub-mkconfig} will generate menu entries that use

=== modified file 'util/grub.d/20_linux_xen.in'

grub.d/20_linux_xen.in +8 -0
@@ -51,6 +51,14 @@ else
   LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID}
 fi
 
+# Allow overriding GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT.
+if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE}" ]; then
+  GRUB_CMDLINE_LINUX="${GRUB_CMDLINE_LINUX_XEN_REPLACE}"
+fi
+if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
+  GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
+fi
+
 linux_entry ()
 {
   os="$1"
Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko