Author: wmb Date: 2007-05-23 00:50:22 +0200 (Wed, 23 May 2007) New Revision: 413
Modified: cpu/x86/pc/olpc/devices.fth dev/olpc/spiflash/recover.fth dev/olpc/spiflash/spiui.fth Log: Added "recover <device_specifier>" and "clone" commands, for rewriting another machine's SPI FLASH.
Modified: cpu/x86/pc/olpc/devices.fth =================================================================== --- cpu/x86/pc/olpc/devices.fth 2007-05-22 01:52:08 UTC (rev 412) +++ cpu/x86/pc/olpc/devices.fth 2007-05-22 22:50:22 UTC (rev 413) @@ -285,6 +285,7 @@
fload ${BP}/dev/olpc/spiflash/spiflash.fth \ SPI FLASH programming fload ${BP}/dev/olpc/spiflash/spiui.fth \ User interface for SPI FLASH programming +fload ${BP}/dev/olpc/spiflash/recover.fth \ XO-to-XO SPI FLASH recovery : ofw-fw-filename$ " disk:\boot\olpc.rom" ; ' ofw-fw-filename$ to fw-filename$
Modified: dev/olpc/spiflash/recover.fth =================================================================== --- dev/olpc/spiflash/recover.fth 2007-05-22 01:52:08 UTC (rev 412) +++ dev/olpc/spiflash/recover.fth 2007-05-22 22:50:22 UTC (rev 413) @@ -30,7 +30,6 @@ ." Getting a copy of this machine's FLASH" cr h# fff0.0000 flash-buf /flash move true to file-loaded? - flash-buf ec-buf /ec move \ Save a copy for merging
(serial-flash) ;
Modified: dev/olpc/spiflash/spiui.fth =================================================================== --- dev/olpc/spiflash/spiui.fth 2007-05-22 01:52:08 UTC (rev 412) +++ dev/olpc/spiflash/spiui.fth 2007-05-22 22:50:22 UTC (rev 413) @@ -153,6 +153,24 @@ : ?move-mfg-data ( -- ) ." Merging existing manufacturing data" cr
+ flash-base -1 = if + \ Read the manufacturing data from the other FLASH + \ First try the new location in the e.0000 block + flash-buf mfg-data-offset + /flash-block mfg-data-offset read-spi-flash + + \ If there is no mfg data in the e.000 block, get whatever is in the + \ last 2K of the 0 block, where the mfg data used to live. + flash-buf mfg-data-end-offset + invalid-tag? if + flash-buf mfg-data-offset + /flash-block h# ff erase + + flash-buf mfg-data-end-offset + h# 800 - h# 800 ( adr len ) + mfg-data-end-offset h# 800 - ( adr len offset ) + read-spi-flash ( ) + then + exit + then + + \ If the system has mfg data in the old place, move it to the new place mfg-data-top flash-base h# 1.0000 + = if \ Copy just the manufacturing data into the memory buffer; don't