grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: grub-devel@gnu.org
Subject: Re: Obtaining the MAC address of the boot NIC for a PXE boot
Date: Sat, 04 May 2013 23:08:03 +0200	[thread overview]
Message-ID: <518578B3.5040003@gmail.com> (raw)
In-Reply-To: <20130501185934.3f2b9c28@opensuse.site>

[-- Attachment #1: Type: text/plain, Size: 2233 bytes --]


> 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.
> 
> 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).
> 

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
> 
> - it adds "eval" command (same as known from UNIX shells) which
>   executes its argument

eval is generally good

> 
> - it exports boot interface as "efi_boot_interface" variable
> 

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=pxe
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
> 
> if $grub_platform = efi ; then
>   eval "set net_pxe_mac=\$net_${efi_boot_interface}_mac" 
> fi
> 

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 = grub_register_extcmd ("eval", grub_cmd_eval, 0,
> +			      N_("[STRING]"), N_("Evaluate commands"),

This description seems a bit vague for either human-reading or translation.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

  reply	other threads:[~2013-05-04 21:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1367240132.58582.YahooMailNeo@web120204.mail.ne1.yahoo.com>
2013-05-01 14:59 ` Obtaining the MAC address of the boot NIC for a PXE boot Andrey Borzenkov
2013-05-04 21:08   ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-05-04 21:19     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-05  5:17       ` Andrey Borzenkov
2013-05-07 10:03         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-07 17:50           ` Documentation for (Re: Obtaining the MAC address of the boot NIC for a PXE boot) Andrey Borzenkov
2013-05-07 19:45             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-08 14:52               ` Andrey Borzenkov
2013-05-11 16:35     ` New command eval Andrey Borzenkov
2013-05-11 17:02       ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-11 17:30         ` Andrey Borzenkov
2013-05-14  6:26           ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-12  0:07       ` Seth Goldberg
2013-05-12  5:39         ` Andrey Borzenkov
2013-05-13  5:13           ` Seth Goldberg
2013-05-14  7:21         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-08 17:27   ` Obtaining the MAC address of the boot NIC for a PXE boot Rigoberto Corujo
2013-05-08 19:25     ` Andrey Borzenkov
2013-05-10 16:12       ` Rigoberto Corujo
2013-05-11  4:47         ` Andrey Borzenkov
2013-05-15 17:09           ` Rigoberto Corujo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=518578B3.5040003@gmail.com \
    --to=phcoder@gmail.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).