Heiko Schocher | 30b4c25 | 2007-07-11 18:39:11 +0200 | [diff] [blame] | 1 | SHA1 usage: |
| 2 | ----------- |
| 3 | |
| 4 | In the U-Boot Image for the pcs440ep board is a SHA1 checksum integrated. |
| 5 | This SHA1 sum is used, to check, if the U-Boot Image in Flash is not |
| 6 | corrupted. |
| 7 | |
| 8 | The following command is available: |
| 9 | |
| 10 | => help sha1 |
| 11 | sha1 address len [addr] calculate the SHA1 sum [save at addr] |
| 12 | -p calculate the SHA1 sum from the U-Boot image in flash and print |
| 13 | -c check the U-Boot image in flash |
| 14 | |
| 15 | "sha1 -p" |
| 16 | calculates and prints the SHA1 sum, from the Image stored in Flash |
| 17 | |
| 18 | "sha1 -c" |
| 19 | check, if the SHA1 sum from the Image stored in Flash is correct |
| 20 | |
| 21 | |
| 22 | It is possible to calculate a SHA1 checksum from a memoryrange with: |
| 23 | |
| 24 | "sha1 address len" |
| 25 | |
| 26 | If you want to store a new Image in Flash for the pcs440ep board, |
| 27 | which has no SHA1 sum, you can do the following: |
| 28 | |
| 29 | a) cp the new Image on a position in RAM (here 0x300000) |
| 30 | (for this example we use the Image from Flash, stored at 0xfffa0000 and |
| 31 | 0x60000 Bytes long) |
| 32 | |
| 33 | "cp.b fffa0000 300000 60000" |
| 34 | |
| 35 | b) Initialize the SHA1 sum in the Image with 0x00 |
| 36 | The SHA1 sum is stored in Flash at: |
Jean-Christophe PLAGNIOL-VILLARD | 0383694 | 2008-10-16 15:01:15 +0200 | [diff] [blame^] | 37 | CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN + SHA1_SUM_POS |
Wolfgang Denk | e877984 | 2007-07-12 01:45:34 +0200 | [diff] [blame] | 38 | for the pcs440ep Flash: 0xfffa0000 + 0x60000 + -0x20 |
| 39 | = 0xffffffe0 |
| 40 | for the example in RAM: 0x300000 + 0x60000 + -0x20 |
| 41 | = 0x35ffe0 |
Heiko Schocher | 30b4c25 | 2007-07-11 18:39:11 +0200 | [diff] [blame] | 42 | |
| 43 | note: a SHA1 checksum is 20 bytes long. |
| 44 | |
| 45 | "mw.b 35ffe0 0 14" |
| 46 | |
| 47 | c) now calculate the SHA1 sum from the memoryrange and write |
| 48 | the calculated checksum at the right place: |
| 49 | |
| 50 | "sha1 300000 60000 35ffe0" |
| 51 | |
| 52 | Now you have a U-Boot-Image for the pcs440ep board with the correct SHA1 sum. |
| 53 | |
| 54 | If you do a "./MAKEALL pcs440ep" or a "make all" to get the U-Boot image, |
| 55 | the correct SHA1 sum will be automagically included in the U-Boot image. |
| 56 | |
| 57 | Heiko Schocher, 11 Jul 2007 |