Thanks for the information, i try to fix it.
Another funny thing:
in ./grub-core/kern/emu/hostdisk.c:
disk->total_sectors = grub_util_get_fd_size (fd, map[drive].device,
&disk->log_sector_size);
disk->total_sectors >>= disk->log_sector_size;
second line is overwrite the value of previous life :-)
> Andrei Borzenkov <[email protected]> 於 2015年11月12日 下午3:40 寫道:
>
> On Thu, Nov 12, 2015 at 10:29 AM, Peter Cheung <[email protected]> wrote:
>> Thanks, i am trying to fix this in code, but i am too new to grub coding. I
>> want to print out something in ./grub-core/kern/disk_common.c, so i do
>> "grub_util_info("peter\n");" and add "include <grub/util/misc.h>" on the top
>> of the file, but i get this error:
>>
>> In file included from lib/../kern/disk_common.c:1:0,
>>
>> from lib/disk.c:31:
>>
>> ../include/grub/util/misc.h:22:20: fatal error: stdlib.h: No such file or
>> directory
>>
>
> disk_common is unrelated to your problem. You need to look at host
> device probing code under grub-core/osdep, code that maps host device
> to grub device is historically located in various getroot.c files.
>
>>
>> May I know the correct way to print out something please?
>>
>
> #ifdef GRUB_UTIL
> grub_util_info (...);
> #endif
>
>
>
>> thanks
>> from Peter
>>
>>> Subject: Re: grub in mac
>>> To: [email protected]
>>> From: [email protected]
>>> Date: Wed, 11 Nov 2015 08:08:09 +0300
>>> CC: [email protected]
>>
>>>
>>> 11.11.2015 07:34, Peter Cheung пишет:
>>>> I tried grub-install, but same error message, another thing i discovered
>>>> is "the size of hostdisk//dev/rdisk2 is 204800", but my hd.img file is
>>>> 100MB.thanksfrom Peter
>>>>
>>> ...
>>>
>>>> /toolchain/sbin/grub-install: info: drive = 0.
>>>> /toolchain/sbin/grub-install: info: the size of hostdisk//dev/rdisk2 is
>>>> 204800.
>>>> /toolchain/sbin/grub-install: info: guessed root_dev
>>>> `hostdisk//dev/rdisk2' from dir
>>>> `/Users/peter/NetBeansProjects/PeterI/temp/grub/i386-pc'.
>>>> /toolchain/sbin/grub-install: info: setting the root device to
>>>> `hostdisk//dev/rdisk2,1'.
>>>> /toolchain/sbin/grub-install: error: attempt to read or write outside of
>>>> disk `hostdisk//dev/disk2'.
>>>>
>>>
>>>
>>> No, it is not the same message. Now it correctly detects disk2, but it
>>> lacks MAC OS X specific code for BIOS device guessing.
>>>
>>> grub-install expects device.map in /boot/grub; so put it there (i.e. on
>>> filesystem on /dev/disk2s1).
>>>
>>> Someone more familiar with OS X need to contribute device detection code
>>> for it.
>>>
>>> _______________________________________________
>>> Help-grub mailing list
>>> [email protected]
>>> https://lists.gnu.org/mailman/listinfo/help-grub
_______________________________________________
Help-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-grub