grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Mingw support for grub2


From: Bean
Subject: Re: [PATCH] Mingw support for grub2
Date: Sun, 24 Aug 2008 22:12:23 +0800

On Sun, Aug 24, 2008 at 8:40 PM, Christian Franke
<address@hidden> wrote:
> Bean wrote:
>>
>> Hi,
>>
>> This patch add support for mingw, now you can create native executable
>> for windows.
>>
>>
>
> Nice!
>
> Does grub-setup work?

Yes, it works, although mingw can't use device names like /dev/sda,
but it can use windows special name //./PHYSICALDRIVE0.

>
>
>> ...
>> --- a/include/grub/util/misc.h
>> +++ b/include/grub/util/misc.h
>> ...
>> +#ifdef __MINGW32__
>> +
>> +#include <windows.h>
>> +
>> +grub_int64_t fseeko (FILE *fp, grub_int64_t offset, int whence);
>> +grub_int64_t ftello (FILE *fp);
>>
>
> The mingw runtime provides fseeko64/ftello64(), see
> /usr/include/mingw/stdio.h
>
> So the following may work:
>
> #ifdef __MINGW32__
> #define fseeko fseeko64
> #define ftello ftello64
> #endif
>
> or use inline functions.

Oh, thanks for the tip.


>
>
>> +void sync (void);
>> +int asprintf (char **buf, const char *fmt, ...);
>> +
>>
>
> I would suggest to add AC_CHECK_FUNC(asprintf) to configure.
> asprintf() is a GNU extension and not part of C99 or POSIX.
>

Good point.

>
>> +grub_int64_t grub_util_get_disk_size (char *name);
>> +
>> +#define sleep  Sleep
>>
>
> The Sleep() parameter specifies milliseconds.
>
> #define sleep(s) Sleep((s)*1000)
> or
> inline void sleep(unsigned s) { Sleep(s * 1000); }
> or
> add sleep() to util/misc.c to avoid global inclusion of the namespace
> polluter windows.h :-)

Yes, perhaps I should put it in util/misc.c.

-- 
Bean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]