summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Heymans <arthur@aheymans.xyz>2024-08-21 13:47:09 +0200
committerNico Huber <nico.h@gmx.de>2024-08-27 09:06:58 +0000
commit1dfe9dc46063c751e0bf3a4637e144c0da4d5502 (patch)
treec9de2c0c3cf3f6e80fbae665c4a03189cec15a58
parentb1cf21378d843bd97a8061569c2b9fc837b7bb84 (diff)
libpayload: Set reasonable arch defaults
This makes it easy to switch between x86_32 and x86_64 in payloads. Change-Id: I3ac5f24d83dc80db924e92b53403c477e6256c44 Signed-off-by: Arthur Heymans <arthur@aheymans.xyz> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84014 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nico Huber <nico.h@gmx.de>
-rw-r--r--payloads/coreinfo/Makefile2
-rw-r--r--payloads/libpayload/Makefile.payload20
-rw-r--r--payloads/nvramcui/Makefile1
3 files changed, 14 insertions, 9 deletions
diff --git a/payloads/coreinfo/Makefile b/payloads/coreinfo/Makefile
index 9655e24cc3..c8bf8f09fc 100644
--- a/payloads/coreinfo/Makefile
+++ b/payloads/coreinfo/Makefile
@@ -19,8 +19,6 @@ OBJECTS = cpuinfo_module.o cpuid.S.o pci_module.o coreboot_module.o \
OBJS = $(patsubst %,$(obj)/%,$(OBJECTS))
TARGET = $(obj)/coreinfo.elf
-ARCH := x86_32
-
all: real-all
include ../libpayload/Makefile.payload
diff --git a/payloads/libpayload/Makefile.payload b/payloads/libpayload/Makefile.payload
index 936698760b..d2860bf42d 100644
--- a/payloads/libpayload/Makefile.payload
+++ b/payloads/libpayload/Makefile.payload
@@ -32,14 +32,8 @@ DEFAULT_DEPS += $(PAYLOAD_DEPS)
obj ?= build
-ARCH ?=
OBJS ?=
CCACHE ?=
-
-CFLAGS = $(CFLAGS_$(ARCH))
-CFLAGS += -Os -ffreestanding
-CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wvla -Werror
-
STRIP ?= debug
$(TARGET):
@@ -78,6 +72,20 @@ $(error $(xcompile) deleted because it's invalid. \
Restarting the build should fix that, or explain the problem.)
endif
+ifeq ($(CONFIG_LP_ARCH_ARM),y)
+ARCH ?= arm
+else ifeq ($(CONFIG_LP_ARCH_X86_64),y)
+ARCH ?= x86_64
+else ifeq ($(CONFIG_LP_ARCH_X86_32),y)
+ARCH ?= x86_32
+else ifeq ($(CONFIG_LP_ARCH_ARM64),y)
+ARCH ?= arm64
+endif
+
+CFLAGS = $(CFLAGS_$(ARCH))
+CFLAGS += -Os -ffreestanding
+CFLAGS += -Wall -Wextra -Wmissing-prototypes -Wvla -Werror
+
# `lpgcc` in in-tree mode:
LPGCC = CC="$(CCACHE) $(CC_$(ARCH))"
LPGCC += _OBJ="$(LIBPAYLOAD_OBJ)"
diff --git a/payloads/nvramcui/Makefile b/payloads/nvramcui/Makefile
index cfe279bb54..a0662cf8dc 100644
--- a/payloads/nvramcui/Makefile
+++ b/payloads/nvramcui/Makefile
@@ -1,6 +1,5 @@
unexport $(COREBOOT_EXPORTS)
-ARCH = x86_32
OBJS = $(obj)/nvramcui.o
TARGET = $(obj)/nvramcui.elf