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>
This commit is contained in:
Arthur Heymans 2024-08-21 13:47:09 +02:00 committed by Nico Huber
commit 1dfe9dc460
3 changed files with 14 additions and 9 deletions

View file

@ -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

View file

@ -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)"

View file

@ -1,6 +1,5 @@
unexport $(COREBOOT_EXPORTS)
ARCH = x86_32
OBJS = $(obj)/nvramcui.o
TARGET = $(obj)/nvramcui.elf