-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit of test program for SKINIT
Signed-off-by: Ross Philipson <[email protected]>
- Loading branch information
1 parent
d43d4f3
commit e8b57bf
Showing
43 changed files
with
12,736 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
*.o | ||
*.efi | ||
*.dsm | ||
*.hex | ||
*.gz | ||
skboot | ||
skboot-syms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright (c) 2006-2010, Intel Corporation | ||
# All rights reserved. | ||
|
||
# -*- mode: Makefile; -*- | ||
|
||
# debug build | ||
debug ?= n | ||
|
||
# cc-option: Check if compiler supports first option, else fall back to second. | ||
# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586) | ||
cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \ | ||
/dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;) | ||
|
||
CFLAGS_WARN = -Wall -Wformat-security -Werror -Wstrict-prototypes \ | ||
-Wextra -Winit-self -Wswitch-default -Wunused-parameter \ | ||
-Wwrite-strings \ | ||
$(call cc-option,$(CC),-Wlogical-op,) \ | ||
-Wno-missing-field-initializers | ||
|
||
AS = as | ||
LD = ld | ||
CC = gcc | ||
CPP = cpp | ||
AR = ar | ||
RANLIB = ranlib | ||
NM = nm | ||
STRIP = strip | ||
OBJCOPY = objcopy | ||
OBJDUMP = objdump | ||
|
||
CFLAGS += $(CFLAGS_WARN) -fno-strict-aliasing -std=gnu99 | ||
# due to bug in gcc v4.2,3,? | ||
CFLAGS += $(call cc-option,$(CC),-Wno-array-bounds,) | ||
|
||
|
||
ifeq ($(debug),y) | ||
CFLAGS += -g -DDEBUG | ||
else | ||
CFLAGS += -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 | ||
endif | ||
|
||
# | ||
# slboot-specific build settings | ||
# | ||
RELEASEVER := "1.0.0" | ||
RELEASETIME := "2021-08-01 15:00 +0800" | ||
|
||
# if target arch is 64b, then convert -m64 to -m32 (skboot is always 32b) | ||
CFLAGS += -m32 | ||
CFLAGS += -march=i686 | ||
CFLAGS += -nostdinc | ||
CFLAGS += -fno-builtin -fno-common -fno-strict-aliasing | ||
CFLAGS += -fomit-frame-pointer | ||
CFLAGS += -pipe | ||
CFLAGS += -iwithprefix include | ||
CFLAGS += -I$(CURDIR)/include | ||
# ensure no floating-point variables | ||
CFLAGS += -msoft-float | ||
# Disable PIE/SSP if GCC supports them. They can break us. | ||
CFLAGS += $(call cc-option,$(CC),-nopie,) | ||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector,) | ||
CFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,) | ||
CFLAGS += $(call cc-option,$(CC),-fno-stack-check,) | ||
|
||
# changeset variable for banner | ||
CFLAGS += -DSKBOOT_CHANGESET=\""$(shell ((hg parents --template "{isodate|isodate} {rev}:{node|short}" >/dev/null && hg parents --template "{isodate|isodate} {rev}:{node|short}") || echo "$(RELEASETIME) $(RELEASEVER)") 2>/dev/null)"\" | ||
|
||
|
||
AFLAGS += -D__ASSEMBLY__ | ||
|
||
# Most CFLAGS are safe for assembly files: | ||
# -std=gnu{89,99} gets confused by #-prefixed end-of-line comments | ||
AFLAGS += $(patsubst -std=gnu%,,$(CFLAGS)) | ||
|
||
|
||
# LDFLAGS are only passed directly to $(LD) | ||
LDFLAGS = -melf_i386 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# Copyright (c) 2006-2010, Intel Corporation | ||
# All rights reserved. | ||
|
||
# -*- mode: Makefile; -*- | ||
|
||
# | ||
# skboot makefile | ||
# | ||
|
||
include $(CURDIR)/Config.mk | ||
|
||
TARGET := $(CURDIR)/skboot | ||
|
||
# boot.o must be first | ||
obj-y := common/boot.o | ||
obj-y += common/cmdline.o common/com.o common/e820.o | ||
obj-y += common/linux.o common/loader.o | ||
obj-y += common/misc.o common/pci.o common/printk.o | ||
obj-y += common/string.o common/skboot.o common/skl.o | ||
obj-y += common/sha1.o common/sha256.o | ||
obj-y += common/tpm.o common/tpm_12.o common/tpm_20.o | ||
obj-y += common/vga.o | ||
|
||
OBJS := $(obj-y) | ||
|
||
|
||
TARGET_LDS := $(CURDIR)/common/skboot.lds | ||
|
||
$(TARGET).gz : $(TARGET) | ||
gzip -n -f -9 < $< > $@ | ||
|
||
$(TARGET) : $(OBJS) $(TARGET_LDS) | ||
$(LD) $(LDFLAGS) -T $(TARGET_LDS) -N $(OBJS) -o $(@D)/.$(@F).0 | ||
$(NM) -n $(@D)/.$(@F).0 >$(TARGET)-syms | ||
$(LD) $(LDFLAGS) -T $(TARGET_LDS) $(LDFLAGS_STRIP) $(@D)/.$(@F).0 -o $(TARGET) | ||
rm -f $(@D)/.$(@F).0 | ||
|
||
#$(TARGET_LDS) : $(TARGET_LDS).x $(HDRS) | ||
# $(CPP) -P -E -Ui386 $(AFLAGS) -o $@ $< | ||
|
||
#$(TARGET_LDS).x : FORCE | ||
|
||
#.PHONY: FORCE | ||
#FORCE : | ||
# @: # do nothing | ||
# | ||
# universal rules | ||
# | ||
dist : install | ||
|
||
|
||
build : $(TARGET).gz | ||
|
||
|
||
install : $(DISTDIR)/boot/$(TARGET).gz | ||
|
||
$(DISTDIR)/boot/$(TARGET).gz : $(TARGET).gz | ||
[ -d $(DISTDIR)/boot ] || $(INSTALL_DIR) $(DISTDIR)/boot | ||
$(INSTALL_DATA) $(TARGET).gz $(DISTDIR)/boot/$(notdir $(TARGET)).gz | ||
$(INSTALL_DATA) $(TARGET)-syms $(DISTDIR)/boot/$(notdir $(TARGET))-syms | ||
[ -d $(DISTDIR)/etc/grub.d ] || $(INSTALL_DIR) $(DISTDIR)/etc/grub.d | ||
$(INSTALL) -m755 -t $(DISTDIR)/etc/grub.d 20* | ||
|
||
|
||
clean : | ||
rm -f $(TARGET)* *~ include/*~ include/txt/*~ *.o common/*~ txt/*~ common/*.o txt/*.o | ||
rm -f tags TAGS cscope.files cscope.in.out cscope.out cscope.po.out | ||
|
||
|
||
distclean : clean | ||
|
||
|
||
# | ||
# TAGS / tags | ||
# | ||
define all_sources | ||
( find . -name '*.[chS]' -print ) | ||
endef | ||
define set_exuberant_flags | ||
exuberant_flags=`$1 --version 2>/dev/null | grep -iq exuberant && \ | ||
echo "-I __initdata,__exitdata,__acquires,__releases \ | ||
-I EXPORT_SYMBOL \ | ||
--extra=+f --c-kinds=+px"` | ||
endef | ||
|
||
.PHONY: TAGS | ||
TAGS : | ||
rm -f TAGS; \ | ||
$(call set_exuberant_flags,etags); \ | ||
$(all_sources) | xargs etags $$exuberant_flags -a | ||
|
||
.PHONY: tags | ||
tags : | ||
rm -f tags; \ | ||
$(call set_exuberant_flags,ctags); \ | ||
$(all_sources) | xargs ctags $$exuberant_flags -a | ||
|
||
# | ||
# cscope | ||
# | ||
.PHONY: cscope | ||
cscope : | ||
$(all_sources) > cscope.files | ||
cscope -k -b -q | ||
|
||
# | ||
# MAP | ||
# | ||
.PHONY: MAP | ||
MAP : | ||
$(NM) -n $(TARGET)-syms | grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' > System.map | ||
|
||
# | ||
# implicit rules | ||
# | ||
|
||
HDRS := $(wildcard $(CURDIR)/include/*.h) | ||
HDRS += $(wildcard $(CURDIR)/include/txt/*.h) | ||
|
||
BUILD_DEPS := $(CURDIR)/Config.mk $(CURDIR)/Makefile | ||
|
||
# fix case where gcc doesn't use builtin memcmp() when built w/o optimizations | ||
ifeq ($(debug),y) | ||
CFLAGS += -O2 | ||
endif | ||
|
||
%.o : %.c $(HDRS) $(BUILD_DEPS) | ||
$(CC) $(CFLAGS) -c $< -o $@ | ||
|
||
%.o : %.S $(HDRS) $(BUILD_DEPS) | ||
$(CC) $(AFLAGS) -c $< -o $@ | ||
|
||
%.i : %.c $(HDRS) $(BUILD_DEPS) | ||
$(CPP) $(CFLAGS) $< -o $@ | ||
|
||
# -std=gnu{89,99} gets confused by # as an end-of-line comment marker | ||
%.s : %.S $(HDRS) $(BUILD_DEPS) | ||
$(CPP) $(AFLAGS) $< -o $@ |
Oops, something went wrong.