Before I write anything for docs or a blog post on snagboot
, I thought I’d just start by documenting my experience using snagboot
here.
For background, snagboot
is a tool for bootloading boards, including PocketBeagle 2, without needing to have a programmed microSD card inserted. The opportunity here is to avoid needing any external adapter and establish control over setting the state of PocketBeagle 2 directly from bb-imager
.
Instructions for building u-boot at AM62x Beagleboard.org Beagleplay — Das U-Boot unknown version documentation.
jkridner@slotcar:~/workspace$ git clone https://openbeagle.org/beagleboard/u-boot
jkridner@slotcar:~/workspace$ cd u-boot
jkridner@slotcar:~/workspace/u-boot$ ls configs | grep pocketbeagle
am6232_pocketbeagle2_a53_defconfig
am6232_pocketbeagle2_r5_defconfig
jkridner@slotcar:~/workspace/u-boot$ git checkout v2025.01-pocketbeagle2
Updating files: 100% (24840/24840), done.
branch 'v2025.01-pocketbeagle2' set up to track 'origin/v2025.01-pocketbeagle2'.
Switched to a new branch 'v2025.01-pocketbeagle2'
jkridner@slotcar:~/workspace/u-boot$ python3 -m venv snagboot
jkridner@slotcar:~/workspace/u-boot$ source snagboot/bin/activate
(snagboot) jkridner@slotcar:~/workspace/u-boot$ export PATH=$PATH:$HOME/workspace/u-boot/snagboot/bin
(snagboot) jkridner@slotcar:~/workspace/u-boot$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
(snagboot) jkridner@slotcar:~/workspace/u-boot$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
...
Bus 003 Device 034: ID 0451:6165 Texas Instruments, Inc. AM62x DFU
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
...
(snagboot) jkridner@slotcar:~/workspace/u-boot$ pip install snagboot
Collecting snagboot
Downloading snagboot-2.1-py3-none-any.whl.metadata (7.3 kB)
...
sha256=8f24f391222e3f1ae7efd96ab35b005b6c9fe3495f67ab52ec67329f7fb65a10
Stored in directory: /home/jkridner/.cache/pip/wheels/dd/f6/68/d406bafc5bebc848316590360012a838aa2a844cba9a4fbfa6
Building wheel for tftpy (pyproject.toml) ... done
Created wheel for tftpy: filename=tftpy-0.8.2-py3-none-any.whl size=29549 sha256=ca22457e212e395d214350bc3186513b6391ac6f5d6505b446306410903efb56
Stored in directory: /home/jkridner/.cache/pip/wheels/ef/94/16/15d8833761a47ebe47364d11f51b5c2f75b3378c90a57e5c91
Successfully built pylibfdt tftpy
Installing collected packages: swig, pyserial, pylibfdt, crccheck, tftpy, pyyaml, pyusb, packaging, snagboot
Successfully installed crccheck-1.3.0 packaging-24.2 pylibfdt-1.7.2 pyserial-3.5 pyusb-1.3.1 pyyaml-6.0.2 snagboot-2.1 swig-4.3.0 tftpy-0.8.2
(snagboot) jkridner@slotcar:~/workspace/u-boot$ snagrecover -h
usage: snagrecover [-h] [-s SOC] [-f "templates/colibri-imx7d.yaml"] [-F "{'fw1': {'path': '/path/to', 'address': 0x00}}"] [--netns NETNS] [--loglevel {silent,info,debug}]
[--logfile LOGFILE] [--rom-usb ROM_USB] [--usb-path vid:pid|bus-port1.port2.[...]] [--list-socs] [--version] [-t name] [--udev] [--am335x-setup]
options:
-h, --help show this help message and exit
Mandatory:
-s SOC, --soc SOC soc model
-f "templates/colibri-imx7d.yaml", --firmware-file "templates/colibri-imx7d.yaml"
firmware configurations, passed as a yaml file
-F "{'fw1': {'path': '/path/to', 'address': 0x00}}", --firmware "{'fw1': {'path': '/path/to', 'address': 0x00}}"
firmware configurations, formatted as a python3 dict
Optional:
--netns NETNS network namespace for AM335x USB recovery, defaults to 'snagbootnet'
--loglevel {silent,info,debug}
set loglevel
--logfile LOGFILE set logfile
--rom-usb ROM_USB legacy, please use --usb-path
--usb-path vid:pid|bus-port1.port2.[...]
address of recovery USB device
Utilities:
--list-socs list supported socs
--version show version
-t name, --template name
get an example firmware configuration file
--udev get required udev rules for snagrecover
--am335x-setup get setup script for am335x USB recovery
Examples:
snagrecover -s stm32mp15 -f stm32mp15.yaml
snagrecover -s stm32mp15 -F "{'tf-a': {'path': 'binaries/tf-a-stm32.bin'}}" -F "{'fip': {'path': 'binaries/u-boot.stm32'}}"
Templates:
am335x-beaglebone-black
am62x-beagle-play
am62x-phyboard-lyra
...
(snagboot) jkridner@slotcar:~/workspace/pocketbeagle-2$ snagrecover --udev | tee 50-snagboot.rules
...
#TI rules
SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="6165", MODE="0660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="6141", MODE="0660", TAG+="uaccess"
SUBSYSTEM=="usb", ATTRS{idVendor}=="0451", ATTRS{idProduct}=="d022", MODE="0660", TAG+="uaccess"
...
(snagboot) jkridner@slotcar:~/workspace/pocketbeagle-2$ sudo udevadm control --reload-rules
(snagboot) jkridner@slotcar:~/workspace/pocketbeagle-2$ sudo udevadm trigger
...
(snagboot) jkridner@slotcar:~/workspace/u-boot$ snagrecover -s am625 -f snagboot/lib/python3.12/site-packages/snagrecover/templates/am62x-beagle-play.yaml
2025-02-18 18:07:45,737 [INFO] Starting recovery of am625 board
2025-02-18 18:07:45,797 [INFO] Installing firmware tiboot3
2025-02-18 18:07:45,798 [INFO] Searching for partition id...
2025-02-18 18:07:45,802 [INFO] Found DFU Functional descriptor: wTransferSize = 512
2025-02-18 18:07:45,802 [INFO] Downloading file...
2025-02-18 18:07:46,531 [INFO] Could not read status after end of manifest phase
2025-02-18 18:07:46,531 [INFO] Done
2025-02-18 18:07:46,531 [INFO] Done installing firmware tiboot3
2025-02-18 18:07:47,552 [INFO] Installing firmware tispl
2025-02-18 18:07:47,552 [INFO] Searching for partition id...
2025-02-18 18:07:47,553 [INFO] Found DFU Functional descriptor: wTransferSize = 4096
2025-02-18 18:07:47,553 [INFO] Downloading file...
2025-02-18 18:07:48,916 [INFO] Done manifesting firmware
2025-02-18 18:07:48,916 [INFO] Done
2025-02-18 18:07:48,916 [INFO] Done installing firmware tispl
2025-02-18 18:07:48,931 [INFO] Installing firmware u-boot
2025-02-18 18:07:48,931 [INFO] Searching for partition id...
2025-02-18 18:07:48,932 [INFO] Found DFU Functional descriptor: wTransferSize = 4096
2025-02-18 18:07:48,932 [INFO] Downloading file...
2025-02-18 18:07:50,333 [INFO] Done manifesting firmware
2025-02-18 18:07:50,333 [INFO] Done
2025-02-18 18:07:50,333 [INFO] Sending detach command...
2025-02-18 18:07:50,334 [INFO] Sending DFU_DETACH...
2025-02-18 18:07:50,335 [INFO] Done installing firmware u-boot
2025-02-18 18:07:52,336 [INFO] USB retry 1/9
2025-02-18 18:07:53,337 [INFO] USB retry 2/9
2025-02-18 18:07:54,338 [INFO] USB retry 3/9
2025-02-18 18:07:55,339 [INFO] USB retry 4/9
2025-02-18 18:07:56,340 [INFO] USB retry 5/9
2025-02-18 18:07:57,341 [INFO] USB retry 6/9
2025-02-18 18:07:58,343 [INFO] USB retry 7/9
2025-02-18 18:07:59,344 [INFO] USB retry 8/9
2025-02-18 18:08:00,345 [INFO] USB retry 9/9
2025-02-18 18:08:01,346 [INFO] USB retry 10/9
2025-02-18 18:08:02,346 [INFO] Done recovering am625 board
2025-02-18 18:08:02,346 [INFO] Done recovering am625 board
(snagboot) jkridner@slotcar:~/workspace/u-boot$
In another shell, monitoring the 3-pin serial port with a Pi Debug probe…
Core: 86 devices, 30 uclasses, devicetree: separate
MMC: mmc@fa10000: 0, mmc@fa00000: 1
Loading Environment from nowhere... OK
In: serial@2860000
Out: serial@2860000
Err: serial@2860000
Net: No ethernet found.
Press SPACE to abort autoboot in 2 seconds
MMC: no card present
Scanning for bootflows in all bootdevs
Seq Method State Uclass Part Name Filename
--- ----------- ------ -------- ---- ------------------------ ----------------
Scanning bootdev 'mmc@fa00000.bootdev':
MMC: no card present
MMC: no card present
MMC: no card present
MMC: no card present
Scanning bootdev 'mmc@fa10000.bootdev':
Card did not respond to voltage select! : -110
No more bootdevs
--- ----------- ------ -------- ---- ------------------------ ----------------
(0 bootflows, 0 valid)
=>
So, next step is for me to build u-boot with NETCONSOLE support, like I did for the original PocketBeagle and try to figure out how to package this all up neatly.