NXP i.MX6 DL - Ubuntu 20.04 LTS

Hi all,

Thanks in advance for the reply.

I am using i.mx6 processor in my gateway, Using Ubuntu 20.04 LTS OS, booting from eMMC of 8GB, and also possible to boot from memory card supporting upto 32 GB.
I partitioned the memory into 4 parts. one FAT16 partition and three EXT4 partition. I installed the mender client and after that i installed mender artifact also,
Then now i am able to do the application update to the device. But my aim is to do the system update, so can you help me to do the complete system update.

The commands i used are writing below for the application update.

wget https://downloads.mender.io/2.5.0/dist-packages/debian/armhf/mender-client_2.5.0-1_armhf.deb --no-check-certificate
sudo ln -s /usr/lib/arm-linux-gnueabihf/libffi.so.7 /usr/lib/arm-linux-gnueabihf/libffi.so.6
sudo dpkg -i mender-client_2.5.0-1_armhf.deb
wget http://downloads.mender.io/mender-artifact/3.5.0/linux/mender-artifact
sudo chmod +x mender-artifact
sudo cp mender-artifact /usr/local/bin/
curl -fLsS https://get.mender.io -o get-mender.sh
sudo sh get-mender.sh

So, for system update, from where i can start,(expecting the reply for changes in Uboot and kernel level also if there any)

Have you had a look at the integration checklist ?

And since you are running Ubuntu, you will also need this link.
Drew

Compatibility with mender- Integration steps i have done, can u look on it.

root@CAS-IIoT:/etc# fw_printenv
bootcmd=run distro_bootcmd
bootdelay=2
baudrate=115200
stdin=serial,cros-ec-keyb,usbkbd
stdout=serial,vidconsole
stderr=serial,vidconsole
ethaddr=00:00:11:22:33:44
eth1addr=00:00:11:22:33:45
eth3addr=00:00:11:22:33:46
eth5addr=00:00:11:22:33:47
ipaddr=1.2.3.4
host_boot=if host dev {devnum}; then devtype=host; run scan_dev_for_boot_part; fi sata_boot=if sata dev {devnum}; then devtype=sata; run scan_dev_for_boot_part; fi
scsi_init=if {scsi_need_init}; then scsi_need_init=false; scsi scan; fi scsi_boot=run scsi_init; if scsi dev {devnum}; then devtype=scsi; run scan_dev_for_boot_part; fi
virtio_boot=if virtio dev {devnum}; then devtype=virtio; run scan_dev_for_boot_part; fi boot_prefixes=/ /boot/ boot_scripts=boot.scr.uimg boot.scr boot_script_dhcp=boot.scr.uimg boot_targets=host1 host0 boot_syslinux_conf=extlinux/extlinux.conf boot_extlinux=sysboot {devtype} {devnum}:{distro_bootpart} any {scriptaddr} {prefix}{boot_syslinux_conf} scan_dev_for_extlinux=if test -e {devtype} {devnum}:{distro_bootpart} {prefix}{boot_syslinux_conf}; then echo Found {prefix}{boot_syslinux_conf}; run boot_extlinux
; echo SCRIPT FAILED: continuing…; fi
boot_a_script=load {devtype} {devnum}:{distro_bootpart} {scriptaddr} {prefix}{script}; source {scriptaddr} scan_dev_for_scripts=for script in {boot_scripts}; do if test -e {devtype} {devnum}:{distro_bootpart} {prefix}{script}; then echo Found U-Boot script {prefix}{scr ipt}; run boot_a_script; echo SCRIPT FAILED: continuing...; fi; done scan_dev_for_boot=echo Scanning {devtype} {devnum}:{distro_bootpart}…; for prefix in {boot_prefixes}; do run scan_dev_for_extlinux; run scan_dev_for_scripts; done; scan_dev_for_boot_part=part list {devtype} {devnum} -bootable devplist; env exists devplist || setenv devplist 1; for distro_bootpart in {devplist}; do if fstype {dev type} {devnum}:{distro_bootpart} bootfstype; then run scan_dev_for_boot; fi; done; setenv devplist bootcmd_host1=devnum=1; run host_boot bootcmd_host0=devnum=0; run host_boot distro_bootcmd=scsi_need_init=; for target in {boot_targets}; do run bootcmd_${target}; done
bootm_size=0x10000000
kernel_addr_r=0x1000000
fdt_addr_r=0xc00000
ramdisk_addr_r=0x2000000
scriptaddr=0x1000
pxefile_addr_r=0x2000
mender_boot_part=2
upgrade_available=1
bootcount=0

This is the output for fw_printenv.

nano /etc/fw_env.config output is
/dev/mmcblk0p2 0x800000 0x20000
/dev/mmcblk0p2 0x1000000 0x20000

Partition A - mmcblk0p2 where rootfs
Partition B - mmcblk0p3

In integration steps, step 7 didnt work for me

Can u have a look on it

It’s not just the steps in the integration checklist. You need to run the mender-convert utility to ensure that your bootloader has the proper environment variables setup.

Drew

root@CAS-IIoT:/etc/mendersw# sudo apt-get install docker-ce docker-ce-cli containerd.io
Reading package lists… Done
Building dependency tree
Reading state information… Done
Package docker-ce is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package ‘docker-ce’ has no installation candidate
E: Unable to locate package docker-ce-cli
E: Unable to locate package containerd.io
E: Couldn’t find any package by glob ‘containerd.io
E: Couldn’t find any package by regex ‘containerd.io

I couldn’t install docker engine, why?

I think it’s because the packages on Ubuntu are differently named and maintained. See this link.

E: The repository ‘https://download.docker.com/linux/debian focal Release’ does not have a Release file.

An error message is showing when i am trying to install docker engine, Are you sure that, docker engine debian focal release is available for 20.04 LTS version ?

It’s possible that it is not. You’ll need to check with Docker on that.

Finally successfully i installed Docker engine on my device, I installed bionic version docker engine, then updated. So then i copied the disk image into my workstation PC, then i saw the instruction that " Generate a Mender Artifact and disk image from this golden image using mender-convert (continue reading for details)" , so exactly where i have to install docker engine ? in workstation or device. I know it is a foolish question, even please help.

For running the mender-convert utility, it should be installed on your workstation PC. If you need docker containers running on the client, then you need to install it there.

Thank you,

MENDER_ARTIFACT_NAME=release-1 ./mender-convert \
  --disk-image input/<image-to-convert.img> \
  --config configs/raspberrypi3_config \
  --config configs/custom_config

I am using i.mx6 DL, by adding a custom config only, it will create mender artifact ?, The script i am giving below.

MENDER_ARTIFACT_NAME=release-1 ./mender-convert
–disk-image input/<image-to-convert.img>
–config configs/custom_config

i am not giving in the place of raspberri pi_config

mender_create_artifact() {
local -r device_type="{1}" local -r artifact_name="{2}"
mender_artifact=deploy/{device_type}-{artifact_name}.mender
log_info “Running custom implementation of the ‘mender_create_artifact’ hook”
log_info “Writing Mender artifact to: {mender_artifact}" log_info "This can take up to 20 minutes depending on which compression method is used" run_and_log_cmd "mender-artifact --compression {MENDER_ARTIFACT_COMPRESSION}
write rootfs-image
–file work/rootfs.img
–output-path {mender_artifact} \ --artifact-name {artifact_name}
–device-type ${device_type}
–script my-state-scripts/ArtifactInstall_Enter_00”

}

Can you tell me, it will create .mender artifact file?

Yes, the output of mender-convert is both an SDIMG file and a Mender artifact.

sudo dd if=<PATH-TO-IMAGE>.img of=<DEVICE> bs=4M && sync

After creating .img file, i executed this command.
From work station to memorycard .
sudo dd if=.img of=/dev/sdb bs=4M

After the execution the partition of memory card became 2 from 4. I think the default mender convert set is like that only, for making 4 partitions , i have to make changes in default configuration i think.

But with two partition it will execute?

If it will work, can you suggest me for mender artifact creation?

Simply i gave this for creating artifact

root@cascademic101:/media/cascademic-101/D/Roshan-Cascademic/Container_image/mender-convert# mender-artifact write rootfs-image \

-t IIOT
-n release-1
–software-version version1.0
-f rootfs.ext4
-o artifact.mender
Incorrect Usage: flag provided but not defined: -software-version

NAME:
mender-artifact write rootfs-image - Writes Mender artifact containing rootfs image

USAGE:
mender-artifact write rootfs-image [command options]

OPTIONS:
–file FILE, -f FILE Payload FILE.
–device-type value, -t value Type of device(s) supported by the Artifact. You can specify multiple compatible devices providing this parameter multiple times.
–artifact-name value, -n value Name of the artifact
–output-path value, -o value Full path to output artifact file.
–version value, -v value Version of the artifact. (default: 3)
–key value, -k value Full path to the private key that will be used to verify the artifact signature.
–script value, -s value Full path to the state script(s). You can specify multiple scripts providing this parameter multiple times.
–compression value Compression to use for data and header inside the artifact, currently supports: none, gzip, lzma.

Please suggest.

Yes, there definitely should be 4 partitions. I don’t know how you would get one with only 2 but it won’t work in that case.

Why are you manually creating the artifact rather than relying on mender-convert?

Drew

  1. I partitioned sd card into 4.
  2. Added rootfs in a partition and Uboot in a partition
  3. Memory card inserted my device.
  4. Installed the packages.
  5. Configured mender.conf (Partitions).
  6. Installed Docker engine in my workstation
  7. Removed the SD card and connected to the workstation.
  8. Copied the contents of golden image from sd card to workstation in a director …/mender-convert/input
  9. Hosted server client connection command
  10. Then run the command

MENDER_ARTIFACT_NAME=release-1.1 ./docker-mender-convert
–disk-image input/golden-image-1.img
–config configs/raspberrypi3_config
–overlay rootfs_overlay_demo/

  1. raspberripi3_config

IIOT_CONFIG=“IIOT”
#RASPBERRYPI_KERNEL_IMAGE=“kernel7.img”
MENDER_KERNEL_IMAGETYPE=“zImage”
MENDER_DEVICE_TYPE=“IIOT”

source configs/raspberrypi3_config

  1. raspberrypi3_config

MENDER_GRUB_EFI_INTEGRATION=n
MENDER_COPY_BOOT_GAP=n
MENDER_IGNORE_MISSING_EFI_STUB=1
function platform_modify() {
mkdir -p work/rpi/binaries

run_and_log_cmd “cp Ubuntu20_04.tar.bz2 work/rpi/binaries”
run_and_log_cmd “tar -jxvf work/rpi/binaries/Ubuntu20_04.tar.bz2 -C work/rpi/binaries”

run_and_log_cmd “sudo ln -sf /dev/null work/rootfs/etc/systemd/system/udisks2.service”

IIOT_KERNEL_IMAGE=“zImage”
RASPBERRYPI_BOOTLOADER_IMAGE=“u-boot.imx”

if [ -L work/rootfs/etc/rc3.d/S01resize2fs_once ]; then
run_and_log_cmd “sudo unlink work/rootfs/etc/rc3.d/S01resize2fs_once”
fi
run_and_log_cmd “sudo rm -f work/rootfs/etc/init.d/resize2fs_once”
}

  1. .img created and .mender also

  2. Copied this .img golden image to sd card which having already the rootfs and image file with 4 partition

  3. Then again inserted the sd card in my device. now 4 partitions are there, but it is 3.1 GB 2, 1.3 GB and 134mb. Previously i partitioned it into 5.3GB2, 1.3GB and 3.3GB.

  4. Changed the artifact name to 1.2 from 1.1

  5. Connected the device with hosted mender

  6. Uploaded and deployed the .mender file.

  7. But failed ,

log:

2021-03-09 13:19:07 +0000 UTC info: Running Mender client version: 2.5.0
2021-03-09 13:19:08 +0000 UTC info: State transition: update-fetch [Download_Enter] → update-store [Download_Enter]
2021-03-09 13:19:08 +0000 UTC info: No public key was provided for authenticating the artifact
2021-03-09 13:19:08 +0000 UTC error: Fetching Artifact headers failed: installer: failed to read Artifact: readHeaderV3: handleHeaderReads: Artifact Payload type ‘rootfs-image’ is not supported by this Mender Client. Ensure that the Mender Client is fully integrated and that the RootfsPartA/B configuration variables are set correctly in ‘mender.conf’
2021-03-09 13:19:08 +0000 UTC info: State transition: update-store [Download_Enter] → fetch-install-retry-wait [Download_Enter]
2021-03-09 13:19:08 +0000 UTC info: State transition: fetch-install-retry-wait [Download_Enter] → update-error [ArtifactFailure]
2021-03-09 13:19:08 +0000 UTC info: State transition: update-error [ArtifactFailure] → cleanup [Error]
2021-03-09 13:19:08 +0000 UTC info: State transition: cleanup [Error] → update-status-report [none]

Can u please tell me what are the errors, Where i have to do the changes for a successful deploy.

Thank you

I would suggest that you keep your golden image free of any Mender configurations. You don’t need to manually create the partitions or configure the mender.conf file. That should all be handled by the mender-convert invocation. The input image should be a standard RPI image with a single partition. The mender-convert utility will then do those steps. You can read a post discussing this workflow here.

HTH,
Drew

Hii,

I created two .mender artifact and .img of version 1.1 and 1.2.

I deployed version 1.1 to my device normally. Then i deployed version 1.2 by an updation through hosted mender server. Deploying was successful. But the difference between 1.1 and 1.2 is only one extra directory is there, but after successful deploying also, i couldnt find that directory. so i am suspecting that it is not deployed correctly.

The syslog informatiom i am giving below, please tell me the error.

root@CAS-IIoT:~# tail -f /var/log/syslog
Mar 10 20:04:39 CAS-IIoT mender[941]: time=“2021-03-10T20:04:39+05:30” level=info msg=“No public key was provided for authenticating the artifact”
Mar 10 20:04:39 CAS-IIoT mender[941]: time=“2021-03-10T20:04:39+05:30” level=info msg=“Opening device “/dev/mmcblk0p3” for writing”
Mar 10 20:04:39 CAS-IIoT mender[941]: time=“2021-03-10T20:04:39+05:30” level=info msg=“Native sector size of block device /dev/mmcblk0p3 is 512 bytes. Mender will write i
n chunks of 1048576 bytes”
Mar 10 20:06:06 CAS-IIoT pppd[9526]: In file /etc/ppp/options-mobile: unrecognized option ‘ttyUSB2’
Mar 10 20:07:32 CAS-IIoT systemd[1]: Starting Cleanup of Temporary Directories…
Mar 10 20:07:32 CAS-IIoT systemd[1]: Started Session c3 of user root.
Mar 10 20:07:33 CAS-IIoT systemd[1]: systemd-tmpfiles-clean.service: Succeeded.
Mar 10 20:07:33 CAS-IIoT systemd[1]: Finished Cleanup of Temporary Directories.
Mar 10 20:08:28 CAS-IIoT pppd[9709]: In file /etc/ppp/options-mobile: unrecognized option ‘ttyUSB2’
Mar 10 20:09:01 CAS-IIoT kernel: System is too hot. GPU3D will work at 1/64 clock.
Mar 10 20:10:00 CAS-IIoT pppd[9817]: In file /etc/ppp/options-mobile: unrecognized option ‘ttyUSB2’
Mar 10 20:14:05 CAS-IIoT kernel: Hot alarm is canceled. GPU3D clock will return to 64/64
Mar 10 20:15:10 CAS-IIoT mender[941]: time=“2021-03-10T20:15:10+05:30” level=info msg=“All bytes were successfully written to the new partition”
Mar 10 20:15:10 CAS-IIoT mender[941]: time=“2021-03-10T20:15:10+05:30” level=info msg=“The optimized block-device writer wrote a total of 2027 frames, where 1282 frames d
id need to be rewritten (i.e., skipped)”
Mar 10 20:15:11 CAS-IIoT mender[941]: time=“2021-03-10T20:15:10+05:30” level=info msg=“Wrote 2124558336/2124558336 bytes to the inactive partition”
Mar 10 20:15:12 CAS-IIoT mender[941]: time=“2021-03-10T20:15:12+05:30” level=info msg=“State transition: update-store [Download_Enter] → update-after-store [Download_Lea
ve]”
Mar 10 20:15:12 CAS-IIoT mender[941]: time=“2021-03-10T20:15:12+05:30” level=info msg=“State transition: update-after-store [Download_Leave] → update-install [ArtifactIn
stall]”
Mar 10 20:15:12 CAS-IIoT mender[941]: time=“2021-03-10T20:15:12+05:30” level=info msg=“Enabling partition with new image installed to be a boot candidate: 3”
Mar 10 20:15:14 CAS-IIoT mender[941]: time=“2021-03-10T20:15:14+05:30” level=info msg="State transition: update-install [ArtifactInstall] → reboot [ArtifactReboot_Enter]
"
Mar 10 20:15:14 CAS-IIoT mender[941]: time=“2021-03-10T20:15:14+05:30” level=info msg=“Rebooting device(s)”
Mar 10 20:15:14 CAS-IIoT mender[941]: time=“2021-03-10T20:15:14+05:30” level=info msg=“Mender rebooting from active partition: /dev/mmcblk0p2”
Mar 10 20:15:15 C� Stopping Session c3 of user root.

This is the syslog information.

and at the time of rebooting,

Kernel BUG at 8004f780 [verbose debug info unavailable]
Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
Modules linked in: mxc_dcic
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.1.15+gb63f3f5 #25
Hardware name: iW-RainboW-G15 platform based on i.MX6 (Device Tree)
task: a806f200 ti: a8092000 task.ti: a8092000
PC is at idle_task_exit+0xc4/0xc8
LR is at idle_task_exit+0x20/0xc8
pc : [<8004f780>] lr : [<8004f6dc>] psr: 20010013
sp : a8093fa8 ip : ab62f800 fp : a8093fbc
r10: 80b76304 r9 : a8093fc8 r8 : 00000000
r7 : 00000000 r6 : 80801308 r5 : 80b7f5e8 r4 : a8818000
r3 : 00000001 r2 : 00000000 r1 : 80b7f59c r0 : 00000001
Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c53c7d Table: 3881c04a DAC: 00000015
Process swapper/1 (pid: 0, stack limit = 0xa8092210)
Stack: (0xa8093fa8 to 0xa8094000)
systemd-shutdown[1]: Syncing filesystems and block devices.
3fa0: 00000001 80b7f5e8 80801308 00000000 00000001 807f481c
3fc0: a8092000 8005d05c 00000000 80b78ec8 80b7f70c 80beaf29 80b7f5f0 80b79800
3fe0: 80b79800 00000000 3807c06a 80bee384 00000000 1000948c 00000000 00000000
[<8004f780>] (idle_task_exit) from [<807f481c>] (cpu_die+0x10/0x80)
[<807f481c>] (cpu_die) from [<8005d05c>] (cpu_startup_entry+0x278/0x324)
[<8005d05c>] (cpu_startup_entry) from [<1000948c>] (0x1000948c)
Code: e1a00004 e24bd014 e8bd48f0 eaff6da7 (e7f001f2)
bad: scheduling from the idle thread!
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.1.15+gb63f3f5 #25

WARNING: CPU: 1 PID: 0 at kernel/softirq.c:300 __do_softirq+0x224/0x23c()
Modules linked in: mxc_dcic
CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.1.15+gb63f3f5 #25
Hardware name: iW-RainboW-G15 platform based on i.MX6 (Device Tree)
[<80016920>] (unwind_backtrace) from [<80012750>] (show_stack+0x10/0x14)
[<80012750>] (show_stack) from [<807f7ba8>] (dump_stack+0x84/0xc4)
[<807f7

From hosted mender it is showing that it is a successful deploy. Please help me