Uses for SPI Flash
#1
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?
Leonora Tindall | https:///nora.codes
Pinebook 1080p / Pinebook Pro / Pinephone UBPorts CE
  Reply
#2
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.
--
Arwen Evenstar
Princess of Rivendale
  Reply
#3
(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.
Leonora Tindall | https:///nora.codes
Pinebook 1080p / Pinebook Pro / Pinephone UBPorts CE
  Reply
#4
(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.)
--
Arwen Evenstar
Princess of Rivendale
  Reply
#5
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.
  Reply
#6
(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.
  Reply
#7
You can have image that has uboot behaving this way: preferring SD over eMMC.
Homepage: https://ayufan.eu

Releases:
Rock/Pro 64/Pinebook Pro: LinuxChromium OS
So/Pine A64/Pinebook: LinuxAndroid 6.0Android 7.1

Buy me a Beer
  Reply
#8
(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).
  Reply
#9
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.
  Reply
#10
(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.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  U-Boot with direct NVMe boot support for eMMC/SPI Flash pcm720 117 86,151 05-13-2021, 11:44 AM
Last Post: tophneal
Question erase spi flash aiminick 1 195 04-07-2021, 06:50 AM
Last Post: tophneal
  Booting to sdcard stopped working after emmc flash techiedog 3 1,006 12-31-2020, 06:30 PM
Last Post: Anarethos
  Flash non-bootable eMMC? midnightcheese 2 564 12-24-2020, 08:01 AM
Last Post: midnightcheese
  U-Boot on SPI flash - discussion Arwen 20 7,326 09-16-2020, 08:20 AM
Last Post: hmuller
  Am I supposed to flash keyboard firmware and u-boot imgs? superkazuya 4 1,972 09-02-2020, 04:12 AM
Last Post: pfeerick
  How to flash the emmc when it has Chromium on it? U47 3 1,379 07-10-2020, 10:07 AM
Last Post: U47
  emmc image will not flash Uturn 10 3,277 04-12-2020, 06:38 PM
Last Post: D4RK
  The usage/access of the SPI flash aaspectre 2 1,199 01-06-2020, 08:14 AM
Last Post: aaspectre

Forum Jump:


Users browsing this thread: 1 Guest(s)