Apparently compilation worked before I introduced the target OS check during compilation, but it seems the generated binaries back then might have been incorrect for Debian/kFreeBSD.
This stuff should compile and run well. Output of flashrom -V on a desktop PC (not a laptop) would be appreciated.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-kfreebsd_glibc/hwaccess.c =================================================================== --- flashrom-kfreebsd_glibc/hwaccess.c (Revision 1504) +++ flashrom-kfreebsd_glibc/hwaccess.c (Arbeitskopie) @@ -40,7 +40,7 @@ { }
-#if defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) int io_fd; #endif
@@ -52,7 +52,7 @@ #else #if defined (__sun) && (defined(__i386) || defined(__amd64)) if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) != 0) { -#elif defined(__FreeBSD__) || defined (__DragonFly__) +#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined (__DragonFly__) if ((io_fd = open("/dev/io", O_RDWR)) < 0) { #else if (iopl(3) != 0) { @@ -71,7 +71,7 @@
void release_io_perms(void) { -#if defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) close(io_fd); #endif } Index: flashrom-kfreebsd_glibc/hwaccess.h =================================================================== --- flashrom-kfreebsd_glibc/hwaccess.h (Revision 1504) +++ flashrom-kfreebsd_glibc/hwaccess.h (Arbeitskopie) @@ -189,6 +189,7 @@ */
#if defined(__FreeBSD__) || defined(__DragonFly__) + /* Note that FreeBSD kernel with glibc does not have machine/cpufunc.h. */ #include <machine/cpufunc.h> #define off64_t off_t #define lseek64 lseek @@ -228,7 +229,7 @@ #define INL inportl
#else - + /* This is the usual glibc interface. */ #define OUTB outb #define OUTW outw #define OUTL outl @@ -299,12 +300,12 @@ #endif #endif
-#if !defined(__DARWIN__) && !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__LIBPAYLOAD__) +#if !defined(__DARWIN__) && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) && !defined(__DragonFly__) && !defined(__LIBPAYLOAD__) typedef struct { uint32_t hi, lo; } msr_t; msr_t rdmsr(int addr); int wrmsr(int addr, msr_t msr); #endif -#if defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) /* FreeBSD already has conflicting definitions for wrmsr/rdmsr. */ #undef rdmsr #undef wrmsr Index: flashrom-kfreebsd_glibc/os.h =================================================================== --- flashrom-kfreebsd_glibc/os.h (Revision 1504) +++ flashrom-kfreebsd_glibc/os.h (Arbeitskopie) @@ -30,6 +30,9 @@ // FreeBSD #elif defined(__FreeBSD__) #define __FLASHROM_OS__ "FreeBSD" +// FreeBSD with glibc-based userspace (e.g. Debian/kFreeBSD) +#elif defined(__FreeBSD_kernel__) && defined(__GLIBC__) +#define __FLASHROM_OS__ "FreeBSD-glibc" // DragonFlyBSD #elif defined(__DragonFly__) #define __FLASHROM_OS__ "DragonFlyBSD" Index: flashrom-kfreebsd_glibc/physmap.c =================================================================== --- flashrom-kfreebsd_glibc/physmap.c (Revision 1504) +++ flashrom-kfreebsd_glibc/physmap.c (Arbeitskopie) @@ -382,7 +382,7 @@ fd_msr = -1; } #else -#if defined(__FreeBSD__) || defined(__DragonFly__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #include <sys/ioctl.h>
typedef struct {
Am 22.02.2012 01:52 schrieb Carl-Daniel Hailfinger:
Apparently compilation worked before I introduced the target OS check during compilation, but it seems the generated binaries back then might have been incorrect for Debian/kFreeBSD.
This stuff should compile and run well. Output of flashrom -V on a desktop PC (not a laptop) would be appreciated.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
A patch with slightly changed comments was Tested-by: Robert Millan rmh@debian.org Tested-by: Uwe Hermann uwe@hermann-uwe.de Acked-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net and committed in r1507. (self-ack because it was tested by others and it's a build fix)
Regards, Carl-Daniel