Author: wmb Date: Wed Oct 3 23:50:56 2012 New Revision: 3350 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3350
Log: OLPC XO-1.75 - support old OS releases from OFW with new device tree layout.
Added: cpu/arm/olpc/1.75/dtcompat.fth Modified: cpu/arm/olpc/1.75/fw.bth forth/lib/substrin.fth
Added: cpu/arm/olpc/1.75/dtcompat.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ cpu/arm/olpc/1.75/dtcompat.fth Wed Oct 3 23:50:56 2012 (r3350) @@ -0,0 +1,34 @@ +purpose: Hack to make old kernels boot with new device tree layout + +\ The problem this solves is that older OS releases for XO-1.75 +\ a) Require ATAGS info instead of flattened device tree (kernel), and +\ b) Require MMC pathnames of the form /sd@d4280000/disk@N instead of +\ the new form /sd/sdhci@d428nnnn/disk (initrd). +\ In order to boot those old OS releases, when we detect an old release, +\ we use ATAGS and rewrite the "bootpath" property in /chosen to the old +\ form. + + +\ If "bootpath" (whose underlying storage is load-path) matches newpath$, +\ replace it with oldpath$ . +: $replaced? ( oldpath$ newpath$ -- flag ) + load-path cscount substring? if ( oldpath$ ) + load-path place-cstr ( ) + true ( flag ) + else ( oldpath$ ) + 2drop false ( flag ) + then ( flag ) +; + +: fixup-bootpath ( -- ) + disable-interrupts + /ramdisk 0= if exit then + " $bootpath in"n"t"t/sd@" ramdisk-adr /ramdisk $sindex nip if ( ) + false to use-fdt? + " /sd@d4280000/disk@1:/" " /sd/sdhci@d4280000/disk" $replaced? ?exit + " /sd@d4280000/disk@2:/" " /sd/sdhci@d4280800/disk" $replaced? ?exit + " /sd@d4280000/disk@3:/" " /sd/sdhci@d4281000/disk" $replaced? ?exit + then +; + +patch fixup-bootpath disable-interrupts linux-fixup
Modified: cpu/arm/olpc/1.75/fw.bth ============================================================================== --- cpu/arm/olpc/1.75/fw.bth Wed Oct 3 23:40:57 2012 (r3349) +++ cpu/arm/olpc/1.75/fw.bth Wed Oct 3 23:50:56 2012 (r3350) @@ -31,5 +31,6 @@ fload ${BP}/cpu/arm/olpc/1.75/testinstructions.fth fload ${BP}/cpu/arm/olpc/gpio-gamekeys.fth fload ${BP}/cpu/arm/olpc/test-tweaks.fth +fload ${BP}/cpu/arm/olpc/1.75/dtcompat.fth
fload ${BP}/cpu/arm/olpc/save-fw.fth
Modified: forth/lib/substrin.fth ============================================================================== --- forth/lib/substrin.fth Wed Oct 3 23:40:57 2012 (r3349) +++ forth/lib/substrin.fth Wed Oct 3 23:50:56 2012 (r3350) @@ -31,6 +31,20 @@ r> 1+ >r again ; + +\ This version is faster (due to bscan being a code word) and arguably more convenient than sindex +: $sindex ( small$ big$ -- rem$ ) + 2 pick 0= if 4drop 0 then \ Null string is initial substring of anything + 3 pick c@ >r ( small$ big$ r: firstchar ) + begin r@ bscan dup while ( small$ rem$ r: firstchar ) + 4dup substring? if ( small$ rem$ r: firstchar ) + 2swap r> 3drop exit ( -- rem$ ) + then ( small$ rem$ r: firstchar ) + 1 /string ( small$ rem$' r: firstchar ) + repeat ( small$ rem$ r: firstchar ) + 2swap r> 3drop ( rem$ ) +; + only forth also definitions
\ LICENSE_BEGIN
openfirmware@openfirmware.info