coreboot classes: Add dynamic classes to coreboot

Provide functionality to create dynamic classes based on program name and the
architecture for which the program needs to be compiled/linked. define_class
takes program_name and arch as its arguments and adds the program_name to
classes-y to create dynamic class and compiler toolset is created for the
specified arch. All the files for this program can then be added to
program_name-y += .. Ensure that define_class is called before any files are
added to the class. Check subdirs-y for order of directory inclusion.

One such example of dynamic class is rmodules. Multiple rmodules can be used
which need to be compiled for different architectures. With dynamic classes,
this is possible.

BUG=chrome-os-partner:30784
BRANCH=None
TEST=Compiles successfully for nyan, rush and link.

Original-Change-Id: I3e3aadbe723d432b9b3500c44bcff578c98f5643
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/209379
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Tested-by: Furquan Shaikh <furquan@chromium.org>
Original-Commit-Queue: Aaron Durbin <adurbin@chromium.org>
(cherry picked from commit 242bb90d7476c2ee47d60c50ee18785edeb1a295)

Some of this cherry-pick had already been committed here:
commit 133096b6dc
Signed-off-by: Marc Jones <marc.jones@se-eng.com>

Change-Id: I9f5868d704c4b3251ca6f54afa634588108a788c
Reviewed-on: http://review.coreboot.org/8672
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:
Furquan Shaikh 2014-07-22 15:59:16 -07:00 committed by Marc Jones
parent 74aa7770f6
commit fbff908a74
5 changed files with 15 additions and 4 deletions

View File

@ -118,6 +118,10 @@ ramstage-y += memset.S
ramstage-y += memcpy.S ramstage-y += memcpy.S
ramstage-y += memmove.S ramstage-y += memmove.S
ramstage-y += clock.c ramstage-y += clock.c
rmodules_arm-y += memset.S
rmodules_arm-y += memcpy.S
rmodules_arm-y += memmove.S
rmodules_arm-y += eabi_compat.c
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
$(objcbfs)/ramstage.debug: $$(ramstage-objs) $(src)/arch/arm/ramstage.ld $(obj)/ldoptions $(objcbfs)/ramstage.debug: $$(ramstage-objs) $(src)/arch/arm/ramstage.ld $(obj)/ldoptions

View File

@ -93,6 +93,6 @@ ramstage-c-ccopts += $(armv7_flags)
ramstage-S-ccopts += $(armv7_asm_flags) ramstage-S-ccopts += $(armv7_asm_flags)
# All rmodule code is armv7 if ramstage is armv7. # All rmodule code is armv7 if ramstage is armv7.
rmodules-c-ccopts += $(armv7_flags) rmodules_arm-c-ccopts += $(armv7_flags)
rmodules-S-ccopts += $(armv7_asm_flags) rmodules_arm-S-ccopts += $(armv7_asm_flags)
endif # CONFIG_ARCH_RAMSTAGE_ARMV7 endif # CONFIG_ARCH_RAMSTAGE_ARMV7

View File

@ -115,6 +115,10 @@ ramstage-y += ../../lib/memset.c
ramstage-y += ../../lib/memcpy.c ramstage-y += ../../lib/memcpy.c
ramstage-y += ../../lib/memmove.c ramstage-y += ../../lib/memmove.c
ramstage-y += stage_entry.S ramstage-y += stage_entry.S
rmodules_arm64-y += ../../lib/memset.c
rmodules_arm64-y += ../../lib/memcpy.c
rmodules_arm64-y += ../../lib/memmove.c
rmodules_arm64-y += eabi_compat.c
ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c) ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)

View File

@ -68,8 +68,8 @@ ramstage-y += ../tegra/usb.c
ramstage-y += timer.c ramstage-y += timer.c
ramstage-$(CONFIG_DRIVERS_UART) += uart.c ramstage-$(CONFIG_DRIVERS_UART) += uart.c
rmodules-y += monotonic_timer.c rmodules_$(ARCH-romstage-y)-y += monotonic_timer.c
VBOOT_STUB_DEPS += $(obj)/soc/nvidia/tegra124/monotonic_timer.rmodules.o VBOOT_STUB_DEPS += $(obj)/soc/nvidia/tegra124/monotonic_timer.rmodules_$(ARCH-romstage-y).o
CPPFLAGS_common += -Isrc/soc/nvidia/tegra124/include/ CPPFLAGS_common += -Isrc/soc/nvidia/tegra124/include/

View File

@ -48,6 +48,9 @@ ramstage-y += dp.c dp_lowlevel.c fimd.c
ramstage-y += usb.c ramstage-y += usb.c
ramstage-y += cbmem.c ramstage-y += cbmem.c
rmodules_$(ARCH-romstage-y)-y += monotonic_timer.c
rmodules_$(ARCH-romstage-y)-y += mct.c
$(objcbfs)/bootblock.raw.elf: $(objcbfs)/bootblock.elf $(objcbfs)/bootblock.raw.elf: $(objcbfs)/bootblock.elf
cp $< $@ cp $< $@