mirror of
https://review.coreboot.org/flashrom.git
synced 2025-04-27 23:22:37 +02:00
Fix and improve libpayload platform support
- Fix various minor compile issues (eg. include necessary standard headers) - Fix compilation of libpayload code paths - Provide libpayload support in Makefile - Add make target "libflashrom.a" which links non-CLI code to static library Corresponding to flashrom svn r1280. Signed-off-by: Patrick Georgi <patrick.georgi@secunet.com> Tested-with-DOS-crosscompiler-by: Idwer Vollering <vidwer@gmail.com> Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
parent
7f517a7103
commit
97bc95ce2b
44
Makefile
44
Makefile
@ -28,6 +28,8 @@ PREFIX ?= /usr/local
|
|||||||
MANDIR ?= $(PREFIX)/share/man
|
MANDIR ?= $(PREFIX)/share/man
|
||||||
CFLAGS ?= -Os -Wall -Wshadow
|
CFLAGS ?= -Os -Wall -Wshadow
|
||||||
EXPORTDIR ?= .
|
EXPORTDIR ?= .
|
||||||
|
AR ?= ar
|
||||||
|
RANLIB ?= ranlib
|
||||||
|
|
||||||
WARNERROR ?= yes
|
WARNERROR ?= yes
|
||||||
|
|
||||||
@ -82,6 +84,39 @@ override CONFIG_FT2232_SPI = no
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(OS_ARCH), libpayload)
|
||||||
|
CC:=CC=i386-elf-gcc lpgcc
|
||||||
|
AR:=i386-elf-ar
|
||||||
|
RANLIB:=i386-elf-ranlib
|
||||||
|
CPPFLAGS += -DSTANDALONE
|
||||||
|
ifeq ($(CONFIG_DUMMY), yes)
|
||||||
|
UNSUPPORTED_FEATURES += CONFIG_DUMMY=yes
|
||||||
|
else
|
||||||
|
override CONFIG_DUMMY = no
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_BUSPIRATE_SPI), yes)
|
||||||
|
UNSUPPORTED_FEATURES += CONFIG_BUSPIRATE_SPI=yes
|
||||||
|
else
|
||||||
|
override CONFIG_BUSPIRATE_SPI = no
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_SERPROG), yes)
|
||||||
|
UNSUPPORTED_FEATURES += CONFIG_SERPROG=yes
|
||||||
|
else
|
||||||
|
override CONFIG_SERPROG = no
|
||||||
|
endif
|
||||||
|
# Dediprog and FT2232 are not supported with libpayload (missing libusb support)
|
||||||
|
ifeq ($(CONFIG_DEDIPROG), yes)
|
||||||
|
UNSUPPORTED_FEATURES += CONFIG_DEDIPROG=yes
|
||||||
|
else
|
||||||
|
override CONFIG_DEDIPROG = no
|
||||||
|
endif
|
||||||
|
ifeq ($(CONFIG_FT2232_SPI), yes)
|
||||||
|
UNSUPPORTED_FEATURES += CONFIG_FT2232_SPI=yes
|
||||||
|
else
|
||||||
|
override CONFIG_FT2232_SPI = no
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
CHIP_OBJS = jedec.o stm50flw0x0x.o w39.o w29ee011.o \
|
CHIP_OBJS = jedec.o stm50flw0x0x.o w39.o w29ee011.o \
|
||||||
sst28sf040.o m29f400bt.o 82802ab.o pm49fl00x.o \
|
sst28sf040.o m29f400bt.o 82802ab.o pm49fl00x.o \
|
||||||
sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o spi25.o sharplhf00l04.o
|
sst49lfxxxc.o sst_fwhub.o flashchips.o spi.o spi25.o sharplhf00l04.o
|
||||||
@ -335,11 +370,16 @@ FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "UTSNAME := yes" .features && printf
|
|||||||
# We could use PULLED_IN_LIBS, but that would be ugly.
|
# We could use PULLED_IN_LIBS, but that would be ugly.
|
||||||
FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
|
FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
|
||||||
|
|
||||||
OBJS = $(CHIP_OBJS) $(CLI_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS)
|
LIBFLASHROM_OBJS = $(CHIP_OBJS) $(PROGRAMMER_OBJS) $(LIB_OBJS)
|
||||||
|
OBJS = $(CLI_OBJS) $(LIBFLASHROM_OBJS)
|
||||||
|
|
||||||
$(PROGRAM)$(EXEC_SUFFIX): $(OBJS)
|
$(PROGRAM)$(EXEC_SUFFIX): $(OBJS)
|
||||||
$(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(FEATURE_LIBS) $(LIBS)
|
$(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(FEATURE_LIBS) $(LIBS)
|
||||||
|
|
||||||
|
libflashrom.a: $(LIBFLASHROM_OBJS)
|
||||||
|
$(AR) rcs $@ $^
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
# TAROPTIONS reduces information leakage from the packager's system.
|
# TAROPTIONS reduces information leakage from the packager's system.
|
||||||
# If other tar programs support command line arguments for setting uid/gid of
|
# If other tar programs support command line arguments for setting uid/gid of
|
||||||
# stored files, they can be handled here as well.
|
# stored files, they can be handled here as well.
|
||||||
@ -352,7 +392,7 @@ TAROPTIONS = $(shell LC_ALL=C tar --version|grep -q GNU && echo "--owner=root --
|
|||||||
# This includes all frontends and libflashrom.
|
# This includes all frontends and libflashrom.
|
||||||
# We don't use EXEC_SUFFIX here because we want to clean everything.
|
# We don't use EXEC_SUFFIX here because we want to clean everything.
|
||||||
clean:
|
clean:
|
||||||
rm -f $(PROGRAM) $(PROGRAM).exe *.o *.d
|
rm -f $(PROGRAM) $(PROGRAM).exe libflashrom.a *.o *.d
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f .features .libdeps
|
rm -f .features .libdeps
|
||||||
|
@ -492,6 +492,7 @@ msr_t libpayload_rdmsr(int addr)
|
|||||||
int libpayload_wrmsr(int addr, msr_t msr)
|
int libpayload_wrmsr(int addr, msr_t msr)
|
||||||
{
|
{
|
||||||
_wrmsr(addr, msr.lo | ((unsigned long long)msr.hi << 32));
|
_wrmsr(addr, msr.lo | ((unsigned long long)msr.hi << 32));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
msr_t rdmsr(int addr)
|
msr_t rdmsr(int addr)
|
||||||
|
1
spi.c
1
spi.c
@ -22,6 +22,7 @@
|
|||||||
* Contains the generic SPI framework
|
* Contains the generic SPI framework
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <strings.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "flashchips.h"
|
#include "flashchips.h"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user