Skip to content

Commit b0164e6

Browse files
payloads/bareflank: initial commit
Signed-off-by: Krystian Hebel <[email protected]>
1 parent bc58355 commit b0164e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+9709
-0
lines changed

payloads/Kconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,14 @@ config COREINFO_SECONDARY_PAYLOAD
124124
coreinfo can be loaded as a secondary payload under SeaBIOS, GRUB,
125125
or any other payload that can load additional payloads.
126126

127+
config BAREFLANK_SECONDARY_PAYLOAD
128+
bool "Load Bareflank as a secondary payload"
129+
default n
130+
depends on ARCH_X86
131+
help
132+
Bareflank can be loaded as a secondary payload under SeaBIOS, GRUB,
133+
or any other payload that can load additional payloads.
134+
127135
config MEMTEST_SECONDARY_PAYLOAD
128136
bool "Load Memtest86+ as a secondary payload"
129137
default n

payloads/Makefile.inc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
## GNU General Public License for more details.
1414
##
1515

16+
cbfs-files-$(CONFIG_BAREFLANK_SECONDARY_PAYLOAD) += img/bareflank
17+
img/bareflank-file := payloads/bareflank/build/bareflank.elf
18+
img/bareflank-type := payload
19+
img/bareflank-compression := $(CBFS_SECONDARY_PAYLOAD_COMPRESS_FLAG)
20+
1621
cbfs-files-$(CONFIG_COREINFO_SECONDARY_PAYLOAD) += img/coreinfo
1722
img/coreinfo-file := payloads/coreinfo/build/coreinfo.elf
1823
img/coreinfo-type := payload
@@ -24,6 +29,7 @@ img/nvramcui-type := payload
2429
img/nvramcui-compression := $(CBFS_SECONDARY_PAYLOAD_COMPRESS_FLAG)
2530

2631
PAYLOADS_LIST=\
32+
payloads/bareflank \
2733
payloads/coreinfo \
2834
payloads/nvramcui \
2935
payloads/libpayload \
@@ -38,6 +44,9 @@ payloads/external/GRUB2 \
3844
payloads/external/LinuxBoot \
3945
payloads/external/Yabits \
4046

47+
payloads/bareflank/build/bareflank.elf bareflank:
48+
$(MAKE) -C payloads/bareflank defaultbuild
49+
4150
payloads/coreinfo/build/coreinfo.elf coreinfo:
4251
$(MAKE) -C payloads/coreinfo defaultbuild
4352

payloads/bareflank/Kconfig

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
##
2+
## This program is free software; you can redistribute it and/or modify
3+
## it under the terms of the GNU General Public License as published by
4+
## the Free Software Foundation; version 2 of the License.
5+
##
6+
## This program is distributed in the hope that it will be useful,
7+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
8+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9+
## GNU General Public License for more details.
10+
##
11+
12+
#
13+
# For a description of the syntax of this configuration file,
14+
# see http://lxr.linux.no/source/Documentation/kbuild/kconfig-language.txt.
15+
#
16+
17+
mainmenu "Bareflank Configuration"

payloads/bareflank/Makefile

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
##
2+
## This file is part of the coreinfo project.
3+
##
4+
## Copyright (C) 2008 Advanced Micro Devices, Inc.
5+
## Copyright (C) 2008 Uwe Hermann <[email protected]>
6+
##
7+
## This program is free software; you can redistribute it and/or modify
8+
## it under the terms of the GNU General Public License as published by
9+
## the Free Software Foundation; version 2 of the License.
10+
##
11+
## This program is distributed in the hope that it will be useful,
12+
## but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
## GNU General Public License for more details.
15+
##
16+
17+
src := $(CURDIR)
18+
srctree := $(src)
19+
srck := $(src)/../../util/kconfig
20+
coreinfo_obj := $(src)/build
21+
objk := $(src)/build/util/kconfig
22+
23+
ifeq ($(filter %clean,$(MAKECMDGOALS)),)
24+
export KERNELVERSION := 0.1.0
25+
export KCONFIG_AUTOHEADER := $(coreinfo_obj)/config.h
26+
export KCONFIG_AUTOCONFIG := $(coreinfo_obj)/auto.conf
27+
export KCONFIG_DEPENDENCIES := $(coreinfo_obj)/auto.conf.cmd
28+
export KCONFIG_SPLITCONFIG := $(coreinfo_obj)/config
29+
export KCONFIG_TRISTATE := $(coreinfo_obj)/tristate.conf
30+
export KCONFIG_CONFIG := $(CURDIR)/.config
31+
export KCONFIG_NEGATIVES := 1
32+
export Kconfig := Kconfig
33+
34+
export V := $(V)
35+
36+
CONFIG_SHELL := sh
37+
KBUILD_DEFCONFIG := configs/defconfig
38+
UNAME_RELEASE := $(shell uname -r)
39+
HAVE_DOTCONFIG := $(wildcard .config)
40+
MAKEFLAGS += -rR --no-print-directory
41+
42+
# Make is silent per default, but 'make V=1' will show all compiler calls.
43+
ifneq ($(V),1)
44+
.SILENT:
45+
endif
46+
47+
HOSTCC ?= gcc
48+
HOSTCXX ?= g++
49+
HOSTCFLAGS := -I$(srck) -I$(objk)
50+
HOSTCXXFLAGS := -I$(srck) -I$(objk)
51+
52+
LIBPAYLOAD_PATH := $(realpath ../libpayload)
53+
LIBPAYLOAD_OBJ := $(coreinfo_obj)/libpayload
54+
HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_OBJ)/lib/libpayload.a)
55+
LIBPAYLOAD_CONFIG ?= configs/defconfig-tinycurses-64
56+
OBJCOPY ?= objcopy
57+
58+
INCLUDES = -I$(coreinfo_obj) -include $(LIBPAYLOAD_OBJ)/include/kconfig.h -I$(src)/../../src/commonlib/include -I$(src)/include -I$(src)
59+
OBJECTS = common.o entry.o platform.o
60+
OBJS = $(patsubst %,$(coreinfo_obj)/%,$(OBJECTS))
61+
TARGET = $(coreinfo_obj)/bareflank.elf
62+
63+
all: real-all
64+
65+
# in addition to the dependency below, create the file if it doesn't exist
66+
# to silence warnings about a file that would be generated anyway.
67+
$(if $(wildcard .xcompile),,$(eval $(shell ../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
68+
.xcompile: ../../util/xcompile/xcompile
69+
$< $(XGCCPATH) > $@.tmp
70+
\mv -f $@.tmp $@ 2> /dev/null || rm -f $@.tmp $@
71+
72+
CONFIG_COMPILER_GCC := y
73+
ARCH-y := x86_64
74+
75+
include .xcompile
76+
77+
CC := $(CC_$(ARCH-y))
78+
AS := $(AS_$(ARCH-y))
79+
OBJCOPY := $(OBJCOPY_$(ARCH-y))
80+
81+
LPCC := CC="$(CC)" $(LIBPAYLOAD_OBJ)/bin/lpgcc
82+
LPAS := AS="$(AS)" $(LIBPAYLOAD_OBJ)/bin/lpas
83+
84+
CFLAGS += -Wall -Werror -Os -fno-builtin $(CFLAGS_$(ARCH-y)) $(INCLUDES)
85+
86+
ifneq ($(strip $(HAVE_DOTCONFIG)),)
87+
include $(src)/.config
88+
real-all: $(TARGET)
89+
90+
$(TARGET): $(src)/.config $(coreinfo_obj)/config.h $(OBJS) libpayload
91+
printf " LPCC $(subst $(CURDIR)/,,$(@)) (LINK)\n"
92+
$(LPCC) -o $@ $(OBJS)
93+
$(OBJCOPY) --only-keep-debug $@ $(TARGET).debug
94+
$(OBJCOPY) --strip-debug $@
95+
$(OBJCOPY) --add-gnu-debuglink=$(TARGET).debug $@
96+
97+
$(coreinfo_obj)/%.S.o: $(src)/%.S libpayload
98+
printf " LPAS $(subst $(CURDIR)/,,$(@))\n"
99+
$(LPAS) -o $@ $<
100+
101+
$(coreinfo_obj)/%.o: $(src)/%.c libpayload
102+
printf " LPCC $(subst $(CURDIR)/,,$(@))\n"
103+
$(LPCC) $(CFLAGS) -c -o $@ $<
104+
105+
else
106+
real-all: config
107+
endif
108+
109+
defaultbuild:
110+
$(MAKE) olddefconfig
111+
$(MAKE) all
112+
113+
ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
114+
libpayload:
115+
printf "Found Libpayload $(LIBPAYLOAD_OBJ).\n"
116+
else
117+
LPOPTS=obj="$(CURDIR)/lpbuild" DOTCONFIG="$(CURDIR)/lp.config"
118+
libpayload:
119+
printf "Building libpayload @ $(LIBPAYLOAD_PATH).\n"
120+
$(MAKE) -C $(LIBPAYLOAD_PATH) $(LPOPTS) distclean coreinfo_obj=$(coreinfo_obj)/libptmp
121+
$(MAKE) -C $(LIBPAYLOAD_PATH) $(LPOPTS) defconfig KBUILD_DEFCONFIG=$(LIBPAYLOAD_CONFIG)
122+
$(MAKE) -C $(LIBPAYLOAD_PATH) $(LPOPTS) install DESTDIR=$(coreinfo_obj)
123+
endif
124+
125+
$(coreinfo_obj)/config.h:
126+
$(MAKE) oldconfig
127+
128+
$(shell mkdir -p $(coreinfo_obj) $(objk)/lxdialog $(KCONFIG_SPLITCONFIG))
129+
130+
include $(srck)/Makefile
131+
132+
.PHONY: $(PHONY) prepare
133+
134+
else
135+
136+
clean:
137+
rm -rf build/*.elf build/*.o .xcompile
138+
139+
distclean: clean
140+
rm -rf build lpbuild
141+
rm -f .config* lp.config*
142+
143+
.PHONY: clean distclean
144+
endif

0 commit comments

Comments
 (0)