[coreboot] port nvramtool to FreeBSD
Andriy Gapon
avg at icyb.net.ua
Thu Oct 30 16:54:45 CET 2008
on 30/10/2008 17:46 Uwe Hermann said the following:
> On Wed, Oct 29, 2008 at 03:14:46PM +0200, Andriy Gapon wrote:
>> Allow nvramtool to build and work on FreeBSD.
>>
>> Signed-off-by: Andriy Gapon <avg at icyb.net.ua>
>
> Thanks, r3709, with some changes though.
Thanks a lot!
> The patch you posted was breaking the build on Linux for me.
>
>
>> Index: cmos_lowlevel.c
>> ===================================================================
>> --- cmos_lowlevel.c (revision 3704)
>> +++ cmos_lowlevel.c (working copy)
>> @@ -28,7 +28,15 @@
>> * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
>> \*****************************************************************************/
>>
>> +#if defined(__GLIBC__)
>> #include <sys/io.h>
>> +#endif
>
> This seemed to cause trouble here, I fixed it by putting <sys/io.h>
> into the '#else' part of the 'defined(__FreeBSD__)' code in common.h.
>
> This builds fine for me now, but please check that it also still works
> on FreeBSD, just in case.
Yes, FreeBSD build is still fine.
Sorry for the mistakes, thank you for catching and fixing them.
>
>> Index: common.h
>> ===================================================================
>> --- common.h (revision 3704)
>> +++ common.h (working copy)
>> @@ -43,6 +43,25 @@
>> #include <string.h>
>> #include <ctype.h>
>>
>> +#if defined(__FreeBSD__)
>> +#include <sys/types.h>
>> +#include <machine/cpufunc.h>
>> +#define OUTB(x, y) do { u_int tmp = (y); outb(tmp, (x)); } while (0)
>> +#define OUTW(x, y) do { u_int tmp = (y); outw(tmp, (x)); } while (0)
>> +#define OUTL(x, y) do { u_int tmp = (y); outl(tmp, (x)); } while (0)
>> +#define INB(x) __extension__ ({ u_int tmp = (x); inb(tmp); })
>> +#define INW(x) __extension__ ({ u_int tmp = (x); inw(tmp); })
>> +#define INL(x) __extension__ ({ u_int tmp = (x); inl(tmp); })
>> +#else
>> +#define OUTB OUTB
> ^^^^
> outb
>
>> +#define OUTW outw
>> +#define OUTL outl
>> +#define INB INB
> ^^^
> inb
>
>> +#define INW inw
>> +#define INL inl
>> +#endif
>> +
>> +
>> #define FALSE 0
>> #define TRUE 1
>
>
> Uwe.
--
Andriy Gapon
More information about the coreboot
mailing list