Pi4 with custom gadget won't boot, only a blank screen

Hello!

I’m trying to build a custom image, and want to include some custom stuff in the gadget. I’m trying to test whether I can even build the custom gadget and create the image with it before I try modifying it, but I’m running into trouble. Here’s what I’ve done so far:

  1. Clone the 20-arm64 branch of the universal pi-gadget (https://github.com/snapcore/pi-gadget)
  2. Build the universal pi-gadget without modifying it, just by running snapcraft in the directory.
  3. Edit my model.json to call the pi gadget without an id (so that it won’t pull from the snap store).
  4. Build the custom UC20 image with ubuntu-image, and using --extra-snaps locally-built-pi-gadget.snap
  5. Write the image to the SD card using Raspberry Pi Imager.

When I try to boot the Pi from the SD card, I just get a completely blank screen, no rainbow screen, no other output. I’ve tried both HDMI ports on the Pi just to make sure.

What’s interesting, is if I use the pi gadget (20/stable) from the snap store, instead of the one built locally, the Pi boots the custom image just fine.

I was under the impression that the pi gadget in the snap store is built using the code from the github repo, but maybe I’m wrong on that?

Thanks in advance for any insight on this!

did you do this on a RPi (or any other arm hardware) ?

… else you will need the build instructions from the readme of the gadget branch to actually cross-build the snap …

(just calling snapcraft will produce a snap for your host architecture, not for the desired target architecture)

Oh interesting! I’m building it on an x64 Ubuntu 20.04 machine. I assumed that because I had this in the snapcraft.yaml, it would cross build it:

architectures:
- build-on: [amd64, arm64]
  run-on: arm64

I tried the target arch params from the readme: sudo snapcraft snap --target-arch=arm64 --destructive-mode --enable-experimental-target-arch

But it fails to build, it looks like there are some 404s when it’s trying to grab the main arm64 package (it seems to try three times): Err:35 http://security.ubuntu.com/ubuntu focal-security/main arm64 Packages 404 Not Found [IP: 91.189.91.38 80]

And then it finally fails with:

make: *** [Makefile:79: multiverse] Error 100
make: Leaving directory '/home/keith/git/pi-gadget/parts/gadget/src'
Failed to run 'override-build': Exit code was 2.

I will try installing Ubuntu 20.04 directly on the Pi and then see if I can get it to build there. Thanks for your help so far!

if you happen to have an UC20 image around already (from former testing or whatnot), note that you can also easily build snaps on UbuntuCore using an lxd container:

I was able to build it using LXD in Ubuntu Server on the Pi, so all good now. Thanks a bunch for your help!

1 Like