Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
23 changes: 19 additions & 4 deletions buildtools/dol2ipl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
Expand All @@ -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]} <output> <executable> [<IPL ROM>]")
print(f"Usage: {sys.argv[0]} <output> <executable> [<IPL ROM>/<family>]")
return 1

output = sys.argv[1]
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
24 changes: 23 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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: '/',
Expand Down