]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/loader/multiboot_mbi2.c: Implement network tag.
authorVladimir Serbinenko <phcoder@gmail.com>
Mon, 28 Oct 2013 14:53:39 +0000 (15:53 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Mon, 28 Oct 2013 14:53:39 +0000 (15:53 +0100)
ChangeLog
grub-core/loader/multiboot_mbi2.c

index 344e3c09d8bb1a98abcc4af613377b27aa772228..93fe8be25b0549e04fb12b09cd7f02c099e80bd5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2013-10-28  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/loader/multiboot_mbi2.c: Implement network tag.
+
 2013-10-28  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/loader/multiboot_mbi2.c: Add EFI memory map to the list
index 09452cce28b0b207b7b6aa09ede2dd30e1246903..6a6be77e21fd2dfba93c74abf8bab075e897beba 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007,2008,2009,2010,2011,2012,2013  Free Software Foundation, Inc.
  *
  *  GRUB is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@
 #include <grub/video.h>
 #include <grub/acpi.h>
 #include <grub/i18n.h>
+#include <grub/net.h>
 
 #if defined (GRUB_MACHINE_EFI)
 #include <grub/efi/efi.h>
@@ -156,6 +157,7 @@ grub_multiboot_load (grub_file_t file, const char *filename)
              case MULTIBOOT_TAG_TYPE_EFI64:
              case MULTIBOOT_TAG_TYPE_ACPI_OLD:
              case MULTIBOOT_TAG_TYPE_ACPI_NEW:
+             case MULTIBOOT_TAG_TYPE_NETWORK:
              case MULTIBOOT_TAG_TYPE_EFI_MMAP:
                break;
 
@@ -338,6 +340,19 @@ find_efi_mmap_size (void)
 }
 #endif
 
+static grub_size_t
+net_size (void)
+{
+  struct grub_net_network_level_interface *net;
+  grub_size_t ret = 0;
+
+  FOR_NET_NETWORK_LEVEL_INTERFACES(net)
+    if (net->dhcp_ack)
+      ret += ALIGN_UP (sizeof (struct multiboot_tag_network) + net->dhcp_acklen,
+                      MULTIBOOT_TAG_ALIGN);
+  return ret;
+}
+
 static grub_size_t
 grub_multiboot_get_mbi_size (void)
 {
@@ -365,6 +380,7 @@ grub_multiboot_get_mbi_size (void)
     + ALIGN_UP (sizeof (struct multiboot_tag_old_acpi)
                + sizeof (struct grub_acpi_rsdp_v10), MULTIBOOT_TAG_ALIGN)
     + acpiv2_size ()
+    + net_size ()
 #ifdef GRUB_MACHINE_EFI
     + ALIGN_UP (sizeof (struct multiboot_tag_efi_mmap)
                + efi_mmap_size, MULTIBOOT_TAG_ALIGN)
@@ -736,6 +752,22 @@ grub_multiboot_make_mbi (grub_uint32_t *target)
        / sizeof (grub_properly_aligned_t);
   }
 
+  {
+    struct grub_net_network_level_interface *net;
+
+    FOR_NET_NETWORK_LEVEL_INTERFACES(net)
+      if (net->dhcp_ack)
+       {
+         struct multiboot_tag_network *tag
+           = (struct multiboot_tag_network *) ptrorig;
+         tag->type = MULTIBOOT_TAG_TYPE_NETWORK;
+         tag->size = sizeof (struct multiboot_tag_network) + net->dhcp_acklen;
+         grub_memcpy (tag->dhcpack, net->dhcp_ack, net->dhcp_acklen);
+         ptrorig += ALIGN_UP (tag->size, MULTIBOOT_TAG_ALIGN)
+           / sizeof (grub_properly_aligned_t);
+       }
+  }
+
   if (bootdev_set)
     {
       struct multiboot_tag_bootdev *tag