What's the first code to run when booting from TF/UDISK?

hi community,

i’d like to study the boot prcess of CE after bootloader, i.e., from the img released on github.

so my first question is, what’s the first code to run in the FAT32 partition labelled with COREELEC, and who decides to boot this code instead of others?

many thanks.

i belive the very first code to run is aml_autoscript, though i’ve got no proof…

and what’s the format of kernel.img?

and, where do the commands setenv/run/fatload/bootm/etc are defined?

aml_autoscript does only setup the boot environment of the Amlogic u-boot.
Then we use cfgload script for generic or boot.ini SBC device where we deliver CE u-boot as well.

So cfgload or boot.ini loads the kernel.img from storage to memory and boot the kernel.

one step ahead. thanks.

what’s the format of kernel.img? KERNEL seems to be a squashfs image (i’m not with a linux box so i cannot verify it)