From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UYjgh-0008E6-25 for mharc-grub-devel@gnu.org; Sat, 04 May 2013 17:08:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:35157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYjge-0008CV-BK for grub-devel@gnu.org; Sat, 04 May 2013 17:08:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UYjgd-0001K5-9X for grub-devel@gnu.org; Sat, 04 May 2013 17:08:08 -0400 Received: from mail-ea0-x22c.google.com ([2a00:1450:4013:c01::22c]:44530) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UYjgd-0001IQ-32 for grub-devel@gnu.org; Sat, 04 May 2013 17:08:07 -0400 Received: by mail-ea0-f172.google.com with SMTP id r16so1236872ead.31 for ; Sat, 04 May 2013 14:08:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:x-enigmail-version:content-type; bh=1CquXksnzbU+FjqUc+xjmundezVLweUIigdpPJQP5xs=; b=U+cfS51eTBfd61penXLnbWp7BPjIZ4WNrAwSAmUZDakhePSuNisZVOz5TzTlN1MTpx cC68mUQ+7Hf2NKCisTW1PCVcTV5AzVKQIBnsFOlLcAbkpgwfWjVxAClNdwUB7FLix4gA gJgrwinuaLSaZaFbN8pv3UYjs2B04O9YC/P4DmGc8pLS0rWG7I1+/xeK7qcF+tTDjE6g 2zbtAc+kURaWqfbf3ZFgfP3pkkvVbaEZu/hxcE+khPpRKgGk88xmDfPbM0k0OF+GeIe4 cFizxa1MRu9LvI7SKUy4ScgmsndnoEh/zzv/q9hi/qr571BCQpiKObOTHre5+zTKme21 c/0A== X-Received: by 10.14.203.73 with SMTP id e49mr44820042eeo.20.1367701685890; Sat, 04 May 2013 14:08:05 -0700 (PDT) Received: from debian.x201.phnet (245-188.1-85.cust.bluewin.ch. [85.1.188.245]) by mx.google.com with ESMTPSA id bp51sm21863270eeb.5.2013.05.04.14.08.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 04 May 2013 14:08:05 -0700 (PDT) Message-ID: <518578B3.5040003@gmail.com> Date: Sat, 04 May 2013 23:08:03 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: grub-devel@gnu.org Subject: Re: Obtaining the MAC address of the boot NIC for a PXE boot References: <1367240132.58582.YahooMailNeo@web120204.mail.ne1.yahoo.com> <20130501185934.3f2b9c28@opensuse.site> In-Reply-To: <20130501185934.3f2b9c28@opensuse.site> X-Enigmail-Version: 1.4.1 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="------------enig5CD6F21B5280C2ECB4B959A9" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::22c 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: Sat, 04 May 2013 21:08:09 -0000 This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig5CD6F21B5280C2ECB4B959A9 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable > As it stands currently, net_pxe_* variables are defined on PC BIOS > platform only. For UEFI (which you apparently have) GRUB2 defines > net_efinetNN_* variables where efinetNN is symbolic name for interface > that was used to boot GRUB2. >=20 > May be GRUB2 should also define net_pxe_* namespace for the case of > UEFI. "pxe" is the name of drivers used for BIOS. But it's ok to define net_boot_* on all platforms and make it alias to the boot interface. > There is no real way to find out which interface was used for > booting and even if there were, grub does not support nested > variables substitution or eval'ing (like ${net_${boot_if}_mac). >=20 Bash doesn't support such construction either. We generally prefer to stay reasonably close to bash to allow for easy reference and testing. > Probably, adding "eval" support is really the most simple. Could you > test the patch below. What it does, is >=20 > - it adds "eval" command (same as known from UNIX shells) which > executes its argument eval is generally good >=20 > - it exports boot interface as "efi_boot_interface" variable >=20 This is needlessly EFI-specific. Similar variable would be useful on many platforms. But a possible problem is that it's not known when using native drivers (and on some platforms you have to). Perhaps making something similar to "root" partition would be useful: E.g. net_default_interface=3Dpxe echo $net_default_mac With net_default_interface defined to boot one on boot. This would parallel net_default_server. > This should allow you to do >=20 > if $grub_platform =3D efi ; then > eval "set net_pxe_mac=3D\$net_${efi_boot_interface}_mac"=20 > fi >=20 Defining system variables manually looks dirty. > +static grub_err_t > +grub_cmd_eval (grub_extcmd_context_t ctxt __attribute__((__unused__)),= > + int argc, char *argv[]) > +{ You don't use any argument parsing. It's better to use command and not extcmd in this case. Also "eval" in bash concatenates its arguments. > + cmd =3D grub_register_extcmd ("eval", grub_cmd_eval, 0, > + N_("[STRING]"), N_("Evaluate commands"), This description seems a bit vague for either human-reading or translatio= n. --------------enig5CD6F21B5280C2ECB4B959A9 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iF4EAREKAAYFAlGFeLMACgkQNak7dOguQgny4QD9EDmD7JUAsf41r/Bv9DSLhc6l KF/+wIRwKESYmK6L5QUA/AuN+ILiPuYbBHSJ8RbTKHe//7QAT34gi+mq2krb13M4 =Xf6v -----END PGP SIGNATURE----- --------------enig5CD6F21B5280C2ECB4B959A9--