[yocto] [PATCH] rmc: Fix include path and type definitions

Jianxun Zhang jianxun.zhang at linux.intel.com
Tue Nov 15 20:56:19 PST 2016


Add detection of current path for -I option, also update
type definitions for EFI compiling.

Signed-off-by: Jianxun Zhang <jianxun.zhang at linux.intel.com>
---
 Makefile        | 4 +++-
 Makefile.efi    | 4 +++-
 inc/rmc_types.h | 9 ++++++---
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index f152829..6c68a51 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,7 @@
 # Copyright (C) 2016 Jianxun Zhang <jianxun.zhang at intel.com>
 
+TOPDIR = $(shell if [ -z "$$PWD" ]; then pwd; else echo "$$PWD"; fi)
+
 RMC_TOOL_SRC := $(wildcard src/*.c)
 RMC_TOOL_OBJ := $(patsubst %.c,%.o,$(RMC_TOOL_SRC))
 
@@ -17,7 +19,7 @@ RMC_INSTALL_BIN_PATH := $(RMC_INSTALL_PREFIX)/bin/
 
 ALL_OBJS := $(RMC_TOOL_OBJ) $(RMCL_OBJ) $(RSMP_OBJ)
 
-CFLAGS := -Wall -O2 -Iinc $(RMC_CFLAGS)
+CFLAGS := -Wall -O2 -I$(TOPDIR)/inc $(RMC_CFLAGS)
 
 all: rmc librmcl librsmp
 
diff --git a/Makefile.efi b/Makefile.efi
index 4c2aada..2af85cb 100644
--- a/Makefile.efi
+++ b/Makefile.efi
@@ -1,5 +1,7 @@
 # Copyright (C) 2016 Jianxun Zhang <jianxun.zhang at intel.com>
 
+TOPDIR = $(shell if [ -z "$$PWD" ]; then pwd; else echo "$$PWD"; fi)
+
 RMCL_SRC :=$(wildcard src/rmcl/*.c)
 RMCL_OBJ := $(patsubst %.c,%.efi.o,$(RMCL_SRC))
 
@@ -34,7 +36,7 @@ RMC_INSTALL_LIBS_PATH := $(RMC_INSTALL_PREFIX)/lib/
 SHARED_OBJS := src/util/util.efi.o
 ALL_OBJS := $(RMCL_OBJ) $(RSMP_OBJ) $(SHARED_OBJS)
 
-CFLAGS := -DRMC_EFI -Wall -O2 -Iinc -fpic -nostdinc -nostdlib  -fno-builtin -std=gnu90 \
+CFLAGS := -DRMC_EFI -Wall -O2 -I$(TOPDIR)/inc -fpic -nostdinc -nostdlib  -fno-builtin -std=gnu90 \
 	   -I$(RMC_EFI_HEADER_PREFIX) -I$(RMC_EFI_HEADER_PREFIX)/$(RMC_EFI_ARCH) $(RMC_CFLAGS)
 
 all: librmclefi librsmpefi
diff --git a/inc/rmc_types.h b/inc/rmc_types.h
index b6e4521..9154231 100644
--- a/inc/rmc_types.h
+++ b/inc/rmc_types.h
@@ -7,14 +7,17 @@
 #define INC_RMC_TYPES_H_
 
 #ifndef RMC_EFI
+#include <sys/types.h>
 #include <stdint.h>
 #include <stddef.h>
 #include <string.h>
 #else
 #include <efi.h>
-/* Fixme: we define (s)size_t here for both 32 and 64 bit because gnu-efi doesn't provide these */
-typedef uint64_t size_t;
-typedef uint64_t ssize_t;
+/* we specify -nostdinc in C flag and provide these in rmc
+ * for EFI applications that don't want to use standard headers.
+ */
+typedef unsigned long size_t;
+typedef long ssize_t;
 #endif
 
 typedef uint8_t BYTE;
-- 
2.7.4




More information about the yocto mailing list