Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K7b2S-0001Rq-DT for mharc-grub-devel@gnu.org; Sat, 14 Jun 2008 15:03:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7b2Q-0001Q1-Md for grub-devel@gnu.org; Sat, 14 Jun 2008 15:03:46 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7b2P-0001O5-6n for grub-devel@gnu.org; Sat, 14 Jun 2008 15:03:46 -0400 Received: from [199.232.76.173] (port=53238 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7b2P-0001Ns-0b for grub-devel@gnu.org; Sat, 14 Jun 2008 15:03:45 -0400 Received: from po-out-1718.google.com ([72.14.252.159]:63038) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7b2O-0005Xo-Jj for grub-devel@gnu.org; Sat, 14 Jun 2008 15:03:44 -0400 Received: by po-out-1718.google.com with SMTP id c31so8644285poi.1 for ; Sat, 14 Jun 2008 12:03:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=BrjfNMOK6xDWbSquW87Ten4ZQ1JvEHfy6QhWausJiNY=; b=ao4iNeLtu06YZxwo7gpHiTQTc6u8NnMVgJKtOMCZ1Zvtt4mvjDoTnYr0V7iZYuidaB 7yW8Y3G3SEMoT8Y6heBpTb2mLJ1Rz7DN0mqKhKFyy3DJBrtli0EQeexgvXk3p0hyrBP5 mKHStVWaSzqkKjk6WtvTEd2M1c7p9I6hdogtk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=EDkZxbPY/8y8KFfkaiXmLCa4LRKK3zVYSib/s6Ogd8q/G1qwPcd1WWT8NC2/bvU+Cn 81sHd9czhWH58mxrvouhoSqIqvxVyFc5+5HYx4/AzFf0MJqCqlRm+s5cymteb+nu1D5N EjTfR0FAK2qhn7sawWeBVJ2cFY3OQxZiWoN10= Received: by 10.141.63.20 with SMTP id q20mr2649383rvk.291.1213470223613; Sat, 14 Jun 2008 12:03:43 -0700 (PDT) Received: by 10.141.66.21 with HTTP; Sat, 14 Jun 2008 12:03:43 -0700 (PDT) Message-ID: Date: Sun, 15 Jun 2008 03:03:43 +0800 From: Bean To: "The development of GRUB 2" In-Reply-To: <20080614184757.GH5636@thorin> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080614184757.GH5636@thorin> X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) Subject: Re: [PATCH] Save/Load environment variable support X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Jun 2008 19:03:46 -0000 On Sun, Jun 15, 2008 at 2:47 AM, Robert Millan wrote: > On Fri, Jun 13, 2008 at 03:07:54PM +0800, Bean wrote: >> Hi, >> >> I separate the save/load environment variable function from my >> previous patch on environment block. It contains the command >> save_env/load_env/list_env and tool grub-editenv, but without the >> kernel patch. >> -- >> Bean > >> >> diff --git a/commands/loadenv.c b/commands/loadenv.c >> new file mode 100755 >> index 0000000..970baf3 >> --- /dev/null >> +++ b/commands/loadenv.c >> @@ -0,0 +1,250 @@ >> +/* loadenv.c - command to load/save environment variable. */ > > Is this useful as a standalone command? If we're in a stage in which commands > can be executed, the same effect could be archieved with the "." command on > a grub.cfg-like formatted file? > > IIRC you explained that this feature could be useful as the basis for > findroot style search, or to override existing variables like "root", "prefix" > or "default". In both cases (if I understood correctly) you want it to be run > automaticaly as the init routine for your module. > > However if your code is small enough, maybe it could replace the existing > use of grub_prefix (I commented this on the other mail), thereby reducing > kernel size and making it preferable to be part of kernel than a separate > module. Do you think that's possible? Hi, Yes, this is a standalone command, it's used to support persistent variable. For example, we can archive the result of savedefault using the following command: load_env menuentry aa { save_env default } load_env loads the environment variable from $prefix/grubenv, and save_env save selected variable to it. grubenv contain a environment block, so that we can manage it using grub-editenv, just like the environment block in the kernel. -- Bean