getting closer...

This commit is contained in:
Yehowshua Immanuel 2025-02-19 09:06:40 -05:00
parent 32932f4816
commit f9248057f9
7 changed files with 107 additions and 51 deletions

View file

@ -23,9 +23,13 @@ $(ELF): $(SRC) $(LDSCRIPT)
$(AS) $(ARCH_FLAGS) -o $(OBJ) $(SRC)
$(LD) -T $(LDSCRIPT) -o $(ELF) $(OBJ)
# Convert ELF to raw binary
# Convert ELF to raw binary and pad to the next multiple of 4 bytes
$(BIN): $(ELF)
$(OBJCOPY) -O binary $(ELF) $(BIN)
# Pad the binary to a multiple of 4 bytes
size=$$(stat -f%z $(BIN)); \
padding=$$(( (4 - (size % 4)) % 4 )); \
[ $$padding -ne 0 ] && dd if=/dev/zero bs=1 count=$$padding >> $(BIN) || true
# Run in QEMU
run: $(BIN)