UBI on SPI flash finally working!

Finally have UBI actually working, I think!

Unfortunately it requires a number of changes to U-Boot. So I’m almost certainly going to fork u-boot-xlnx (actually, I already have) and push those changes there. Namely:

  • CONFIG_ENV_IS_IN_UBI doesn’t play well with when the MTD device is SPI flash – because the SPI flash doesn’t initialize itself during board bringup. This was first mentioned here: the obvious place to add the equivalent ‘sf probe’ was by creating an ‘initr_spiflash’ and inserting it into the init_sequence right before initr_env.
  • UBI in u-boot does not play well with 4K eraseblocks. I don’t know why – it just doesn’t work right. I’ve got a feeling is that it runs out of memory and silently Tells No One. This doesn’t matter anyway, since 4K eraseblocks are too small for UBIFS, so we didn’t want to use them in any case. So we need to apply this patch which thankfully applies cleanly against u-boot-xlnx.

It also requires a number of changes to platform-top.h in the U-Boot configuration area.

  • All of the stuff to enable environment in UBI.
  • An mtdids and mtdparts environment variable in CONFIG_EXTRA_ENV_SETTINGS. This means I have to completely undo the existing ones coming from platform-auto.h, but to be honest, that’s probably OK. Those, in general, suck horribly. I’ll probably just replace the whole thing.

So with that, you can actually load U-Boot, and set up the flash however you want it! Once I have things looking sane, I’ll probably set up a ubinized image for a one-time flash onto it, but it’s nice to see that it will eventually be working.

Leave a Reply

Your email address will not be published. Required fields are marked *