From: Wei Kong Subject: Re: [PATCH] pygrub: parse xen module option in grub Date: Fri, 20 Feb 2009 12:15:30 +0800 Message-ID: References: <20090220025505.GA5452@movementarian.org> <20090220032435.GB7709@movementarian.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1209946545==" Return-path: In-Reply-To: <20090220032435.GB7709@movementarian.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: John Levon Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1209946545== Content-Type: multipart/alternative; boundary=0015174c1b8e4b137f046351e76a --0015174c1b8e4b137f046351e76a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 2009/2/20 John Levon > On Fri, Feb 20, 2009 at 11:20:38AM +0800, Wei Kong wrote: > > > > The patch is wrong anyway, you can't just add on the incoming args for > > > Solaris at least. At the very least you need to add the args only when > > > run_grub() is called. > > > > > No, I didn't add any args for solaris. > > Because I don't want to add args for Solaris, so I add args here, not in > > run_grub(). > > Please read the code more closely: again, you cannot just pass inargs > out again, you must only do so if run_grub() is called. Presuming it > even makes sense - thanks, john Sorry for I not think about Solaris carefully. Current run_grub() doesn't get any kernel args from user. We could add another argument for this function and return args back, whatever, it's hard for run_grub() to pass this args to GRUB() entry to let the user see it again. > why can't the user edit the grub entry? Yes, but if you could write it in configuration file, why do it by hand. Do you like the below modify? --- xen-unstable.hg.changeset_19232/tools/pygrub/src/pygrub 2009-02-20 12:07:34.000000000 +0800 +++ xen-unstable.hg/tools/pygrub/src/pygrub 2009-02-20 12:07:40.000000000 +0800 @@ -501,7 +501,7 @@ def get_entry_idx(cf, entry): return None -def run_grub(file, entry, fs): +def run_grub(file, entry, fs, arg): global g global sel @@ -534,7 +534,7 @@ def run_grub(file, entry, fs): if img.initrd: grubcfg["ramdisk"] = img.initrd[1] if img.args: - grubcfg["args"] = img.args + grubcfg["args"] = img.args + " " + arg return grubcfg @@ -659,7 +659,7 @@ if __name__ == "__main__": chosencfg = sniff_solaris(fs, incfg) if not chosencfg["kernel"]: - chosencfg = run_grub(file, entry, fs) + chosencfg = run_grub(file, entry, fs, incfg["args"]) data = fs.open_file(chosencfg["kernel"]).read() (tfd, bootcfg["kernel"]) = tempfile.mkstemp(prefix="boot_kernel.", --0015174c1b8e4b137f046351e76a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

2009/2/20 John Levon &= lt;levon@movementarian.org&g= t;
On Fri, Feb 20, 2009 at 11:20:38AM +0800, Wei Kong wr= ote:

> > The patch is wrong anyway, you can't just add on the incoming= args for
> > Solaris at least. At the very least you need to add the args only= when
> > run_grub() is called.
> >
> No, I didn't add any args for solaris.
> Because I don't want to add args for Solaris, so I add args here, = not in
> run_grub().

Please read the code more closely: again, you cannot just pass inargs=
out again, you must only do so if run_grub() is called. Presuming it
even makes sense -

than= ks, john

Sorry for I not think about Solaris carefully.

Curre= nt run_grub() doesn't get any kernel args from user.
We could add an= other argument for this function and return args back,
whatever, it's hard for run_grub() to pass this args to GRUB() entry to= let the user see it again.

> why can't the user edit the gru= b entry?
Yes, but if you could write it in configuration file, why do it= by hand.

Do you like the below modify?

--- xen-unstable.hg.changeset_1923= 2/tools/pygrub/src/pygrub    2009-02-20 12:07:34.000000000 += 0800
+++ xen-unstable.hg/tools/pygrub/src/pygrub    2009-= 02-20 12:07:40.000000000 +0800
@@ -501,7 +501,7 @@ def get_entry_idx(cf, entry):
 
  =    return None
 
-def run_grub(file, entry, fs):
+d= ef run_grub(file, entry, fs, arg):
     global g
=      global sel
 
@@ -534,7 +534,7 @@ def ru= n_grub(file, entry, fs):
     if img.initrd:
     &n= bsp;   grubcfg["ramdisk"] =3D img.initrd[1]
 &n= bsp;   if img.args:
-       = ; grubcfg["args"] =3D img.args
+     =    grubcfg["args"] =3D img.args + " " + arg  
     return grubcfg
 
@@ -659,7 +6= 59,7 @@ if __name__ =3D=3D "__main__":
    = ; chosencfg =3D sniff_solaris(fs, incfg)
 
   &nb= sp; if not chosencfg["kernel"]:
-     = ;   chosencfg =3D run_grub(file, entry, fs)
+        chosencfg =3D run_grub(file, en= try, fs, incfg["args"])
 
     dat= a =3D fs.open_file(chosencfg["kernel"]).read()
  &nb= sp;  (tfd, bootcfg["kernel"]) =3D tempfile.mkstemp(prefix=3D= "boot_kernel.",
--0015174c1b8e4b137f046351e76a-- --===============1209946545== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1209946545==--