2 ## This file is part of the coreboot project.
4 ## Copyright (C) 2008-2010 coresystems GmbH
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; version 2 of the License.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; if not, write to the Free Software
17 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 ramstage-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.S
21 ifeq ($(CONFIG_HAVE_SMI_HANDLER),y)
22 ramstage-srcs += $(obj)/cpu/x86/smm/smm_wrap
25 # Use TSEG specific entry point and linker script
26 ifeq ($(CONFIG_SMM_TSEG),y)
27 smm-y += smmhandler_tseg.S
28 SMM_LDFLAGS := $(LDFLAGS) -pie
29 SMM_LDSCRIPT := smm_tseg.ld
32 SMM_LDFLAGS := $(LDFLAGFS)
33 SMM_LDSCRIPT := smm.ld
39 $(obj)/cpu/x86/smm/smm.o: $$(smm-objs)
40 $(CC) $(LDFLAGS) -nostdlib -r -o $@ $^
42 $(obj)/cpu/x86/smm/smm_wrap: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/$(SMM_LDSCRIPT) $(obj)/ldoptions
43 $(CC) $(SMM_LDFLAGS) -nostdlib -nostartfiles -static -o $(obj)/cpu/x86/smm/smm.elf -T $(src)/cpu/x86/smm/$(SMM_LDSCRIPT) $(obj)/cpu/x86/smm/smm.o
44 $(NM) -n $(obj)/cpu/x86/smm/smm.elf | sort > $(obj)/cpu/x86/smm/smm.map
45 $(OBJCOPY) -O binary $(obj)/cpu/x86/smm/smm.elf $(obj)/cpu/x86/smm/smm
47 # change to the target path because objcopy will use the path name in its
49 $(obj)/cpu/x86/smm/smm_wrap.ramstage.o: $(obj)/cpu/x86/smm/smm_wrap
50 @printf " OBJCOPY $(subst $(obj)/,,$(@))\n"
51 cd $(obj)/cpu/x86/smm; $(OBJCOPY) -I binary smm -O elf32-i386 -B i386 smm_wrap.ramstage.o