[openfirmware] [commit] r3656 - cpu/arm/olpc/1.75
repository service
svn at openfirmware.info
Tue May 7 07:06:35 CEST 2013
Author: quozl
Date: Tue May 7 07:06:33 2013
New Revision: 3656
URL: http://tracker.coreboot.org/trac/openfirmware/changeset/3656
Log:
OLPC XO-1.75 - retain the file name portion of the /chosen bootpath property, so that the initramfs can deduce whether the system is being booted in activation mode or not. The initramfs may also use ramdisk to deduce. #12672.
Modified:
cpu/arm/olpc/1.75/dtcompat.fth
Modified: cpu/arm/olpc/1.75/dtcompat.fth
==============================================================================
--- cpu/arm/olpc/1.75/dtcompat.fth Thu May 2 04:36:27 2013 (r3655)
+++ cpu/arm/olpc/1.75/dtcompat.fth Tue May 7 07:06:33 2013 (r3656)
@@ -9,15 +9,30 @@
\ 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 )
+\ append a fragment to a path in place, returning the new path string
+: $append ( path$ fragment$ -- 'path$ )
+ dup >r ( path$ fragment$ r: /fragment )
+ 2over ca+ ( path$ fragment$ dst r: /fragment )
+ swap cmove ( path$ r: /fragment )
+ r> ca+ ( 'path$ )
+ 2dup ca+ 0 swap c! ( 'path$ )
+;
+
+\ if "bootpath" (whose underlying storage is load-path) starts with
+\ new$ then replace only those characters with old$
+: $replaced? ( old$ new$ -- flag )
+ load-path cscount ( old$ new$ path$ )
+ [char] : left-parse-string ( old$ new$ tail$ head$ )
+ 2swap 2>r ( old$ new$ head$ r: tail$ )
+ $= if ( old$ r: tail$ )
+ load-path 0 ( old$ path$ )
+ 2swap $append ( path$ r: tail$ )
+ " :" $append ( path$ r: tail$ )
+ 2r> $append ( path$ )
+ 2drop true ( flag )
+ else ( old$ r: tail$ )
+ 2r> 4drop false ( flag )
+ then ( flag )
;
: fixup-bootpath ( -- )
@@ -25,9 +40,9 @@
/ramdisk 0= if exit then
" $bootpath in"n"t"t/sd@" ramdisk-adr /ramdisk $sindex nip if ( )
false to use-fdt?
- " /sd at d4280000/disk at 1:/" " /sd/sdhci at d4280000/disk" $replaced? ?exit
- " /sd at d4280000/disk at 2:/" " /sd/sdhci at d4280800/disk" $replaced? ?exit
- " /sd at d4280000/disk at 3:/" " /sd/sdhci at d4281000/disk" $replaced? ?exit
+ " /sd at d4280000/disk at 1" " /sd/sdhci at d4280000/disk" $replaced? ?exit
+ " /sd at d4280000/disk at 2" " /sd/sdhci at d4280800/disk" $replaced? ?exit
+ " /sd at d4280000/disk at 3" " /sd/sdhci at d4281000/disk" $replaced? ?exit
then
;
More information about the openfirmware
mailing list