About first init of ubuntu core

I have some questions about first boot of ubuntu core.Becasue i’m a beginner of linux, i’m not familiar with linux uboot and kernel.

I built images via this.And my raspberry is already running ubuntu core with self-build kernel and gadget.

Now i’m building image for imx6ull board designed by myself. But it’s not going well.
I have read the blog about gadget.
I understand the gadget snap need at least two file,snap.yaml and gadget.yaml.
snap.yaml is snap details and just package things that generate by gadget.yaml together, and gadget.yaml is generate uboot and init the disk, is it right?
Kernel.snap is packages of kernel. It will be unsquashfs and moved to the right place.
core.snap is package of rootfs for ubuntu core.

I build a image and while booting it cannnot find uboot.scr and zimage.So i mount it on my pc. And find the boot.scr is in /boot file and kernel/initrd/dtbs is in xxx_x1.snap. After init the xxx_x1.snap will change name to snap. So how can i make uboot to read this file? And how do uboot read this file for the first time?And how to read this file after change name to snap?

I notice that while building kernel.snap it will download os.snap. What is os.snap? Is it used for first init and other functions of ubuntu core?

regarding the gadget snap, try basing off https://github.com/ogra1/sabrelite-gadget which is an actual imx6 gadget …

it should be possible to just adjust the “mx6qsabrelite_config” in snapcraft.yaml to point to your required config and then adjust ftd_file, loadaddr, initrd_addr and fdt_addr to the ones your board requires to make it work.

note that zimage or boot.scr are not used at all in UbuntuCore. when ubuntu-image builds the image it creates the proper structure inside the system-boot partition to have /boot/uboot/{kernel.img/initrd.img/dtbs} by copying these files out of your kernel snap package.

the os.snap is actually the core snap which is also providing the root filesystem of your image … in the case of the kernel snap build it is used to obtain a generic initrd.img file that lives inside the os snap package.