Custom bootloader: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
Line 6: Line 6:
==Boot location==
==Boot location==


You need 3 things to boot, a boot-file a boot-device and a ramdisk. You can hose these on a USB, a SD or on the internal nand. You may even have the olpc.fth boot file in any of these places (in /boot/) and the first location it finds is the one it is going to use. The order for searching is USB -> SD -> nand so it is possible to make a bootable USB stick, and it will boot that when present, but it will boot the normal nand when it is removed. this is helpful for trying out unstable distro's as it doens't alter the internal memory at all.

The locations of these items with either be:
* sd:\ - SD card
* disk:\ - USB disk
* nand:\ - internal nand

===Boot-file===
The inputs needed for the boot file are:
*ro - assuming this means read only
*root - location of the root filesystem
*rootdelay - optional adds in a delay before booting
*console - sets up the console displaay
*fbcon - sets up some fonts

The rootfile is the main editable place it points to the root filesystem partition Usually
* /dev/mmcblk0p1 - SD card
* /dev/sda1 - USB stick
* mtd0 -internal nand

===Boot-device===
This is the location of the kernal that you wish to boot this line usually works to:
locator\boot\vmlinuz
for example to boot from SD
sd:\boot\vmlinuz
===Ramdisk===
This is the initial ramdisk used for booting. Usually:
locator\boot\olpcrd.img
example to boot from SD
sd:\boot|olpcrd.img

===Sample menued bootloader to allow for selection of boot location===
\
\
\ Uber bootscript for OLPC Place in /boot as olpc.fth
\ Uber bootscript for OLPC Place in /boot as olpc.fth

Revision as of 11:06, 28 April 2008

This is the boot script for the olpc. It is normally ofund on the nand, in /boot.

Open firmware first searches for this file on a usb stick, then on a sd card, and finally on the nand. Below are found a commonly used script to allow for booting from a variety of locations.

Boot location

You need 3 things to boot, a boot-file a boot-device and a ramdisk. You can hose these on a USB, a SD or on the internal nand. You may even have the olpc.fth boot file in any of these places (in /boot/) and the first location it finds is the one it is going to use. The order for searching is USB -> SD -> nand so it is possible to make a bootable USB stick, and it will boot that when present, but it will boot the normal nand when it is removed. this is helpful for trying out unstable distro's as it doens't alter the internal memory at all.

The locations of these items with either be:

  • sd:\ - SD card
  • disk:\ - USB disk
  • nand:\ - internal nand

Boot-file

The inputs needed for the boot file are:

  • ro - assuming this means read only
  • root - location of the root filesystem
  • rootdelay - optional adds in a delay before booting
  • console - sets up the console displaay
  • fbcon - sets up some fonts

The rootfile is the main editable place it points to the root filesystem partition Usually

  • /dev/mmcblk0p1 - SD card
  • /dev/sda1 - USB stick
  • mtd0 -internal nand

Boot-device

This is the location of the kernal that you wish to boot this line usually works to:

locator\boot\vmlinuz

for example to boot from SD

sd:\boot\vmlinuz

Ramdisk

This is the initial ramdisk used for booting. Usually:

locator\boot\olpcrd.img

example to boot from SD

sd:\boot|olpcrd.img

Sample menued bootloader to allow for selection of boot location

\ 
\ Uber bootscript for OLPC  Place in /boot as olpc.fth
\
cr
." 1 to boot from SD" cr
." 2 to boot from USB" cr
." 3 to boot from internal nand" cr
." 4 to boot alternate image from Nand" cr
cr
key dup drop dup dup
31 = if 
\ SD boot info
  " ro root=/dev/mmcblk0p1 rootdelay=1 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
  " sd:\boot\vmlinuz" to boot-device
  " sd:\boot\olpcrd.img" to ramdisk
else 32 = if 
\ USB boot info
  " ro root=/dev/sda1 rootdelay=1 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
  " disk:\boot\vmlinuz" to boot-device
  " disk:\boot\olpcrd.img" to ramdisk
else 34 = if 
\ Alternate boot image info
   " ro root=mtd0 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
   " nand:\boot-alt\vmlinuz" to boot-device
   " nand:\boot-alt\olpcrd.img" to ramdisk
else 
\ Default into boot as sugar
   " ro root=mtd0 console=ttyS0,115200 console=tty0 fbcon=font:SUN12x22" to boot-file
   " nand:\boot\vmlinuz" to boot-device
   " nand:\boot\olpcrd.img" to ramdisk
then
then
then 
unfreeze
boot
\ end of script

overclock

You can also overclock your OLPC with the olpc.fth file. In order to accomplish this you need to set your timings before it loads the operating system. You must add some numbers to the forth stack and when write these registers using wmrsr. Shown below is a specific overclock frequency and that can be changed by altering the middle number to what you find below in the overclock table.

7de009e
5dd
4c000014
wrmsr

You then add in any specific booting information you want (see above).

XO-1 Overclock Settings
in MHz; default is 433/166 (4d9)
CPU Bus Speed
133 166 200 216 233
333 3d3 4d3 5d3 653 6d3
366 3d5 4d5 5d5 655 6d5
400 3d7 4d7 5d7 657 6d7
433 3d9 4d9 5d9 659 6d9
466 3db 4db 5db 65b 6db
500 3dd 4dd 5dd 65d 6dd
533 3df 4df 5df 65f 6df
566 3e1 4e1 5e1 661 6e1