mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-20 22:48:22 +00:00
Use bootp packet to set prefix and card address.
This commit is contained in:
1 parent
6d5c2ed68a
commit
59b361a2df
4 files changed
+77
-38
No files matched your search
@@ -31,6 +31,8 @@
|
||||
#include <grub/ieee1275/console.h>
|
||||
#include <grub/ieee1275/ofdisk.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/ieee1275/ofnet.h>
|
||||
#include <grub/net.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/memory.h>
|
||||
|
||||
@@ -74,7 +76,22 @@ grub_machine_set_prefix (void)
|
||||
char bootpath[64]; /* XXX check length */
|
||||
char *filename;
|
||||
char *prefix;
|
||||
|
||||
grub_bootp_t bootp_pckt;
|
||||
char addr[GRUB_NET_MAX_STR_ADDR_LEN];
|
||||
|
||||
/* Set the net prefix when possible. */
|
||||
if (grub_getbootp && (bootp_pckt = grub_getbootp()))
|
||||
{
|
||||
grub_uint32_t n = bootp_pckt->siaddr;
|
||||
grub_snprintf (addr, GRUB_NET_MAX_STR_ADDR_LEN, "%d.%d.%d.%d",
|
||||
((n >> 24) & 0xff), ((n >> 16) & 0xff),
|
||||
((n >> 8) & 0xff), ((n >> 0) & 0xff));
|
||||
prefix = grub_xasprintf ("(tftp,%s)%s", addr,grub_prefix);
|
||||
grub_env_set ("prefix", prefix);
|
||||
grub_free (prefix);
|
||||
return;
|
||||
}
|
||||
|
||||
if (grub_prefix[0])
|
||||
{
|
||||
grub_env_set ("prefix", grub_prefix);
|
||||
|
||||
Reference in new issue
Block a user