Author: wmb Date: 2010-01-22 08:46:45 +0100 (Fri, 22 Jan 2010) New Revision: 1683
Added: cpu/x86/pc/olpc/via/mcastnand.bth Modified: cpu/x86/pc/olpc/gridmap.fth cpu/x86/pc/olpc/nandcastui.fth cpu/x86/pc/olpc/via/copynand.fth cpu/x86/pc/olpc/via/fsupdate.fth cpu/x86/pc/olpc/via/fw.bth cpu/x86/pc/olpc/via/olpc.bth cpu/x86/pc/olpc/via/versions.fth Log: XO-1.5 NANDblaster, first cut.
Modified: cpu/x86/pc/olpc/gridmap.fth =================================================================== --- cpu/x86/pc/olpc/gridmap.fth 2010-01-22 05:43:23 UTC (rev 1682) +++ cpu/x86/pc/olpc/gridmap.fth 2010-01-22 07:46:45 UTC (rev 1683) @@ -8,7 +8,7 @@ 9 constant grid-h
d# 128 value #cols -d# 94 value #rows +d# 90 value #rows : max-grid ( -- n ) #rows #cols * ;
\needs xy+ : xy+ ( x1 y1 x2 y2 -- x3 y3 ) rot + -rot + swap ;
Modified: cpu/x86/pc/olpc/nandcastui.fth =================================================================== --- cpu/x86/pc/olpc/nandcastui.fth 2010-01-22 05:43:23 UTC (rev 1682) +++ cpu/x86/pc/olpc/nandcastui.fth 2010-01-22 07:46:45 UTC (rev 1683) @@ -1,6 +1,11 @@ purpose: User interface for NAND multicast updater \ See license at end of file
+\ Number of blocks NANDblaster read in zdata mode +\ nb_rx will set this using the interpret client service. +-1 value nb-zd-#sectors +: set-nb-zd-#sectors ( n -- ) to nb-zd-#sectors ; + : mesh-ssids ( -- $ ) " olpc-mesh"nolpc-mesh"nolpc-mesh"nolpc-mesh"nolpc-mesh"nolpc-mesh" ; @@ -34,6 +39,7 @@ : #nb ( channel# -- ) depth 1 < abort" Usage: channel# #nb" secure$ rot + -1 to nb-zd-#sectors " rom:nb_rx ether:%d %s" sprintf boot-load go ; : #nb-clone ( channel# -- ) @@ -91,17 +97,22 @@ : meshnand use-mesh false to already-go? - " boot rom:nb_rx 239.255.1.2" eval + " boot rom:nb_rx ,,239.255.1.2" eval ;
: nb_rx false to already-go? - " boot rom:nb_rx 239.255.1.2" eval + " boot rom:nb_rx ,,239.255.1.2" eval ; : ucastnand false to already-go? " boot rom:nb_rx 10.20.0.16,,10.20.0.44" eval ; +: nbit ( "filename" -- ) + false to already-go? + safe-parse-word + " boot rom:nb_tx udp:239.255.1.2 %s 20 131072" sprintf eval +;
\ LICENSE_BEGIN \ Copyright (c) 2008 FirmWorks
Modified: cpu/x86/pc/olpc/via/copynand.fth =================================================================== --- cpu/x86/pc/olpc/via/copynand.fth 2010-01-22 05:43:23 UTC (rev 1682) +++ cpu/x86/pc/olpc/via/copynand.fth 2010-01-22 07:46:45 UTC (rev 1683) @@ -97,14 +97,14 @@ 0 h# ff h# ff rgb>565 constant strange-color \ cyan h# e8 h# e8 h# e8 rgb>565 constant starting-color \ very light gray
-d# 28 constant status-line +d# 26 constant status-line
: gshow-init ( #eblocks -- ) dup set-grid-scale cursor-off " erase-screen" $call-screen
starting-color ( #eblocks color ) - over 0 ?do i over show-state loop ( #eblocks color ) + over 0 ?do i over show-state scale-factor +loop ( #eblocks color ) drop ( #eblocks ) 1 status-line at-xy ." Blocks/square: " scale-factor .d ." Total blocks: " .d @@ -233,62 +233,7 @@ current-block highlight-block ;
-0 value nand-block-limit -: +block ( offset -- ) - current-block + nand-block-limit mod ( new-block# ) - dup point-block ( new-block# ) - dup show-eblock# ( new-block# ) - nand-map + c@ status-descriptions count type kill-line -;
-: process-key ( char -- ) - case - h# 9b of endof - [char] A of #cols negate +block endof \ up - [char] B of #cols +block endof \ down - [char] C of 1 +block endof \ right - [char] D of -1 +block endof \ left - [char] ? of #cols 8 * negate +block endof \ page up - [char] / of #cols 8 * +block endof \ page down - [char] K of 8 +block endof \ page right - [char] H of -8 +block endof \ page left - h# 1b of d# 20 ms key? 0= if true to examine-done? then endof - endcase -; - -: examine-nand ( -- ) - 0 status-line 1- at-xy red-letters ." Arrows, fn Arrows to move, Esc to exit" black-letters cr - #nand-pages nand-pages/block / to nand-block-limit - 0 to current-block - current-block highlight-block - false to examine-done? - begin key process-key examine-done? until - current-block lowlight-block -; - -: (scan-nand) ( -- ) - nand-map 0= if - #nand-pages nand-pages/block / alloc-mem to nand-map - then - - " usable-page-limit" $call-nand - dup nand-pages/block / show-init ( page-limit ) - - 0 ?do - i classify-block ( status ) - i nand-pages/block / ( status eblock# ) - 2dup nand-map + c! ( status eblock# ) - show-block-type ( ) - nand-pages/block +loop ( ) - - show-done -; - -: scan-nand ( -- ) - open-nand (scan-nand) close-nand-ihs - examine-nand -; - \ LICENSE_BEGIN \ Copyright (c) 2009 FirmWorks \
Modified: cpu/x86/pc/olpc/via/fsupdate.fth =================================================================== --- cpu/x86/pc/olpc/via/fsupdate.fth 2010-01-22 05:43:23 UTC (rev 1682) +++ cpu/x86/pc/olpc/via/fsupdate.fth 2010-01-22 07:46:45 UTC (rev 1683) @@ -68,7 +68,6 @@ ?compare-spec-line get-hex# to /nand-block get-hex# to #image-eblocks - open-nand " size" $call-nand #image-eblocks /nand-block um* d< " Image size is larger than output device" ?nand-abort #image-eblocks show-init @@ -87,6 +86,7 @@ " write-blocks-end" $call-nand ( error? ) " Write error" ?nand-abort \ #image-eblocks erase-gap + fexit ;
: data: ( "filename" -- ) @@ -195,7 +195,9 @@ : fs-update ( "devspec" -- ) load-crypto abort" Can't load hash routines"
- false to secure-fsupdate? + open-nand ( ) + + false to secure-fsupdate? ( ) safe-parse-word r/o open-file ( fd ) abort" Can't open file" ( fd )
@@ -285,6 +287,29 @@ ; : update-nand ( "devspec" -- ) safe-parse-word $update-nand ;
+0 0 " " " /" begin-package + " nb-updater" device-name + 0. 2value offset + : size ( -- d.#bytes ) nb-zd-#sectors h# 200 um* ; + : open ( -- flag ) + nb-zd-#sectors -1 = if + ." nb-updater: nb-zd-#sectors is not set" cr + false exit + then + nandih 0= if + ." nb-updater: fsdisk device is not open" cr + false exit + then + " size" $call-nand ( d.size ) + size d- to offset + true + ; + : close ; + : seek ( d.pos -- ) offset d+ " seek" $call-nand ; + : read ( adr len -- actual ) " read" $call-nand ; + \ No write method for this +end-package + \ LICENSE_BEGIN \ Copyright (c) 2007 FirmWorks \
Modified: cpu/x86/pc/olpc/via/fw.bth =================================================================== --- cpu/x86/pc/olpc/via/fw.bth 2010-01-22 05:43:23 UTC (rev 1682) +++ cpu/x86/pc/olpc/via/fw.bth 2010-01-22 07:46:45 UTC (rev 1683) @@ -470,6 +470,7 @@ fload ${BP}/forth/lib/selstr.fth
fload ${BP}/cpu/x86/pc/olpc/via/padlock.fth \ Via security engine +fload ${BP}/dev/hdaudio/noiseburst.fth \ audio-test support package
fload ${BP}/ofw/inet/loadtcp.fth
@@ -497,10 +498,8 @@ ; ' olpc-ssids to default-ssids
-[ifdef] Later fload ${BP}/cpu/x86/pc/olpc/nandcastui.fth fload ${BP}/cpu/x86/pc/olpc/wifichannel.fth -[then] fload ${BP}/cpu/x86/pc/olpc/via/fsupdate.fth fload ${BP}/cpu/x86/pc/olpc/via/fsverify.fth devalias fsdisk int:0
Added: cpu/x86/pc/olpc/via/mcastnand.bth =================================================================== --- cpu/x86/pc/olpc/via/mcastnand.bth (rev 0) +++ cpu/x86/pc/olpc/via/mcastnand.bth 2010-01-22 07:46:45 UTC (rev 1683) @@ -0,0 +1,30 @@ +purpose: Fetch and compile the multicast NAND reflash program + +command: &builder &this +build-now + +fload ${BP}/cpu/x86/pc/olpc/via/versions.fth + +1 [if] +" ${MCNAND_VERSION}" expand$ " test" $= [if] + " multicast-nand/Makefile" $file-exists? 0= [if] + " git clone -q git://dev.laptop.org/users/wmb/multicast-nand" expand$ $sh + [then] +[else] +" rm -rf multicast-nand" $sh +" wget -q -O multicast-nand.tar.gz http://dev.laptop.org/git/users/wmb/multicast-nand/snapshot/multicast-nand-$..." expand$ $sh +" tar xfz multicast-nand.tar.gz" $sh +" mv multicast-nand-${MCNAND_VERSION} multicast-nand" expand$ $sh +" rm multicast-nand.tar.gz" $sh +[then] + +" (cd multicast-nand; make BPDIR=../../../../../../.. nandblaster15_rx.bin nandblaster_tx.bin; cp nandblaster15_rx.bin nandblaster_tx.bin ..)" expand$ $sh +[else] +" (cd /home/wmb/Git/multicast-nand; make BPDIR=/home/wmb/ofw.test nandblaster15_rx.bin nandblaster_tx.bin;)" $sh +" cp /home/wmb/Git/multicast-nand/nandblaster*.bin ." expand$ $sh +[then] + +\ This forces the creation of a .log file, so we don't re-fetch +writing mcastnand.version +" ${MCNAND_VERSION}"n" expand$ ofd @ fputs +ofd @ fclose
Modified: cpu/x86/pc/olpc/via/olpc.bth =================================================================== --- cpu/x86/pc/olpc/via/olpc.bth 2010-01-22 05:43:23 UTC (rev 1682) +++ cpu/x86/pc/olpc/via/olpc.bth 2010-01-22 07:46:45 UTC (rev 1683) @@ -28,7 +28,7 @@ \ in: ${BP}/dev/ide/build/leghier.fc \ in: ${BP}/cpu/x86/pc/olpc/via/build/camera.fc in: ${BP}/cpu/x86/pc/olpc/via/build/dsdt.aml -\ in: ${BP}/cpu/x86/pc/olpc/via/build/mcastnand.bin +in: ${BP}/cpu/x86/pc/olpc/via/build/mcastnand.bin in: ${BP}/dev/hdaudio/build/hdaudio.fc in: sd8686.bin in: testicons.bin @@ -188,10 +188,8 @@ " ${BP}/cpu/x86/pc/olpc/images/leds.di" $add-file " ${BP}/cpu/x86/pc/olpc/images/ebook.di" $add-file
-[ifdef] Later - " ${BP}/cpu/x86/pc/olpc/via/build/nandblaster_rx.bin" " nb_rx" $add-deflated-dropin + " ${BP}/cpu/x86/pc/olpc/via/build/nandblaster15_rx.bin" " nb_rx" $add-deflated-dropin " ${BP}/cpu/x86/pc/olpc/via/build/nandblaster_tx.bin" " nb_tx" $add-deflated-dropin -[then]
.( Dropin top is ) ofd @ fsize .x cr
Modified: cpu/x86/pc/olpc/via/versions.fth =================================================================== --- cpu/x86/pc/olpc/via/versions.fth 2010-01-22 05:43:23 UTC (rev 1682) +++ cpu/x86/pc/olpc/via/versions.fth 2010-01-22 07:46:45 UTC (rev 1683) @@ -2,7 +2,7 @@
\ The overall firmware revision macro: FW_MAJOR A -macro: FW_MINOR 26 +macro: FW_MINOR 26h
\ The EC microcode macro: EC_VERSION 1_9_21 @@ -30,6 +30,6 @@ \ With a specific ID, mcastnand.bth will download a tarball without .git stuff. \ With "test", mcastnand.bth will clone the git head if build/multicast-nand/ \ is not already present, then you can modify the git subtree as needed. -macro: MCNAND_VERSION b9a9d22b6037c3891f9cf8eabeaf7cd9efbd5241 +macro: MCNAND_VERSION 0fcff94005b9570e4b7f1406f2f9e155f828b6d2 \ macro: MCNAND_VERSION test \ macro: MCNAND_VERSION HEAD