Author: wmb Date: Wed Oct 13 00:16:13 2010 New Revision: 1974 URL: http://tracker.coreboot.org/trac/openfirmware/changeset/1974
Log: OLPC - Integrated Windows booting into the normal "disk-label" mechanism, thus avoiding the need for a separate "/xp" device node and making it possible to boot Windows from either internal or external SD devices (or even from USB).
Added: ofw/fs/ntfs/ntfs.fth ofw/fs/ntfs/partition.fth Modified: cpu/x86/pc/biosints.fth cpu/x86/pc/olpc/fw.bth cpu/x86/pc/olpc/via/fw.bth ofw/disklabel/loadpkg.fth ofw/disklabel/methods.fth
Modified: cpu/x86/pc/biosints.fth ============================================================================== --- cpu/x86/pc/biosints.fth Wed Oct 13 00:06:16 2010 (r1973) +++ cpu/x86/pc/biosints.fth Wed Oct 13 00:16:13 2010 (r1974) @@ -476,6 +476,22 @@
: drive-sectors ( -- n ) " #blocks" bios-ih $call-method ; : drive-/sector ( -- n ) " block-size" bios-ih $call-method ; +d# 256 buffer: bios-devname +\ Replace the filename with "0" +\ For example, /pci/sd@c/disk@3:\boot\olpc.fth//nt-file-system:\boot\olpc.fth +\ becomes /pci/sd@c/disk@3:0 +: bios-dev$ ( -- adr len ) + load-path cscount [char] \ left-parse-string 2nip ( head$ ) + bios-devname place + " 0" bios-devname $cat + bios-devname count +; +: ?open-bios-disk ( -- ) + bios-disk-ih 0= if + bios-dev$ open-dev to bios-disk-ih + bios-disk-ih 0= abort" Can't open BIOS disk device" + then +; [ifndef] notdef : (bios-read-sectors) ( adr sector# #sectors -- #sectors-read ) drive-/sector >r ( adr #sectors d.byte# r: /sector ) @@ -665,6 +681,7 @@ ;
: disk-int ( -- ) \ INT 13 handler + ?open-bios-disk rm-ah@ case h# 00 of reset-disks endof \ Reset disk system h# 02 of chs-read-sectors endof @@ -1104,9 +1121,7 @@ ; [then]
-0 value mbr-boot? : is-mbr? ( adr len -- flag ) - mbr-boot? 0= if 2drop false exit then + 2 - le-w@ h# aa55 = ; warning @ warning off @@ -1199,9 +1214,9 @@ bios-boot-dev# select-bios-disk boot-sector# boot-#sectors bios-read-sectors bios-boot-dev# h# 82 = if h# 800 else h# 200 then * - true to mbr-boot? ;
+[ifdef] notdef 0 0 " " " /" begin-package " xp" device-name : open @@ -1216,6 +1231,7 @@ : close ; : load ( adr -- nbytes ) mbr-load ; end-package +[then]
0 0 " " " /" begin-package " xpinstall" device-name @@ -1283,11 +1299,12 @@
: install-xp ( -- ) " /xpinstall" $boot ;
-label xx h# 99 # al mov al h# 80 # out begin again end-code -here xx - constant /xx +\ This is a debugging hack that lets you inject a dead-end port80 callout into code +\ label xx h# 99 # al mov al h# 80 # out begin again end-code +\ here xx - constant /xx +\ : put-xx ( adr -- ) xx swap /xx move ; : @.w ( -- ) w@ 5 u.r ; : @.l ( -- ) @ 9 u.r ; -: put-xx ( adr -- ) xx swap /xx move ; : .lreg ( adr -- adr' ) 4 - dup l@ 9 u.r ; : .wreg ( adr -- adr' ) 2 - dup w@ 5 u.r ; : .caller-regs ( -- )
Modified: cpu/x86/pc/olpc/fw.bth ============================================================================== --- cpu/x86/pc/olpc/fw.bth Wed Oct 13 00:06:16 2010 (r1973) +++ cpu/x86/pc/olpc/fw.bth Wed Oct 13 00:16:13 2010 (r1974) @@ -138,6 +138,10 @@ end-support-package [then]
+support-package: nt-file-system + fload ${BP}/ofw/fs/ntfs/ntfs.fth \ Windows NT File System +end-support-package + support-package: zip-file-system fload ${BP}/ofw/fs/zipfs.fth \ Zip file system end-support-package @@ -376,7 +380,7 @@ ; [then]
-" /xp disk:\boot\olpc.fth sd:\boot\olpc.fth nand:\boot\olpc.fth /prober /usb/ethernet /usb/wlan" +" disk:\boot\olpc.fth sd:\boot\olpc.fth nand:\boot\olpc.fth /prober /usb/ethernet /usb/wlan" ' boot-device set-config-string-default
\needs ramdisk " " d# 128 config-string ramdisk
Modified: cpu/x86/pc/olpc/via/fw.bth ============================================================================== --- cpu/x86/pc/olpc/via/fw.bth Wed Oct 13 00:06:16 2010 (r1973) +++ cpu/x86/pc/olpc/via/fw.bth Wed Oct 13 00:16:13 2010 (r1974) @@ -151,6 +151,10 @@ end-support-package [then]
+support-package: nt-file-system + fload ${BP}/ofw/fs/ntfs/ntfs.fth \ Windows NT File System +end-support-package + support-package: zip-file-system fload ${BP}/ofw/fs/zipfs.fth \ Zip file system end-support-package @@ -409,7 +413,7 @@ [then] fload ${BP}/cpu/x86/pc/olpc/rtcwake.fth
-" /xp u:\boot\olpc.fth ext:\boot\olpc.fth int:\boot\olpc.fth /prober /usb/ethernet /wlan" +" u:\boot\olpc.fth ext:\boot\olpc.fth int:\boot\olpc.fth /prober /usb/ethernet /wlan" ' boot-device set-config-string-default
\needs ramdisk " " d# 128 config-string ramdisk
Modified: ofw/disklabel/loadpkg.fth ============================================================================== --- ofw/disklabel/loadpkg.fth Wed Oct 13 00:06:16 2010 (r1973) +++ ofw/disklabel/loadpkg.fth Wed Oct 13 00:16:13 2010 (r1974) @@ -8,6 +8,7 @@ fload ${BP}/ofw/fs/ufs/partition.fth [then] fload ${BP}/ofw/fs/ext2fs/partition.fth +fload ${BP}/ofw/fs/ntfs/partition.fth [ifdef] hfs-support fload ${BP}/ofw/fs/macfs/partition.fth [then]
Modified: ofw/disklabel/methods.fth ============================================================================== --- ofw/disklabel/methods.fth Wed Oct 13 00:06:16 2010 (r1973) +++ ofw/disklabel/methods.fth Wed Oct 13 00:16:13 2010 (r1974) @@ -141,6 +141,7 @@ then " fat-file-system" exit then + ntfs? if " nt-file-system" exit then
." Error: Unknown file system" cr abort
Added: ofw/fs/ntfs/ntfs.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ ofw/fs/ntfs/ntfs.fth Wed Oct 13 00:16:13 2010 (r1974) @@ -0,0 +1,47 @@ +\ See license at end of file +purpose: NTFS file system package methods + +\ This rudimentary file system package supports only "load", which +\ in fact loads the Master Boot Record + +external +: open ( -- flag ) + \ This lets us open the node during compilation + standalone? 0= if true exit then + + " bypass-bios-boot?" $find if + execute if false exit then + then + + my-args " \boot\olpc.fth" $= if true exit then + + false +; +: close ( -- ) ; +: load ( adr -- len ) + 0 1 " read-blocks" $call-parent " block-size" $call-parent * +; + +\ LICENSE_BEGIN +\ Copyright (c) 2010 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END
Added: ofw/fs/ntfs/partition.fth ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ ofw/fs/ntfs/partition.fth Wed Oct 13 00:16:13 2010 (r1974) @@ -0,0 +1,31 @@ +\ See license at end of file +purpose: NTFS partition map decoding support + +\ Returns true if the sector buffer contains an NTFS signature +: ntfs? ( -- flag ) + sector-buf 3 + " NTFS " comp 0= +; + +\ LICENSE_BEGIN +\ Copyright (c) 2010 FirmWorks +\ +\ Permission is hereby granted, free of charge, to any person obtaining +\ a copy of this software and associated documentation files (the +\ "Software"), to deal in the Software without restriction, including +\ without limitation the rights to use, copy, modify, merge, publish, +\ distribute, sublicense, and/or sell copies of the Software, and to +\ permit persons to whom the Software is furnished to do so, subject to +\ the following conditions: +\ +\ The above copyright notice and this permission notice shall be +\ included in all copies or substantial portions of the Software. +\ +\ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +\ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +\ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +\ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +\ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +\ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +\ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +\ +\ LICENSE_END