OS Builder output img ?

Richard Smith richard at laptop.org
Mon Mar 25 20:16:18 EDT 2013


> special command to reboot without the lock.  No way around it as you
> can only unlock with a reboot.  I suppose you could do the security
> disable first and then when you see that its 'ww' rather than 'wp'
> continue on with the re-flash and then the LO change as the last step.

I had a vague recollection of doing something like this many moons ago
to automate the conversion of a large amount of laptops to an Arabic
keyboard.  I managed to dig up the script.  IIRC this script was for
XO-1.5 but since then I think we added this support back into XO-1
firmware.  I did a quick check on a unit I have with q2f13 and all
then necessary words existed.  I offer it up as example code.   Seems
I did exactly what I was suggesting in the previous mail.  Do the
disable-security first and and ignore the error if security has been
disabled.

the line:

['] disable-security catch drop

does that nicely.  It will reboot the 1st time then clear security the
2nd time.  On laptops that have already had security disabled it just
continues on.


\ Automate arabic conversion

visible
unfreeze

\ ka-dir$ is not used in this script but kept so the code is
\ idential to the stuff from the mfg scripts
\ Location of the files containing KA tag data
: ka-dir$  ( -- adr len )  " http:\\10.1.0.1\ka\"  ;

: put-ascii-tag  ( value$ name$ -- )
   2swap  dup  if  add-null  then  2swap  ( value$' key$ )
   ($add-tag)                             ( )
;

: put-ka-tag  ( value$ key$ -- )
   2over  8 min  ka-dir$ " %s%s" sprintf  ( value$ key$ filename$ )
   ." Fetching KA tag file " 2dup type cr ( value$ key$ filename$ )
   $read-file  if                     ( value$ key$ )
      ." ERROR: No KA tag file for " 2swap type cr  ( key$ )
      true  abort" KA file not found" ( key$ )
      2drop                           ( )
   else                               ( value$ key$ file-data$ )
      2swap ($add-tag)                ( value$ )
      2drop                           ( )
   then
;

: special-tag?  ( value$ key$ -- true | value$ key$ false )
   2dup " KA" $=  if                      ( value$ key$ )
      put-ka-tag  true  exit
   then                                   ( value$ key$ )
   false
;

: put-tag  ( value$ key$ -- )
   special-tag?  if  exit  then           ( value$ key$ )
   put-ascii-tag
;

: compare-tag ( value$ key$ -- success? )
    find-tag 0= if false exit then
    ?-null $= 0=
;

: arabic? ( -- true/false )

   " olpc"         " KM"  compare-tag if false exit then
   " us,ara"       " KL"  compare-tag if false exit then
   " olpc2,olpc"   " KV"  compare-tag if false exit then
   " ar_EG.UTF-8"  " LO"  compare-tag if false exit then
   true
;

: arabic-tags  ( -- )

   get-mfg-data

   " KM"  ($delete-tag)
   " KL"  ($delete-tag)
   " KV"  ($delete-tag)
   " LO"  ($delete-tag)

   " olpc"         " KM"  put-tag
   " us,ara"       " KL"  put-tag
   " olpc2,olpc"   " KV"  put-tag
   " ar_EG.UTF-8"  " LO"  put-tag

   flash-write-enable
   (put-mfg-data)

   kbc-on
;

: make-arabic

    arabic? if
	." Tags already correct" cr
    else
	." Changing tags" cr
	arabic-tags
    then
;

: go-arabic ( -- )
    d# 5000 ms
    ['] disable-security catch drop
    make-arabic
    nb
;

go-arabic


-- 
Richard A. Smith
One Laptop per Child



More information about the Devel mailing list