Power Log Collector: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
m (Reverted edits by Rizwan1218 (Talk) to last revision by Quozl)
 
(15 intermediate revisions by 6 users not shown)
Line 1: Line 1:
<noinclude>[[Category:Battery & Power]]
This Power Log Collector boots an XO-1 or XO-1.5 and copies the power logs to itself before shutting the laptop down.
</noinclude>
The Power Log Collectors boot an XO and copy the power logs to itself before shutting the laptop down.


'''Note''': will not work on secured laptops without signing.
= Use =
* Download . and unpack onto a USB flash drive.
* Shut down the XO
* Insert the USB drive and turn on the XO
* The XO will collect the power logs, print a message saying has done so and then shut down.


There are two versions provided here. One uses Tiny Core Linux, and the other uses Open Firmware.
= Theory of Operation =
* Based on [[Tiny Core Linux]]
* An [[Custom_bootloader#A_single_bootloader_for_both_XO-1_and_XO-1.5|Open Firmware Boot Script]] selects the XO-1 or XO-1.5 kernel.
* The initial ramdisk mounts /dev/sda (which should be the first USB drive) and..
* executes rc.local on that drive
* rc.local does the collection


{| border="1" cellspacing="0" cellpadding="2" width="100%" class="wikitable"
= Modifying Tiny Core Linux =
! collector
This will unpack the initial ramdisk to the current directory.
! supported hardware
# gunzip <../initrd.gz | cpio -i
! minimum firmware
# Modify as needed
! time taken
# find | sudo cpio -o -H newc --quiet | gzip -2 > ../initrd.gz
|-
|[[#Tiny Core Linux|Tiny Core Linux based]]
| XO-1 XO-1.5
| none
| a couple of minutes
|-
|[[#Open Firmware|Open Firmware based]]
| XO-1 XO-1.5 XO-1.75
| [[OLPC_Firmware_q2f09|Q2F09]] [[OLPC_Firmware_q3c05|Q3C05]] [[OLPC_Firmware_q4d12|Q4D12]]
| less than a minute
|}


== Tiny Core Linux ==
Note: will not work on secured laptops without signing.
=== How to Use ===

* Download [[media:Power-log-collector.tar.bz2|Power-log-collector.tar.bz2]] and unpack onto a USB flash drive,
* [[Shutdown|Shut down]] the XO,
* Insert the USB drive, and
* Turn on the XO.

The XO will collect the power logs, print a message saying has done so and then shut down.

=== Theory of Operation ===
* Based on [[Tiny Core Linux]],
* An [[Custom_bootloader#A_single_bootloader_for_both_XO-1_and_XO-1.5|Open Firmware Boot Script]] selects the XO-1 or XO-1.5 kernel,
* The initial ramdisk mounts /dev/sda (which should be the first USB drive), and
* executes rc.local on that drive, which does the collection.

=== How it was Made ===

It was made by remastering Tiny Core Linux.

Unpack the initial ramdisk to the current directory:
# gunzip <../initrd.gz | cpio -i

Modify the files as needed, then repack the initial ramdisk:
# find | sudo cpio -o -H newc --quiet | gzip -2 > ../initrd.gz

Then assemble into a .tar.bz2 for download.

=== rc.local ===

The script that does the collection:

#!/bin/sh
uname -a | grep _xo1-
if [ $? -eq 0 ]
then
echo detected xo-1.0
XO_ROOT=mtdblock0
XO_FS=jffs2
else
echo detected xo-1.5
XO_ROOT=mmcblk0p2
XO_FS=ext3
fi
mkdir -p /mnt/$XO_ROOT
mount -t $XO_FS -o ro /dev/$XO_ROOT /mnt/$XO_ROOT
mkdir -p /mnt/sda1/power-logs
cp /mnt/$XO_ROOT/home/olpc/power-logs/* /mnt/sda1/power-logs
umount /mnt/$XO_ROOT
mount /dev/sda1 /mnt/sda1 -o remount,ro
sync
echo Power Logs Recovered
echo Shutting down in 10 seconds
echo You may remove the USB now
sleep 10
poweroff

== Open Firmware ==

A bootable filesystem for USB drive which will save the power logs from a set of OLPC laptops for later analysis, for use on XO-1.75, XO-1.5, and XO-1.

=== Preparing the drive ===

Select a USB drive with at least 128MB capacity, and preferably nothing important on it.

* download [http://dev.laptop.org/~quozl/save-power-logs-1.0.zip save-power-logs-1.0.zip],
* unpack onto a USB drive.

This will create a ''boot'' directory containing the program.

This works with either the common FAT filesystem or ext2.

* for FAT filesystems, please use dosfsck, scandisk, Disk Utility or other tools to ensure the filesystem is without errors,
* for ext2 filesystems, please use Open Firmware [[OLPC_Firmware_q4d12|Q4D12]] or later.

=== Using the drive ===

* ensure the laptop is off,
* insert the drive,
* press the power button,
* wait for the green screen,
* remove the drive,
* move to the next laptop.

The data will be placed in a ''pwr.tar'' file on the USB drive.

=== Theory of operation ===

The first time it is booted, the program creates a ''pwr.tar'' file on the USB drive containing the power logs.

The second and subsequent boots append new entries to the ''pwr.tar'' file.

Running the collector twice on a laptop is harmless, in that the duplicate entries added to the file supersede the previous entries.

Latest revision as of 20:31, 25 July 2013


The Power Log Collectors boot an XO and copy the power logs to itself before shutting the laptop down.

Note: will not work on secured laptops without signing.

There are two versions provided here. One uses Tiny Core Linux, and the other uses Open Firmware.

collector supported hardware minimum firmware time taken
Tiny Core Linux based XO-1 XO-1.5 none a couple of minutes
Open Firmware based XO-1 XO-1.5 XO-1.75 Q2F09 Q3C05 Q4D12 less than a minute

Tiny Core Linux

How to Use

The XO will collect the power logs, print a message saying has done so and then shut down.

Theory of Operation

  • Based on Tiny Core Linux,
  • An Open Firmware Boot Script selects the XO-1 or XO-1.5 kernel,
  • The initial ramdisk mounts /dev/sda (which should be the first USB drive), and
  • executes rc.local on that drive, which does the collection.

How it was Made

It was made by remastering Tiny Core Linux.

Unpack the initial ramdisk to the current directory:

# gunzip <../initrd.gz | cpio -i

Modify the files as needed, then repack the initial ramdisk:

# find | sudo cpio -o -H newc --quiet | gzip -2 > ../initrd.gz

Then assemble into a .tar.bz2 for download.

rc.local

The script that does the collection:

#!/bin/sh

uname -a | grep _xo1-
if [ $? -eq 0 ]
then
       echo detected xo-1.0
       XO_ROOT=mtdblock0
       XO_FS=jffs2
else
       echo detected xo-1.5
       XO_ROOT=mmcblk0p2
       XO_FS=ext3
fi

mkdir -p /mnt/$XO_ROOT

mount -t $XO_FS -o ro /dev/$XO_ROOT /mnt/$XO_ROOT
mkdir -p /mnt/sda1/power-logs
cp /mnt/$XO_ROOT/home/olpc/power-logs/* /mnt/sda1/power-logs
umount /mnt/$XO_ROOT
mount /dev/sda1 /mnt/sda1 -o remount,ro
sync
echo Power Logs Recovered
echo Shutting down in 10 seconds
echo You may remove the USB now
sleep 10
poweroff

Open Firmware

A bootable filesystem for USB drive which will save the power logs from a set of OLPC laptops for later analysis, for use on XO-1.75, XO-1.5, and XO-1.

Preparing the drive

Select a USB drive with at least 128MB capacity, and preferably nothing important on it.

This will create a boot directory containing the program.

This works with either the common FAT filesystem or ext2.

  • for FAT filesystems, please use dosfsck, scandisk, Disk Utility or other tools to ensure the filesystem is without errors,
  • for ext2 filesystems, please use Open Firmware Q4D12 or later.

Using the drive

  • ensure the laptop is off,
  • insert the drive,
  • press the power button,
  • wait for the green screen,
  • remove the drive,
  • move to the next laptop.

The data will be placed in a pwr.tar file on the USB drive.

Theory of operation

The first time it is booted, the program creates a pwr.tar file on the USB drive containing the power logs.

The second and subsequent boots append new entries to the pwr.tar file.

Running the collector twice on a laptop is harmless, in that the duplicate entries added to the file supersede the previous entries.