prusa3d / Prusa-Firmware-SL1

Original Prusa SL1 3D printer firmware
GNU General Public License v3.0
38 stars 17 forks source link

How to install custom firmware? #65

Open achingbrain opened 2 years ago

achingbrain commented 2 years ago

I'm not quite sure what I'm doing wrong here, any guidance would be much appreciated.

The steps I've taken are:

  1. Install fresh Ubuntu VM
  2. Update system and Install tools from Dockerfile
  3. Clone the repository
  4. Obtain certificates for image signing
  5. Fork firmware
  6. Make one small change
  7. Update SRC_URI and SRCREV for sla-fw to point to my fork & commit with my changes
  8. Build development SD image - using sla-update-bundle target
  9. Copy resulting build/tmp/deploy/images/prusa64-sl1/sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb file to the USB thumb drive
  10. Choose the firmware upgrade menu on my printer and choose the .raucb file that appears in the menu that matches the file I copied onto the thumbdrive

At this point I see a screen saying "FW meta information not found", if I continue with the installation it fails with a 10534 error which means it failed to read the file?

Did I miss a step? Do I need to generate this meta information somehow?

achingbrain commented 2 years ago

I can print the rauc bundle metadata:

$ rauc info --output-format=json --keyring=../../../../../keys/cert.pem sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb | jq .
rauc-Message: 06:58:59.390: Reading bundle: /home/parallels/Prusa-Firmware-SL1/build/tmp/deploy/images/prusa64-sl1/sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb
rauc-Message: 06:58:59.391: Verifying bundle... 
{
  "compatible": "prusa64-sl1--prusa",
  "version": "my-custom-build",
  "description": "sla-update-bundle version 1.0-r0",
  "build": "20220620064512",
  "hooks": [],
  "images": [
    {
      "rootfs": {
        "variant": null,
        "filename": "sla-image-prusa64-sl1.root.ext4",
        "checksum": "ac5675e6a1182293c7ece6f29a49b05dd80134d5e836904905a14101d9e10c97",
        "size": 805306368,
        "hooks": [
          "post-install"
        ]
      }
    },
    {
      "bootloader": {
        "variant": null,
        "filename": "u-boot-sunxi-with-spl.bin",
        "checksum": "c62657f11aac1a9a72854e5f46a2545f6a85fd1d6a554f4a665581d611d52be4",
        "size": 473859,
        "hooks": [
          "post-install"
        ]
      }
    },
    {
      "etcfs": {
        "variant": null,
        "filename": "sla-image-prusa64-sl1.etc.ext4",
        "checksum": "ff518931127a4cbb97bc15f6239aa16d57ce53b340a437b3f9c8650e5a08ca25",
        "size": 33554432,
        "hooks": [
          "post-install"
        ]
      }
    }
  ]
}

And the sha1sums of the bundle on the host and the thumbdrive match:

$ sha1sum sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb 
8d0d7261916063533d62250ef5829e9dd5d4c0b9  sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb
$ sha1sum /media/parallels/872C-D12A/sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb 
8d0d7261916063533d62250ef5829e9dd5d4c0b9  /media/parallels/872C-D12A/sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb
achingbrain commented 2 years ago

Digging into the system logs it seems it's failing because the certificate generated as part of step 4 in the OP is self-signed:

Jun 21 08:31:30.614260 prusa64-sl1 rauc[257]: signature verification failed: Verify error:self signed certificate
Jun 21 08:31:30.616561 prusa64-sl1 rauc[257]: installing /run/media/system/sda1/sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb: signature verification failed: Verify error:self signed certificate
Jun 21 08:31:30.616601 prusa64-sl1 rauc[257]: installing /run/media/system/sda1/sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb: finished
Jun 21 08:31:30.617229 prusa64-sl1 rauc[257]: installing `/run/media/system/sda1/sla-update-bundle-prusa64-sl1-my-custom-build-dirty.raucb` failed: 1
Jun 21 08:31:30.775829 prusa64-sl1 touch-ui[308]: qml: Error updating firmware: signature verification failed: Verify error:self signed certificate
Jun 21 08:31:30.778256 prusa64-sl1 touch-ui[308]: qml: Trying to push an error:  {"code":"#10534"}

I'm guessing the printer needs to be put into some sort of development mode to skip the certificate check, otherwise it looks like you can only install official firmware on the device?

tritol commented 2 years ago

Your guess is correct, the firmware protects itself. You can make the bootstrap μSD via sla-bootstrap. Remove the red sticker from the μSD slot (THIS WILL VOID YOUR WARRANTY!) and boot from that μSD card. It completely deletes the original firmware and you can use your own. The μSD slot is on the other side of the RTC battery.

tritol commented 2 years ago

Optionally you can boot up sla-dev-image μSD and just use it instead of full bootstrap. You can go back to original fw if you remove the μSD (but you will lost your warranty anyway).