summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordzwdz2023-08-08 18:47:08 +0200
committerdzwdz2023-08-08 18:47:08 +0200
commit0e8ae092443b8a5a582a3a5aaad663d6fbe4f500 (patch)
tree6d79c06ad3ee5692b98fe360ceff1d827b555462
parent0ddd4d1dab8dc2ba092c7351cfb2e054fce1f429 (diff)
build: build bootstrap as an ELF first, and then convert to a raw binary
-rw-r--r--Makefile7
-rw-r--r--src/user/bootstrap/linker.ld1
2 files changed, 5 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 764f7f0..7a1b5cf 100644
--- a/Makefile
+++ b/Makefile
@@ -90,9 +90,12 @@ out/libm.a:
@mkdir -p $(@D)
@$(AR) rcs $@ $^
-out/bootstrap: src/user/bootstrap/linker.ld $(call from_sources, src/user/bootstrap/) out/libc.a
+out/bootstrap: out/bootstrap.elf
+ @objcopy -O binary $^ $@
+
+out/bootstrap.elf: src/user/bootstrap/linker.ld $(call from_sources, src/user/bootstrap/) out/libc.a
@mkdir -p $(@D)
- @$(CC) -nostdlib -Wl,-no-pie -Wl,-Map=% -T $^ -o $@
+ @$(CC) -nostdlib -Wl,-no-pie -T $^ -o $@
out/fs/boot/init: out/bootstrap out/initrd.tar
@mkdir -p $(@D)
diff --git a/src/user/bootstrap/linker.ld b/src/user/bootstrap/linker.ld
index 5d8abe7..10e3f98 100644
--- a/src/user/bootstrap/linker.ld
+++ b/src/user/bootstrap/linker.ld
@@ -1,5 +1,4 @@
ENTRY(_start)
-OUTPUT_FORMAT("binary")
SECTIONS
{