Quoting Chris Knadle <[EMAIL PROTECTED]>:
I'm trying to figure out how to get grub to check the first
sector. Mainly
I'm asking for hints. I think it involves running a new instance of
grub_disk_read for the first sector (sector 0 of the partition) within the
apple_partition_map_iterate function -- something like:
grub_disk_read(&raw, 0, 0, sizeof (struct grub_apple_part), (char *)&apart))
I'm not sure grub_apple_part would describe the first sector
correctly. Besides, you only need two bytes. Why reuse "apart"? You
can use a 16-bit variable and read those two bytes there.
But then I want to check the first block against 0x4552, and
apart.first_phys_block is 32-bits.
Why first_phys_block? The first field is 16 bit wide and is called "magic".
Since I want the first (high) 16 bits, I
think I need to make the comparison in a way such as:
if ((apart.first_phys_block & 0xFFFF0000) == (0x4552 << 16))
That won't work on little endian systems, including ordinary PC. You
are assuming big endian byte order here. Instead, the data from the
disk should be converted to CPU-endian from whatever it is and
compared to the magic value.
--
Regards,
Pavel Roskin
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/grub-devel