summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2013-01-23 10:20:16 -0800
committerChromeBot <chrome-bot@google.com>2013-01-23 13:23:05 -0800
commit61a2eb389d9903b1b5a88d3e11ad5d713b3a364a (patch)
treeefe51e936d236df8f819541e4709b4148d6e28b3
parent59d7508c2261a8371715b28f663b8b2efbb5a895 (diff)
downloadvboot-61a2eb389d9903b1b5a88d3e11ad5d713b3a364a.tar.gz
Fix architecture definitions.
We should use only arm, x86, and x86_64; currently we also use i386 to mean x86, and amd64 to mean x86_64. BUG=chromium-os:26317 BRANCH=none TEST=manual sudo FEATURES=test emerge vboot_reference FEATURES=test emerge-link vboot_reference chromeos-u-boot chromeos-installer FEATURES=test emerge-daisy vboot_reference chromeos-u-boot chromeos-installer FEATURES=test emerge-x86-alex vboot_reference chromeos-installer make && make runtests (both inside and outside chroot) Change-Id: I4fb64fafa9c48a76ded862e074776cab9ea54ab3 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41838 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--Makefile46
-rw-r--r--firmware/arch/x86/include/biosincludes.h (renamed from firmware/arch/i386/include/biosincludes.h)0
l---------host/arch/x86_64/lib/crossystem_arch.c (renamed from host/arch/amd64/lib/crossystem_arch.c)0
3 files changed, 25 insertions, 21 deletions
diff --git a/Makefile b/Makefile
index bb5b91c3..7c094015 100644
--- a/Makefile
+++ b/Makefile
@@ -52,6 +52,29 @@ ifeq (${V},)
Q := @
endif
+# Architecture detection
+_machname := $(shell uname -m)
+HOST_ARCH ?= ${_machname}
+
+# ARCH and/or FIRMWARE_ARCH are defined by the Chromium OS ebuild.
+# Pick a sane target architecture if none is defined.
+ifeq (${ARCH},)
+ ARCH := ${HOST_ARCH}
+else ifeq (${ARCH},i386)
+ override ARCH := x86
+else ifeq (${ARCH},amd64)
+ override ARCH := x86_64
+endif
+
+# FIRMWARE_ARCH is only defined by the Chromium OS ebuild if compiling
+# for a firmware target (such as u-boot or depthcharge). It must map
+# to the same consistent set of architectures as the host.
+ifeq (${FIRMWARE_ARCH},i386)
+ override FIRMWARE_ARCH := x86
+else ifeq (${FIRMWARE_ARCH},amd64)
+ override FIRMWARE_ARCH := x86_64
+endif
+
# Provide default CC and CFLAGS for firmware builds; if you have any -D flags,
# please add them after this point (e.g., -DVBOOT_DEBUG).
#
@@ -75,7 +98,7 @@ CFLAGS ?= -march=armv5 \
-fno-common -ffixed-r8 \
-mfloat-abi=hard -marm -mabi=aapcs-linux -mno-thumb-interwork \
${COMMON_FLAGS}
-else ifeq (${FIRMWARE_ARCH}, i386)
+else ifeq (${FIRMWARE_ARCH}, x86)
CC ?= i686-pc-linux-gnu-gcc
# Drop -march=i386 to permit use of SSE instructions
CFLAGS ?= \
@@ -116,32 +139,13 @@ LD = ${CC}
CXX ?= g++ # HEY: really?
PKG_CONFIG ?= pkg-config
-# Architecture detection. If we're cross-compiling, we may need to run unit
-# tests inside QEMU.
-_machname := $(shell uname -m)
-HOST_ARCH ?= ${_machname}
-
-# Note: ARCH is defined by the Chromium OS ebuild. Pick a sane target
-# architecture if none is defined.
-ifeq (${ARCH},)
- ARCH := ${HOST_ARCH}
- ifeq (${ARCH}, x86_64)
- ARCH := amd64
- endif
-endif
-
# Determine QEMU architecture needed, if any
ifeq (${ARCH},${HOST_ARCH})
# Same architecture; no need for QEMU
QEMU_ARCH :=
-else ifeq (${HOST_ARCH}-${ARCH},x86_64-i386)
+else ifeq (${HOST_ARCH}-${ARCH},x86_64-x86)
# 64-bit host can run 32-bit targets directly
QEMU_ARCH :=
-else ifeq (${HOST_ARCH}-${ARCH},x86_64-amd64)
- # 64-bit host can run 64-bit directly
- QEMU_ARCH :=
-else ifeq (${ARCH},amd64)
- QEMU_ARCH := x86_64
else
QEMU_ARCH := ${ARCH}
endif
diff --git a/firmware/arch/i386/include/biosincludes.h b/firmware/arch/x86/include/biosincludes.h
index 5f6b1cc2..5f6b1cc2 100644
--- a/firmware/arch/i386/include/biosincludes.h
+++ b/firmware/arch/x86/include/biosincludes.h
diff --git a/host/arch/amd64/lib/crossystem_arch.c b/host/arch/x86_64/lib/crossystem_arch.c
index 1f5d6522..1f5d6522 120000
--- a/host/arch/amd64/lib/crossystem_arch.c
+++ b/host/arch/x86_64/lib/crossystem_arch.c