Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) Upgrading BIOS using intel-spi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) ==============================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) Many Intel CPUs like Baytrail and Braswell include SPI serial flash host
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) controller which is used to hold BIOS and other platform specific data.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) Since contents of the SPI serial flash is crucial for machine to function,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) it is typically protected by different hardware protection mechanisms to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) avoid accidental (or on purpose) overwrite of the content.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) Not all manufacturers protect the SPI serial flash, mainly because it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) allows upgrading the BIOS image directly from an OS.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) The intel-spi driver makes it possible to read and write the SPI serial
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) flash, if certain protection bits are not set and locked. If it finds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) any of them set, the whole MTD device is made read-only to prevent
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) partial overwrites. By default the driver exposes SPI serial flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) contents as read-only but it can be changed from kernel command line,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) passing "intel-spi.writeable=1".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) Please keep in mind that overwriting the BIOS image on SPI serial flash
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) might render the machine unbootable and requires special equipment like
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) Dediprog to revive. You have been warned!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) Below are the steps how to upgrade MinnowBoard MAX BIOS directly from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Linux.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)  1) Download and extract the latest Minnowboard MAX BIOS SPI image
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)     [1]. At the time writing this the latest image is v92.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31)  2) Install mtd-utils package [2]. We need this in order to erase the SPI
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)     serial flash. Distros like Debian and Fedora have this prepackaged with
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)     name "mtd-utils".
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)  3) Add "intel-spi.writeable=1" to the kernel command line and reboot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)     the board (you can also reload the driver passing "writeable=1" as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)     module parameter to modprobe).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39)  4) Once the board is up and running again, find the right MTD partition
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40)     (it is named as "BIOS")::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	# cat /proc/mtd
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	dev:    size   erasesize  name
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	mtd0: 00800000 00001000 "BIOS"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)     So here it will be /dev/mtd0 but it may vary.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)  5) Make backup of the existing image first::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	# dd if=/dev/mtd0ro of=bios.bak
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	16384+0 records in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	16384+0 records out
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	8388608 bytes (8.4 MB) copied, 10.0269 s, 837 kB/s
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55)  6) Verify the backup:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	# sha1sum /dev/mtd0ro bios.bak
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	fdbb011920572ca6c991377c4b418a0502668b73  /dev/mtd0ro
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	fdbb011920572ca6c991377c4b418a0502668b73  bios.bak
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61)     The SHA1 sums must match. Otherwise do not continue any further!
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63)  7) Erase the SPI serial flash. After this step, do not reboot the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64)     board! Otherwise it will not start anymore::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	# flash_erase /dev/mtd0 0 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	Erasing 4 Kibyte @ 7ff000 -- 100 % complete
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69)  8) Once completed without errors you can write the new BIOS image:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71)     # dd if=MNW2MAX1.X64.0092.R01.1605221712.bin of=/dev/mtd0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73)  9) Verify that the new content of the SPI serial flash matches the new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74)     BIOS image::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	# sha1sum /dev/mtd0ro MNW2MAX1.X64.0092.R01.1605221712.bin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	9b4df9e4be2057fceec3a5529ec3d950836c87a2  /dev/mtd0ro
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	9b4df9e4be2057fceec3a5529ec3d950836c87a2 MNW2MAX1.X64.0092.R01.1605221712.bin
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80)     The SHA1 sums should match.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82)  10) Now you can reboot your board and observe the new BIOS starting up
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)      properly.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) References
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) ----------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) [1] https://firmware.intel.com/sites/default/files/MinnowBoard%2EMAX_%2EX64%2E92%2ER01%2Ezip
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) [2] http://www.linux-mtd.infradead.org/