Ideas for Upgrading / Resetting Custom imx6 Device

Hello all,

I'm not super experienced with this field of software, so I was hoping for some ideas or tips. I'm working with a custom imx6 board and I need to be able to upgrade / reset it. A lot of this may have to do with my inexperience with the build system, I don't know.

Presently, I make the individual files I need (SPL, u-boot, zImage, and rootfs), put the board into USB mass storage mode, and then write the files onto the board's mmc from another computer.

While this works, I have no idea if it's poor convention or if it's fine or what. Regardless, I think this is a bit of an issue when you want to update. I'm pretty sure I can figure out how to make them into a single file by just looking at other makefiles and figuring it out.

current makefile entry for my device in /target/linux/imx6/image
define Device/my-device
  DEVICE_TITLE := my-device
  FILESYSTEMS := squashfs ext4
  DEVICE_PACKAGES := \
	kmod-can kmod-can-flexcan kmod-can-raw \
	kmod-leds-gpio kmod-gpio-button-hotplug \
	kmod-pps-gpio kmod-rtc-ds1307
  DEVICE_NAME := my-device
  KERNEL := kernel-bin | uImage none
enddef

What else is pressing is that /proc/mtd has no entries. It's my understanding that most of the built in update stuff in openWRT uses mtd and /overlay stuff, so this makes the stock openWRT sysupgrade stuff not useful to me. Could making it a different way change this?

Lastly, I would like to include a method for reverting to the state of the original openWRT install.

Here is my current idea for theses things, please let me know if it's terrible:

I have plenty of space, so I could make 2 new partitions.
One that just holds the original openWRT install files and whatever sysupgrade versions that might be uploaded.
The other partition with a minimal linux install that is only booted into to clear and re-write the bootfs and rootfs on the partions that are usually booted to.

Thanks for any insights!

there are 100 ways ( well lots ) to do what you need...

the key two-ish things you have to consider are;

  • is it recovery / portable / oem friendly
  • do you expect other people to use it ( i.e. push officially )

i've written a dual boot installer for the pi4... it uses a similar method you describe... but needs alot of work in all relevent areas of the OS and then some...

from what I see around the place... typically these (internal)mmc based SBC's ( if I'm assuming right )... typically zap an initramfs into kernel... as a stepping stone ( due to severely limited or crippled bootloader facilities )... so you really have to describe how oem works / what stock boot hooks you have available / answer the two questions above in order to maximize your chances of suggestions here...

can't really say much more without knowing that stuff, or why your suggested method is superior...

this has to do with squashfs/f2fs images and resettable overlays... which has implications in how your makefile/imagebuild-structure is defined and conversely how sysupgrade handles that for your device... ( and whether or not the 'firstboot / jffsreset' works )

there is no hard requirement for mtd... specifically you can build and flash ext4 images quite simply... all depends on the other answers and if your looking to implement squashfs/f2fs...

Hey wulfy, thanks for the reply.

After posting this I buckled down and started trying to just do it instead of thinking about it and I got it to work with surprisingly little actual changes. (I was able to copy a significant amount from another board with the same processor)

First I modified my makefile and started making an actual .bin file. I still don't entirely understand the process of making partitions in the bin, but it does work. I don't know how exactly I want to do the factory reset / store that original copy of the firmware yet.

Otherwise I just had to make changes to platform.sh and imx6.sh and now it accepts my sysupgrade file and everything!