Leapster Explorer: USB Boot settings

This is a short tutorial to explain how to setup the explorer so that you can use the USB Boot method to test a kernel running a 'stock' bootup rcS script. This shouldn't damage your explorer but should you mess up your OS you won't be able to automatically start the recovery process. as long as you have console access you should be able to manually start the recovery process. You have been warned.

Usually when you boot the leapfrog explorer in USB Boot mode you are setting off a chain of actions that are supposed to lead to updating a new kernel and rootfs or recovering a broken OS, whatever the boot method, the explorer runs /etc/init.d/rcS and reads the boot image type on line 32 of /etc/init.d/rcS :

if [ `cat /sys/devices/platform/lf1000-gpio/boot_image` = "RECOVERY" ]; then # Recovery boot echo "Recovery Mode" # Launch in background; it will "poweroff" when done /usr/bin/recovery & exit 0 elif

the elif copes with the different types of boot mode that could be expected, this is fine if you want to update or fix your explorer but if you want to use USB Boot to test a kernel with the normal file system and boot settings then then you're out of luck. This is where this tutorial comes in. for the time being I have created a quick and dirty hack to overcome this issue.

in rcS edit lines 32 and 38 and make them look like this:

if [ `cat /sys/devices/platform/lf1000-gpio/boot_image` = "RECOVERY" ] && [ !-e /flags/usbdev ]; then elif [ `cat /sys/devices/platform/lf1000-gpio/request` = "TRAPDOOR" ] && [ !-e /flags/usbdev ]; then

on the explorer when you want to boot 'normally' from USB boot run the following command:

touch /flags/usbdev

and to reverse the process to allow an automatic recovery:

rm /flags/usbdev

notes

whilst this method works and allows you to test a custom kernel booting it from usb using the 'normal' boot options as if you were booting the kernel from the explorer normally, its probably not the absolute best way to do things. At the moment if you have usbdev set if something goes wrong with the OS it won't kick start recovery mode, however, as long as you've got serial access then you will be able to start dftpdevice manually and start the recovery process via pager.sh or LFConnect or simply remove /flags/usbdev and reboot. Using USB Boot will also set you into a loop where after a reboot it will try and do another usb boot, this can be desirable if you are testing kernels/software but if you want it to stop simply power off the unit by holding down the power button.

Files to note: /etc/init.d/rcS /usr/bin/recovery /usr/bin/trapdoor /usr/bin/short-circuit

the latter 3 being scripts called via rcS depending on what type of boot the system expects to perform.

I believe there is a better method using the leapfrogs internal flagging system, using the /sys/devices/platform/lf1000-gpio/ subsystem:

request

boot_image

boot_source

power

but this will require further investigation as some of this will be tied to emerald boot and messing with that could be dangerous.