From 3a5150fd1a76fd5f6cb613784f7de1c00caff20f Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Sun, 4 May 2025 20:56:32 +0200 Subject: [PATCH 1/3] Add dol files to release package --- meson.build | 2 ++ 1 file changed, 2 insertions(+) diff --git a/meson.build b/meson.build index 3a12cab..3783c85 100644 --- a/meson.build +++ b/meson.build @@ -102,6 +102,8 @@ foreach name, exe: dols output: name + '.dol', command: [elf2dol, '@INPUT@', '@OUTPUT@'], build_by_default: true, + install: true, + install_dir: '/', ) set_variable(name + '_dol', dol) endforeach From e411fc2977b408ae3f04a8c80117e29f95bae2c1 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Thu, 15 May 2025 19:30:47 +0000 Subject: [PATCH 2/3] Build universal uf2 file --- README.md | 3 +++ buildtools/dol2ipl.py | 23 +++++++++++++++++++---- meson.build | 22 +++++++++++++++++++++- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ac78819..e553b42 100644 --- a/README.md +++ b/README.md @@ -206,8 +206,11 @@ $ meson compile -C build # The binaries will be in the build directory $ ls build ... +gekkoboot.dol gekkoboot_memcard.gci gekkoboot_pico.uf2 +gekkoboot_pico2.uf2 +gekkoboot_universal.uf2 gekkoboot_qoob_pro.gcb gekkoboot_viper.vgc qoob_pro_gekkoboot_upgrade.elf diff --git a/buildtools/dol2ipl.py b/buildtools/dol2ipl.py index 00f5ee9..0c3d2aa 100755 --- a/buildtools/dol2ipl.py +++ b/buildtools/dol2ipl.py @@ -83,7 +83,16 @@ def flatten_dol(data): # Entry point, load address, memory image return entry, dol_min, img -def pack_uf2(data, base_address): +def pack_uf2(data, base_address, family): + if family == "rp2040": + family_id = 0xE48BFF56 # RP2040 + elif family == "rp2350": + family_id = 0xE48BFF59 # RP2350-ARM-S + elif family == "data": + family_id = 0xE48BFF58 # DATA family ID compatible with RP2350 + else: + raise ValueError(f"Unknown family: {family}") + ret = bytearray() seq = 0 @@ -103,7 +112,7 @@ def pack_uf2(data, base_address): chunk_size, seq, total_chunks, - 0xE48BFF56, # Board family: Raspberry Pi RP2040 + family_id, chunk, 0x0AB16F30, # Final magic ) @@ -115,7 +124,7 @@ def pack_uf2(data, base_address): def main(): if len(sys.argv) not in range(3, 4 + 1): - print(f"Usage: {sys.argv[0]} []") + print(f"Usage: {sys.argv[0]} [/]") return 1 output = sys.argv[1] @@ -179,6 +188,12 @@ def main(): out = header + scramble(bytearray(0x720) + img)[0x720:] elif output.endswith(".uf2"): + if len(sys.argv) < 4: + print("Missing family argument!") + return -1 + + family = sys.argv[3] + if entry != 0x81300000 or load != 0x01300000: print("Invalid entry point and base address (must be 0x81300000)") return -1 @@ -199,7 +214,7 @@ def main(): ) assert len(header) == header_size - out = pack_uf2(header + img, 0x10080000) + out = pack_uf2(header + img, 0x10080000, family) elif output.endswith(".qbsx"): # SX BIOSes are always one page long diff --git a/meson.build b/meson.build index 3783c85..e2a25b1 100644 --- a/meson.build +++ b/meson.build @@ -165,7 +165,27 @@ pico = custom_target( 'pico', input: gekkoboot_dol, output: 'gekkoboot_pico.uf2', - command: [dol2ipl, '@OUTPUT@', '@INPUT@'], + command: [dol2ipl, '@OUTPUT@', '@INPUT@', 'rp2040'], + build_by_default: true, + install: false, + install_dir: '/', +) + +pico2 = custom_target( + 'pico2', + input: gekkoboot_dol, + output: 'gekkoboot_pico2.uf2', + command: [dol2ipl, '@OUTPUT@', '@INPUT@', 'rp2350'], + build_by_default: true, + install: false, + install_dir: '/', +) + +pico_universal = custom_target( + 'pico_universal', + input: [pico, pico2], + output: 'gekkoboot_universal.uf2', + command: ['sh', '-c', 'cat "$1" "$2" > "$3"', 'sh', '@INPUT0@', '@INPUT1@', '@OUTPUT@'], build_by_default: true, install: true, install_dir: '/', From 8454b9889001a33456d39e5abbbe76824de727a9 Mon Sep 17 00:00:00 2001 From: Maciej Kobus Date: Thu, 15 May 2025 20:04:01 +0000 Subject: [PATCH 3/3] Reference correct file in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e553b42..2a0567c 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ gekkoboot is bundled with the [PicoBoot] firmware. Just follow the [update guide][pb-update]. You can also update gekkoboot separately from the PicoBoot firmware, -using the supplied `gekkoboot_pico.uf2`, and following the same procedure +using the supplied `gekkoboot_universal.uf2`, and following the same procedure (requires PicoBoot 0.4 or later). [PicoBoot]: https://github.com/webhdx/PicoBoot