I am trying to add support for a new device.
factory generated image boots fine.
when i try to do sysupgrade after that.
it fails to boot and stuck at
Boot act = 1
MCR Image Checksum Error
MCR Image Checksum Error
Boot Checksum Error (side 1+2)
This is the sysupgrade process output
root@test:/# [ 89.114972] device wlan1 left promiscuous mode
[ 89.119635] br-lan: port 5(wlan1) entered disabled state
Watchdog handover: fd=3
- watchdog -
Watchdog does not have CARDRESET support
[ 89.186967] device wlan0 left promiscuous mode
[ 89.191772] br-lan: port 6(wlan0) entered disabled state
Sat Sep 3 04:56:54 EET 2022 upgrade: Sending TERM to remaining processes ...
Sat Sep 3 04:56:54 EET 2022 upgrade: Sending signal TERM to ntpd (2416)
Sat Sep 3 04:56:54 EET 2022 upgrade: Sending signal TERM to ntpd (2459)
Sat Sep 3 04:56:58 EET 2022 upgrade: Sending KILL to remaining processes ...
Sat Sep 3 04:56:58 EET 2022 upgrade: Sending signal KILL to ntpd (2416)
Sat Sep 3 04:56:58 EET 2022 upgrade: Sending signal KILL to ntpd (2459)
[ 99.954344] stage2 (3390): drop_caches: 3
Sat Sep 3 04:57:05 EET 2022 upgrade: Switching to ramdisk...
[ 102.985874] UBIFS (ubi0:1): background thread "ubifs_bgt0_1" stops
[ 103.004894] UBIFS (ubi0:1): un-mount UBI device 0
Sat Sep 3 02:57:08 UTC 2022 upgrade: Performing system upgrade...
[ 103.097671] do_stage2 (3390): drop_caches: 3
Unlocking firmware ...
Writing from <stdin> to firmware ...
Sat Sep 3 02:57:11 UTC 2022 upgrade: Upgrade completed
Sat Sep 3 02:57:12 UTC 2022 upgrade: Rebooting system...
umount: can't unmount /dev: Resource busy
umount: can't unmount /tmp: Resource [ 107.339300] reboot: Restarting system
busy
i tried to change how image is generated, but i don't understand the difference between factory and sysupgrade and how it is related to the device specific hardware
i analyzed hex dump of flash memory and binwalk gave me useful information about partition
MD5 Checksum: 241cb9a0d22ca9fcc82efa6126a16580
Signatures: 344
DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
0 0x0 uImage header, header size: 64 bytes, header CRC: 0xEB1827DA, created: 2017-02-06 02:27:30, image size: 123348 bytes, Data Address: 0xA0200000, Entry Point: 0xA0200000, data CRC: 0xD4FC3225, OS: Linux, CPU: MIPS, image type: Standalone Program, compression type: none, image name: "NAND Flash I"
102920 0x19208 U-Boot version string, "U-Boot 1.1.3 (Feb 6 2017 - 11:27:25)"
1310720 0x140000 uImage header, header size: 64 bytes, header CRC: 0xDDF317C1, created: 2019-02-12 04:59:40, image size: 4004016 bytes, Data Address: 0x80001000, Entry Point: 0x806C16C0, data CRC: 0xD1B860B8, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "Linux Kernel Image"
1310784 0x140040 LZMA compressed data, properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 10693760 bytes
5241572 0x4FFAE4 MySQL ISAM index file Version 7
5314800 0x5118F0 Squashfs filesystem, little endian, version 4.0, compression:xz, size: 6439730 bytes, 1177 inodes, blocksize: 131072 bytes, created: 2019-02-12 04:51:16
51642368 0x3140000 uImage header, header size: 64 bytes, header CRC: 0xD487A1AD, created: 2018-11-23 01:48:12, image size: 4004281 bytes, Data Address: 0x80001000, Entry Point: 0x806C1510, data CRC: 0xE9E51B5, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: "Linux Kernel Image"
51642432 0x3140040 LZMA compressed data, properties: 0x5D, dictionary size: 33554432 bytes, uncompressed size: 10693760 bytes
55646713 0x35119F9 Squashfs filesystem, little endian, version 4.0, compression:xz, size: 6436258 bytes, 1176 inodes, blocksize: 131072 bytes, created: 2018-11-23 01:40:03
110624768 0x6980000 JFFS2 filesystem, little endian
so i went out to fill out my dts file with this
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "u-boot";
reg = <0x0 0x80000>;
read-only;
};
partition@80000 {
label = "u-boot-env";
reg = <0x80000 0x40000>;
};
factory: partition@c0000 {
label = "factory";
reg = <0xc0000 0x40000>;
read-only;
};
art: partition@100000 {
label = "art";
reg = <0x100000 0x40000>;
read-only;
};
partition@140000 {
label = "firmware";
reg = <0x140000 0x7100000>;
compatible = "denx,uimage";
#address-cells = <1>;
#size-cells = <1>;
};
partition@7240000 {
label = "nvram";
reg = <0x7240000 0x720000>;
read-only;
};
partition@7960000 {
label = "recoverk";
reg = <0x7960000 0xe0000>;
read-only;
};
partition@7a40000 {
label = "recovere";
reg = <0x7a40000 0xe0000>;
read-only;
};
partition@7b20000 {
label = "nvbackup";
reg = <0x7b20000 0x4e0000>;
read-only;
};
};
};
[ 1.345286] 9 fixed-partitions partitions found on MTD device mt7621-nand
[ 1.352062] Creating 9 MTD partitions on "mt7621-nand":
[ 1.357269] 0x000000000000-0x000000080000 : "u-boot"
[ 1.363294] 0x000000080000-0x0000000c0000 : "u-boot-env"
[ 1.369964] 0x0000000c0000-0x000000100000 : "factory"
[ 1.375967] 0x000000100000-0x000000140000 : "art"
[ 1.381663] 0x000000140000-0x000007240000 : "firmware"
[ 1.397067] 2 uimage-fw partitions found on MTD device firmware
[ 1.403159] Creating 2 MTD partitions on "firmware":
[ 1.408111] 0x000000000000-0x000000400000 : "kernel"
[ 1.414014] 0x000000400000-0x000007100000 : "ubi"
[ 1.420074] 0x000007240000-0x000007960000 : "nvram"
[ 1.425941] 0x000007960000-0x000007a40000 : "recoverk"
[ 1.432079] 0x000007a40000-0x000007b20000 : "recovere"
[ 1.438261] 0x000007b20000-0x000008000000 : "nvbackup"
What i don't understand what should my lines in image file should look like?
define Device/device_model
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
PAGESIZE := 2048
BLOCKSIZE := 128k
KERNEL_SIZE := 4096k
IMAGE_SIZE := 115712k
DEVICE_VENDOR := Brand
DEVICE_MODEL := Model
KERNEL_INITRAMFS := $$(KERNEL)
UBINIZE_OPTS := -E 5
IMAGES += factory.img
IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
check-size
IMAGE/sysupgrade.bin := append-metadata
DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3
endef
TARGET_DEVICES += device_model