blob: 014c2c792d886e7cdbf6fe3cdf7df88b801f1974 [file] [log] [blame]
Patrick Georgi0588d192009-08-12 15:00:51 +00001##
2## This file is part of the coreboot project.
3##
4## Copyright (C) 2008 coresystems GmbH
5##
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; either version 2 of the License, or
9## (at your option) any later version.
10##
11## This program is distributed in the hope that it will be useful,
12## but WITHOUT ANY WARRANTY; without even the implied warranty of
13## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14## GNU General Public License for more details.
15##
16## You should have received a copy of the GNU General Public License
17## along with this program; if not, write to the Free Software
18## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19##
20
Stefan Reinauerc35a4512009-10-24 17:59:36 +000021obj-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.o
Stefan Reinauer60fc92a2009-10-24 03:33:44 +000022obj-$(CONFIG_HAVE_SMI_HANDLER) += smm_bin.o
23
Stefan Reinauerc35a4512009-10-24 17:59:36 +000024smmobj-y += smmhandler.o
Stefan Reinauer60fc92a2009-10-24 03:33:44 +000025smmobj-y += smihandler.o
26smmobj-y += smiutil.o
27
28ifdef POST_EVALUATION
29
Stefan Reinauerc35a4512009-10-24 17:59:36 +000030$(obj)/cpu/x86/smm/smm.o: $(smmobjs) $(obj)/console/printk.o $(obj)/console/vtxprintf.o $(LIBGCC_FILE_NAME)
Stefan Reinauer60fc92a2009-10-24 03:33:44 +000031 $(CC) $(LDFLAGS) -nostdlib -r -o $@ $^
32
Stefan Reinauerc35a4512009-10-24 17:59:36 +000033$(obj)/cpu/x86/smm/smm: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/smm.ld $(obj)/ldoptions
Myles Watsona0681642009-10-27 15:53:27 +000034 $(CC) $(LDFLAGS) -nostdlib -nostartfiles -static -o $(obj)/cpu/x86/smm/smm.elf -T $(src)/cpu/x86/smm/smm.ld $(obj)/cpu/x86/smm/smm.o
35 $(CONFIG_CROSS_COMPILE)nm -n $(obj)/cpu/x86/smm/smm.elf | sort > $(obj)/cpu/x86/smm/smm.map
36 $(OBJCOPY) -O binary $(obj)/cpu/x86/smm/smm.elf $(obj)/cpu/x86/smm/smm
Stefan Reinauer60fc92a2009-10-24 03:33:44 +000037
38$(obj)/cpu/x86/smm/smm_bin.c: $(obj)/cpu/x86/smm/smm
Myles Watsona0681642009-10-27 15:53:27 +000039 (echo 'unsigned char smm[] = {'; od -vtx1 $(obj)/cpu/x86/smm/smm | sed -e 's,^[0-9]* *,,' -e 's:[0-9a-f][0-9a-f] :0x&,:g' -e 's:[0-9a-f][0-9a-f]$$:0x&,:'; echo '}; unsigned int smm_len = '; wc -c $(obj)/cpu/x86/smm/smm |awk '{print $$1;}' ; echo ';') > $@
Stefan Reinauer60fc92a2009-10-24 03:33:44 +000040
Patrick Georgi020f51f2010-03-14 21:25:03 +000041$(obj)/cpu/x86/smm/smm_bin.o: $(obj)/cpu/x86/smm/smm_bin.c
42 @printf " CC $(subst $(obj)/,,$(@))\n"
43 $(CC) $(CFLAGS) -c -o $@ $<
44
Stefan Reinauer60fc92a2009-10-24 03:33:44 +000045endif
46