From da2891f9620a706847bbe8f36c06e5b56b31ed40 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 1 Sep 2010 10:29:30 +0100 Subject: [PATCH 1/5] * docs/grub.texi: Add myself as an author. --- ChangeLog | 4 ++++ docs/grub.texi | 1 + 2 files changed, 5 insertions(+) diff --git a/ChangeLog b/ChangeLog index e63b30284..d8851c641 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-09-01 Colin Watson + + * docs/grub.texi: Add myself as an author. + 2010-09-01 Vladimir Serbinenko * Makefile.util.def (libgrub.a): Add missing sunpc. diff --git a/docs/grub.texi b/docs/grub.texi index 18dc39389..fb0907a59 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -46,6 +46,7 @@ Invariant Sections. @subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}. @author Gordon Matzigkeit @author Yoshinori K. Okuji +@author Colin Watson @c The following two commands start the copyright page. @page @vskip 0pt plus 1filll From 4066f57f1946f459472fc2a8c8f69eab2fd23cab Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 1 Sep 2010 10:32:34 +0100 Subject: [PATCH 2/5] * util/grub-mkrescue.in (usage): Tidy up usage output (and hence generated manual page) a little. --- ChangeLog | 5 +++++ util/grub-mkrescue.in | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index d8851c641..220cc61fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-09-01 Colin Watson + + * util/grub-mkrescue.in (usage): Tidy up usage output (and hence + generated manual page) a little. + 2010-09-01 Colin Watson * docs/grub.texi: Add myself as an author. diff --git a/util/grub-mkrescue.in b/util/grub-mkrescue.in index 0f40e92cc..142ee85cd 100644 --- a/util/grub-mkrescue.in +++ b/util/grub-mkrescue.in @@ -62,7 +62,8 @@ Make GRUB rescue image. $self generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by: xorriso -as mkisofs -help -Option -- switches to native xorriso command mode. or directories. + +Option -- switches to native xorriso command mode. Report bugs to . Mail xorriso support requests to . From f9cefc4eb38f867ccf0419ae7a172d41ec0cd442 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Wed, 1 Sep 2010 18:15:46 +0100 Subject: [PATCH 3/5] * NEWS: Document most of the important changes since 1.98. --- ChangeLog | 4 +++ NEWS | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 93 insertions(+) diff --git a/ChangeLog b/ChangeLog index 220cc61fe..c78bcef7d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2010-09-01 Colin Watson + + * NEWS: Document most of the important changes since 1.98. + 2010-09-01 Colin Watson * util/grub-mkrescue.in (usage): Tidy up usage output (and hence diff --git a/NEWS b/NEWS index e16504342..bb6b8df3f 100644 --- a/NEWS +++ b/NEWS @@ -1,9 +1,98 @@ New in 1.99: +* New relocator. Allows for more kernel support and more + straightforward loader writing. + +* Handle USB pendrives exposed as floppies. + +* New Automake-based build system. + +* Add `sendkey' command (i386-pc only). + * ZFS support in `grub-install' and `grub-mkconfig'. Note: complete functionality requires external ZFS implementation (available from grub-extras). +* Support 1.x versions of mdadm metadata. + +* Fix corruption when reading Reiserfs directory entries. + +* Bidirectional text and diacritics support. + +* Skip LVM snapshots. + +* MIPS Yeeloong firmware port. + +* Change grub-mkdevicemap to emit /dev/disk/by-id/ names where possible + on GNU/Linux. + +* Add `grub-mkconfig' support for Xen with Linux. + +* Add `grub-mkconfig' support for initrd images on Fedora 13. + +* Support >3GiB and <16MiB RAM in i386-qemu. + +* Add support for Cirrus 5446 and Bochs video cards. + +* Load more appropriate video drivers automatically in `grub-mkconfig'. + +* USB improvements, including hotplugging/hotunplugging, hub support, + and USB serial support. + +* AMD Geode CS5536 support. + +* Extensive updates to the Texinfo documentation. + +* Add `grub-probe' support for the btrfs filesystem, permitting / to + reside on btrfs as long as /boot is on a filesystem natively supported + by GRUB. + +* Handle symbolic links under /dev/mapper on GNU/Linux. + +* Handle installation across multiple partition table types. + +* Add `cmostest' command (i386/x86_64 only). + +* Add support for DM-RAID disk devices on GNU/Linux. + +* Remove `grub-mkisofs'. `grub-mkrescue' now uses GNU xorriso to build + CD images. + +* `grub-mkrescue' support for EFI, coreboot, and QEMU platforms. + +* Unify `grub-mkimage' source code across platforms. + +* Fix VGA (as opposed to VBE) video driver, formerly a terminal driver. + +* Add menu hotkey support. + +* Add support for the nilfs2 filesystem. + +* `grub-probe' and `grub-mkconfig' support for NetBSD. + +* Support setting a background image in `grub-mkconfig'. + +* Support multiple terminals in `grub-mkconfig'. + +* Regexp support. + +* MIPS multiboot2 support. + +* Multiboot2 tag support. + +* sunpc partition table support. + +* Add a number of new language features to GRUB script: `for', `while', + `until', `elif', function parameters, `break', `continue', and + `shift'. + +* Support nested partition tables. GRUB now prefers to name partitions + in the form `(hd0,msdos1,bsd1)' rather than `(hd0,1,a)'. + +* Speed up consecutive hostdisk operations on the same device. + +* Compile parts of `grub-emu' as modules. + New in 1.98 - 2010-03-06: * Multiboot on EFI support. From 9a093920572de083c853b85b7372c6ca608b1677 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 2 Sep 2010 15:47:03 +0200 Subject: [PATCH 4/5] Fix grub_pxe_scan. * grub-core/fs/i386/pc/pxe.c (grub_pxe_pxenv): Put correct type bangpxe. (grub_pxe_scan): Fix types and pxe_rm_entry computation. All users updated. * include/grub/i386/pc/pxe.h (grub_pxe_bangpxe): New struct. (grub_pxe_pxenv): Correct type. --- ChangeLog | 10 ++++++++++ grub-core/fs/i386/pc/pxe.c | 36 +++++++++++++++++++++--------------- include/grub/i386/pc/pxe.h | 15 ++++++++++++++- 3 files changed, 45 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index c78bcef7d..ce3141985 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2010-09-02 Vladimir Serbinenko + + Fix grub_pxe_scan. + + * grub-core/fs/i386/pc/pxe.c (grub_pxe_pxenv): Put correct type bangpxe. + (grub_pxe_scan): Fix types and pxe_rm_entry computation. + All users updated. + * include/grub/i386/pc/pxe.h (grub_pxe_bangpxe): New struct. + (grub_pxe_pxenv): Correct type. + 2010-09-01 Colin Watson * NEWS: Document most of the important changes since 1.98. diff --git a/grub-core/fs/i386/pc/pxe.c b/grub-core/fs/i386/pc/pxe.c index 0dd44a30a..ee8c55416 100644 --- a/grub-core/fs/i386/pc/pxe.c +++ b/grub-core/fs/i386/pc/pxe.c @@ -41,7 +41,7 @@ struct grub_pxe_disk_data grub_uint32_t gateway_ip; }; -struct grub_pxenv *grub_pxe_pxenv; +struct grub_pxe_bangpxe *grub_pxe_pxenv; static grub_uint32_t grub_pxe_your_ip; static grub_uint32_t grub_pxe_default_server_ip; static grub_uint32_t grub_pxe_default_gateway_ip; @@ -58,41 +58,47 @@ struct grub_pxe_data static grub_uint32_t pxe_rm_entry = 0; -static struct grub_pxenv * +static struct grub_pxe_bangpxe * grub_pxe_scan (void) { struct grub_bios_int_registers regs; - struct grub_pxenv *ret; - void *pxe; + struct grub_pxenv *pxenv; + struct grub_pxe_bangpxe *bangpxe; regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.ebx = 0; regs.ecx = 0; regs.eax = 0x5650; + regs.es = 0; grub_bios_interrupt (0x1a, ®s); if ((regs.eax & 0xffff) != 0x564e) return NULL; - ret = (struct grub_pxenv *) ((regs.es << 4) + (regs.ebx & 0xffff)); - if (grub_memcmp (ret->signature, GRUB_PXE_SIGNATURE, sizeof (ret->signature)) + + pxenv = (struct grub_pxenv *) ((regs.es << 4) + (regs.ebx & 0xffff)); + if (grub_memcmp (pxenv->signature, GRUB_PXE_SIGNATURE, + sizeof (pxenv->signature)) != 0) return NULL; - if (ret->version < 0x201) + + if (pxenv->version < 0x201) return NULL; - pxe = (void *) ((((ret->pxe_ptr & 0xffff0000) >> 16) << 4) - + (ret->pxe_ptr & 0xffff)); - if (!pxe) + bangpxe = (void *) ((((pxenv->pxe_ptr & 0xffff0000) >> 16) << 4) + + (pxenv->pxe_ptr & 0xffff)); + + if (!bangpxe) return NULL; - /* !PXE */ - if (*(grub_uint32_t *) pxe != 0x45585021) + if (grub_memcmp (bangpxe->signature, GRUB_PXE_BANGPXE_SIGNATURE, + sizeof (bangpxe->signature)) != 0) return NULL; - pxe_rm_entry = ret->rm_entry; - return ret; + pxe_rm_entry = bangpxe->rm_entry; + + return bangpxe; } static int @@ -483,7 +489,7 @@ parse_dhcp_vendor (void *vend, int limit) static void grub_pxe_detect (void) { - struct grub_pxenv *pxenv; + struct grub_pxe_bangpxe *pxenv; struct grub_pxenv_get_cached_info ci; struct grub_pxenv_boot_player *bp; diff --git a/include/grub/i386/pc/pxe.h b/include/grub/i386/pc/pxe.h index 049dd1950..62ece21b0 100644 --- a/include/grub/i386/pc/pxe.h +++ b/include/grub/i386/pc/pxe.h @@ -192,6 +192,19 @@ struct grub_pxenv grub_uint32_t pxe_ptr; /* SEG:OFF to !PXE struct. */ } __attribute__ ((packed)); +struct grub_pxe_bangpxe +{ + grub_uint8_t signature[4]; +#define GRUB_PXE_BANGPXE_SIGNATURE "!PXE" + grub_uint8_t length; + grub_uint8_t chksum; + grub_uint8_t rev; + grub_uint8_t reserved; + grub_uint32_t undiromid; + grub_uint32_t baseromid; + grub_uint32_t rm_entry; +} __attribute__ ((packed)); + struct grub_pxenv_get_cached_info { grub_uint16_t status; @@ -306,7 +319,7 @@ struct grub_pxenv_unload_stack int EXPORT_FUNC(grub_pxe_call) (int func, void * data, grub_uint32_t pxe_rm_entry); -extern struct grub_pxenv *grub_pxe_pxenv; +extern struct grub_pxe_bangpxe *grub_pxe_pxenv; void grub_pxe_unload (void); From 529cc99acf9bbb8ac07d95e30af99fa1fefdac4b Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Thu, 2 Sep 2010 16:07:52 +0200 Subject: [PATCH 5/5] 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. --- ChangeLog | 9 +++++++++ util/grub-mkimage.c | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ce3141985..4b1ccafd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-09-02 Vladimir Serbinenko + + 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 Fix grub_pxe_scan. diff --git a/util/grub-mkimage.c b/util/grub-mkimage.c index 0e82afae9..4e151dd62 100644 --- a/util/grub-mkimage.c +++ b/util/grub-mkimage.c @@ -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)