User talk:Wmb@firmworks.com
recurse, yum
Hi! In lesson 4, I might have only used the definition of factorial that used the word 'recurse', and just skipped 'recursive'. 'recurse' is ever so much nicer, don't you think?
<Mitch> I don't have a strong opinion about recurse vs. recursive. Both get the job done.
Thanks for the awesome intro to forth!
<Mitch> You're welcome, glad you like it.
Questions on building Forth firmware
How do I build the firmware? I want to add some new words and some games.
westfield@potter-pod.com
Mike Westfield
Answer:
svn co svn://openbios.org/openfirmware cd openfirmware/cpu/x86/pc/olpc/build make
The whole process takes less than a minute if you have a reasonably fast Internet connection.
You can put new "fload" commands in openfirmware/cpu/x86/pc/olpc/fw.bth to include the files defining your new features.
Thanks.
What I am trying to do is automatically, during a boot, over-clock my XO. What file can I modify to execute my new word or words?
Answer:
- If you want to build a new firmware image, you can cause it to execute your new words automatically by calling them inside the definition "startup", which is defined in the file "openfirmware/cpu/x86/pc/olpc/fw.bth
- Alternatively, you can do it without building new firmware simply by putting your new definitions inside the file "/boot/olpc.fth" on the boot device (which is typically the NAND FLASH, but might also be a USB key or SD card). On a system with security turned off, OFW boots by interpreting Forth source code from that file. That file normally contains code to look for updates, then sets up the cmdline and ramdisk and re-executes the "boot" command to load the kernel. You can add any additional code that you want to it. On a USB key or SD card, the "/boot/" directory is just "/boot/", but on NAND FLASH, "/boot" is a symlink to "/versions/boot/current/boot", and there is some additional trickery at the OS level to switch versions, so you may need to dig around to find the actual location of /boot/olpc.fth under Linux.
How do I get this new build into my XO?
Answer:
Put the new image on a USB key (for example in a file named "new.rom") and type:
ok flash u:\new.rom
Thanks for all of the help. I modified the /boot/olpc.fth file and I now run at 564.942 MHz. per "cat /proc/cpuinfo" and I have been running memtest at that speed for several hours with no error. Memtest reports a memory speed of 512 Mbs.
fastboot
Ivan Krstić wrote: (on the VPRI FONC mailing list)
There was an experimental 'fastboot' branch of Open Firmware that allowed an XO to (cold)boot a full image from a separate partition in about 3 seconds from power-on to Linux console. Various practicalities kept it from being used.
Is that branch still available somewhere? Is that work considered "active", "dormant", or "dead" (i.e. OLPC does not intend to pick it up again)?
- Felix Rabe
It was 3-ish seconds from power on to Linux kernel in memory and running. From that point, Linux startup takes however long it takes.
The released Open Firmware (Q2D07 and later) supports partitioning (and hence fast boot). The current origin/stable branch of the OLPC kernel also has partition support enabled in the CaFe NAND driver.
The missing pieces are the initrd and the build procedures for creating the partitioned NAND image. The current initrd startup procedure does a lot of filesystem fiddling to support olpc-update, and that (Python) code doesn't account for the possibility that the boot images might be in a separate partition from the rest of the root filesystem. In principle, the changes should be straightforward, but they aren't there yet.
The OFW "secure filesystem update" code, in which you can copy a NAND image from a USB key to the NAND FLASH, supports partitioning - see http://wiki.laptop.org/go/OFW_NAND_FLASH_Updater
So the mechanism for putting a suitably-partitioned image onto NAND exists. What is missing is for someone to put all the pieces together.