picotool icon indicating copy to clipboard operation
picotool copied to clipboard

Add Block Device Support

Open will-v-pi opened this issue 1 year ago • 2 comments

Adds support for using ls, mkdir, cp (including between host and device), rm, and cat commands, with LittleFS (used by MicroPython) or FatFS filesystem support.

Works with block devices specified in the binary info, and with partitions. It autodetects the file system if --filesystem is not specified, and also supports formatting the block device if required with the -f argument.

This fixes #58

will-v-pi avatar Dec 18 '24 17:12 will-v-pi

A thought I just had - to make this slightly easier to use, could you have picotool check what filename it was invoked with (e.g. like busybox does), and then you could have picotool_ls, picotool_cat, etc. symlinks to the picotool binary, and then calling picotool_ls somedir would do the same thing as picotool bdev ls somedir ? (Or if that's not possible, perhaps the picotool CMake install could add a bunch of shell scripts e.g. named picotool_ls which just does picotool bdev ls $@)

lurch avatar Aug 25 '25 09:08 lurch

A thought I just had - to make this slightly easier to use, could you have picotool check what filename it was invoked with (e.g. like busybox does), and then you could have picotool_ls, picotool_cat, etc. symlinks to the picotool binary, and then calling picotool_ls somedir would do the same thing as picotool bdev ls somedir ? (Or if that's not possible, perhaps the picotool CMake install could add a bunch of shell scripts e.g. named picotool_ls which just does picotool bdev ls $@)

I think that might be best left to the user to do, to avoid polluting their shell (eg you might want picotool_ls to list devices, not use the bdev command) - you could also create an alias to picotool bdev in bashrc (which also avoids the need for underscores and therefore the shift key), so I don’t think I’ll include that is this PR

will-v-pi avatar Aug 25 '25 14:08 will-v-pi