olpc.fth
Jerry Vonau
jvonau at shaw.ca
Thu Feb 3 19:22:03 EST 2011
On Thu, 2011-02-03 at 17:20 -0600, Jerry Vonau wrote:
> On Thu, 2011-02-03 at 17:02 -0600, Jerry Vonau wrote:
> > On Thu, 2011-02-03 at 15:52 -0600, Jerry Vonau wrote:
> > > On Thu, 2011-02-03 at 15:37 -0600, Jerry Vonau wrote:
> > > > On Thu, 2011-02-03 at 16:21 -0500, Martin Langhoff wrote:
> > > > > On Thu, Feb 3, 2011 at 4:16 PM, Jerry Vonau <jvonau at shaw.ca> wrote:
> > > > > > Just a quick question is it possible to run commands that are available
> > > > > > at OFW prompt inside the olpc.fth file? I'm looking at trying to run
> > > > > > add-tag-from-file from within olpc.fth.
> > > > >
> > > > > I used to think you could, but according to Reuben and Mitch... you
> > > > > can't. By the time boot.fth gets executed, OFW has put the memory back
> > > > > in readonly mode.
> > > > >
> > > > > So the add-tag game should be done with a proper keyjector.
> > > > >
> > > > > Impractical but safer.
> > > > >
> > > >
> > > > Then the trick for olpc.fth would be to store the info and reboot to
> > > > flash the info in, like how bootfw.zip is handled.
> > > >
> > > > just thinking out loud,
> > >
> > > Just found this gem:
> > >
> > > http://dev.laptop.org/pub/firmware/scripts/newkatag.fth
> > >
> > > looks to be do-able,
> > >
> > > Jerry
> >
> > Rough proof of concept attached.
> >
>
> ok the buffer is too small, the key gets truncated, but this looks to be
> viable. Anybody got a quick fix?
>
> Jerry
>
Think this is better a better one.
Jerry
-------------- next part --------------
\ OLPC boot script
visible
sound-end
[ifndef] do-firmware-update
: do-firmware-update ( img$ -- )
\ Keep .error from printing an input sream position report
\ which makes a buffer@<address> show up in the error message
['] noop to show-error
visible
tuck flash-buf swap move ( len )
['] ?image-valid catch ?dup if ( )
visible
red-letters
." Bad firmware image file - " .error
." Continuing with old firmware" cr
black-letters
exit
then
true to file-loaded?
d# 12,000 wait-until \ Wait for EC to notice the battery
['] ?enough-power catch ?dup if
visible
red-letters
." Unsafe to update firmware now - " .error
." Continuing with old firmware" cr
black-letters
exit
then
" Updating firmware" ?lease-debug-cr
ec-indexed-io-off? if
visible
." Restarting to enable SPI FLASH writing." cr
d# 3000 ms
ec-ixio-reboot
security-failure
then
\ Latch alternate? flag for next startup
alternate? if [char] A h# 82 cmos! then
reflash \ Should power-off and reboot
show-x
" Reflash returned, unexpectedly" .security-failure
;
[then]
[ifndef] do-skey-update ( -- )
: do-skey-update " add-tag-from-file s1 u:\boot\s.pub" eval ;
[then]
[ifndef] ?ofw-reflash
\ Check for new firmware.
: ?ofw-reflash ( -- )
" ${DN}${PN}\bootfw.zip" expand$
['] (boot-read) catch if 2drop exit then
img$ firmware-up-to-date? if exit then
img$ do-firmware-update
;
[then]
[ifndef] ?ofw-skey
\ Check for new s.pub key.
: ?ofw-skey ( -- )
cr
." 1 to install s-key from USB" cr
cr
key [char] 1 = if
." Continuing to install skey" cr
do-skey-update
else
." Not installing" cr
then
;
[then]
: set-path-macros ( -- )
button-o game-key? if " \boot-alt" else " \boot" then pn-buf place
" /chosen" find-package if ( phandle )
" bootpath" rot get-package-property 0= if ( propval$ )
get-encoded-string ( bootpath$ )
[char] \ left-parse-string 2nip ( dn$ )
dn-buf place ( )
then
then
;
: olpc-fth-boot-me
set-path-macros
?ofw-reflash
?ofw-skey
;
olpc-fth-boot-me
More information about the Devel
mailing list