11#! /bin/bash
2+ # -----------------------------------------------------------------------
3+ # build.sh - Builds PicoBoot firmware files for different platforms
4+ # -----------------------------------------------------------------------
5+ # Purpose:
6+ # Builds PicoBoot firmware files for both Raspberry Pi Pico and Pico 2
7+ # platforms. Processes gekkoboot.dol into payload files and creates
8+ # universal payload that works on both boards.
9+ # Outputs uf2 files into dist/ directory.
10+ #
11+ # Usage:
12+ # ./build.sh
13+ # -----------------------------------------------------------------------
214
315set -e
416
@@ -16,25 +28,25 @@ build_type="RelWithDebInfo"
1628
1729num_configs=${# platforms[@]}
1830
19- if [ ! -f " gekkoboot .dol" ]; then
20- echo -e " ${RED} Error: gekkoboot .dol file not found${NC} "
31+ if [ ! -f " payload .dol" ]; then
32+ echo -e " ${RED} Error: payload .dol file not found${NC} "
2133 exit 1
2234fi
2335
2436echo -e " ${BLUE} ##########################################################${NC} "
2537echo -e " 🚀 ${YELLOW} Generating payload uf2 files:${NC} "
26- echo -e " 📂 ${YELLOW} Build directory :${NC} ${GREEN} build/gekkoboot ${NC} "
38+ echo -e " 📂 ${YELLOW} Input file :${NC} ${GREEN} payload.dol ${NC} "
2739echo -e " ${BLUE} ##########################################################${NC} "
2840
2941if [ ! -d " dist" ]; then
3042 mkdir dist
3143fi
3244
3345echo -e " \n🔨 ${YELLOW} Building payload uf2 file for Pico...${NC} "
34- ./process_ipl.py dist/payload_pico.uf2 gekkoboot .dol rp2040
46+ ./process_ipl.py dist/payload_pico.uf2 payload .dol rp2040
3547
3648echo -e " \n🔨 ${YELLOW} Building payload uf2 file for Pico 2...${NC} "
37- ./process_ipl.py dist/payload_pico2.uf2 gekkoboot .dol rp2350
49+ ./process_ipl.py dist/payload_pico2.uf2 payload .dol rp2350
3850
3951echo -e " \n🔨 ${YELLOW} Building universal payload uf2 file...${NC} "
4052cat dist/payload_pico.uf2 dist/payload_pico2.uf2 > dist/payload_universal.uf2
@@ -63,13 +75,15 @@ for (( i=0; i<num_configs; i++ )); do
6375 cp build/${build_dir} /picoboot.uf2 dist/picoboot_${board_arch} .uf2
6476
6577 if [ " ${platform} " == " rp2350" ]; then
66- # RP2350 workaround for invalid core+payload uf2 file
6778 echo -e " \n🔨 ${YELLOW} RP2350 workaround: Building core uf2 file...${NC} "
6879 picotool uf2 convert build/${build_dir} /dist/picoboot.bin build/${build_dir} /picoboot.uf2 --family rp2350-arm-s
80+ else
81+ echo -e " \n🔨 ${YELLOW} RP2040 workaround: Padding binary to 4k block size...${NC} "
82+ tools/rp2040_4k_align.sh build/${build_dir} /dist/picoboot.bin build/${build_dir} /dist/picoboot_padded.bin
83+ picotool uf2 convert build/${build_dir} /dist/picoboot_padded.bin build/${build_dir} /picoboot.uf2 --family rp2040
6984 fi
7085
7186 echo -e " \n🔨 ${YELLOW} Merging binaries...${NC} "
72-
7387 uf2tool join -o dist/${output_file} build/${build_dir} /picoboot.uf2 dist/payload_${board_arch} .uf2 --family ${family}
7488
7589 echo -e " ✨ ${GREEN} Build finished for ${platform} (${board} )!${NC} \n"
0 commit comments