dangowrt / owrt-ubi-installer

OpenWrt firmware installer for the Linksys E8450 aka. Belkin RT3200
GNU General Public License v2.0
394 stars 50 forks source link

UBI vs NO-UBI #9

Open ErnyTech opened 3 years ago

ErnyTech commented 3 years ago

From OpenWRT-Wiki:

Due to the not exactly advantageous layout and management of the SPI Flash, the best way to use the device is to replace everything rather than trying to stay compatible with the vendor firmware. If you just want to try OpenWrt and still plan to go back to the vendor firmware, use the non-UBI version of the firmware which can be flashed using the vendor's web interface. In this case, download the non-UBI variant of the device firmware openwrt-mediatek-mt7622-linksys_e8450-squashfs-sysupgrade.bin and upload it in the vendor firmware Web UI upgrade page.

If you do want to use OpenWrt permanently, the easiest is to create an installation image using github.com/dangowrt/linksys-e8450-openwrt-installer and use that once to convert the device to UBI layout.

Could you explain to me what the disadvantages are if I use openwrt-mediatek-mt7622-linksys_e8450-squashfs-sysupgrade.bin instead of this method that creates UBI?

dangowrt commented 3 years ago
BarryHuffman commented 2 years ago

A few examples of flash devices which lack dedicated wear leveling hardware controllers are micro/SD, CompactFlash, USB flash drives, eMMC modules.

These "hot blocks" or zones that dangowrt mentioned will wear out prematurely due to the constant re-writing.

In modern SSDs and NVMes you hear of the term TRIM or garbage collection, the controller can also reallocate dead zones into unprovisioned areas which is not always transparent to the operating system.

In embedded devices (like routers) it's less common to see wear leveling due to costs of scale.

In those instances it can be mitigated through software with a copy on write filesystem or directly handled in OS drivers.

In the future we should hope all OpenWRT devices utilize UBI.

robhancock commented 2 years ago

A few examples of flash devices which lack dedicated wear leveling hardware controllers are micro/SD, CompactFlash, USB flash drives, eMMC modules.

All of those devices have wear levelling. The raw NOR or NAND flash in most routers does not and this needs to be done through software.

BarryHuffman commented 2 years ago

All of those devices have wear levelling.

They majorly utilize software based wear leveling on the OS.

There is few exceptions I've seen for SD/mSD/eMMC that are industrial non consumer.

For flashdrives "wear leveling" is not always equal and generally dynamic type.

I do see Corsair referenced that their older voyager used static while the rest of their devices are using dynamic type.

It doesn't look common place or advertised in the consumer space.

robhancock commented 2 years ago

Software wear levelling is almost never used with such devices such as SD, eMMC, USB flash. They are generally used with file systems such as FAT or ext4 and cannot assume that the OS will do any wear levelling. In some cases there is a pretty cheesy wear levelling strategy but there is always something, otherwise commonly written areas like the FAT tables would be quickly destroyed.

chinmaythosar commented 2 years ago

Is it possible to have the same UBI image for the E5600 if you happen to have one?

dangowrt commented 2 years ago

@chinmaythosar The E5600 is based on MT7621 (unlike the E8450/RT3200 which is based on MT7622). There is a series to add support for this SoC to U-Boot https://patchwork.ozlabs.org/project/uboot/list/?series=272786 and technically it's even a bit easier to handle compared to MT7622 because the Ethernet switch is built-into the SoC (hence always the same for all devices) and it's MIPS32, so no ARM Trusted Firmware. And no secretive stuff to calibrate the DRAM.

So it's thinkable to do similar things for MT7621-based devices as well, it's just a bit of work...

Update: Now that @mtk-openwrt patches for MT7621 are part of U-Boot, I added builds for the MIPS-based reference boards (mt7620, mt7621 and mt76x8): https://github.com/openwrt/openwrt/commit/2f7fb57c12d7afe5be7747611bceec92a4c0c834 Hacking up support for modern U-Boot with UBI support on any MT7621 board hence just became much easier.