From b987f7bb3f69eabfb5eb515041bbcabb36d1ccf8 Mon Sep 17 00:00:00 2001 From: Stefan Reinauer Date: Sun, 30 May 2010 13:44:32 +0000 Subject: don't generate C source code file but use objcopy to include the SMM blob. Signed-off-by: Stefan Reinauer Acked-by: Stefan Reinauer git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5600 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- src/cpu/x86/smm/Makefile.inc | 18 ++++++++---------- src/southbridge/intel/i82801dx/i82801dx_smi.c | 6 +++--- src/southbridge/intel/i82801gx/i82801gx_smi.c | 6 +++--- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/cpu/x86/smm/Makefile.inc b/src/cpu/x86/smm/Makefile.inc index 9ea1022603..42413510e9 100644 --- a/src/cpu/x86/smm/Makefile.inc +++ b/src/cpu/x86/smm/Makefile.inc @@ -1,12 +1,11 @@ ## ## This file is part of the coreboot project. ## -## Copyright (C) 2008 coresystems GmbH +## Copyright (C) 2008-2010 coresystems GmbH ## ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by -## the Free Software Foundation; either version 2 of the License, or -## (at your option) any later version. +## the Free Software Foundation; version 2 of the License. ## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -19,7 +18,7 @@ ## obj-$(CONFIG_HAVE_SMI_HANDLER) += smmrelocate.o -obj-$(CONFIG_HAVE_SMI_HANDLER) += smm_bin.o +obj-$(CONFIG_HAVE_SMI_HANDLER) += smm_wrap.o smmobj-y += smmhandler.o smmobj-y += smihandler.o @@ -33,10 +32,9 @@ $(obj)/cpu/x86/smm/smm: $(obj)/cpu/x86/smm/smm.o $(src)/cpu/x86/smm/smm.ld $(obj $(NM) -n $(obj)/cpu/x86/smm/smm.elf | sort > $(obj)/cpu/x86/smm/smm.map $(OBJCOPY) -O binary $(obj)/cpu/x86/smm/smm.elf $(obj)/cpu/x86/smm/smm -$(obj)/cpu/x86/smm/smm_bin.c: $(obj)/cpu/x86/smm/smm - (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 ';') > $@ - -$(obj)/cpu/x86/smm/smm_bin.o: $(obj)/cpu/x86/smm/smm_bin.c - @printf " CC $(subst $(obj)/,,$(@))\n" - $(CC) $(CFLAGS) -c -o $@ $< +# change to the target path because objcopy will use the path name in its +# ELF symbol names. +$(obj)/cpu/x86/smm/smm_wrap.o: $(obj)/cpu/x86/smm/smm + @printf " OBJCOPY $(subst $(obj)/,,$(@))\n" + cd $(obj)/cpu/x86/smm; $(OBJCOPY) -I binary smm -O elf32-i386 -B i386 smm_wrap.o diff --git a/src/southbridge/intel/i82801dx/i82801dx_smi.c b/src/southbridge/intel/i82801dx/i82801dx_smi.c index a1277b03a4..e63fb501f2 100644 --- a/src/southbridge/intel/i82801dx/i82801dx_smi.c +++ b/src/southbridge/intel/i82801dx/i82801dx_smi.c @@ -30,8 +30,8 @@ #include #include "i82801dx.h" -extern unsigned char smm[]; -extern unsigned int smm_len; +extern unsigned char _binary_smm_start; +extern unsigned char _binary_smm_size; /* I945 */ #define SMRAM 0x90 @@ -325,7 +325,7 @@ static void smm_install(void) D_OPEN | G_SMRAME | C_BASE_SEG); /* copy the real SMM handler */ - memcpy((void *)0xa0000, smm, smm_len); + memcpy((void *)0xa0000, &_binary_smm_start, (size_t)&_binary_smm_size); wbinvd(); /* close the SMM memory window and enable normal SMM */ diff --git a/src/southbridge/intel/i82801gx/i82801gx_smi.c b/src/southbridge/intel/i82801gx/i82801gx_smi.c index 3ba21b0dd1..0d15ca50f5 100644 --- a/src/southbridge/intel/i82801gx/i82801gx_smi.c +++ b/src/southbridge/intel/i82801gx/i82801gx_smi.c @@ -30,8 +30,8 @@ #include #include "i82801gx.h" -extern unsigned char smm[]; -extern unsigned int smm_len; +extern unsigned char _binary_smm_start; +extern unsigned char _binary_smm_size; /* I945 */ #define SMRAM 0x9d @@ -325,7 +325,7 @@ static void smm_install(void) D_OPEN | G_SMRAME | C_BASE_SEG); /* copy the real SMM handler */ - memcpy((void *)0xa0000, smm, smm_len); + memcpy((void *)0xa0000, &_binary_smm_start, (size_t)&_binary_smm_size); wbinvd(); /* close the SMM memory window and enable normal SMM */ -- cgit v1.2.3