Received: from list by lists.gnu.org with archive (Exim 4.71) id 1WpAwL-0007d3-MF for mharc-grub-devel@gnu.org; Tue, 27 May 2014 02:32:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49323) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpAwC-0007cQ-0q for grub-devel@gnu.org; Tue, 27 May 2014 02:32:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WpAw4-0001ua-Dh for grub-devel@gnu.org; Tue, 27 May 2014 02:32:39 -0400 Received: from mail-ob0-f177.google.com ([209.85.214.177]:48600) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WpAw4-0001uW-7a for grub-devel@gnu.org; Tue, 27 May 2014 02:32:32 -0400 Received: by mail-ob0-f177.google.com with SMTP id wp4so8619133obc.36 for ; Mon, 26 May 2014 23:32:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:mime-version:content-type; bh=i2mgQJpbl1Tal43RW+/rLbcwSWg/PJo3cNVHfjCRseI=; b=DOfZOdX/7RVduWb/i4c54pKN5DFmX6V5nelHOWQefMVYBOkdxq5yZ1rTUpY1EfLXFY 8G6GwC1OceaKFbVAnpCrXhAcrqQio5r8L2EB6l4eHeIvKXON5PfvaQynZJ3m9G0vk9lb vXEOLcA6FGhgZoYR1nvgsfKO22BMZZbs59xOb1bra3gFEA49l9J/0Xuwd0U/IIWEVxxw KZQFrgenuRSTJL7XHjmRfXmPgJJS3S/WBKfaiAWAXOKdVnYGEiVoVAZc8JH63kdiS6hJ SVt4StJR8sD1IMSb//6pvAGMRYi4yjet9+9uTt8aUTPVx84WxEP0MrSJP4HvvuK3dAvQ 3JAg== X-Gm-Message-State: ALoCoQmFBE/vGJ22We/JGtiRJ/LK2KssmAsXQoxe8NduWbKIFUO91pfNBlVcK6nA4H+pQOVA0Bdm X-Received: by 10.182.126.137 with SMTP id my9mr30280069obb.61.1401172351432; Mon, 26 May 2014 23:32:31 -0700 (PDT) Received: from crass-Ideapad-Z570 (cpe-70-117-77-21.austin.res.rr.com. [70.117.77.21]) by mx.google.com with ESMTPSA id ny5sm26847203obb.21.2014.05.26.23.32.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 26 May 2014 23:32:30 -0700 (PDT) Date: Tue, 27 May 2014 01:32:22 -0500 From: Glenn Washburn To: grub-devel@gnu.org Subject: Re: [PATCH 2/2] Add emdedded-config hidden option to grub-install. Message-ID: <20140527013222.1caa4c9f@crass-Ideapad-Z570> In-Reply-To: <537DA831.6030006@gmail.com> References: <20140519020307.2763ac7d@crass-Ideapad-Z570> <537DA831.6030006@gmail.com> X-Mailer: Claws Mail 3.9.3 (GTK+ 2.24.20; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/UAAUv6yCK.j78i/0XdwbL+O"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.214.177 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 May 2014 06:32:47 -0000 --Sig_/UAAUv6yCK.j78i/0XdwbL+O Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 22 May 2014 09:33:05 +0200 Vladimir '=CF=86-coder/phcoder' Serbinenko wrote: > On 19.05.2014 09:03, Glenn Washburn wrote: > > One thing to note with this patch is that the supplied embedded > > config file is appended to the normally generated one. I did this > > to allow the default root and prefix to be generated and > > subsequently overridden if desired. > >=20 > embed config isn't meant to hold user-supplied command. Normal config > is for this. If you want to change root/prefix, why not just install > to the location where the desired prefix is? This is currently needed to set the root to (memdisk) when supplying a memdisk. But I generally like the flexibility it offers. I've made this a hidden command, so that the average user isn't confused by it, but available if the user really wants to use it. It also give grub-install a capability that it previously had, when it was a shell script. > > --- > > util/grub-install.c | 20 +++++++++++++++++++- > > 1 file changed, 19 insertions(+), 1 deletion(-) > >=20 > > diff --git a/util/grub-install.c b/util/grub-install.c > > index d66030f..85dd3a1 100644 > > --- a/util/grub-install.c > > +++ b/util/grub-install.c > > @@ -74,6 +74,7 @@ static char *memdisk =3D NULL; > > static int have_load_cfg =3D 0; > > static FILE * load_cfg_f =3D NULL; > > static char *load_cfg; > > +static char *embed_cfg =3D NULL; > > static int install_bootsector =3D 1; > > static char *label_font; > > static char *label_color; > > @@ -100,6 +101,7 @@ enum > > OPTION_BOOTLOADER_ID,=20 > > OPTION_EFI_DIRECTORY, > > OPTION_MEMDISK, > > + OPTION_EMBED_CFG, > > OPTION_FONT, > > OPTION_DEBUG, > > OPTION_DEBUG_IMAGE, > > @@ -188,6 +190,11 @@ argp_parser (int key, char *arg, struct > > argp_state *state) memdisk =3D xstrdup (arg); > > return 0; > > =20 > > + case OPTION_EMBED_CFG: > > + free (embed_cfg); > > + embed_cfg =3D xstrdup (arg); > > + return 0; > > + > > case OPTION_DISK_MODULE: > > free (disk_module); > > disk_module =3D xstrdup (arg); > > @@ -264,6 +271,7 @@ static struct argp_option options[] =3D { > > /* TRANSLATORS: "TARGET" as in "target platform". */ > > 0, N_("install GRUB for TARGET platform [default=3D%s]; available > > targets: %s"), 2}, {"memdisk", OPTION_MEMDISK, N_("FILE"), > > OPTION_HIDDEN, 0, 2}, > > + {"embedded-config", OPTION_EMBED_CFG, N_("FILE"), OPTION_HIDDEN, > > 0, 2}, {"grub-setup", OPTION_SETUP, "FILE", OPTION_HIDDEN, 0, 2}, > > {"grub-mkrelpath", OPTION_MKRELPATH, "FILE", OPTION_HIDDEN, 0, > > 2}, {"grub-mkdevicemap", OPTION_MKDEVICEMAP, "FILE", OPTION_HIDDEN, > > 0, 2}, @@ -1586,7 +1594,17 @@ main (int argc, char *argv[]) > > grub_util_error ("%s", _("You've found a bug")); > > =20 > > if (load_cfg_f) > > - fclose (load_cfg_f); > > + { > > + if (embed_cfg) > > + { > > + size_t size =3D grub_util_get_image_size(embed_cfg); > > + char *embed_cfg_data =3D grub_util_read_image(embed_cfg); > > + grub_util_write_image(embed_cfg_data, size, load_cfg_f, > > load_cfg); > > + free(embed_cfg_data); > > + } > > + =20 > > + fclose (load_cfg_f); > > + } > > =20 > > char *imgfile =3D grub_util_path_concat (2, platdir, > > core_name); > >=20 >=20 >=20 --Sig_/UAAUv6yCK.j78i/0XdwbL+O Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.14 (GNU/Linux) iQEcBAEBAgAGBQJThDF2AAoJEEPj94mUXoYsbCIH/22LcR9ucC7NjuARBSFJJyAh fWa1KIHQ41ilke0W5+bPdBM2naSdcshyiSZXxiEuEzmxyF4SKs+dTzkaBKP6w96O qM37ZZYG4gE9RNG2xxeL1N2Vd3teLlM4wPbJ11ovf7pWSG5Ykl6S5+wa6mgozkjM 2k7Jub525QQDc/z7xB1lu21IgbpWpNNzEQ799IayqsI1/Xkrvjw3Nt4W+sFHhXyN V/6hNqUIH8pEKQAWzJ0GnYF9ASLU7MTD16RqyR0PDLjYRXN02bDKampOj9kBQXqT XS70UFTkmryqsmWz0qe7oeuHIJ6vMhQsphkSiksAbFo0G7uB7uwHoEpbusGjCHY= =MH7a -----END PGP SIGNATURE----- --Sig_/UAAUv6yCK.j78i/0XdwbL+O--