From 2c5455e35d250140e2856103d011a32d05e3ef20 Mon Sep 17 00:00:00 2001
From: ISSOtm <me@eldred.fr>
Date: Sun, 9 Jun 2024 16:36:13 +0200
Subject: [PATCH] Use `rgblink -x` instead of `dd`

This saves a few build steps and intermediate files
---
 BootROMs/cgb_boot.asm | 1 +
 Makefile              | 5 ++---
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/BootROMs/cgb_boot.asm b/BootROMs/cgb_boot.asm
index fba44550e..116c227a4 100644
--- a/BootROMs/cgb_boot.asm
+++ b/BootROMs/cgb_boot.asm
@@ -1238,6 +1238,7 @@ BootEnd:
 IF BootEnd > $900
     FAIL "BootROM overflowed: {BootEnd}"
 ENDC
+    ds $100 + $800 - @ ; Ensure that the ROM is padded up to standard size.
 
 SECTION "HRAM", HRAM[$FF80]
 TitleChecksum:
diff --git a/Makefile b/Makefile
index 6ce3063cc..844057177 100644
--- a/Makefile
+++ b/Makefile
@@ -638,9 +638,8 @@ $(BIN)/BootROMs/sgb2_boot: BootROMs/sgb_boot.asm
 $(BIN)/BootROMs/%.bin: BootROMs/%.asm $(OBJ)/BootROMs/SameBoyLogo.pb12
 	-@$(MKDIR) -p $(dir $@)
 	$(RGBASM) -i $(OBJ)/BootROMs/ -i BootROMs/ -o $@.tmp $<
-	$(RGBLINK) -o $@.tmp2 $@.tmp
-	dd if=$@.tmp2 of=$@ count=1 bs=$(if $(findstring cgb,$@)$(findstring agb,$@),2304,256) 2> $(NULL)
-	@rm $@.tmp $@.tmp2
+	$(RGBLINK) -x -o $@ $@.tmp
+	@rm $@.tmp
 
 # Libretro Core (uses its own build system)
 libretro: