Author: wmb Date: 2009-01-23 20:26:25 +0100 (Fri, 23 Jan 2009) New Revision: 1074
Added: cpu/x86/pc/biosload/HOWTO_USB_boot.txt cpu/x86/pc/biosload/config-olpc.fth Modified: cpu/x86/pc/biosload/addrs.fth cpu/x86/pc/biosload/devices.fth cpu/x86/pc/biosload/fw.bth cpu/x86/pc/biosload/ofw.bth Log: Biosload build - Added OLPC build variant for use as a recovery tool (in case of XOs that have been reflashed with Insyde BIOS), and added instructions for how to prepare a generic USB-bootable version.
Added: cpu/x86/pc/biosload/HOWTO_USB_boot.txt =================================================================== --- cpu/x86/pc/biosload/HOWTO_USB_boot.txt (rev 0) +++ cpu/x86/pc/biosload/HOWTO_USB_boot.txt 2009-01-23 19:26:25 UTC (rev 1074) @@ -0,0 +1,61 @@ +== Booting OFW from BIOS via a USB Drive == + +You need a USB drive (hard disk, FLASH stick, pendrive) that is formatted with a FAT filesystem +(they come that way from the factory). + +These instructions assume that you know the basics of mounting USB drives and copying files to and from them. + +=== Build OFW === + +On a Linux system with gcc and Subversion installed: + + $ svn co svn://openbios.org/openfirmware + $ cd openfirmware/cpu/x86/pc/biosload + $ cp config-usbkey.fth config.fth + $ cd build + $ make + +The output file is ofw.c32 . It is in "COM32" format, as used by SYSLINUX. + +* Copy ofw.c32 to the USB drive's root directory + +* Copy openfirmware/cpu/x86/biosload/syslinux.cfg to the USB drive's root directory + +=== Make the USB Key Bootable ... === + +==== ... On Linux ==== + +* Install the "syslinux" package (e.g. "apt-get install syslinux" or "yum install syslinux" or get the whole distribution from http://www.kernel.org/pub/linux/utils/boot/syslinux/ and use linux/syslinux therein). + +* Unmount any filesystems that are currently mounted on the USB drive + +* Find the USB drive's device name. It will probably be something like /dev/sda . You want the name of the whole drive (just sda), NOT a subordinate partition (NOT sda1). + +* Run this command, replacing "/dev/sda" with the appropriate device name for your USB drive: + + $ syslinux /dev/sda + + +==== ... On Windows ==== + +* Open My Computer and find the drive corresponding to the USB key. The following instructions assume that it is "F". + +* Download and extract the following onto your host machine: http://www.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.72.zip + +* Open a cmd window + +* cd to the directory where you unzipped the syslinux files + +* cd to the win32 subdirectory + +* Run this command line, replacing "f" with the drive letter for your USB key: + + syslinux f: + +* Use the "Safely Remove Hardware" icon in the system tray to stop the USB key device, then remove that device + +=== Setup Your BIOS to Boot From USB === + +... depends on your particular BIOS, but in general, you must set the +boot order so something like "USB HDD" is the first choice. You do not +want "USB ZIP drive" or "USB floppy".
Modified: cpu/x86/pc/biosload/addrs.fth =================================================================== --- cpu/x86/pc/biosload/addrs.fth 2009-01-16 09:06:43 UTC (rev 1073) +++ cpu/x86/pc/biosload/addrs.fth 2009-01-23 19:26:25 UTC (rev 1074) @@ -34,6 +34,21 @@ h# 08.0000 constant dropin-size [then]
+[ifdef] olpc +\ System has limited memory (256M for most versions, 128M for a few) +\needs fw-pa h# e00.0000 constant fw-pa \ OFW dictionary location +\needs /fw-ram h# 20.0000 constant /fw-ram + +\needs heap-base h# e20.0000 constant heap-base \ Dynamic allocation heap +\needs heap-size h# 20.0000 constant heap-size + +\needs dma-base h# e40.0000 constant dma-base \ DMA heap +\needs dma-size h# 20.0000 constant dma-size + + h# e60.0000 constant dropin-base \ Location of payload in RAM + h# 08.0000 constant dropin-size +[then] + \needs dropin-base h# 198.0000 constant dropin-base \needs dropin-size h# 8.0000 constant dropin-size \needs ResetBase dropin-base h# 20 + constant ResetBase \ Location of "reset" dropin in ROM
Added: cpu/x86/pc/biosload/config-olpc.fth =================================================================== --- cpu/x86/pc/biosload/config-olpc.fth (rev 0) +++ cpu/x86/pc/biosload/config-olpc.fth 2009-01-23 19:26:25 UTC (rev 1074) @@ -0,0 +1,55 @@ +\ See license at end of file +purpose: Configuration for loading from a USB key via Syslinux on OLPC + +create olpc \ OLPC-specific SPI FLASH programming + +\ --- The environment that "boots" OFW --- +\ - Image Format - Example Media - previous stage bootloader + +\ - (Syslinux) COM32 format - USB Key w/ FAT FS - Syslinux +create syslinux-loaded + +\ create serial-console +create pc + +\ create pseudo-nvram +create debug-startup +create resident-packages +create addresses-assigned \ Don't reassign PCI addresses +\ create virtual-mode +\ create use-root-isa +create use-timestamp-counter +create use-pci-isa +create use-isa-ide +create use-ega +create use-elf +\ create use-ne2000 +create use-watch-all +create use-null-nvram +create no-floppy-node + +fload ${BP}/cpu/x86/pc/biosload/addrs.fth + +\ LICENSE_BEGIN +\ Copyright (c) 2006 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
Modified: cpu/x86/pc/biosload/devices.fth =================================================================== --- cpu/x86/pc/biosload/devices.fth 2009-01-16 09:06:43 UTC (rev 1073) +++ cpu/x86/pc/biosload/devices.fth 2009-01-23 19:26:25 UTC (rev 1074) @@ -82,6 +82,19 @@ fload ${BP}/dev/pc87317.fth \ National PC87317 superIO [then]
+[ifdef] olpc +\ Create the top-level device node to access the entire boot FLASH device +0 0 " fff00000" " /" begin-package + " flash" device-name + + h# 10.0000 value /device + h# 10.0000 constant /device-phys + my-address my-space /device-phys reg + fload ${BP}/dev/flashpkg.fth + fload ${BP}/dev/flashwrite.fth +end-package +[then] + 0 0 dropin-base <# u#s u#> " /" begin-package " flash" device-name
@@ -176,7 +189,8 @@ [then]
fload ${BP}/ofw/core/countdwn.fth \ Startup countdown -fload ${BP}/forth/lib/pattern.fth \ Text string pattern matching +fload ${BP}/forth/lib/pattern.fth \ Text string pattern matching +fload ${BP}/forth/lib/tofile.fth \ to-file and append-to-file \ XXX remove the OS file commands from tools.dic fload ${BP}/ofw/core/filecmds.fth \ File commands: dir, del, ren, etc.
@@ -302,6 +316,34 @@ fload ${BP}/cpu/x86/pc/egauart.fth \ Output also to EGA
fload ${BP}/cpu/x86/pc/reset.fth \ reset-all + +[ifdef] olpc +\ true constant lx? \ +h# fff0.0000 constant rom-pa \ Physical address of boot ROM +fload ${BP}/dev/geode/acpi.fth \ Power management +fload ${BP}/dev/olpc/kb3700/ecspi.fth \ EC chip SPI FLASH access + +warning @ warning off +: stand-init-io stand-init-io h# fff0.0000 to flash-base ; +warning ! + +fload ${BP}/dev/olpc/kb3700/ecserial.fth \ Serial access to EC chip + +fload ${BP}/dev/olpc/kb3700/ecio.fth \ I/O space access to EC chip + +\ fload ${BP}/cpu/x86/pc/olpc/boardrev.fth \ Board revision decoding +fload ${BP}/cpu/x86/pc/olpc/mfgdata.fth \ Manufacturing data +fload ${BP}/cpu/x86/pc/olpc/mfgtree.fth \ Manufacturing data in device tree +fload ${BP}/dev/olpc/kb3700/battery.fth \ Battery status reports + +fload ${BP}/dev/olpc/spiflash/spiflash.fth \ SPI FLASH programming +fload ${BP}/dev/olpc/spiflash/spiui.fth \ User interface for SPI FLASH programming +fload ${BP}/dev/olpc/spiflash/recover.fth \ XO-to-XO SPI FLASH recovery +fload ${BP}/cpu/x86/pc/olpc/iflash.fth \ Insyde BIOS replacement tools +: ofw-fw-filename$ " u:\olpcofw.rom" ; +' ofw-fw-filename$ to fw-filename$ +[then] + \ LICENSE_BEGIN \ Copyright (c) 2006 FirmWorks \
Modified: cpu/x86/pc/biosload/fw.bth =================================================================== --- cpu/x86/pc/biosload/fw.bth 2009-01-16 09:06:43 UTC (rev 1073) +++ cpu/x86/pc/biosload/fw.bth 2009-01-23 19:26:25 UTC (rev 1074) @@ -49,6 +49,7 @@
\ XXX should be loaded by basefw.bth fload ${BP}/cpu/x86/initpgm.fth \ Basic boot handler +fload ${BP}/cpu/x86/msr.fth \ Access to machine specific registers
: (cpu-arch ( -- adr len ) " architecture" ['] root-node get-package-property drop @@ -61,7 +62,7 @@
dev / 1 encode-int " #address-cells" property - +1 encode-int " #size-cells" property " Generic PC" model " PC" encode-string " architecture" property
@@ -79,6 +80,7 @@ fload ${BP}/ofw/core/showlist.fth \ Linked list display tool fload ${BP}/ofw/core/allocph1.fth \ S Physical memory allocator fload ${BP}/ofw/core/availpm.fth \ Available memory list +fload ${BP}/ofw/core/allocmor.fth \ Secondary allocator
fload ${BP}/cpu/x86/pc/rootnode.fth \ Platform-specific root node changes
@@ -114,6 +116,7 @@ [then]
[ifdef] linux-support +\needs unix-seconds> fload ${BP}/ofw/fs/unixtime.fth \ Unix time calculation support-package: ext2-file-system fload ${BP}/ofw/fs/ext2fs/ext2fs.fth \ Linux file system end-support-package @@ -145,10 +148,10 @@ [ifdef] virtual-mode \ Depends on the assumption that physical memory is mapped 1:1 already : (elf-map-in) ( va size -- ) 0 mem-claim drop ; -' (elf-map-in) is elf-map-in [else] -' 2drop is elf-map-in +: (elf-map-in) ( va size -- ) 2drop ; [then] +' (elf-map-in) is elf-map-in [then]
\ Reboot and re-entry code @@ -166,7 +169,16 @@
[ifdef] virtual-mode fload ${BP}/cpu/x86/pc/mmusetup.fth \ Initial values for MMU lists +[ifdef] olpc +dev /mmu +: claim-rom ( -- ) + (initial-claim) + rom-pa h# ffff.0000 over - claim-virtual drop \ ROM 1-1 map +; +' claim-rom to initial-claim +dend [then] +[then]
fload ${BP}/cpu/x86/pc/biosload/devices.fth
@@ -265,6 +277,11 @@ " penguin.txt" find-drop-in if page type then ;
+[ifdef] olpc +fload ${BP}/cpu/x86/pc/olpc/usbpwr.fth +devalias net /wlan +[then] + : probe-all ( -- ) " probe-" do-drop-in ." probe-pci" cr @@ -273,9 +290,14 @@ [ifdef] probe-isa-modem probe-isa-modem [then] +[ifdef] olpc + power-cycle-usb probe-usb +[else] + probe-usb + report-net +[then] report-disk - report-net report-pci-fb ;
Modified: cpu/x86/pc/biosload/ofw.bth =================================================================== --- cpu/x86/pc/biosload/ofw.bth 2009-01-16 09:06:43 UTC (rev 1073) +++ cpu/x86/pc/biosload/ofw.bth 2009-01-23 19:26:25 UTC (rev 1074) @@ -96,6 +96,10 @@ " ${BP}/dev/usb2/device/net/build/usbnet.fc" " usbnet" $add-deflated-dropin " ${BP}/dev/usb2/device/serial/build/usbserial.fc" " usbserial" $add-deflated-dropin " ${BP}/dev/usb2/device/storage/build/usbstorage.fc" " usbstorage" $add-deflated-dropin +[ifdef] olpc + " ${BP}/dev/usb2/device/wlan/build/usb8388.fc" " usb1286,2001" $add-deflated-dropin + " ../../olpc/build/usb8388.bin" " usb8388.bin" $add-deflated-dropin +[then]
" builton.fth" " probe-" $add-dropin [ifndef] resident-packages