> How does this patch integrate with "make libflashrom.a" ? Integrated in the updated patch.
> I would rather/also see something like this: > > +libpayload: > + make OS_ARCH=libpayload > + Thanks for the suggestion. > > +#define PCI_VENDOR_ID_INTEL 0x8086 > > + > > uint8_t *nicintel_bar; > > uint8_t *nicintel_control_bar; > > This part should be merged with this patch: > http://patchwork.coreboot.org/patch/2823/ -- nicintel.c didn't exist > when I submitted that patch. Fixed according to your suggestion on IRC. Attaching updated patch. Thanks, Tadas Slotkus
>From dad7e351bf912694090b21f4c242b9700be4444f Mon Sep 17 00:00:00 2001 From: Tadas Slotkus <[email protected]> Date: Sun, 19 Jun 2011 23:39:43 +0300 Subject: [PATCH 1/2] Various fixes for building as a payload. Added targets: payload and payload.a for linking against libpayload. Also fixed nicintel.c pciid issue like Idwer suggested. This patch is for svn rev 1349 Signed-off-by: Tadas Slotkus <[email protected]> --- Makefile | 20 ++++++++++++++------ cli_classic.c | 6 +++++- cli_output.c | 2 ++ flash.h | 6 +++++- flashrom.c | 6 ++++++ layout.c | 6 ++++-- nicintel.c | 6 ++++-- 7 files changed, 40 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 6e6e2de..139997f 100644 --- a/Makefile +++ b/Makefile @@ -85,9 +85,9 @@ endif endif ifeq ($(OS_ARCH), libpayload) -CC:=CC=i386-elf-gcc lpgcc -AR:=i386-elf-ar -RANLIB:=i386-elf-ranlib +CC:=../libpayload/install/libpayload/bin/lpgcc +AR_ARCH = --target=elf32-i386 +RANLIB_ARCH = --target=elf32-i386 CPPFLAGS += -DSTANDALONE ifeq ($(CONFIG_DUMMY), yes) UNSUPPORTED_FEATURES += CONFIG_DUMMY=yes @@ -361,7 +361,9 @@ ifeq ($(OS_ARCH), DOS) # FIXME There needs to be a better way to do this LIBS += ../libpci/lib/libpci.a else +ifneq ($(OS_ARCH), libpayload) LIBS += -lpci +endif ifeq ($(OS_ARCH), OpenBSD) # For (i386|amd64)_iopl(2). LIBS += -l$(shell uname -m) @@ -387,8 +389,14 @@ $(PROGRAM)$(EXEC_SUFFIX): $(OBJS) $(CC) $(LDFLAGS) -o $(PROGRAM)$(EXEC_SUFFIX) $(OBJS) $(FEATURE_LIBS) $(LIBS) libflashrom.a: $(LIBFLASHROM_OBJS) - $(AR) rcs $@ $^ - $(RANLIB) $@ + $(AR) rcs $@ $^ $(AR_ARCH) + $(RANLIB) $@ $(AR_ARCH) + +payload: + make OS_ARCH=libpayload + +payload.a: + make OS_ARCH=libpayload libflashrom.a # TAROPTIONS reduces information leakage from the packager's system. # If other tar programs support command line arguments for setting uid/gid of @@ -519,6 +527,6 @@ tarball: export djgpp-dos: clean make CC=i586-pc-msdosdjgpp-gcc STRIP=i586-pc-msdosdjgpp-strip WARNERROR=no OS_ARCH=DOS -.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable +.PHONY: all clean distclean compiler pciutils features export tarball dos featuresavailable payload payload.a -include $(OBJS:.o=.d) diff --git a/cli_classic.c b/cli_classic.c index 59096a0..6254257 100644 --- a/cli_classic.c +++ b/cli_classic.c @@ -22,8 +22,10 @@ */ #include <stdio.h> +#ifndef __LIBPAYLOAD__ #include <fcntl.h> #include <sys/stat.h> +#endif #include <string.h> #include <stdlib.h> #include <getopt.h> @@ -150,12 +152,14 @@ int cli_classic(int argc, char *argv[]) if (selfcheck()) exit(1); +#ifndef __LIBPAYLOAD__ setbuf(stdout, NULL); +#endif /* FIXME: Delay all operation_specified checks until after command * line parsing to allow --help overriding everything else. */ while ((opt = getopt_long(argc, argv, optstring, - long_options, &option_index)) != EOF) { + long_options, &option_index)) != -1) { switch (opt) { case 'r': if (++operation_specified > 1) { diff --git a/cli_output.c b/cli_output.c index 1c85f7a..fc3356f 100644 --- a/cli_output.c +++ b/cli_output.c @@ -47,6 +47,8 @@ int print(int type, const char *fmt, ...) va_start(ap, fmt); ret = vfprintf(output_type, fmt, ap); va_end(ap); +#ifndef __LIBPAYLOAD__ fflush(output_type); +#endif return ret; } diff --git a/flash.h b/flash.h index f875102..9684244 100644 --- a/flash.h +++ b/flash.h @@ -32,7 +32,11 @@ #undef min #undef max #endif - +#ifdef __LIBPAYLOAD__ +#undef __linux__ +#define fprintf(stream, ...) printf(__VA_ARGS__) +#define vfprintf(output_type, fmt, ap) vprintf(fmt, ap) +#endif #define ERROR_PTR ((void*)-1) /* Error codes */ diff --git a/flashrom.c b/flashrom.c index cfee1a1..79c1174 100644 --- a/flashrom.c +++ b/flashrom.c @@ -26,6 +26,8 @@ #ifndef __LIBPAYLOAD__ #include <fcntl.h> #include <sys/stat.h> +#else +#include <libpayload.h> #endif #include <string.h> #include <stdlib.h> @@ -1219,6 +1221,7 @@ int verify_flash(struct flashchip *flash, uint8_t *buf) int read_buf_from_file(unsigned char *buf, unsigned long size, char *filename) { +#ifndef __LIBPAYLOAD__ unsigned long numbytes; FILE *image; struct stat image_stat; @@ -1247,11 +1250,13 @@ int read_buf_from_file(unsigned char *buf, unsigned long size, char *filename) "wanted %ld!\n", numbytes, size); return 1; } +#endif return 0; } int write_buf_to_file(unsigned char *buf, unsigned long size, char *filename) { +#ifndef __LIBPAYLOAD__ unsigned long numbytes; FILE *image; @@ -1271,6 +1276,7 @@ int write_buf_to_file(unsigned char *buf, unsigned long size, char *filename) filename); return 1; } +#endif return 0; } diff --git a/layout.c b/layout.c index d719a05..c5a0245 100644 --- a/layout.c +++ b/layout.c @@ -136,9 +136,9 @@ int show_id(uint8_t *bios, int size, int force) } #endif -#ifndef __LIBPAYLOAD__ int read_romlayout(char *name) { +#ifndef __LIBPAYLOAD__ FILE *romlayout; char tempstr[256]; int i; @@ -191,8 +191,10 @@ int read_romlayout(char *name) fclose(romlayout); return 0; -} +#else + return -1; #endif +} int find_romentry(char *name) { diff --git a/nicintel.c b/nicintel.c index 2e6e46a..41c58f9 100644 --- a/nicintel.c +++ b/nicintel.c @@ -23,12 +23,14 @@ #include "flash.h" #include "programmer.h" +#define PCI_VENDOR_ID_INTEL 0x8086 + uint8_t *nicintel_bar; uint8_t *nicintel_control_bar; const struct pcidev_status nics_intel[] = { - {PCI_VENDOR_ID_INTEL, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"}, - {PCI_VENDOR_ID_INTEL, 0x1229, NT, "Intel", "82557/8/9/0/1 Ethernet Pro 100"}, + {0x8086, 0x1209, NT, "Intel", "8255xER/82551IT Fast Ethernet Controller"}, + {0x8086, 0x1229, NT, "Intel", "82557/8/9/0/1 Ethernet Pro 100"}, {}, }; -- 1.7.0.4
_______________________________________________ flashrom mailing list [email protected] http://www.flashrom.org/mailman/listinfo/flashrom
