direct-io.hg

changeset 7345:68e754d7e1cb

Fix firmware build for cross-compilation.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kaf24@firebug.cl.cam.ac.uk
date Wed Oct 12 13:03:10 2005 +0100 (2005-10-12)
parents def91f2dbc89
children 26599c5d298d
files tools/firmware/acpi/acpi_gen.c tools/firmware/vmxassist/Makefile
line diff
     1.1 --- a/tools/firmware/acpi/acpi_gen.c	Wed Oct 12 11:47:16 2005 +0100
     1.2 +++ b/tools/firmware/acpi/acpi_gen.c	Wed Oct 12 13:03:10 2005 +0100
     1.3 @@ -16,44 +16,38 @@
     1.4   *
     1.5   */
     1.6  #include "acpi2_0.h"
     1.7 -#include "stdio.h"
     1.8 -
     1.9 -/*
    1.10 - * Generate acpi table
    1.11 - * write acpi table to binary: acpitable.bin
    1.12 - *
    1.13 - */
    1.14 - 
    1.15 -#define USAGE "Usage: acpi_gen filename \n" \
    1.16 -			  "       generage acpitable and write to the binary \n" \
    1.17 -			  "       filename - the binary name\n"
    1.18 -
    1.19 -
    1.20 -int main(int argc, char** argv){
    1.21 -		char* filename;
    1.22 -		char  buf[ACPI_TABLE_SIZE];
    1.23 -		FILE* f=NULL;
    1.24 -		int i;
    1.25 +#include <stdio.h>
    1.26 +#include <stdlib.h>
    1.27 +#include <unistd.h>
    1.28  
    1.29 -		for (i=0; i<ACPI_TABLE_SIZE; i++){
    1.30 -				buf[i]=0;
    1.31 -		}
    1.32 +#define USAGE	"Usage: acpi_gen filename \n"				\
    1.33 +		"       generage acpitable and write to the binary \n"	\
    1.34 +		"       filename - the binary name\n"
    1.35  
    1.36 -		if (argc<2){
    1.37 -				fprintf(stderr,"%s",USAGE);
    1.38 -				exit(1);
    1.39 -		}
    1.40 +int main(int argc, char **argv)
    1.41 +{
    1.42 +	char *filename;
    1.43 +	char  buf[ACPI_TABLE_SIZE] = { 0 };
    1.44 +	FILE *f;
    1.45  
    1.46 -		filename = argv[1];
    1.47 +	if (argc < 2) {
    1.48 +		fprintf(stderr,"%s",USAGE);
    1.49 +		exit(1);
    1.50 +	}
    1.51 +
    1.52 +	filename = argv[1];
    1.53  		
    1.54 -		if(!(f=fopen(filename, "w+"))){
    1.55 -				fprintf(stderr,"Can not open %s",filename);
    1.56 -				exit(1);
    1.57 -		}		
    1.58 -        AcpiBuildTable(buf);
    1.59 -		if (fwrite(buf, ACPI_TABLE_SIZE, 1, f)<1){
    1.60 -				fprintf(stderr,"Can not write to %s\n",filename);
    1.61 -				exit(1);
    1.62 -		}
    1.63 -		return 0;		
    1.64 +	if ((f = fopen(filename, "w+")) == NULL) {
    1.65 +		fprintf(stderr,"Can not open %s", filename);
    1.66 +		exit(1);
    1.67 +	}
    1.68 +
    1.69 +	AcpiBuildTable((uint8_t *)buf);
    1.70 +
    1.71 +	if (fwrite(buf, ACPI_TABLE_SIZE, 1, f) < 1) {
    1.72 +		fprintf(stderr,"Can not write to %s\n", filename);
    1.73 +		exit(1);
    1.74 +	}
    1.75 +
    1.76 +	return 0;
    1.77  }
     2.1 --- a/tools/firmware/vmxassist/Makefile	Wed Oct 12 11:47:16 2005 +0100
     2.2 +++ b/tools/firmware/vmxassist/Makefile	Wed Oct 12 13:03:10 2005 +0100
     2.3 @@ -24,14 +24,14 @@ include $(XEN_ROOT)/tools/Rules.mk
     2.4  # The emulator code lives in ROM space
     2.5  TEXTADDR=0x000D0000
     2.6  
     2.7 -DEFINES=-DDEBUG -DTEXTADDR=${TEXTADDR}
     2.8 +DEFINES=-DDEBUG -DTEXTADDR=$(TEXTADDR)
     2.9  XENINC=-I$(XEN_ROOT)/tools/libxc
    2.10  
    2.11  LD       = ld
    2.12  CC       = gcc
    2.13  CPP      = cpp -P
    2.14  OBJCOPY  = objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0
    2.15 -CFLAGS   = ${DEFINES} -I. $(XENINC) -Wall -fno-builtin -O2 -msoft-float
    2.16 +CFLAGS   = $(DEFINES) -I. $(XENINC) -Wall -fno-builtin -O2 -msoft-float
    2.17  CFLAGS  += -m32 -march=i686
    2.18  LDFLAGS  = -m elf_i386
    2.19  
    2.20 @@ -40,33 +40,33 @@ OBJECTS = head.o trap.o vm86.o setup.o u
    2.21  all: vmxloader
    2.22  
    2.23  vmxloader: roms.h vmxloader.c acpi.h acpi_madt.c
    2.24 -	${CC} ${CFLAGS} ${DEFINES} -c vmxloader.c -c acpi_madt.c
    2.25 +	$(CC) $(CFLAGS) $(DEFINES) -c vmxloader.c -c acpi_madt.c
    2.26  	$(CC) -o vmxloader.tmp -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,0x100000 vmxloader.o acpi_madt.o
    2.27  	objcopy vmxloader.tmp vmxloader
    2.28  	rm -f vmxloader.tmp
    2.29  
    2.30 -vmxassist.bin: vmxassist.ld ${OBJECTS}
    2.31 -	${CPP} ${DEFINES} vmxassist.ld > vmxassist.tmp
    2.32 -	${LD} -o vmxassist ${LDFLAGS} -nostdlib --fatal-warnings -N -T vmxassist.tmp ${OBJECTS}
    2.33 +vmxassist.bin: vmxassist.ld $(OBJECTS)
    2.34 +	$(CPP) $(DEFINES) vmxassist.ld > vmxassist.tmp
    2.35 +	$(LD) -o vmxassist $(LDFLAGS) -nostdlib --fatal-warnings -N -T vmxassist.tmp $(OBJECTS)
    2.36  	nm -n vmxassist > vmxassist.sym
    2.37 -	${OBJCOPY} vmxassist vmxassist.tmp
    2.38 +	$(OBJCOPY) vmxassist vmxassist.tmp
    2.39  	dd if=vmxassist.tmp of=vmxassist.bin ibs=512 conv=sync
    2.40  	rm -f vmxassist.tmp
    2.41  
    2.42  head.o: machine.h head.S
    2.43 -	${CC} ${CFLAGS} -D__ASSEMBLY__ ${DEFINES} -c head.S
    2.44 +	$(CC) $(CFLAGS) -D__ASSEMBLY__ $(DEFINES) -c head.S
    2.45  
    2.46  trap.o: machine.h offsets.h trap.S
    2.47 -	${CC} ${CFLAGS} -D__ASSEMBLY__ ${DEFINES} -c trap.S
    2.48 +	$(CC) $(CFLAGS) -D__ASSEMBLY__ $(DEFINES) -c trap.S
    2.49  
    2.50  vm86.o: machine.h vm86.c
    2.51 -	${CC} ${CFLAGS} -c vm86.c
    2.52 +	$(CC) $(CFLAGS) -c vm86.c
    2.53  
    2.54  setup.o: machine.h setup.c
    2.55 -	${CC} ${CFLAGS} -c setup.c
    2.56 +	$(CC) $(CFLAGS) -c setup.c
    2.57  
    2.58  util.o: machine.h util.c
    2.59 -	${CC} ${CFLAGS} -c util.c
    2.60 +	$(CC) $(CFLAGS) -c util.c
    2.61  
    2.62  roms.h:	../rombios/BIOS-bochs-latest ../vgabios/VGABIOS-lgpl-latest.bin ../vgabios/VGABIOS-lgpl-latest.cirrus.bin vmxassist.bin
    2.63  	./mkhex rombios ../rombios/BIOS-bochs-latest > roms.h
    2.64 @@ -81,10 +81,10 @@ offsets.h: gen
    2.65  	./gen > offsets.h
    2.66  
    2.67  gen:	gen.c
    2.68 -	${CC} ${CFLAGS} -o gen gen.c
    2.69 +	$(HOSTCC) $(HOSTCFLAGS) -I. $(XENINC) -o gen gen.c
    2.70  
    2.71  clean:
    2.72  	rm -f vmxassist vmxassist.tmp vmxassist.bin vmxassist.run vmxassist.sym head.s roms.h acpi.h
    2.73 -	rm -f vmxloader vmxloader.tmp vmxloader.o ${OBJECTS}
    2.74 +	rm -f vmxloader vmxloader.tmp vmxloader.o $(OBJECTS)
    2.75  	rm -f gen gen.o offsets.h
    2.76