Pico Pro/Max with Linux Host (SocToolKit/upgrade_tool for Linux with SD card support)

  • A quick solution could be:
    • we use `upgrade_tool` to write to eMMC (256MB), which would require a change of the .env.txt, so only those *.img are written which belong to the eMMC
    • we use a dedicated script to write to the SD card while connected to the host (not yet inserted into the board)
    I started to code a small script which takes .env.txt and and looks at the *.img (it doesn't write anything yet):
    % blkenvflash /dev/sdc
    mmcblk1: env.img size:32,768/32K (offset:0/0B) imgsize:32,768 (32K)
    mmcblk1: idblock.img size:524,288/512K (offset:32,768/32K) imgsize:182,272 (178K)
    mmcblk1: uboot.img size:262,144/256K (offset:0/0B) imgsize:262,144 (256K)
    mmcblk1: boot.img size:33,554,432/32M (offset:0/0B) imgsize:2,903,552 (2,903,552B)
    mmcblk1: oem.img size:536,870,912/512M (offset:0/0B) imgsize:45,555,712 (44,488K)
    mmcblk1: userdata.img size:268,435,456/256M (offset:0/0B) imgsize:9,999,360 (9,765K)
    mmcblk1: rootfs.img size:6,442,450,944/6G (offset:0/0B) imgsize:1,094,365,184 (1,068,716K)
    mmcblk0: idblock.img size:524,288/512K (offset:32,768/32K) imgsize:182,272 (178K)
    mmcblk0: uboot.img size:4,194,304/4M (offset:0/0B) imgsize:262,144 (256K)
    this is the Ubuntu with 6G rootfs.img.

    Questions:
    • can I write the mmcblk1/*.img with `dd` in one go (concat the involved *.img) or do we need to fdisk/sfdisk to partition the SD card first, and then individually `dd` the *.img to the SD card?
    • is there anything else on the SD card beside the mmclbk1/*.img?
  • I developed the solution based on the feedback I received at https://github.com/LuckfoxTECH/luckfox-pico/issues/129 - there also link to the script is posted.
  • Also, for clarification, there is a SocToolKit for Linux at https://github.com/LuckfoxTECH/luckfox- ... SocToolKit

    As SocToolKit didn't work for me, I did this blkenvflash script which allows to write to the SD card direct on the Linux Host: https://gist.github.com/Spiritdude/da36 ... 0a8b9f972f
  • Thank you for sharing.
  • To use Pico Pro/Max with a Linux host for flashing or upgrading via SD card, follow these steps: SSO ID Login

    1. Download Tools: Obtain `SocToolKit` or `upgrade_tool` for Linux from the official source or repository.

    2. Prepare SD Card:
    - Format the SD card to FAT32.
    - Copy the firmware image or upgrade files to the SD card.

    3. Connect Devices:
    - Insert the SD card into the Pico Pro/Max device.
    - Connect the device to your Linux host using the appropriate interface (USB/Serial).

    4. Run Tool:
    - Open a terminal on your Linux host.
    - Use `SocToolKit` or `upgrade_tool` commands to interact with the device.
    - Replace `firmware.img` with your firmware file and ensure the correct tool syntax.

    5. Monitor Progress: Follow the terminal output for progress and any error messages.

    6. Completion: Once the process is complete, remove the SD card and reboot the Pico Pro/Max to apply the changes.
  • Thanks a lot for the information about the linux version of SocToolKit!

    However I am getting an error running it on my Ubuntu 23.04 machine
    ```
    $ ./SocToolKit
    QSocketNotifier: Can only be used with threads started with QThread

    (SocToolKit:50620): GLib-GIO-ERROR **: 20:59:34.487: Settings schema 'org.gnome.settings-daemon.plugins.xsettings' does not contain a key named 'antialiasing'
    Trace/breakpoint trap (core dumped)
    ```

    Being able to develop for this board without windows would be amazing! Also, you work trying to get around windows/soctoolkit altogether is also great, because SocToolKit is super buggy.
  • spiritdude wrote: 2024-06-19 4:42 Also, for clarification, there is a SocToolKit for Linux at https://github.com/LuckfoxTECH/luckfox- ... SocToolKit

    As SocToolKit didn't work for me, I did this blkenvflash script which allows to write to the SD card direct on the Linux Host: https://gist.github.com/Spiritdude/da36 ... 0a8b9f972f
    Thanks for this tool link! I missed it the first time coming around to this thread! blkenvflash worked for me on my Mac.

    Hopefully this get me going on my project finally. The mental context switching to use windows computer, or my painfully slow Parallels install made developing for this board terrible.