[openfirmware] [commit] r2133 - cpu/arm/olpc/1.75 forth/lib

repository service svn at openfirmware.info
Thu Jan 20 02:14:06 CET 2011


Author: wmb
Date: Thu Jan 20 02:14:05 2011
New Revision: 2133
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/2133

Log:
Eliminate the use of the "md5sum" command in the builder scripts for XO-1.75, because OS-X doesn't have that command.

Added:
   forth/lib/md5file.fth
Modified:
   cpu/arm/olpc/1.75/sd8686.bth
   cpu/arm/olpc/1.75/verify.bth

Modified: cpu/arm/olpc/1.75/sd8686.bth
==============================================================================
--- cpu/arm/olpc/1.75/sd8686.bth	Thu Jan 20 02:12:45 2011	(r2132)
+++ cpu/arm/olpc/1.75/sd8686.bth	Thu Jan 20 02:14:05 2011	(r2133)
@@ -3,23 +3,8 @@
 command: &builder &this
 build-now
 
-char * value prefix
-\needs $md5digest1 fload ${BP}/ofw/ppp/md5.fth
-: $md5sum-file  ( filename$ -- )
-   2dup $read-file         ( filename$ adr len )
-   2dup $md5digest1        ( filename$ adr len md5$ )
-   2swap free-mem          ( filename$ md5$ )
-   " md5string" $new-file  ( filename$ md5$ )
-   bounds  ?do             ( filename$ )
-      i c@  push-hex  <# u# u# u#> ofd @ fputs  pop-base
-   loop                    ( filename$ )
-   "  " ofd @ fputs        ( filename$ )
-   prefix ofd @ fputc      ( filename$ )
-   ofd @ fputs             ( )
-   fcr
-   ofd @ fclose
-;
-
+\needs to-file       fload ${BP}/forth/lib/tofile.fth
+\needs $md5sum-file  fload ${BP}/forth/lib/md5file.fth
 
 fload ${BP}/cpu/arm/olpc/1.75/wlan-version.fth
 
@@ -33,14 +18,14 @@
 " wget -q http://dev.laptop.org/pub/firmware/libertas/thinfirm/${WLAN_FILE}.bin" expand$ $sh
 " wget -q http://dev.laptop.org/pub/firmware/libertas/thinfirm/${WLAN_FILE}.bin.md5" expand$ $sh
 
-bl to prefix  " ${WLAN_FILE}.bin" expand$ $md5sum-file
+to-file md5string  "  "  " ${WLAN_FILE}.bin" expand$ $md5sum-file
 " cmp md5string ${WLAN_FILE}.bin.md5" expand$ $sh
 
 " mv ${WLAN_FILE}.bin sd8686.bin" expand$ $sh
 
 " wget -q http://dev.laptop.org/pub/firmware/libertas/sd8686_helper.bin" expand$ $sh
 " wget -q http://dev.laptop.org/pub/firmware/libertas/sd8686_helper.bin.md5" expand$ $sh
-char * to prefix  " sd8686_helper.bin" $md5sum-file
+to-file md5string  " *" " sd8686_helper.bin" $md5sum-file
 " cmp md5string sd8686_helper.bin.md5" expand$ $sh
 
 " rm ${WLAN_FILE}.bin.md5 sd8686_helper.bin.md5 md5string" expand$ $sh

Modified: cpu/arm/olpc/1.75/verify.bth
==============================================================================
--- cpu/arm/olpc/1.75/verify.bth	Thu Jan 20 02:12:45 2011	(r2132)
+++ cpu/arm/olpc/1.75/verify.bth	Thu Jan 20 02:14:05 2011	(r2133)
@@ -3,6 +3,9 @@
 command: &builder &this
 build-now
 
+\needs to-file       fload ${BP}/forth/lib/tofile.fth
+\needs $md5sum-file  fload ${BP}/forth/lib/md5file.fth
+
 fload ${BP}/cpu/arm/olpc/1.75/crypto-version.fth
 
 " wget -q http://dev.laptop.org/pub/firmware/crypto/${KEYS}/os.public        -O os.public"        expand$ $sh
@@ -13,10 +16,11 @@
 " wget -q http://dev.laptop.org/pub/firmware/crypto/bios_verify-${CRYPTO_VERSION}.img" expand$ $sh
 " wget -q http://dev.laptop.org/pub/firmware/crypto/bios_verify-${CRYPTO_VERSION}.img.md5" expand$ $sh
 
-" md5sum -b bios_verify-${CRYPTO_VERSION}.img | cmp - bios_verify-${CRYPTO_VERSION}.img.md5" expand$ $sh
+to-file md5string  " *"  " bios_verify-${CRYPTO_VERSION}.img" expand$ $md5sum-file
+" cmp md5string bios_verify-${CRYPTO_VERSION}.img.md5" expand$ $sh
 
 " mv bios_verify-${CRYPTO_VERSION}.img verify.img" expand$ $sh
-" rm bios_verify-${CRYPTO_VERSION}.img.md5" expand$ $sh
+" rm bios_verify-${CRYPTO_VERSION}.img.md5 md5string" expand$ $sh
 
 \ This forces the creation of an verify.log file, so we don't re-fetch
 writing verify.version

Added: forth/lib/md5file.fth
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ forth/lib/md5file.fth	Thu Jan 20 02:14:05 2011	(r2133)
@@ -0,0 +1,28 @@
+purpose: Emulate the Linux md5sum command
+
+\needs $md5digest1 fload ${BP}/ofw/ppp/md5.fth
+
+: $md5sum-file  ( prefix$ filename$ -- )
+   \ Read file into memory and compute its MD5 hash
+   2dup $read-file         ( prefix$ filename$ adr len )
+   2dup $md5digest1        ( prefix$ filename$ adr len md5$ )
+   2swap free-mem          ( prefix$ filename$ md5$ )
+
+   \ Write the hash and the filename in the same format as
+   \ the output of the Linux "md5sum" command.  prefix$ should
+   \ be " *" to match the output of "md5sum -b" and "  "
+   \ to match the output of "md5sum" without -b.
+
+   \ Output MD5 in lower case ASCII hex
+   push-hex                ( prefix$ filename$ md5$ )
+   bounds  ?do             ( prefix$ filename$ )
+      i c@  <# u# u# u#> type
+   loop                    ( prefix$ filename$ )
+   pop-base                ( prefix$ filename$ )
+
+   \ ... followed by "  filename" or " *filename"
+   ."  "                   ( prefix$ filename$ )
+   2swap type              ( filename$ )
+   type                    ( )
+   cr
+;



More information about the openfirmware mailing list