[OLPC-devel] writing nand flash on OLPC

Ronald G Minnich rminnich at lanl.gov
Wed Jul 26 11:05:56 EDT 2006


John R. wrote:
> On 7/26/06, Mark J. Foster <mfoster at laptop.org> wrote:
> 
>> of the USB drives that we've tested.  Alternately, you might begin the
>> transition to LinuxBIOS...
> 
> 
> Is there a Wiki howto on using LinuxBIOS with OLPC? Last I had asked
> Ron Minnich it wasn't ready yet but maybe that has changed.

Yes, the Insyde has its issues. They are smart guys but ... USB is HARD 
to get right for all cases, esp. in a BIOS.

For you guys with rom sockets, I guess now is the time. BTW, I think the 
  wiki is "too deep" for me. I'd like a page on 'boot environment' if no 
one minds -- I can add it if you want. I wrote some stuff on linuxbios 
last week, and now I can't find it!

Here is a tutorial start, let's iterate on this until it's right.

Hardware you need for the socket. You need a 49lf008b 1 MBYTE FLASH 
part. You really should have 2. A FLASH part extractor, e.g. from radio 
shack.

Tools you'll need:
1. git
2. svn
3. quilt
4. python
5. pci-devel utils and libraries, e.g.
pciutils.i386                            2.1.99.test8-10 
installed
pciutils-devel.i386                      2.1.99.test8-10        installed
6. msr manipulation: rdmsr and wrmsr (attached)

Packages are:
1. buildrom from olpc
2. vsa binary image (attached here, shall we put it on the wiki?)
3. linuxbios

The rom image for the socketed part will consist of the vsa binary (at 
the base, or bottom, of flash), the buildrom kernel+initrd combo (in the 
middle), and linuxbios (at the top). Sizes are 64K for the vsa, 927K for
the payload (linux + initrd), and 32K for linuxbios. NOTE: when we move 
to the SPI, the linux + initrd will have to shrink to 863K! Keep this in 
mind. The keyboard controller BIOS is twice the size of LinuxBIOS. It 
really is a space hog.

You need to get the buildrom stuff first, of course, as you have to 
build payloads for linuxbios. So
git-clone git://dev.laptop.org/users/jcrouse/buildrom

This should "just work", so
cd buildrom
make

(wait a while ...)
cp deploy/olpc-payload.elf /tmp/olpcpayload.elf

OK, this is a payload for linuxbios. Now you need linuxbios itself.

svn co svn://openbios.org/repos/trunk/LinuxBIOSv2
  1004  cd LinuxBIOSv2/
  1005  ls
  1006  cd targets
  1007  ./buildtarget olpc/rev_a/Config.1M.lb
  1008  cd olpc/rev_a/rev_a_1M/
  1009  make

You now have, in olpc/rev_a/rev_a_1M/, a file like this:

-rw-rw-r--  1 rminnich rminnich 983040 Jul 26 08:45 linuxbios.rom

now you need to put this together with VSA:
cat  /home/rminnich/src/amd/GX2/olpc_vsa_softvga.bin.nrv.64k \
		linuxbios.rom > /tmp/flashimage

Now you have an image you can flash.

You need the LinuxBIOS flashrom utility:
[rminnich at q rev_a_1M]$ cd /tmp/LinuxBIOSv2/util/flashrom/
[rminnich at q flashrom]$ make

Checking for pciutils... found.
.
.
.
[rminnich at q flashrom]$ ls -l flashrom
-rwxrwxr-x  1 rminnich rminnich 510156 Jul 26 08:55 flashrom

You're going to need to enable flash writes ...

to enable flash writes, you need msr support in your kernel, and you 
need the rdmsr and wrmsr tools (attached, do we put these in buildrom too?)

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

(note: I'll probably be putting this support into flashrom ...)

Put the flash part in your OLPC and do this:
flashrom
You should see it say something about the type of flash part. I can't 
run this right now, but I'll add it from home tonight.

To burn the image:
flashrom -w flashimage

You're in. Reset and you should see graphics in 10 seconds or less. USB 
keyboards and memory work fine.

> On the general topic of Fedora kernel vs. bog standard kernels I think
> it is error prone and serves no purpose to build required components
> of OLPC as modules. I think it would make much more sense to switch to
> a kernel.org kernel configured with with most drivers included (not
> modules) plus any patches that are necessary or useful specifically
> for OLPC.

That's how I'm doing it. I don't see any point in modules for parts we 
know are there. The only hotplug on OLPC is the USB, and that's built 
into USB. A non-modular kernel, modulo the bug in the cs553x driver, is 
the way to go. Plus, the stream kernels still won't kexec for me -- 
there is some dependency in there on a BIOS that I have not figured out 
-- those are BIG kernels.

We'll try to fix the buildrom process to include pulling down linuxbios.

I have a variant on the buildrom tree, called buildusb, that is for 
building a kernel/initrd for the usb stick. If anyone wants it, let me 
know.

ron
-------------- next part --------------
A non-text attachment was scrubbed...
Name: olpc_vsa_softvga.bin.nrv.64k
Type: application/octet-stream
Size: 65536 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20060726/1fa1a682/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rdmsr.c
Type: text/x-csrc
Size: 557 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20060726/1fa1a682/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wrmsr.c
Type: text/x-csrc
Size: 681 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20060726/1fa1a682/attachment-0001.c>


More information about the Devel mailing list