[openfirmware] [commit] r3366 - cpu/x86/pc/olpc ofw/core

repository service svn at openfirmware.info
Sat Oct 13 03:30:15 CEST 2012


Author: wmb
Date: Sat Oct 13 03:30:13 2012
New Revision: 3366
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3366

Log:
OLPC trac #12106 and #12181 - inflate initrd images from inside a .zip bundle.

Modified:
   cpu/x86/pc/olpc/security.fth
   ofw/core/infltdi.fth

Modified: cpu/x86/pc/olpc/security.fth
==============================================================================
--- cpu/x86/pc/olpc/security.fth	Sat Oct 13 01:08:50 2012	(r3365)
+++ cpu/x86/pc/olpc/security.fth	Sat Oct 13 03:30:13 2012	(r3366)
@@ -796,7 +796,7 @@
       "   RD found - " ?lease-debug
       img$  sig$  sha-valid?  if
          show-unlock
-         img$ place-ramdisk
+         img$ $inflated? drop  place-ramdisk
          exit
       else
          show-unlock

Modified: ofw/core/infltdi.fth
==============================================================================
--- ofw/core/infltdi.fth	Sat Oct 13 01:08:50 2012	(r3365)
+++ ofw/core/infltdi.fth	Sat Oct 13 03:30:13 2012	(r3366)
@@ -51,12 +51,27 @@
 ;
 ' try-inflate to ?inflate
 
+\ Inflates the image at adr len if it is compressed.
+\ The uncompressed image is placed after the compressed image in memory,
+\ so sufficient space must be available there.  In practice, this
+\ usually means that adr should be in the region beginning at load-base .
+
+: $inflated?  ( adr len -- adr' len' true | adr len false )
+   over " "(1f8b08)"  comp 0=  if    ( adr len )
+      over +  4 round-up  tuck       ( adr+len adr adr+len )
+      inflate  true                  ( adr' len' true )
+   else                              ( adr len )
+      false                          ( adr len false )
+   then
+;
 : (?inflate-loaded)  ( -- )
-   load-base  " "(1f8b08)"  comp 0=  if
-      load-base  loaded +  tuck  inflate  !load-size  ( infl-adr )
-      loaded move                                     ( )
+   loaded $inflated?  if       ( adr len )
+      !load-size  loaded move  ( )
+   else                        ( adr len )
+      2drop                    ( )
    then
 ;
+
 ' (?inflate-loaded) to ?inflate-loaded
 headers
 \ LICENSE_BEGIN



More information about the openfirmware mailing list