Skip to content

Commit 814ff4a

Browse files
committed
build: Miscellaneous updates, and update to PicoEFI (rebranded Nyu-EFI)
1 parent 7a0ce21 commit 814ff4a

File tree

8 files changed

+37
-45
lines changed

8 files changed

+37
-45
lines changed

.gitmodules

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[submodule "freestnd-c-hdrs"]
22
path = freestnd-c-hdrs
3-
url = https://codeberg.org/osdev/freestnd-c-hdrs-0bsd.git
3+
url = https://github.com/osdev0/freestnd-c-hdrs-0bsd.git
44
[submodule "cc-runtime"]
55
path = cc-runtime
6-
url = https://codeberg.org/osdev/cc-runtime.git
7-
[submodule "nyu-efi"]
8-
path = nyu-efi
9-
url = https://codeberg.org/osdev/nyu-efi.git
6+
url = https://github.com/osdev0/cc-runtime.git
7+
[submodule "picoefi"]
8+
path = picoefi
9+
url = https://github.com/PicoEFI/PicoEFI.git
1010
[submodule "nanoprintf"]
1111
path = nanoprintf
1212
url = https://github.com/charlesnicholson/nanoprintf.git

GNUmakefile

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
# Nuke built-in rules and variables.
2-
MAKEFLAGS += -rR
1+
# Nuke built-in rules.
32
.SUFFIXES:
43

54
# This is the name that our final executable will have.
@@ -64,7 +63,7 @@ CFLAGS := -g -O2 -pipe
6463
CPPFLAGS :=
6564

6665
# User controllable nasm flags.
67-
NASMFLAGS := -F dwarf -g
66+
NASMFLAGS := -g
6867

6968
# User controllable linker flags. We set none by default.
7069
LDFLAGS :=
@@ -104,14 +103,15 @@ override CFLAGS += \
104103
-fno-stack-protector \
105104
-fno-stack-check \
106105
-fshort-wchar \
106+
-fno-lto \
107107
-fPIE \
108108
-ffunction-sections \
109109
-fdata-sections
110110

111111
# Internal C preprocessor flags that should not be changed by the user.
112112
override CPPFLAGS := \
113113
-I src \
114-
-I nyu-efi/inc \
114+
-I picoefi/inc \
115115
-I uACPI/include \
116116
-DUACPI_OVERRIDE_CONFIG \
117117
-DBUILD_VERSION=\"$(BUILD_VERSION)\" \
@@ -121,7 +121,8 @@ override CPPFLAGS := \
121121
-MP
122122

123123
# Internal nasm flags that should not be changed by the user.
124-
override NASMFLAGS += \
124+
override NASMFLAGS := \
125+
$(patsubst -g,-g -F dwarf,$(NASMFLAGS)) \
125126
-Wall
126127

127128
# Architecture specific internal flags.
@@ -170,25 +171,23 @@ override LDFLAGS += \
170171
-z text \
171172
-z max-page-size=0x1000 \
172173
--gc-sections \
173-
-T nyu-efi/$(ARCH)/link_script.lds
174-
175-
# Use "find" to glob all *.c, *.S, and *.asm{32,64} files in the tree and obtain the
176-
# object and header dependency file names.
177-
override SRCFILES := $(shell find -L src cc-runtime/src nyu-efi/$(ARCH) uACPI/source -type f 2>/dev/null | LC_ALL=C sort)
174+
-T picoefi/$(ARCH)/link_script.lds
175+
176+
# Use "find" to glob all *.c, *.S, and *.asm files in the tree
177+
# (except the src/arch/* directories, as those are gonna be added
178+
# in the next step).
179+
override SRCFILES := $(shell find -L src cc-runtime/src picoefi/$(ARCH) uACPI/source -type f -not -path 'src/arch/*' 2>/dev/null | LC_ALL=C sort)
180+
# Add architecture specific files, if they exist.
181+
override SRCFILES += $(shell find -L src/arch/$(ARCH) -type f 2>/dev/null | LC_ALL=C sort)
182+
# Obtain the object and header dependencies file names.
178183
override CFILES := $(filter %.c,$(SRCFILES))
179184
override ASFILES := $(filter %.S,$(SRCFILES))
180-
ifeq ($(ARCH),ia32)
181-
override NASMFILES := $(filter %.asm32,$(SRCFILES))
182-
endif
183-
ifeq ($(ARCH),x86_64)
184-
override NASMFILES := $(filter %.asm64,$(SRCFILES))
185+
ifneq ($(filter $(ARCH),ia32 x86_64),)
186+
override NASMFILES := $(filter %.asm,$(SRCFILES))
185187
endif
186188
override OBJ := $(addprefix obj-$(ARCH)/,$(CFILES:.c=.c.o) $(ASFILES:.S=.S.o))
187-
ifeq ($(ARCH),ia32)
188-
override OBJ += $(addprefix obj-$(ARCH)/,$(NASMFILES:.asm32=.asm32.o))
189-
endif
190-
ifeq ($(ARCH),x86_64)
191-
override OBJ += $(addprefix obj-$(ARCH)/,$(NASMFILES:.asm64=.asm64.o))
189+
ifneq ($(filter $(ARCH),ia32 x86_64),)
190+
override OBJ += $(addprefix obj-$(ARCH)/,$(NASMFILES:.asm=.asm.o))
192191
endif
193192
override HEADER_DEPS := $(addprefix obj-$(ARCH)/,$(CFILES:.c=.c.d) $(ASFILES:.S=.S.d))
194193

@@ -210,36 +209,29 @@ obj-$(ARCH)/src/printf.c.o: override CPPFLAGS += \
210209

211210
# Rule to convert the final ELF executable to a .EFI PE executable.
212211
bin-$(ARCH)/$(OUTPUT).efi: bin-$(ARCH)/$(OUTPUT) GNUmakefile
213-
mkdir -p "$$(dirname $@)"
212+
mkdir -p "$(dir $@)"
214213
$(OBJCOPY) -O binary $< $@
215214
dd if=/dev/zero of=$@ bs=4096 count=0 seek=$$(( ($$(wc -c < $@) + 4095) / 4096 )) 2>/dev/null
216215

217216
# Link rules for the final executable.
218-
bin-$(ARCH)/$(OUTPUT): GNUmakefile nyu-efi/$(ARCH)/link_script.lds $(OBJ)
219-
mkdir -p "$$(dirname $@)"
220-
$(LD) $(OBJ) $(LDFLAGS) -o $@
217+
bin-$(ARCH)/$(OUTPUT): GNUmakefile picoefi/$(ARCH)/link_script.lds $(OBJ)
218+
mkdir -p "$(dir $@)"
219+
$(LD) $(LDFLAGS) $(OBJ) -o $@
221220

222221
# Compilation rules for *.c files.
223222
obj-$(ARCH)/%.c.o: %.c GNUmakefile
224-
mkdir -p "$$(dirname $@)"
223+
mkdir -p "$(dir $@)"
225224
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
226225

227226
# Compilation rules for *.S files.
228227
obj-$(ARCH)/%.S.o: %.S GNUmakefile
229-
mkdir -p "$$(dirname $@)"
228+
mkdir -p "$(dir $@)"
230229
$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
231230

232-
ifeq ($(ARCH),ia32)
233-
# Compilation rules for *.asm32 (nasm) files.
234-
obj-$(ARCH)/%.asm32.o: %.asm32 GNUmakefile
235-
mkdir -p "$$(dirname $@)"
236-
nasm $(NASMFLAGS) $< -o $@
237-
endif
238-
239-
ifeq ($(ARCH),x86_64)
240-
# Compilation rules for *.asm64 (nasm) files.
241-
obj-$(ARCH)/%.asm64.o: %.asm64 GNUmakefile
242-
mkdir -p "$$(dirname $@)"
231+
ifneq ($(filter $(ARCH),ia32 x86_64),)
232+
# Compilation rules for *.asm (nasm) files.
233+
obj-$(ARCH)/%.asm.o: %.asm GNUmakefile
234+
mkdir -p "$(dir $@)"
243235
nasm $(NASMFLAGS) $< -o $@
244236
endif
245237

nyu-efi

Lines changed: 0 additions & 1 deletion
This file was deleted.

picoefi

Submodule picoefi added at 2690f9a
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)