LS1021a custom board mender integration

Hello, I want to integrate mender to our custom ls1021a board.
Now I have u-boot with all patches and I need to make wright config_mender_defines.h file. I will have 8 mb (now 128 mb) spi nor flash as a u-boot source and 128 mb nand flash as a rootfs+data storage.

mtd list
=> mtd list
List of MTD devices:
* nand0
  - type: NAND flash
  - block size: 0x20000 bytes
  - min I/O: 0x800 bytes
  - OOB size: 64 bytes
  - OOB available: 30 bytes
  - ECC strength: 4 bits
  - ECC step size: 512 bytes
  - bitflip threshold: 3 bits
  - 0x000000000000-0x000008000000 : "nand0"
          - 0x000000000000-0x000008000000 : "ubi"
* nor0
  - type: NOR flash
  - block size: 0x40000 bytes
  - min I/O: 0x1 bytes
  - 0x000000000000-0x000004000000 : "nor0"
          - 0x000000000000-0x000000100000 : "rcw"
          - 0x000000100000-0x000000300000 : "u-boot"
          - 0x000000300000-0x000000380000 : "u-boot-env-1"
          - 0x000000380000-0x000000400000 : "u-boot-env-2"

I need to set environment variables according to this scheme. Basic config_mender_defines.h was compiled for the sd boot.

config_mender_defines
#define MENDER_UBI
#define MENDER_MTD_UBI_DEVICE_NAME "nand0"

/* Shell variables */
#define MENDER_BOOT_PART_NUMBER ??
#define MENDER_BOOT_PART_NUMBER_HEX ??
#define MENDER_ROOTFS_PART_A_NUMBER 0
#define MENDER_ROOTFS_PART_A_NUMBER_HEX 0
#define MENDER_ROOTFS_PART_B_NUMBER 1
#define MENDER_ROOTFS_PART_B_NUMBER_HEX 1
#define MENDER_UBOOT_STORAGE_INTERFACE "ubi"
#define MENDER_UBOOT_STORAGE_DEVICE 0

/* BB variables. */

#define MENDER_STORAGE_DEVICE_BASE "??"
#define MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET_1 0x300000
#define MENDER_UBOOT_ENV_STORAGE_DEVICE_OFFSET_2 0x380000
#define MENDER_ROOTFS_PART_A_NAME "/dev/ubi0"
#define MENDER_ROOTFS_PART_B_NAME "/dev/ubi1"

/* For sanity checks. */

#define MENDER_BOOTENV_SIZE 0x80000
#define MENDER_BOOT_KERNEL_TYPE "bootm"
#define MENDER_KERNEL_NAME "uImage"
#define MENDER_DTB_NAME "ls1021a-custom.dtb"
#define MENDER_UBOOT_PRE_SETUP_COMMANDS ""
#define MENDER_UBOOT_POST_SETUP_COMMANDS ""

I wrote ?? where I can’t understand what should I st there.
And other problem is that I can’t find how to make ubimg with openwrt builder, maybe somebody know how to do it or even have rite script?
Or maybe you can help me with only nand memory uboot? When uboot, uboot-env will be written to the nand.

At least when using Yocto, Mender only supports having the U-Boot environment in a UBI volume inside the same UBI partition as the rootfs volumes. It’s not a hard requirement in the sense that Mender can work with whatever you choose, but the build process only supports setting up the environment in UBI. For this reason the MENDER_STORAGE_DEVICE needs to be set to the UBI partition prefix, in your case this will be /dev/ubi (without the numbers), and this will be used for both rootfs setup and environment setup.

I’m afraid I don’t know the OpenWRT builder.

Thank you, now I am trying to make only nand memory image. Can you help me with flash layout?
As I understand, I need to make ubi partition in me nand memory, from the start there will be raw uboot+environment. Then I should create first ubi (/dev/ubi1 - ro rootfs1) volume with offset (10 mb for example) and after second ubi (/dev/ubi1 - ro rootfs2) volume. Then I should make third ubi volume (/dev/ubi3 - rw rootfsdata).
I have some questions:

  1. About kernel and dtd placement. Should I write them to the /boot/uImage and /boot/uImage.dtb or I need to create other volume for them?
  2. Is rootfsdata an overlay/extroot partition or a just data storage partition, need I create a special fstab config with such a layout?

Hello again, now I am trying to make mender integration with sdacrd (trying to integrate sdacard first to have workable openwrt mender solution at first).
The integration from NanoPi NEO2 - OpenWrt is not available. Openwrt with mender was deleted and link has 404 error.
Maybe somebody have copy of that integration file?

@kele6ra et-al

I also verified with sdcard first, so, supported.

Sorry 'bout that. Missed these files during server re-org. Should be OK now. Let me know if access issues.

I have moved on, busy, so don’t expect support / questions answered apart from initial mender integration thread. Can always be bribed for paid support, other integrations.

Regards;
Bill

Hello, thank you for help. I have access to files now. I think that I will make recipes for layerscape boards with OpenWRT to make mender more universal.

@mender: Please consider hosting these files locally for redundancy if my site is down.