As we known, mender-convert can be used to convert existing disk images for use with Mender.
For more info, pls see: https://docs.mender.io/2.0/artifacts/debian-family
And the code is: git clone -b 1.1.1 https://github.com/mendersoftware/mender-convert.git
Here we use the following mender-convert cmd to generate the mender image:
DEVICE_TYPE="raspberrypi3"
# RAW_DISK_IMAGE="input/2019-04-09-raspbian-stretch-lite.img "
RAW_DISK_IMAGE="input/ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img"
ARTIFACT_NAME="test"
MENDER_DISK_IMAGE="test.sdimg"
DEMO_HOST_IP="10.80.17.256"
./docker-mender-convert from-raw-disk-image \
--raw-disk-image $RAW_DISK_IMAGE \
--mender-disk-image $MENDER_DISK_IMAGE \
--device-type $DEVICE_TYPE \
--artifact-name $ARTIFACT_NAME \
--bootloader-toolchain arm-buildroot-linux-gnueabihf \
--demo \
--demo-host-ip $DEMO_HOST_IP
Then the output test.sding image will be:
Part Type Purpose Size Configure size
mmcblk0p1 vfat Store the bootloader 44MB Extracted from input image
mmcblk0p2 ext4 Store the root file system and kernel (active) 3908MB --storage-total-size-mb 1
mmcblk0p3 ext4 Store the root file system and kernel (inactive) 3908MB --storage-total-size-mb 1
mmcblk0p4 ext4 Store persistent data, preserved during Mender updates. 128MB --data-part-size-mb 2
Here are two kinds of input image.
The 1st input image:
root@kvm:/home/aaron/Work/mender-convert/input# fdisk -l 2019-04-09-raspbian-stretch-lite.img
Disk 2019-04-09-raspbian-stretch-lite.img: 1.1 GiB, 1174405120 bytes, 2293760 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xc1dc39e5
Device Boot Start End Sectors Size Id Type
2019-04-09-raspbian-stretch-lite.img1 8192 96042 87851 42.9M c W95 FAT32 (LBA)
2019-04-09-raspbian-stretch-lite.img2 98304 2293759 2195456 1G 83 Linux
root@kvm:/home/aaron/Work/mender-convert/input# mount -o loop,offset=4194304 2019-04-09-raspbian-stretch-lite.img /home/aaron/Mnt/
root@kvm:/home/aaron/Work/mender-convert/input# ls /home/aaron/Mnt/
bcm2708-rpi-0-w.dtb bcm2709-rpi-2-b.dtb bootcode.bin fixup_cd.dat issue.txt LICENSE.oracle start.elf
bcm2708-rpi-b.dtb bcm2710-rpi-3-b.dtb cmdline.txt fixup.dat kernel7.img overlays start_x.elf
bcm2708-rpi-b-plus.dtb bcm2710-rpi-3-b-plus.dtb config.txt fixup_db.dat kernel.img start_cd.elf
bcm2708-rpi-cm.dtb bcm2710-rpi-cm3.dtb COPYING.linux fixup_x.dat LICENCE.broadcom start_db.elf
root@kvm:/home/aaron/Work/mender-convert/input# umount /home/aaron/Mnt/
root@kvm:/home/aaron/Work/mender-convert/input# mount -o loop,offset=50331648 2019-04-09-raspbian-stretch-lite.img /home/aaron/Mnt/
root@kvm:/home/aaron/Work/mender-convert/input# ls /home/aaron/Mnt/
bin boot dev etc home lib lost+found media mnt opt proc root run sbin srv sys tmp usr var
root@kvm:/home/aaron/Work/mender-convert/input# ls /home/aaron/Mnt/boot/
root@kvm:/home/aaron/Work/mender-convert/input#
root@kvm:/home/aaron/Work/mender-convert/input#
root@kvm:/home/aaron/Work/mender-convert/input# ls /home/aaron/Mnt/boot/
root@kvm:/home/aaron/Work/mender-convert/input#
root@kvm:/home/aaron/Work/mender-convert/input#
The 2nd input image:
root@kvm:/home/aaron/Work/mender-convert/input# fdisk -l ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img
Disk ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img: 1.9 GiB, 2056257536 bytes, 4016128 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x85baa6c1
Device Boot Start End Sectors Size Id Type
ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img1 * 2048 526335 524288 256M c W95 FAT32 (LBA)
ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img2 526336 4016127 3489792 1.7G 83 Linux
root@kvm:/home/aaron/Work/mender-convert/input#
root@kvm:/home/aaron/Work/mender-convert/input# mount -o loop,offset=1048576 ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img /home/aaron/Mnt/
root@kvm:/home/aaron/Work/mender-convert/input# ls /home/aaron/Mnt/
bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb broadcom fixup_cd.dat fixup_x.dat overlays start.elf
bcm2710-rpi-3-b-plus.dtb bootcode.bin cmdline.txt fixup.dat initrd.img start_cd.elf start_x.elf
bcm2710-rpi-cm3.dtb boot.scr config.txt fixup_db.dat kernel8.img start_db.elf vmlinuz
root@kvm:/home/aaron/Work/mender-convert/input# umount /home/aaron/Mnt/
root@kvm:/home/aaron/Work/mender-convert/input# mount -o loop,offset=269484032 ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img /home/aaron/Mnt/
root@kvm:/home/aaron/Work/mender-convert/input# ls /home/aaron/Mnt/
bin boot dev etc home lib lost+found media mnt opt proc root run sbin snap srv sys tmp usr var
root@kvm:/home/aaron/Work/mender-convert/input# ls /home/aaron/Mnt/boot/
config-4.15.0-1031-raspi2 grub initrd.img-4.15.0-1031-raspi2 System.map-4.15.0-1031-raspi2 vmlinuz-4.15.0-1031-raspi2
firmware initrd.img initrd.img.old vmlinuz vmlinuz.old
The result:
the same mender-convert cmd to generate mender image from two different input image above,
Then the mender image from 2019-04-09-raspbian-stretch-lite.img will run and update in normal way,
But the mender image from ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img will run in abnormal way when boot, it means that the boot proc is abnormal. Why ??
Or, how to generate Mender image from ubuntu 18.04 image with mender-convert?
Edit: @mirzak: formating