What's the possible reason why ubuntu-image is not injecting a default snap_core/kernel in the uboot.env?

For now i try to manually put snap_core/kernel values…any possible reason?

And is it possible not to use uboot.env and just use boot.scr instead?.. When i build an actual image without uboot.env…ubuntu-image complain about no boot config…since i tried to use boot.scr

For some reason… Ubuntu-image now injects the snap_core/kernel value on to uboot.env file during build…

technically you can surely use both and load one from the other, so boot.scr would hold your “normal” environment and be loaded from a script snippet in uboot.env, and uboot.env would only contain all snap related variables as well as the actual boot script (in the snappy_boot variable)

uboot.env is mandatory for the snap variables though, since snapd only implements one way of dealing with each bootloader for the core and kernel auto-rollback feature.

practically you have to create a uboot.env anyway since that is a hard requirement of snapd and the core boot process currently, so it is usually less work to simply transfer all the boot.scr bits into uboot.env as well and only maintain one file instead of two.

(PS: i moved this to the device category since this isnt a snapcraft issue)

1 Like

no worries… i don’t really mind changing the category of this post as i’m not really sure where to palce this…thanks.

now for some reason… if i only use uboot.env alone… it always display error message like…

not defined distro_bootcmd
“run snappy_boot” show not defined too. even if its there when i use “pri or printenv”

if it is a corrupt file issue…i’m not sure… already tried to make a uboot.env file alone as well via ubuntu-image creation…but the result is still the same… i’m trying an u-boot v2017.11 and may use a newt realease v2018.01. also i’m thinking of trying boot.scr + uEnv.txt if it will work to boot it up. so far i only use a boot.scr to check if the initrd.img and kernel.img by ubuntu-image will boot up.

i’m not sure if this is also the reason but i manually modify this line and did not make a patch file of it: kernel.py

def _unpack_generic_initrd(self):
initrd_path = os.path.join(
from: ‘usr’, ‘lib’, ‘ubuntu-core-generic-initrd’, ‘initrd.img-core’)
to: ‘boot’, ‘initrd.img-core’)

The kernel.py change is fine (i use the same currently :slight_smile: ) …

i wrote a set of blogposts a while ago about creating proper gadget snaps for u-boot based devices, i sadly didnt find the time for the “how to create the uboot.env properly” part yet …

1 Like

before i encountered this when snapping the kernel:

RuntimeError: Unable to determine mime type for ‘/tmp/tmp33t2j0m0/squashfs-root/usr/lib/ubuntu-core-generic-initrd/initrd.img-core’: No such file or directory

which “usr/lib/ubuntu-core-generic-initrd/initrd.img-core” is a symlink of initrd.img-core from the boot folder. that’s why i replace “usr/lib/ubuntu-core-generic-initrd” to solve that issue. I already re-installed hoping that it was fixed since some one already submit a bug report of it.

I’ve read your post actually before i tried building one. and helps me alot. :grin:

for the patch i only include a few lines because some are already default and u-boot display that it was defined already so i remove those and only use this lines below: /* vfat support for snappy */

#define CONFIG_SUPPORT_VFAT #define CONFIG_SUPPORT_RAW_INITRD #define CONFIG_SYS_REDUNDAND_ENVIRONMENT

the only issue that holds me back is the uboot.env file. Also i added “source-depth” or the entire repository will be downloaded.

well, the question is if the existing definition is usable by snapd when updating the bootloader variables, snapd requires that a uboot.env file is sitting on the partition with the system-boot label, u-boot needs to know that too so teh defines in your config need to point to this …

CONFIG_ENV_IS_IN_FAT is an essential setting here
to make u-boot find the file at all

and FAT_ENV_INTERFACE, FAT_ENV_DEVICE_AND_PART and FAT_ENV_FILE need to have the right values for the above setting… it is unlikely that the already defined values of these vars point to the right thing, so you should check them.

see https://github.com/ogra1/beaglebone-gadget/blob/master/uboot.patch for typical values for these.

is there any difference between values in a .h file vs. on a defconfig file?

ex. defined on defconfig CONFIG_ENV_FAT_INTERFACE=“mmc” vs #define FAT_ENV_INTERFACE “mmc” on .h file. I’m wondering if there’s any different aside from the naming…

i’ve check again and it has the right config value.