Dear drewmoseley,
thank you very much for this guide. I’m using this module in a project and the mender integration went very well so far, thanks to your effort.
(Just on thing to add maybe: I needed to ‘bitbake -c populate_sdk …’ before building the image itself. Without this step there was some mender compilation error regarding ‘pseudo-native’, which could not be found.)
Now I would like to use OP-TEE for some security features. There are examples by NXP for their EVKs, but none really for the Variscite modules (see the NXP community board). I tried a few approaches and the best one resulted in appending ‘optee’ to the MACHINE_FEATURES and inserting a node into the devicetree - so far, so good.
Then there’s the problem: OP-TEE needs to add a file called ‘tee.bin’ to u-boot, i. e. to the boot partition via IMAGE_BOOT_FILES variable, but following your guide it is manually set to empty by the ‘meta-mender-variscite/templates/local.conf.append’ and the boot partition size is set to ‘0’.
Do you have an idea how to solve this? I tried commenting the overrides in ‘local.conf’, but the board won’t boot then, since it seems to be unable to find the bootloader.
Would it be possible to add the file to ‘/boot’, where kernel and devicetrees are located?
/edit:
I just looked at the u-boot env and there seems to be a new bootcmd with optee content:
bootcmd_mfg=run mfgtool_args;if iminfo ${initrd_addr}; then if test ${tee} = yes; then bootm ${tee_addr} ${initrd_addr} ${fdt_addr}; else booti ${loadaddr} ${initrd_addr} ${fdt_addr}; fi; else echo "Run fastboot ..."; fastboot 0; fi;
u-boot=> printenv
altbootcmd=run mender_altbootcmd; run bootcmd
baudrate=115200
board_name=VAR-SOM-MX8M-MINI
boot_fdt=try
bootcmd=run mender_setup; setenv bootargs root={mender_kernel_root} {bootargs}; if test “{fdt_addr_r}" != ""; then load {mender_uboot_root} {fdt_addr_r} /boot/{mender_dtb_name}; fi; load {mender_uboot_root} {img_addr} /boot/{mender_kernel_name};unzip {img_addr} {loadaddr}; {mender_boot_kernel_type} {kernel_addr_r} - {fdt_addr_r}; run mender_try_to_recover
bootcmd_mfg=run mfgtool_args;if iminfo {initrd_addr}; then if test {tee} = yes; then bootm {tee_addr} {initrd_addr} {fdt_addr}; else booti {loadaddr} {initrd_addr} {fdt_addr}; fi; else echo “Run fastboot …”; fastboot 0; fi;
bootcount=1
bootdelay=1
bootdir=/boot
bootlimit=1
bootscript=echo Running bootscript from mmc …; source
console=ttymxc3,115200 earlycon=ec_imx6q,0x30a60000,115200
emmc_dev=1
ethaddr=xx:xx:xx:xx:xx:xx
ethprime=FEC
fastboot_dev=mmc0
fdt_addr_r=0x43000000
fdt_file=undefined
fdt_high=0xffffffffffffffff
fdtcontroladdr=b6d43ad8
findfdt=if test $fdt_file = undefined; then if test $board_name = VAR-SOM-MX8M-MINI; then if test som_rev = som_rev10; then setenv fdt_file fsl-imx8mm-var-som-rev10.dtb; else setenv fdt_file fsl-imx8mm-var-som.dtb; fi;else setenv fdt_file fsl-imx8mm-var-dart.dtb;fi; fi;
image=Image.gz
img_addr=0x42000000
initrd_addr=0x43800000
initrd_high=0xffffffffffffffff
ip_dyn=yes
kboot=booti
loadaddr=0x40480000
loadbootscript=load mmc {mmcdev}:{mmcpart} {loadaddr} {bootdir}/{script};
loadfdt=run findfdt; echo fdt_file={fdt_file}; load mmc {mmcdev}:{mmcpart} {fdt_addr} {bootdir}/{fdt_file}
loadimage=load mmc {mmcdev}:{mmcpart} {img_addr} {bootdir}/{image};unzip {img_addr} {loadaddr}
loadm4bin=load mmc {mmcdev}:{mmcpart} {m4_addr} {bootdir}/{m4_bin}
m4_addr=0x7e0000
m4_bin=hello_world.bin
mender_altbootcmd=if test {mender_boot_part} = 1; then setenv mender_boot_part 2; setenv mender_boot_part_hex 2; else setenv mender_boot_part 1; setenv mender_boot_part_hex 1; fi; setenv upgrade_available 0; saveenv; run mender_setup
mender_boot_kernel_type=booti
mender_boot_part=1
mender_boot_part_hex=1
mender_check_saveenv_canary=1
mender_dtb_name=fsl-imx8mm-var-som-rev10-m4.dtb
mender_kernel_name=Image.gz
mender_pre_setup_commands= setenv bootargs console={console},{baudrate}; if test "{mmcargs}” != “”; then run mmcargs; fi; if test “{videoargs}" != ""; then run videoargs; fi; if test "{optargs}” != “”; then run optargs; fi; if test “{ramsize_check}" != ""; then run ramsize_check; fi; run findfdt; setenv mender_dtb_name {fdt_file}; setenv kernel_addr_r {loadaddr};
mender_saveenv_canary=1
mender_setup=if test "{mender_saveenv_canary}” != “1”; then setenv mender_saveenv_canary 1; saveenv; fi; if test “{mender_pre_setup_commands}" != ""; then run mender_pre_setup_commands; fi; if test "{mender_systemd_machine_id}” != “”; then setenv bootargs systemd.machine_id={mender_systemd_machine_id} {bootargs}; fi; setenv mender_kernel_root /dev/mmcblk1p${mender_boot_part}; if test {mender_boot_part} = 1; then setenv mender_boot_part_name /dev/mmcblk1p1; else setenv mender_boot_part_name /dev/mmcblk1p2; fi; setenv mender_kernel_root_name {mender_boot_part_name}; setenv mender_uboot_root mmc 0:{mender_boot_part_hex}; setenv mender_uboot_root_name {mender_boot_part_name}; setenv expand_bootargs “setenv bootargs \”{bootargs}\\""; run expand_bootargs; setenv expand_bootargs; if test "{mender_post_setup_commands}" != “”; then run mender_post_setup_commands; fi
mender_try_to_recover=if test {upgrade_available} = 1; then reset; fi
mender_uboot_boot=mmc 0:1
mender_uboot_dev=0
mender_uboot_if=mmc
mfgtool_args=setenv bootargs console={console},{baudrate} rdinit=/linuxrc clk_ignore_unused
mmcargs=setenv bootargs console={console} rootwait rw {cma_size}
mmcautodetect=yes
mmcblk=1
mmcboot=echo Booting from mmc ...; run mmcargs; run optargs; if test {boot_fdt} = yes || test {boot_fdt} = try; then if run loadfdt; then booti {loadaddr} - {fdt_addr}; else echo WARN: Cannot load the DT; fi; else echo wait for boot; fi;
mmcdev=0
mmcpart=1
netargs=setenv bootargs console={console} {cma_size} ip=dhcp nfsroot={serverip}:{nfsroot},v3,tcp
netboot=echo Booting from net ...; if test {ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; {get_cmd} {img_addr} {image}; unzip {img_addr} {loadaddr};run ramsize_check; run netargs; run optargs; if test {boot_fdt} = yes || test {boot_fdt} = try; then run findfdt; echo fdt_file={fdt_file}; if {get_cmd} {fdt_addr} {fdt_file}; then booti {loadaddr} - {fdt_addr}; else echo WARN: Cannot load the DT; fi; else booti; fi;
optargs=setenv bootargs {bootargs} ${kernelargs};
ramsize_check=if test sdram_size -le 512; then setenv cma_size cma=320M; else setenv cma_size cma=640M@1376M; fi;
runm4bin=if test {m4_addr} = 0x7e0000; then echo Booting M4 from TCM; else echo Booting M4 from DRAM; dcache flush; fi; bootaux ${m4_addr};
script=boot.scr
sd_dev=0
sdram_size=2048
serial#=0d111209dab4b749
soc_type=imx8mm
som_rev=som_rev11
splashdisable=setenv splashfile; setenv splashimage
splashenable=setenv splashfile /boot/splash.bmp; setenv splashimage 0x43100000
splashfile=/boot/splash.bmp
splashimage=0x43100000
splashsourceauto=yes
stderr=serial
stdin=serial
stdout=serial
upgrade_available=0
use_m4=no
However, it is not called by the default bootcmd and if I try ‘run bootcmd_mfg’ it says ## Checking Image at 43800000 ... Unknown image format!
because the ‘iminfo’ command cannot find a valid image at ‘initrd_addr’.
I would appreciate your help very much.
djoh