diff --git a/README.md b/README.md index ac78819..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 @@ -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 3a12cab..e2a25b1 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 @@ -163,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: '/',