diff --git a/EdkUnixPkg/Sec/SecMain.c b/EdkUnixPkg/Sec/SecMain.c
index 72fad08e64..04df255277 100644
--- a/EdkUnixPkg/Sec/SecMain.c
+++ b/EdkUnixPkg/Sec/SecMain.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2007 Intel Corporation.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -173,6 +173,9 @@ Returns:
CHAR16 *MemorySizeStr;
CHAR16 *FirmwareVolumesStr;
+ setbuf(stdout, 0);
+ setbuf(stderr, 0);
+
MemorySizeStr = (CHAR16 *)PcdGetPtr (PcdUnixMemorySizeForSecMain);
FirmwareVolumesStr = (CHAR16 *)PcdGetPtr (PcdUnixFirmwareVolume);
diff --git a/EdkUnixPkg/Sec/SecMain_build.xml b/EdkUnixPkg/Sec/SecMain_build.xml
index c1a5caf267..db5ae8db94 100644
--- a/EdkUnixPkg/Sec/SecMain_build.xml
+++ b/EdkUnixPkg/Sec/SecMain_build.xml
@@ -1,6 +1,6 @@
+
+
diff --git a/Tools/CCode/Source/FwImage/fwimage.c b/Tools/CCode/Source/FwImage/fwimage.c
index 97229ce09e..f51f824e22 100644
--- a/Tools/CCode/Source/FwImage/fwimage.c
+++ b/Tools/CCode/Source/FwImage/fwimage.c
@@ -25,7 +25,7 @@ Abstract:
// List of OS and CPU which support ELF to PE conversion
//
#if defined(linux)
-#if defined(i386)
+#if defined (__i386__) || defined(__x86_64__)
#define HAVE_ELF
#endif
#endif
diff --git a/Tools/Conf/tools_def.template b/Tools/Conf/tools_def.template
index 9a99fa4c79..2f6e953548 100644
--- a/Tools/Conf/tools_def.template
+++ b/Tools/Conf/tools_def.template
@@ -404,7 +404,11 @@ RELEASE_VS2005PRO_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF
*_ELFGCC_IA32_PP_NAME = gcc
*_ELFGCC_IA32_VFRPP_NAME = gcc
-*_ELFGCC_IA32_CC_FLAGS = -g -fshort-wchar -Wall -Werror -c -include ${DEST_DIR_DEBUG}/AutoGen.h -DSTRING_ARRAY_NAME=${BASE_NAME}Strings
+*_ELFGCC_IA32_CC_FLAGS = -m32 -g -fshort-wchar -Wall -Werror -c -include ${DEST_DIR_DEBUG}/AutoGen.h -DSTRING_ARRAY_NAME=${BASE_NAME}Strings
+*_ELFGCC_IA32_DLINK_FLAGS = -melf_i386 -nostdlib -n -q -Ttext 0x220 --entry ${ENTRYPOINT} -u ${ENTRYPOINT}
+*_ELFGCC_IA32_ASM_FLAGS = -m32 -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=name
+*_ELFGCC_IA32_PP_FLAGS = -m32 -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h
+
*_ELFGCC_*_DLINK_FLAGS = -nostdlib -n -q -Ttext 0x220 --entry ${ENTRYPOINT} -u ${ENTRYPOINT}
*_ELFGCC_*_ASM_FLAGS = -c -imacros ${DEST_DIR_DEBUG}/AutoGen.h -DASM_PFX(name)=name
*_ELFGCC_*_PP_FLAGS = -E -x assembler-with-cpp -include ${DEST_DIR_DEBUG}/AutoGen.h