Flashing LinuxBIOS on A-Test Boards: Difference between revisions

From OLPC
Jump to navigation Jump to search
(reorganized page)
Line 2: Line 2:


'''YOU CAN BRICK YOUR MACHINE IF YOU FOLLOW ANY OF THESE STEPS!'''
'''YOU CAN BRICK YOUR MACHINE IF YOU FOLLOW ANY OF THESE STEPS!'''
'''DO NOT FOLLOW THESE STEPS UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING!'''


The instructions here are for the A test boards. You can place an PLCC EEPROM into the (only) socket on the A test board, flash it with LinuxBIOS, and on reboot boot from the EEPROM chip
The instructions here are for the A test boards. You can place an PLCC EEPROM into the (only) socket on the A test board, flash it with LinuxBIOS, and on reboot boot from the EEPROM chip containing your newly flashed LinuxBIOS. For now, this only covers flashing a PLCC chip.
containing your newly flashed LinuxBIOS. For now, this only covers flashing a PLCC chip.


== Hardware ==
== Hardware ==


These instructions are only for the revision "A" test boards. You can place a PLCC EEPROM into the (only) socket on the test board, flash it with LinuxBIOS, and reboot from the EEPROM chip containing your newly flashed LinuxBIOS.
Currently there isn't any sane way to flash the ROM to the serial flash on the OLPC board without running a huge risk of bricking it. The only way to try out
the ROM image right now is to write the image to a PLCC ROM chip and use that in the PLCC socket on the Rev A boards.

You will want to use 8Mbit ROM chips, like
[https://www.em.avnet.com/pns/home/0,5533,CID%253D0%2526CCD%253DUSA%2526SID%253D0%2526DID%253DDF2%2526LID%253D0%2526BID%253DDF2%2526CTP%253DPNS,00.html?ref=https://emwcs.avnet.com/webapp/wcs/stores/servlet/RemoteAdvancedSearchView?langId=-1&storeId=500201&catalogId=500201&manufacturerPartNum=SST49LF008A-33-4C-NH these].


For now, this only covers writing the image to this PLCC ROM chip and using it in that PLCC socket; there is no sane way to write to the serial flash (that which contains the normal BIOS) without a huge risk of bricking your device.


You will want to use [https://www.em.avnet.com/pns/home/0,5533,CID%253D0%2526CCD%253DUSA%2526SID%253D0%2526DID%253DDF2%2526LID%253D0%2526BID%253DDF2%2526CTP%253DPNS,00.html?ref=https://emwcs.avnet.com/webapp/wcs/stores/servlet/RemoteAdvancedSearchView?langId=-1&storeId=500201&catalogId=500201&manufacturerPartNum=SST49LF008A-33-4C-NH 8-Mbit EEPROM chips].


==Boot with normal BIOS and setup toolchain==
==Boot with normal BIOS and setup toolchain==

Revision as of 18:11, 11 August 2006

Warnings

YOU CAN BRICK YOUR MACHINE IF YOU FOLLOW ANY OF THESE STEPS! DO NOT FOLLOW THESE STEPS UNLESS YOU ARE SURE YOU KNOW WHAT YOU ARE DOING!

The instructions here are for the A test boards. You can place an PLCC EEPROM into the (only) socket on the A test board, flash it with LinuxBIOS, and on reboot boot from the EEPROM chip containing your newly flashed LinuxBIOS. For now, this only covers flashing a PLCC chip.

Hardware

These instructions are only for the revision "A" test boards. You can place a PLCC EEPROM into the (only) socket on the test board, flash it with LinuxBIOS, and reboot from the EEPROM chip containing your newly flashed LinuxBIOS.

For now, this only covers writing the image to this PLCC ROM chip and using it in that PLCC socket; there is no sane way to write to the serial flash (that which contains the normal BIOS) without a huge risk of bricking your device.

You will want to use 8-Mbit EEPROM chips.

Boot with normal BIOS and setup toolchain

Use your normal serial BIOS (currently, by Insyde Software) to boot into a Linux distribution. You'll need to build some software before you can flash your EEPROM chip with LinuxBIOS.

rdmsr

Build the rdmsr (read MSR) tool by Ron Minnich:

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
    unsigned char buf[8];
    int fd_msr, i;
    unsigned long addr = 0;

    if (argc < 2) {
        printf("usage:rdmsr reg\n");
        exit(1);
    }
    addr = strtoul(argv[1], NULL, 0);

    fd_msr = open("/dev/cpu/0/msr", O_RDONLY);
    lseek(fd_msr, addr, SEEK_SET);
    read(fd_msr, buf, 8);

    printf("MSR register 0x%lx => ", addr);
    for (i = 7; i > 0; i--)
        printf("%2.2x:", buf[i]);
    printf("%2.2x\n", buf[i]);

    return(0);
}

with:

% gcc rdmsr.c -o rdmsr

wrmsr

Build the wrmsr (write MSR) tool (also by Ron Minnich):

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[])
{
    unsigned char buf[8], *p;
    int fd_msr, i;
    unsigned long addr = 0;

    if (argc < 3) {
        printf("usage:wrmsr reg value\n");
        exit(1);
    }
    addr = strtoul(argv[1], NULL, 0);
    p = argv[2];

    printf("MSR register 0x%lx => ", addr);
    for (i = 7; i > 0; i--) {
        buf[i] = strtol(p, &p, 16);
        p++;
        printf("%2.2x:", buf[i]);
    }
    buf[i] = strtol(p, &p, 16);
    printf("%2.2x\n", buf[i]);

    fd_msr = open("/dev/cpu/0/msr", O_WRONLY);
    lseek(fd_msr, addr, SEEK_SET);
    if (write(fd_msr, buf, 8) < 0)
        perror("");

    return(0);
}

with:

% gcc wrmsr.c -o wrmsr

flashrom

Download the latest LinuxBIOS snapshot to get the flashrom utility. Unpack the archive, and go into the util/flashrom directory. After making sure you have your distribution's pciutils and pcituils-dev package installed, run make. This will build the flashrom utility; copy it into a convenient location (such as /usr/local/bin).

Using Flashrom

Enable writing to flash

On Linux, make sure you:

% modprobe msr

so you will have MSR device files. To enable PLCC writing on the OLPC board, you need to enable flash writing. Once you've built rdmsr and wrmsr, run:

./rdmsr 0x1808
./wrmsr 0x1808 22:ff:80:02:10:f7:bf:00
./rdmsr 0x1808

Using flashrom

Once you've got flashrom working, you can now flash your LinuxBIOS image. Check that flashrom can see your writable flash chip:

% flashrom -V

You should see a note about a writable part being detected. If so, you can now write to the part, with the LinuxBIOS image you've built previously:

% flashrom -w linuxbios.rom

Once it's written, verify that it has been written properly:

% flashrom -v linuxbios.rom

Boot with LinuxBIOS

You can now reboot. Make sure you shutdown properly (your disk/filesystems must be in a consistent state, and been unmounted properly). On reboot you'll be greeted by the OLPC LinuxBIOS splash screen, where you can select boot method. Choose USB to boot from a USB disk, hopefully using one of the build images.