From 5bb10282e978dd811246c921a16e535babfbac9a Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sun, 4 Oct 2009 12:30:44 +0000 Subject: [PATCH] This removes the uses of the buildrom utility and the coreboot.strip intermediate file. Signed-off-by: Patrick Georgi Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4718 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/arch/i386/Config.lb | 10 ---- src/arch/ppc/Config.lb | 7 +-- src/config/Config.lb | 12 ++--- src/config/coreboot_ram.ld | 2 +- util/buildrom/buildrom.c | 107 ------------------------------------- 5 files changed, 5 insertions(+), 133 deletions(-) delete mode 100644 util/buildrom/buildrom.c diff --git a/src/arch/i386/Config.lb b/src/arch/i386/Config.lb index 60b15906c3..3b5be31d91 100644 --- a/src/arch/i386/Config.lb +++ b/src/arch/i386/Config.lb @@ -44,16 +44,6 @@ end if CONFIG_USE_FAILOVER_IMAGE makedefine COREBOOT_APC:= makedefine COREBOOT_RAM_ROM:= - - makerule coreboot.rom - depends "coreboot.strip" - action "cp $< $@" - end -else - makerule coreboot.rom - depends "coreboot.strip buildrom" - action "./buildrom $< $@ /dev/null $(CONFIG_ROM_IMAGE_SIZE) $(CONFIG_ROM_SECTION_SIZE)" - end end makerule crt0.S diff --git a/src/arch/ppc/Config.lb b/src/arch/ppc/Config.lb index 0b06eef37e..ef7f140b93 100644 --- a/src/arch/ppc/Config.lb +++ b/src/arch/ppc/Config.lb @@ -1,12 +1,7 @@ ldscript init/ldscript.lb -makerule coreboot.strip - depends "coreboot" - action "cp $< $@" -end - makerule coreboot.rom - depends "coreboot.strip" + depends "coreboot" action "cp $< $@" end diff --git a/src/config/Config.lb b/src/config/Config.lb index 8c954d20bb..40dcf9bd19 100644 --- a/src/config/Config.lb +++ b/src/config/Config.lb @@ -33,9 +33,9 @@ end # action "perl -e 'foreach $$var (split(\" \", $$ENV{VARIABLES})) { if ($$ENV{$$var} =~ m/^(0x[0-9a-fA-F]+|0[0-7]+|[0-9]+)$$/) { print \"$$var = $$ENV{$$var};\n\"; }}' > $@" #end -makerule coreboot.strip +makerule coreboot.rom depends "coreboot" - action "$(CONFIG_OBJCOPY) -O binary coreboot coreboot.strip" + action "$(CONFIG_OBJCOPY) -O binary coreboot coreboot.rom" end makerule coreboot.a @@ -133,12 +133,6 @@ makerule coreboot action "$(CONFIG_CROSS_COMPILE)objdump -dS coreboot > coreboot.disasm" end -# the buildrom tool -makerule buildrom - depends "$(TOP)/util/buildrom/buildrom.c" - action "$(HOSTCC) -o $@ $<" -end - # Force crt0.s (which has build time version code in it to rebuild every time) makedefine .PHONY : crt0.s makerule crt0.s @@ -204,7 +198,7 @@ makerule clean action "rm -f ldscript.ld" action "rm -f a.out *.s *.l *.o *.E *.inc" action "rm -f TAGS tags romcc*" - action "rm -f docipl buildrom* chips.c *chip.c coreboot_apc* coreboot_ram* coreboot_pay*" + action "rm -f docipl chips.c *chip.c coreboot_apc* coreboot_ram* coreboot_pay*" action "rm -f build_opt_tbl* nrv2b* option_table.c option_table.h crt0.S crt0.disasm" action "rm -f smm smm.elf smm.map smm_bin.c" action "rm -f dsdt.aml dsdt.c" diff --git a/src/config/coreboot_ram.ld b/src/config/coreboot_ram.ld index 2934b2e6e2..5e988ffeaf 100644 --- a/src/config/coreboot_ram.ld +++ b/src/config/coreboot_ram.ld @@ -57,7 +57,7 @@ SECTIONS /* * kevinh/Ispiri - Added an align, because the objcopy tool * incorrectly converts sections that are not long word aligned. - * This breaks the coreboot.strip target. + * This breaks the coreboot.rom target. */ . = ALIGN(4); diff --git a/util/buildrom/buildrom.c b/util/buildrom/buildrom.c deleted file mode 100644 index f3efc96b3e..0000000000 --- a/util/buildrom/buildrom.c +++ /dev/null @@ -1,107 +0,0 @@ -#include -#include -#include -#include -#include -#include - - -/* this is the beginning of a tool which will eventually - * be able to build rom images with both fallback and - * normal. For now it just builds a single image - * into a rom iamge - */ -/* one switch we already need: -zero allowing you to tell what - * to do with numbers that are "zero": make them 0xff or whatever - * for flash - * For now we assume "zero" is 0xff - */ - -void usage() -{ - fprintf(stderr, "Usage: buildrom "); - fprintf(stderr, " \n"); - exit(1); -} - -void __attribute__((noreturn)) fatal(char *s) -{ - perror(s); - exit(2); -} - -int main(int argc, char *argv[]) -{ - int infd, payloadfd, outfd, size, readlen, writelen, i; - int romsize; - unsigned char *cp; - struct stat inbuf, payloadbuf; - char zero = 0xff; - - if (argc != 6) - usage(); - - infd = open(argv[1], O_RDONLY); - if (infd < 0) - fatal(argv[1]); - outfd = open(argv[2], O_RDWR | O_CREAT, 0666); - if (outfd < 0) - fatal(argv[2]); - payloadfd = open(argv[3], O_RDONLY); - if (payloadfd < 0) - fatal(argv[3]); - - size = strtol(argv[4], 0, 0); - romsize = strtol(argv[5], 0, 0); - - if (fstat(infd, &inbuf) < 0) - fatal("stat of infile"); - if (inbuf.st_size > size) { - fprintf(stderr, "coreboot image is %d bytes; only %d allowed\n", - (int)inbuf.st_size, size); - fatal("Coreboot input file larger than allowed size!\n"); - } - - if (fstat(payloadfd, &payloadbuf) < 0) - fatal("stat of infile"); - if (payloadbuf.st_size > (romsize - size)){ - fprintf(stderr, "ERROR: payload (%d) + coreboot (%d) - Size is %d bytes larger than ROM size (%d).\n", - (int)payloadbuf.st_size, size, - (int)(payloadbuf.st_size+size-romsize), - romsize); - exit(1); - } - - printf("Payload: %d coreboot: %d ROM size: %d Left space: %d\n", - (int)payloadbuf.st_size, size, romsize, - (int)(romsize-payloadbuf.st_size-size)); - - cp = malloc(romsize); - if (!cp) - fatal("malloc buffer"); - for (i = 0; i < romsize; i++) { - cp[i] = zero; - } - - /* read the input file in at the END of the array */ - readlen = read(infd, &cp[romsize - inbuf.st_size], inbuf.st_size); - if (readlen < inbuf.st_size) { - fprintf(stderr, "Wanted %d, got %d\n", (int)inbuf.st_size, readlen); - fatal("Read input file"); - } - - /* read the payload file in at the START of the array */ - readlen = read(payloadfd, cp, payloadbuf.st_size); - if (readlen < payloadbuf.st_size) { - fprintf(stderr, "Wanted %d, got %d\n", - (int)payloadbuf.st_size, readlen); - fatal("Read payload file"); - } - writelen = write(outfd, cp, romsize); - if (writelen < size) { - fprintf(stderr, "Wanted %d, got %d\n", size, writelen); - fatal("Write output file"); - } - - return 0; -}