]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Add i386-pc-pxe image target.
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 2 Sep 2010 14:07:52 +0000 (16:07 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Thu, 2 Sep 2010 14:07:52 +0000 (16:07 +0200)
* util/grub-mkimage.c (image_target_desc): New enum value
IMAGE_I386_PC_PXE.
(image_targets): New target i386-pc-pxe.
(generate_image): Handle i386-pc-pxe image.

ChangeLog
util/grub-mkimage.c

index ce3141985354f01cf3f521e6a48952e20fd2dd35..4b1ccafd33314bcd90dd6cf96464fdace73a616b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2010-09-02  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       Add i386-pc-pxe image target.
+
+       * util/grub-mkimage.c (image_target_desc): New enum value
+       IMAGE_I386_PC_PXE.
+       (image_targets): New target i386-pc-pxe.
+       (generate_image): Handle i386-pc-pxe image.
+
 2010-09-02  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Fix grub_pxe_scan.
index 0e82afae9e00c925910427a7fc6517d787d4e85b..4e151dd62dd0e7581fd338be56195b91fa426e2c 100644 (file)
@@ -54,7 +54,8 @@ struct image_target_desc
   enum {
     IMAGE_I386_PC, IMAGE_EFI, IMAGE_COREBOOT,
     IMAGE_SPARC64_AOUT, IMAGE_SPARC64_RAW, IMAGE_I386_IEEE1275,
-    IMAGE_YEELOONG_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH
+    IMAGE_YEELOONG_ELF, IMAGE_QEMU, IMAGE_PPC, IMAGE_YEELOONG_FLASH,
+    IMAGE_I386_PC_PXE
   } id;
   enum
     {
@@ -140,6 +141,24 @@ struct image_target_desc image_targets[] =
       .install_bsd_part = GRUB_KERNEL_I386_PC_INSTALL_BSD_PART,
       .link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR
     },
+    {
+      .name = "i386-pc-pxe",
+      .voidp_sizeof = 4,
+      .bigendian = 0,
+      .id = IMAGE_I386_PC_PXE, 
+      .flags = PLATFORM_FLAGS_LZMA,
+      .prefix = GRUB_KERNEL_I386_PC_PREFIX,
+      .data_end = GRUB_KERNEL_I386_PC_DATA_END,
+      .raw_size = GRUB_KERNEL_I386_PC_RAW_SIZE,
+      .total_module_size = GRUB_KERNEL_I386_PC_TOTAL_MODULE_SIZE,
+      .kernel_image_size = GRUB_KERNEL_I386_PC_KERNEL_IMAGE_SIZE,
+      .compressed_size = GRUB_KERNEL_I386_PC_COMPRESSED_SIZE,
+      .section_align = 1,
+      .vaddr_offset = 0,
+      .install_dos_part = GRUB_KERNEL_I386_PC_INSTALL_DOS_PART,
+      .install_bsd_part = GRUB_KERNEL_I386_PC_INSTALL_BSD_PART,
+      .link_addr = GRUB_KERNEL_I386_PC_LINK_ADDR
+    },
     {
       .name = "i386-efi",
       .voidp_sizeof = 4,
@@ -664,6 +683,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
   switch (image_target->id)
     {
     case IMAGE_I386_PC:
+    case IMAGE_I386_PC_PXE:
       {
        unsigned num;
        char *boot_path, *boot_img;
@@ -678,6 +698,20 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
        if (num > 0xffff)
          grub_util_error (_("the core image is too big"));
 
+       if (image_target->id == IMAGE_I386_PC_PXE)
+         {
+           char *pxeboot_path, *pxeboot_img;
+           size_t pxeboot_size;
+           
+           pxeboot_path = grub_util_get_path (dir, "pxeboot.img");
+           pxeboot_size = grub_util_get_image_size (pxeboot_path);
+           pxeboot_img = grub_util_read_image (pxeboot_path);
+           
+           grub_util_write_image (pxeboot_img, pxeboot_size, out);
+           free (pxeboot_img);
+           free (pxeboot_path);
+         }
+
        boot_path = grub_util_get_path (dir, "diskboot.img");
        boot_size = grub_util_get_image_size (boot_path);
        if (boot_size != GRUB_DISK_SECTOR_SIZE)