PINE64
Uses for SPI Flash - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=111)
+--- Forum: General Discussion on Pinebook Pro (https://forum.pine64.org/forumdisplay.php?fid=112)
+--- Thread: Uses for SPI Flash (/showthread.php?tid=8020)

Pages: 1 2 3 4


Uses for SPI Flash - NoraCodes - 09-29-2019

The PBP is listed as having 128 MB of SPI flash - I assume this is where UBoot lives, but perhaps it could also be used for e.g. storing crypto keys and the like? Does anyone know if Linux has a good way to do this safely?


RE: Uses for SPI Flash - Arwen - 09-29-2019

One thing to know is that some types of builtin flash have limited re-write life span.
Like 1,000 or 10,000 re-writes. Perfectly fine for storing boot code, and even boot
parameters. But, anything that may need an update every boot may wear it out too
soon. (Not saying your use needs updates every boot... I don't know your use case.)

Understand, some of these flash devices are NOT like an SSD. SSDs have spares, wear
leveling, error detection and minimal correction. And may have things like RAM buffers
or TRIM support.

Some of these flash devices the way you detect bad blocks, is you write data and if it
reads back as different, block is bad. No spares. Time to replace.

All that said, I don't know if the Pinebook Pro's 128M(b/B?) SPI flash is user replacable.
Or of what type.


RE: Uses for SPI Flash - NoraCodes - 09-29-2019

(09-29-2019, 11:38 AM)Arwen Wrote: One thing to know is that some types of builtin flash have limited re-write life span.
Like 1,000 or 10,000 re-writes. Perfectly fine for storing boot code, and even boot
parameters. But, anything that may need an update every boot may wear it out too
soon. (Not saying your use needs updates every boot... I don't know your use case.)

Understand, some of these flash devices are NOT like an SSD. SSDs have spares, wear
leveling, error detection and minimal correction. And may have things like RAM buffers
or TRIM support.

Some of these flash devices the way you detect bad blocks, is you write data and if it
reads back as different, block is bad. No spares. Time to replace.

All that said, I don't know if the Pinebook Pro's 128M(b/B?) SPI flash is user replacable.
Or of what type.

Thanks, that's a good point to make. I'm mostly interested in potentially storing my GPG and SSH keys there - write once, read every time I reinstall the OS, just to make it easier to rapidly run through operating systems, and because I think it would be cool. I could just use a USB key though, maybe I should do that.


RE: Uses for SPI Flash - Arwen - 09-29-2019

(09-29-2019, 01:12 PM)LeoLambda Wrote:
(09-29-2019, 11:38 AM)Arwen Wrote: One thing to know is that some types of builtin flash have limited re-write life span.
Like 1,000 or 10,000 re-writes. Perfectly fine for storing boot code, and even boot
parameters. But, anything that may need an update every boot may wear it out too
soon. (Not saying your use needs updates every boot... I don't know your use case.)

Understand, some of these flash devices are NOT like an SSD. SSDs have spares, wear
leveling, error detection and minimal correction. And may have things like RAM buffers
or TRIM support.

Some of these flash devices the way you detect bad blocks, is you write data and if it
reads back as different, block is bad. No spares. Time to replace.

All that said, I don't know if the Pinebook Pro's 128M(b/B?) SPI flash is user replacable.
Or of what type.

Thanks, that's a good point to make. I'm mostly interested in potentially storing my GPG and SSH keys there - write once, read every time I reinstall the OS, just to make it easier to rapidly run through operating systems, and because I think it would be cool. I could just use a USB key though, maybe I should do that.

Another way to deal with it, is to have a master copy of your home directory. (Or what you want in your home directory.) I have such for my ~/bin/, ~/help/, ~/.ssh/ & ~/.gnupg/ directories. For me, I have a home media server that I use as the base point for those directories. Then have a script in ~/bin/ to perform an Rsync update when needed for my current desktop and laptop.

(My ~/help/ is for rarely used detail to do things, even esoteric things, kind of like a recipe.)


RE: Uses for SPI Flash - Der Geist der Maschine - 09-29-2019

Uboot is lives on the eMMC flash and you can use the whole spi flash for whatever you like, say for putting a filesystem on it.


It was mentioned some time ago that uboot does not reliably boot from the spi flash (and hence uboot it put on the eMMC flash). This does not rule out that linux can't reliably access the spi flash. Decide wisely Big Grin

> The PBP is listed as having 128 MB of SPI flash

The spi flash is 16 MB.


RE: Uses for SPI Flash - kalpazanius - 09-30-2019

(09-29-2019, 10:03 PM)Der Geist der Maschine Wrote: "...It was mentioned some time ago that uboot does not reliably boot from the spi flash (and hence uboot it put on the eMMC flash)..."

Could you point to the source of this information? What kind of boot reliability problems should be expected?

I intended to store u-boot in the spi flash, configured to boot from external SD card first and from the eMMC next. For example it may check for presence of /boot/uEnv.txt on the external card first and on the eMMC next. This could allow experimenting with different OS-es without the need of a screwdriver whenever PBP is bricked due to incorrect boot configuration of the eMMC.


RE: Uses for SPI Flash - ayufan - 09-30-2019

You can have image that has uboot behaving this way: preferring SD over eMMC.


RE: Uses for SPI Flash - Der Geist der Maschine - 09-30-2019

(09-30-2019, 03:28 AM)kalpazanius Wrote:
(09-29-2019, 10:03 PM)Der Geist der Maschine Wrote: "...It was mentioned some time ago that uboot does not reliably boot from the spi flash (and hence uboot it put on the eMMC flash)..."

Could you point to the source of this information? What kind of boot reliability problems should be expected?

Damn, I was wrong. That's what Luke said some time ago https://forum.pine64.org/showthread.php?tid=7830

You can flash it [uboot] to the SPI at your own risk (there currently is no safe way of flashing it, so not advised).


RE: Uses for SPI Flash - z4v4l - 09-30-2019

the SPI flash size of all pine boards is 128Mbits or 16MBs. it is intended for using as a firmware home, - uboot in this case, and not everything else. it's small for general usage, it wears out for frequent read/write cycles, and it gives you no advantage of having your cryptographic keys there. it is storage for firmware. there is nothing "unreliable " in it. this whole thread became a mess of confusions.


RE: Uses for SPI Flash - Der Geist der Maschine - 09-30-2019

(09-30-2019, 10:25 AM)z4v4l Wrote: the SPI flash size of all pine boards is 128Mbits or 16MBs. it is intended for using as a firmware home, - uboot in this case, and not everything else. it's small for general usage, it wears out for frequent read/write cycles, and it gives you no advantage of having your cryptographic keys there. it is storage for firmware. there is nothing "unreliable " in it. this whole thread became a mess of confusions.


Computers were meant for number-crunching. The Internet was meant for research. But people did not listen ...


The supplied spi flash supports a min of 100,000 erase cycles per sector. Together with a flash filesystem which spread out writes, I can't imagine that the OP will ever wear out her flash.