Skip to contentSkip to conversation

grub-mkimage

PATCH Andrey Shuvikov 2 participants 2 messages Nov 13, 2006 – Nov 25, 2006

lore
Share & tools
lore
#0 lore raw

Hello,

I was looking into how grub2 works and noticed that in the load list in grub2/boot/i386/pc/diskboot.S sector number is 8-byte integer, while grub2/util/i386/pc/grub-mkimage.c sets the number of sectors to load at 4-byte offset. Because of this it actually patches upper part of the sector rather than number of sectors.

This is the changes I've made:

======================================================

grub-mkimage.c Mon Nov 13 13:41:01 2006 renamed from grub-mkimage.old Mon May 08 14:29:10 2006 +0 -0
@@ -143,7 +143,7 @@ generate_image (const char *dir,

FILE *o

/* i386 is a little endian architecture. */ *((grub_uint16_t *) (boot_img +
GRUB_DISK_SECTOR_SIZE
- - GRUB_BOOT_MACHINE_LIST_SIZE + 4))
+ - GRUB_BOOT_MACHINE_LIST_SIZE + 8))

     = grub_cpu_to_le16 (num);

grub_util_write_image (boot_img, boot_size, out);
======================================================

Sincerely,
Andrey Shuvikov

____________________________________________________________________________________
Yahoo! Music Unlimited
Access over 1 million songs.
http://music.yahoo.com/unlimited

#1 lore raw
Quoted 7 lines · Andrey Shuvikov

I was looking into how grub2 works and noticed that in the load list in grub2/boot/i386/pc/diskboot.S sector number is 8-byte integer, while grub2/util/i386/pc/grub-mkimage.c sets the number of sectors to load at 4-byte offset. Because of this it actually patches upper part of the sector rather than number of sectors.

Thank you for your patch. I've checked it in right now.

Okuji