Building u-boot gadget snaps (a series of blog posts)


#1

I just started a little series of HOWTO blog posts around gadget snaps, how to create them and how to build u-boot from source at https://ograblog.wordpress.com/2017/05/30/building-u-boot-gadget-snap-packages-from-source/

It uses the new https://github.com/ogra1/beaglebone-gadget as example code.


The gadget snap
#2

The second post in this series just got published at https://ograblog.wordpress.com/2017/06/13/patching-u-boot-for-use-in-an-ubuntu-core-gadget-snap/

It describes how (and why) the uboot.patch file used by Ubuntu Core gadgets snaps is created and uses https://github.com/ogra1/sabrelite-gadget as example code this time.


#3

Note that you can actually build u-boot using the kbuild plugin. This allows cross compilation with snapcraft --target-arch armhf. You just need to set build-attributes: [no-install] to avoid calling make install.


#4

Since i wrote these blog posts some improvements in snapcraft have been made, the “on” and “to” statements for build-packages can actually make cross building 100% transparent now (independent of what plugin you use), so if the snapcraft.yaml is properly crafted you can just call snapcraft without any --target-arch options (the target arch for gadgets is typically fixed and defined in the yaml already).

If you look at the dragonboard gadget snap you can see that this already uses the kbuild plugin, the problem here is that you need a new enough u-boot tree to support this. Many old board implementations still have not been ported (and probably never will) or simply come with a forked old u-boot tree the BSP lives on top that you will have to deal with.

My personal problem with the kbuild plugin is that it makes everything a bit more opaque, when i want to explain the process to some newcomer a few lines of shell in a script snippet in snapcraft.yaml is easier to understand IMHO. But yeah, you can definitely use kbuild here as well.


#5

That’s quite nice. For 32-bit arm the x-uboot.py from dragonboard-gadget needs a lookup table to translate “armhf” to “arm”.


#6

@ogra
Hi, I followed your blog posts about gadget snaps. I was hoping if you could please explain more in details the uboot.env.in. I’m trying to create a gadget snap for imx6 pico itx board and I’m not sure if I’m setting the env file correctly.
Thank you.