the attached patch is the last infrastructure change necessary for
authorPatrick Georgi <patrick.georgi@coresystems.de>
Fri, 3 Apr 2009 12:52:43 +0000 (12:52 +0000)
committerPatrick Georgi <patrick.georgi@coresystems.de>
Fri, 3 Apr 2009 12:52:43 +0000 (12:52 +0000)
romfs.
Everything else to make a target romfs aware happens in the targets.

What the patch does:
1. missing romfs.h include
2. special handling while creating coreboot.rom
While the romfs code path in the makefile doesn't actually use the file,
it's possible that the build of coreboot.rom fails in a romfs setup,
because the individual buildrom image is too small to host both coreboot
and payloads (as the payloads aren't supposed to be there). Thus, a
special case to replace the payload with /dev/null in case of a romfs
build.
There would be cleaner ways, but they're not easily encoded in the
Config.lb format.
3. config.g is changed to create rules for a romfs build

Targets should still build (they do for me)

Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4049 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1

src/arch/i386/Config.lb
src/boot/hardwaremain.c
util/newconfig/config.g

index ec1dd1ee0d30126a7621d09c54b31b9fd1ec7d61..4c0241d69cb4f011eee086effbe9f7f75ed7b60b 100644 (file)
@@ -79,8 +79,8 @@ if USE_FAILOVER_IMAGE
        end
 else
        makerule coreboot.rom 
-               depends "coreboot.strip buildrom $(PAYLOAD-1)" 
-               action "./buildrom $< $@ $(PAYLOAD-1) $(ROM_IMAGE_SIZE) $(ROM_SECTION_SIZE)"
+               depends "coreboot.strip buildrom $(PAYLOAD-1)"
+               action "PAYLOAD=$(PAYLOAD-1); if [ $(CONFIG_ROMFS) -eq 1 ]; then PAYLOAD=/dev/null; fi; ./buildrom $< $@ $$PAYLOAD $(ROM_IMAGE_SIZE) $(ROM_SECTION_SIZE)"
        end
 end
 
index bf2853a4b93d57433b5b3b84c5934d1efbdc59ae..74f3dfcd972b75d65a8f32277a9256466390b66c 100644 (file)
@@ -36,6 +36,7 @@ it with the version available from LANL.
 #include <part/hard_reset.h>
 #include <part/init_timer.h>
 #include <boot/elf.h>
+#include <romfs.h>
 
 /**
  * @brief Main function of the DRAM part of coreboot.
index eddff03092baa90aa2eed5fc05dc5373303d9a6e..c2f7e20aed7fd216a10b2ed3a59bafd5bf25d97c 100644 (file)
@@ -22,7 +22,9 @@ global_uses_options = {}
 global_exported_options = []
 romimages = {}
 buildroms = []
+rommapping = {}
 curimage = 0
+bootblocksize = 0
 alloptions = 0 # override uses at top level
 
 local_path = re.compile(r'^\.')
@@ -277,8 +279,11 @@ class romimage:
                self.arch = arch
 
        def setpayload(self, payload):
+               global rommapping
                self.payload = payload
 
+               rommapping[self.name] = payload
+
        def setinitfile(self, initfile):
                self.initfile = initfile
 
@@ -1351,7 +1356,10 @@ def startromimage(name):
 
 def endromimage():
        global curimage
+       global bootblocksize
        mainboard()
+       imagesize = getoption("ROM_IMAGE_SIZE", curimage)
+       bootblocksize += imagesize
        print "End ROMIMAGE"
        curimage = 0
        #curpart = 0
@@ -2209,16 +2217,22 @@ def writeimagemakefile(image):
 
 #
 def writemakefile(path):
+       global rommapping
+       global bootblocksize
        makefilepath = os.path.join(path, "Makefile")
        print "Creating", makefilepath
        file = safe_open(makefilepath, 'w+')
        writemakefileheader(file, makefilepath)
 
        # main rule
-       file.write("\nall:")
+       file.write("\nall: romtool")
        for i in buildroms:
-               file.write(" %s" % i.name)
+               file.write(" %sfs" % i.name)
        file.write("\n\n")      
+
+       # romtool rules
+       file.write("\nromtool:\n\tcd $(TOP)/util/romtool; make\n")
+
        file.write("include Makefile.settings\n\n")
        for i, o in romimages.items():
                file.write("%s/coreboot.rom:\n" % o.getname())
@@ -2245,9 +2259,26 @@ def writemakefile(path):
                for j in i.roms:
                        file.write(" %s/coreboot.rom " % j)
                file.write("> %s\n\n" %i.name)
+               # build the bootblock here as well. 
+               file.write("\n")
+               file.write("\t cat ")
+               for j in i.roms:
+                       file.write(" %s/coreboot.strip " % j)
+               file.write("> %s.bootblock\n\n" %i.name)
+
+       romsize = getoption("ROM_SIZE", image)
+       # i.name? That can not be right, can it? 
+       file.write("%sfs: %s $(TOP)/util/romtool/romtool\n" %(i.name,i.name));
+       file.write("\trm -f coreboot.romfs\n");
+       file.write("\t$(TOP)/util/romtool/romtool %sfs create %s %s %s.bootblock\n" % (i.name, romsize, bootblocksize, i.name))
+       for i in buildroms:
+               for j in i.roms:
+                       #failover is a hack that will go away soon. 
+                       if (j != "failover") and (rommapping[j] != "/dev/null"):
+                               file.write("\t $(TOP)/util/romtool/romtool %sfs add-payload %s %s/payload\n" % (i.name, rommapping[j], j))
+               file.write("\t $(TOP)/util/romtool/romtool %sfs print\n" % i.name)
 
-
-       file.write(".PHONY: all clean")
+       file.write(".PHONY: all clean romtool")
        for i in romimages.keys():
                file.write(" %s-clean" % i)
        for i, o in romimages.items():