Difference between revisions of "Leapster Explorer: USB Boot"

From eLinux.org
Jump to: navigation, search
(Programs Needed)
Line 1: Line 1:
This how-to will explain a bit about the USB booting process of the Leapfrog Explorer and provide a Linux shell script to download the file to the device.
+
== Summary ==
 +
The Leapster Explorer's Emerald-Boot contains a feature that allows for a recovery mode, called Surgeon. When put into this mode and connected to LFConnect, it will upload and install a new firmware to your device. The programs provided here, replace LFConnect and will allow you to send a kernel or firmware of your choosing.
  
 
== Programs Needed ==
 
== Programs Needed ==
 
sg3_utils - Provides the needed sg_raw and sg_verify for Linux
 
sg3_utils - Provides the needed sg_raw and sg_verify for Linux
  
[http://code.google.com/p/openlx-pager/ OpenLX Pager] for latest Linux or Windows versions
+
[http://code.google.com/p/openlx-pager/ OpenLX Pager] (Linux or Windows)
 
 
Terminal app to check progress
 
  
 
== Software Needed ==
 
== Software Needed ==
 +
surgeon.cbf (found in the LST3-0x00170028-000000 package)
 +
* Or you can [[Leapster_Explorer:_Testing_Kernels_via_USB_Boot| Modify a Kernel for USB Boot]]
  
 +
== Hardware ==
 +
[[LeapFrog_Pollux_Platform:_Console_Access| Console Access]]
  
surgeon.cbf (found in the LST3-0x00170028-000000 package) or one of your own making, see Issues And Information
 
  
SG3-utils needs to be installed
+
== On Explorer ==
 
 
== Hardware ==
 
  
DJHI or other means of gaining a UART Console (optional)
+
Connect the device to the host PC.
  
== On Explorer ==
+
Hold down Right and Left Shoulder buttons and ? Button.
  
To turn on USB Boot mode, with the USB connected hold down the Right and Left Shoulder buttons along with the ? mark button, while holding them down, turn the power on, you should end up seeing a screen showing the LX connected to a PC.
+
Turn the device on, you can let go of the buttons and you should see download screen.
  
 
== Under Linux ==
 
== Under Linux ==
Line 27: Line 27:
 
Download the Pager script and save it in a directory, make sure it is set to execute file permissions for your user. From a terminal run
 
Download the Pager script and save it in a directory, make sure it is set to execute file permissions for your user. From a terminal run
  
   $ sudo ./pager.sh <filename>
+
   $ sudo ./pager.sh surgeon.cbf
 
 
Where file name is the name of the firmware you want to download to the Explorer. In your terminal window you ran the script in, you should see something like this.
 
 
 
 
   1: Writing bytes:0 -> 16383 to /dev/sdc
 
   1: Writing bytes:0 -> 16383 to /dev/sdc
 
   SCSI Status: Good  
 
   SCSI Status: Good  
Line 48: Line 45:
 
Download the Pager app and extract it, cd to the directory you put it in, from the command prompt.
 
Download the Pager app and extract it, cd to the directory you put it in, from the command prompt.
  
   C:\>pager.exe -f <file name>
+
   C:\>pager.exe -f surgeon.cbf
  
Where file name is the file you wish to download to the Explorer. You should see some info on the screen about your Explorer along with the \PhysicalDrive it is. You'll see ''Sending Packet:'' then ''Finished!'' if all went well. If you get a complaint about Explorer not found, try replugging the USB cable, or if you have more than 10 drives hooked to your host, you'll need to compile your own or unplug a few drives, as it only searches the first 10 drives. Also, this has only been tested on XP SP3 Pro.
+
Where file name is the file you wish to download to the Explorer. You should see some info on the screen about your Explorer along with the \PhysicalDrive it is. You'll see ''Sending Packet:'' then ''Finished!'' if all went well. If you get a complaint about Explorer not found, try replugging the USB cable, or if you have more than 10 drives hooked to your host, you'll need to compile your own or unplug a few drives, as it only searches the first 10 drives.
  
''' Python script to run Pager and set up networking '''
+
''' Cellphone '''
  
This is a wrapper for Pager, that takes the the surgeon.cbf name as an argument, runs Pager with it, then gets the IP address of the Explorer, and creates a route entry for it. You'll need to set the network adapter to have a static IP address, then configure the script for it,its found near the top of the file. You can double click the file to run it, or run it from a command prompt, which will give you the host name of the Explorer, which will be Explorer-<SERIAL NUMBER>.local you can then use that host name in any applications that you use to hook up to the Explorer, like winSCP. This will allow the Explorer to change its address, with out having to configure a new batch script for route.exe or settings in your programs. After starting Explorer with usb hooked up, run the script. Either double click or
+
This is a wrapper for Pager, that takes the the surgeon.cbf name as an argument, runs Pager with it, then gets the IP address of the Explorer, and creates a route entry for it. You'll need to get devices' IP address, then configure the script for that particular IP check [[LeapFrog_Pollux_Platform:_Networking#On_Windows| Windows Networking]]  for more information. Then run:
 
   C:> cellphone.v0.1.py surgeon.cbf
 
   C:> cellphone.v0.1.py surgeon.cbf
  
[[File:Cellphone.v0.1.zip]]
 
  
 
== Using Surgeon ==
 
== Using Surgeon ==
Line 63: Line 59:
 
Mounting stock Explorer / and /LF/Bulk
 
Mounting stock Explorer / and /LF/Bulk
  
Once surgeon.cbf has been booted, you can use the serial console as normal.
+
Once surgeon.cbf has been booted, you can use the serial console as normal. This script mounts /patient-bulk and /patient-rfs which are the Explorers normal partitions.
 
   ./etc/init.d/recovery-mounts start
 
   ./etc/init.d/recovery-mounts start
you will find /patient-bulk and /patient-rfs in / which will contain their respective folders and files from the Explorer. You can then do what you need to do with them.
 
 
 
[http://www.elinux.org/Leapster_Explorer:_Testing_Kernels_via_USB_Boot Creating your own usb kernel]
 
  
In the source code, there is a script called make_cbf.py, this will create a cbf file out of your kernel image, it will also format the file with all the needed parameters to be used with usb boot, magic number and packet size.
+
== Notes ==
 
 
== Issues And Information ==
 
  
 
There are a few restrictions known at this moment.
 
There are a few restrictions known at this moment.
Line 80: Line 70:
 
- "cbf_validate_header: magic wrong: <hex number>" shows up in the UART Console when downloading.
 
- "cbf_validate_header: magic wrong: <hex number>" shows up in the UART Console when downloading.
  
The downloader on the Explorer does a few checks, CRC and the Magic Number, which is 0x9abcdef0. This must be the first 4 bytes of data the Explorer receives when downloading. So any file you send it, but have those 4 bytes in that order, first thing, if that is a problem, it should be possible to create a magic file, with just those four bytes, then modify the Pager script to work with it. The Explorer only checks for the magic number if the SCSI write(10) being sent to it, has the LBA address of 0x000000, which requires all subsequent writes to be addressed to a different LBA. In pager.sh you can see after the first packet, the LBA is switched to 0x01 for the rest of the transfer.
+
The downloader on the Explorer does a few checks, CRC and the Magic Number, which is 0x9abcdef0. This must be the first 4 bytes of data the Explorer receives when downloading. So any file you send it, but have those 4 bytes in that order, first thing. This can easily be accomplished using the scripts/make_cbf.py on your file.
 +
 
 +
The Explorer only checks for the magic number if the SCSI write(10) being sent to it, has the LBA address of 0x000000, which requires all subsequent writes to be addressed to a different LBA. In pager.sh you can see after the first packet, the LBA is switched to 0x01 for the rest of the transfer.
  
 
File Size:
 
File Size:
  
In the source code, there is reference to an 8mb limit, I can't verify why, but I would imagine it has something to do with the available space on the device itself, your mileage may very.
+
There is an 8mb size limit on the file you send.
  
 
CBF file format "Common Boot Format":
 
CBF file format "Common Boot Format":
  
Not much info on this, there is a build script in the sources in /scripts that looks to build the necessary image along with all the needed data.
 
  
 
FTP:
 
FTP:
  
With surgeon.cbf successfully downloaded Explorer out puts this ''Emerald Base DFTP: Initialize DFTP'' from what I can tell, at this stage in the Surgeon/Patient recovery process the Explorer is now looking to do some FTP transfers of the /Firmware-Base images. During this process LFConnect unpacks the necessary packages to C:\Documents And Settings\<USER>\Temp\Leapfrog and they get transfered over.
+
Once Surgeon has been loaded, executed, and finishes booting, it starts up a DFTP server. As best that can be told, this is a Distributed FTP protocol, that allows for push or pull type transfers. This is not standard FTP nor has any DFTP specific servers been found that are compatible.

Revision as of 02:59, 23 July 2011

Summary

The Leapster Explorer's Emerald-Boot contains a feature that allows for a recovery mode, called Surgeon. When put into this mode and connected to LFConnect, it will upload and install a new firmware to your device. The programs provided here, replace LFConnect and will allow you to send a kernel or firmware of your choosing.

Programs Needed

sg3_utils - Provides the needed sg_raw and sg_verify for Linux

OpenLX Pager (Linux or Windows)

Software Needed

surgeon.cbf (found in the LST3-0x00170028-000000 package)

Hardware

Console Access


On Explorer

Connect the device to the host PC.

Hold down Right and Left Shoulder buttons and ? Button.

Turn the device on, you can let go of the buttons and you should see download screen.

Under Linux

Download the Pager script and save it in a directory, make sure it is set to execute file permissions for your user. From a terminal run

 $ sudo ./pager.sh surgeon.cbf
 1: Writing bytes:0 -> 16383 to /dev/sdc
 SCSI Status: Good 
 2: Writing bytes:16384 -> 32767 to /dev/sdc
 SCSI Status: Good 
 ...
 ...
 430: Writing bytes:7045120 -> 7061503 to /dev/sdc
 SCSI Status: Good 
 431: Writing bytes:7061504 -> 7077887 to /dev/sdc
 Verifying /dev/sdc

and it will be done. You can check in your UART terminal, and you should see it uncompressing Linux. And you should notice, the Explorer USB Device has now changed from a Mass Storage Driver to a Network Device.

Under Windows

Download the Pager app and extract it, cd to the directory you put it in, from the command prompt.

 C:\>pager.exe -f surgeon.cbf

Where file name is the file you wish to download to the Explorer. You should see some info on the screen about your Explorer along with the \PhysicalDrive it is. You'll see Sending Packet: then Finished! if all went well. If you get a complaint about Explorer not found, try replugging the USB cable, or if you have more than 10 drives hooked to your host, you'll need to compile your own or unplug a few drives, as it only searches the first 10 drives.

Cellphone

This is a wrapper for Pager, that takes the the surgeon.cbf name as an argument, runs Pager with it, then gets the IP address of the Explorer, and creates a route entry for it. You'll need to get devices' IP address, then configure the script for that particular IP check Windows Networking for more information. Then run:

 C:> cellphone.v0.1.py surgeon.cbf


Using Surgeon

Mounting stock Explorer / and /LF/Bulk

Once surgeon.cbf has been booted, you can use the serial console as normal. This script mounts /patient-bulk and /patient-rfs which are the Explorers normal partitions.

 ./etc/init.d/recovery-mounts start

Notes

There are a few restrictions known at this moment.

Magic Number:

- "cbf_validate_header: magic wrong: <hex number>" shows up in the UART Console when downloading.

The downloader on the Explorer does a few checks, CRC and the Magic Number, which is 0x9abcdef0. This must be the first 4 bytes of data the Explorer receives when downloading. So any file you send it, but have those 4 bytes in that order, first thing. This can easily be accomplished using the scripts/make_cbf.py on your file.

The Explorer only checks for the magic number if the SCSI write(10) being sent to it, has the LBA address of 0x000000, which requires all subsequent writes to be addressed to a different LBA. In pager.sh you can see after the first packet, the LBA is switched to 0x01 for the rest of the transfer.

File Size:

There is an 8mb size limit on the file you send.

CBF file format "Common Boot Format":


FTP:

Once Surgeon has been loaded, executed, and finishes booting, it starts up a DFTP server. As best that can be told, this is a Distributed FTP protocol, that allows for push or pull type transfers. This is not standard FTP nor has any DFTP specific servers been found that are compatible.