payload/ubootcli: Minimal changes to fix build errors.
The libpayload build environment has been changed slightly and here are the
minimal changes to compile ubootcli under ebuild system:
- Allow overriding LIBPAYLOAD_DIR.
- Include only single libpayload.a.
- Revise build flags.
- Increase heap/stack size so video console init is fine.
- Remove abort() which may be defined in libpayload.
- Change weak link default function to non-inline (so it will be provided).
BUG=none
TEST=With a crafted ubootcli.ebuild:
emerge-nyan ubootcli # arm pass
emerge-rambi ubootcli # x86 pass
Change-Id: Icd3bd9f29a3682cd1a2c148a2a57ce44efe33664
Signed-off-by: Hung-Te Lin <hungte@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/199476
Reviewed-by: Julius Werner <jwerner@chromium.org>
This commit is contained in:
parent
395810c4b7
commit
366a2e44af
5 changed files with 28 additions and 33 deletions
|
|
@ -17,12 +17,12 @@
|
|||
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
##
|
||||
|
||||
include build/libpayload/libpayload.config
|
||||
|
||||
export src := $(shell pwd)
|
||||
export obj := $(src)/build
|
||||
|
||||
LIBPAYLOAD_DIR := $(obj)/libpayload
|
||||
LIBPAYLOAD_DIR ?= $(src)/../libpayload/install/libpayload
|
||||
|
||||
include $(LIBPAYLOAD_DIR)/libpayload.config
|
||||
|
||||
$(if $(wildcard .xcompile),,$(eval $(shell bash ../libpayload/util/xcompile/xcompile > .xcompile)))
|
||||
include .xcompile
|
||||
|
|
@ -32,15 +32,8 @@ ARCHDIR-$(CONFIG_LP_ARCH_X86) := x86
|
|||
|
||||
ARCH-y := $(ARCHDIR-y)
|
||||
|
||||
classes-$(CONFIG_LP_PCI) += build/libpayload/lib/libpci.a
|
||||
classes-$(CONFIG_LP_CURSES) += build/libpayload/lib/libcurses.a
|
||||
classes-$(CONFIG_LP_PDCURSES) += build/libpayload/lib/libmenu.a
|
||||
classes-$(CONFIG_LP_PDCURSES) += build/libpayload/lib/libform.a
|
||||
classes-$(CONFIG_LP_PDCURSES) += build/libpayload/lib/libpanel.a
|
||||
classes-$(CONFIG_LP_CBFS) += build/libpayload/lib/libcbfs.a
|
||||
classes-$(CONFIG_LP_LZMA) += build/libpayload/lib/liblzma.a
|
||||
classes-$(CONFIG_LP_LIBC) += build/libpayload/lib/libc.a
|
||||
headdoto= build/libpayload/lib/$(ARCHDIR-y)/head.o
|
||||
classes-y += $(LIBPAYLOAD_DIR)/lib/libpayload.a
|
||||
headdoto= $(LIBPAYLOAD_DIR)/lib/$(ARCHDIR-y)/head.o
|
||||
libraries := $(classes-y)
|
||||
|
||||
# If architecture folder name is different from GCC binutils architecture name,
|
||||
|
|
@ -58,22 +51,26 @@ READELF := $(READELF_$(ARCH-y))
|
|||
STRIP := $(STRIP_$(ARCH-y))
|
||||
AR := $(AR_$(ARCH-y))
|
||||
|
||||
CFLAGS_arm= -mfloat-abi=softfp -marm -mabi=aapcs
|
||||
CFLAGS_arm += -march=armv7-a -Os -fno-builtin
|
||||
CFLAGS_arm += -ffreestanding -fomit-frame-pointer
|
||||
CFLAGS_arm = -mthumb -march=armv7-a
|
||||
|
||||
LIBGCC_FILE_NAME := $(shell test -r `$(LPCC) -print-libgcc-file-name` && \
|
||||
$(LPCC) -print-libgcc-file-name)
|
||||
|
||||
OBJECTS-y=main.o command.o cmd_help.o cmd_license.o
|
||||
|
||||
OBJECTS-y := main.o command.o cmd_help.o cmd_license.o
|
||||
OBJECTS-y += $(libraries) $(LIBGCC_FILE_NAME)
|
||||
|
||||
CFLAGS= -Wall -Werror -Os $(FFLAGS-y) -Ibuild/libpayload/include -I.
|
||||
CFLAGS+= -Ibuild/libpayload/include/$(ARCHDIR-y)
|
||||
CFLAGS+= $(CFLAGS_$(ARCH-y))
|
||||
# Common build params from Depthcharge
|
||||
ABI_FLAGS := $(ARCH_ABI_FLAGS) -ffreestanding -fno-builtin \
|
||||
-fno-stack-protector -fomit-frame-pointer
|
||||
|
||||
CFLAGS= -Wall -Werror -g -Os $(FFLAGS-y) -I$(LIBPAYLOAD_DIR)/include -I.
|
||||
CFLAGS+= -I$(LIBPAYLOAD_DIR)/include/$(ARCHDIR-y)
|
||||
CFLAGS+= $(CFLAGS_$(ARCH-y)) $(ABI_FLAGS)
|
||||
CFLAGS+= -fdata-sections -ffunction-sections -std=gnu99
|
||||
|
||||
LDFLAGS=-Wl,-T,ubootcli.ldscript.$(ARCH-y) -static -nostartfiles -nostdlib
|
||||
LDFLAGS+=$(ARCH_LINK_FLAGS) $(ABI_FLAGS) -fuse-ld=bfd
|
||||
LDFLAGS+=-Wl,--gc-sections -Wl,-Map=$@.map
|
||||
LIBGCC=$(shell $(CC) -m32 -print-libgcc-file-name)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
../../libpayload/install/libpayload
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
/*
|
||||
* Board-specific Platform code can reimplement show_boot_progress () if needed
|
||||
*/
|
||||
void inline __show_boot_progress (int val) {}
|
||||
void __show_boot_progress (int val) {}
|
||||
void show_boot_progress (int val) __attribute__((weak, alias("__show_boot_progress")));
|
||||
|
||||
#define MAX_DELAY_STOP_STR 32
|
||||
|
|
@ -1087,15 +1087,12 @@ int do_run (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
|
|||
}
|
||||
#endif
|
||||
|
||||
void abort(void)
|
||||
{
|
||||
printf("abort()\n");
|
||||
while (1)
|
||||
die("abort");
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#if CONFIG_LP_SKIP_CONSOLE_INIT
|
||||
serial_console_init();
|
||||
video_console_init();
|
||||
#endif
|
||||
main_loop();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ OUTPUT_ARCH(arm)*/
|
|||
|
||||
ENTRY(_entry)
|
||||
|
||||
HEAP_SIZE = 16384;
|
||||
STACK_SIZE = 16384;
|
||||
/* The heap size must be large enough to contain video console buffer. */
|
||||
HEAP_SIZE = 65536;
|
||||
STACK_SIZE = 65536;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ OUTPUT_ARCH(i386)
|
|||
|
||||
ENTRY(_entry)
|
||||
|
||||
HEAP_SIZE = 16384;
|
||||
STACK_SIZE = 16384;
|
||||
/* The heap size must be large enough to contain video console buffer. */
|
||||
HEAP_SIZE = 65536;
|
||||
STACK_SIZE = 65536;
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue