Difference between revisions of "Leapster Explorer: Emerald Boot SD0 Autoboot"

From eLinux.org
Jump to: navigation, search
(Partition SD Card)
(Added Category)
 
(12 intermediate revisions by one other user not shown)
Line 3: Line 3:
  
 
== Prerequisites ==
 
== Prerequisites ==
[[Leapster_Explorer:_UART_Boot| UART Boot Emerald Boot]] (for testing, highly recommended)
+
[[Leapster_Explorer:_UART_Boot| UART Boot Emerald Boot]]
 +
* [[Leapster_Explorer:_Emerald_Boot#Version_2.0.2 | using UART/AutoSD0 Boot Patch V2.0.2]]
 +
** Either over UART or flashed to NOR
 +
[[LeapFrog_Pollux_Platform:_Kernel_Configuration| Kernel Configuration]]
  
 
== Software Needed ==
 
== Software Needed ==
  
[[LeapFrog_Pollux_Platform:_Source_Code#LeapPad_Explorer| LeapPad Explorer Sources ]] (LF-Linux-2503-20110602-1237.tar.gz)
+
[[Leapster_Explorer:_Emerald_Boot| Sources ]]  
 
+
* LeapPad Explorer Sources (LF-Linux-2503-20110602-1237.tar.gz)
EB2.0.2 SD/UART Patch
+
* UART/AutoSD0 Boot Patch V2.0.2
  
 
Linux host PC
 
Linux host PC
Line 15: Line 18:
 
* mke2fs
 
* mke2fs
  
kernel.cbf
+
kernel.cbf modded for SD0
 
+
HEALTH_AND_SAFETY.32.rle
+
  
 
rootfs/
 
rootfs/
Line 27: Line 28:
  
 
micro SD Card
 
micro SD Card
 +
 +
== Build SD0 Kernel ==
 +
==== Configure Kernel Settings ====
 +
The firmware sources have SD1 configured, but not SD0, we will need to switch that, and build MMC into the kernel instead of as a module. See the prerequisite kernel configuration for the basics. Here is the specifics. In linux-2.6 load the config file:
 +
make lf1000_ts_fb_defconfig
 +
 +
Run make menu config to change the MMC settings:
 +
make menuconfig
 +
 +
First change the MMC card support to built in (*) instead of module (M). Then hit return to change the other MMC settings. Change all M to * and add SD0 and remove SD1.
 +
Device Drivers --->
 +
  <[*]> MMC/SD/SDIO card support --->
 +
      <*> MMC block device driver
 +
      [*]  Use bounce buffer for simple hosts
 +
 +
      <*> MagicEyes SDIO host controller support
 +
      [*]  Enable SDIO controller 0
 +
      [ ]  Enable SDIO controller 1
 +
 +
Exit out, and save your changes. One more file to modify and its ready to build.
 +
 +
==== Modify mes_sdhc.c ====
 +
There is a check to see if you are building for LeapPad (madrid) and if not, it errors out. To prevent this in <sources>/linux-2.6/drivers/mmc/host/mes_sdhc.c starting around line 940 this function should be commented out.
 +
 +
if (!gpio_have_gpio_madrid()) {
 +
  dev_warn(&pdev->dev, "Not Madrid -- disabling MMC SD support\n");
 +
  return -ENODEV;
 +
}
 +
 +
That will enable the necessary SD/MMC settings now you can build your kernel.
 +
 +
Once done building the kernel run the <sources>/scripts/make_cbf.py script. It will create a kernel.cbf in the directory you ran it from, you can now use this in the next steps to put on your SD card.
  
 
== Set up SD Card ==
 
== Set up SD Card ==
Line 56: Line 89:
  
 
For Last sector, you'll need to determine the size for each, screens '' +1M '' for kernel '' +8M '' is good, and for the last, rootfs just leave it blank and accept the default by hitting '' return''. If you try and get bulk/ mounted, pick a reasonable value here like +150M, and then leave bulk/ to fill up the rest.
 
For Last sector, you'll need to determine the size for each, screens '' +1M '' for kernel '' +8M '' is good, and for the last, rootfs just leave it blank and accept the default by hitting '' return''. If you try and get bulk/ mounted, pick a reasonable value here like +150M, and then leave bulk/ to fill up the rest.
 +
 +
Repeat adding partitions until all 3 are completed.
  
 
Once all done, type '' w '' to write the settings.
 
Once all done, type '' w '' to write the settings.
  
Once the partitions are created, you will need to format the rootfs as ext3:
+
Once the partitions are created, you will need to unmount then format the rootfs as ext3:
  mkfs.ext3 -L "rootfs" /dev/sdf3
+
  umount /dev/sdf3
 +
sudo mkfs.ext3 -L "rootfs" /dev/sdf3
  
 
==== Write Data to SD Card ====
 
==== Write Data to SD Card ====
 
For the screens and kernel, you'll need to write the data directly, for the rootfs, you'll be able to mount the SD card and copy the files and directories that way. Again be sure to double check everything, as these commands could have disastrous effects if aimed at the wrong places. In this example we will be using /dev/sdf as the device.
 
For the screens and kernel, you'll need to write the data directly, for the rootfs, you'll be able to mount the SD card and copy the files and directories that way. Again be sure to double check everything, as these commands could have disastrous effects if aimed at the wrong places. In this example we will be using /dev/sdf as the device.
  
First to copy HEALTH_AND_SAFETY.32.rle to the screens partition:
+
First to copy <EB_UART/SD Patch>/packages/screens/HEALTH_AND_SAFETY.32.rle to the screens partition:
 
  dd if=HEALTH_AND_SAFETY.32.rle of=/dev/sdf1 bs=512
 
  dd if=HEALTH_AND_SAFETY.32.rle of=/dev/sdf1 bs=512
  
Line 73: Line 109:
 
You should now be able to remount the SD Card and rootfs will automount on your host PC.
 
You should now be able to remount the SD Card and rootfs will automount on your host PC.
  
You can now copy the contents of your rootfs to the rootfs partition on the SD card.
+
For your root file system you can copy it from the LeapFrog firmware package. And then [[File_Systems#Mounting_UBI_Image_on_PC_using_nandsim| mount the ubi image]]. You can then copy the files over:
 +
 
 +
sudo cp -R /erootfs/mount/point/* /media/rootfs
 +
 
 +
Your SD card should be all ready to boot.
 +
[[Category:Leapster Explorer]]

Latest revision as of 09:54, 27 October 2011

Summary

With the LeapPad Explorer SD replaced NAND as the storage medium of choice. The Emerald Boot and Madrid Boot (LeapPad) sources are basically parallel builds, you build both at the same time. With a little tweaking you can set up Emerald Boot to check the SD card in a cartridge on boot up, and if it contains a correctly formatted SD card, kernel, rootfs, etc it will boot off that, if not, it falls back to normal NAND booting. This is fairly similar to how the LeapPad works, except it checks SD1 instead. In theory this modification should work with the LeapPad also. As of this writing the LeapPad has not been released.

Prerequisites

UART Boot Emerald Boot

Kernel Configuration

Software Needed

Sources

  • LeapPad Explorer Sources (LF-Linux-2503-20110602-1237.tar.gz)
  • UART/AutoSD0 Boot Patch V2.0.2

Linux host PC

  • fdisk
  • mke2fs

kernel.cbf modded for SD0

rootfs/

Hardware Needed

Console Access

SD Card Cartridge

micro SD Card

Build SD0 Kernel

Configure Kernel Settings

The firmware sources have SD1 configured, but not SD0, we will need to switch that, and build MMC into the kernel instead of as a module. See the prerequisite kernel configuration for the basics. Here is the specifics. In linux-2.6 load the config file:

make lf1000_ts_fb_defconfig

Run make menu config to change the MMC settings:

make menuconfig

First change the MMC card support to built in (*) instead of module (M). Then hit return to change the other MMC settings. Change all M to * and add SD0 and remove SD1.

Device Drivers --->
  <[*]> MMC/SD/SDIO card support ---> 
      <*> MMC block device driver
      [*]   Use bounce buffer for simple hosts

      <*> MagicEyes SDIO host controller support
      [*]   Enable SDIO controller 0
      [ ]   Enable SDIO controller 1

Exit out, and save your changes. One more file to modify and its ready to build.

Modify mes_sdhc.c

There is a check to see if you are building for LeapPad (madrid) and if not, it errors out. To prevent this in <sources>/linux-2.6/drivers/mmc/host/mes_sdhc.c starting around line 940 this function should be commented out.

if (!gpio_have_gpio_madrid()) {
  dev_warn(&pdev->dev, "Not Madrid -- disabling MMC SD support\n");
  return -ENODEV;
}

That will enable the necessary SD/MMC settings now you can build your kernel.

Once done building the kernel run the <sources>/scripts/make_cbf.py script. It will create a kernel.cbf in the directory you ran it from, you can now use this in the next steps to put on your SD card.

Set up SD Card

Partition SD Card

The SD card requires some special kind of formatting. The file /emerald-boot/README.sd-card-boot explains the structure. It explains everything but the /Bulk partition, which is still mounted from NAND.

Plug in your SD card and reader, then run dmesg in a terminal. You should see an entry like /dev/sdf where f is a,b,c,d,etc where you're SD card was mounted.

Caution make sure you correctly identify your SD card device, and back up any needed information, this will erase all data and could unintentionally destroy needed data if done to the wrong device.

First we need to partition the disk, /dev/sdf is replaced with your device:

sudo fdisk /dev/sdf

This will bring up a prompt in fdisk, type m for help, and it will explain the options.

First type u this will change the units used.

Next create an empty partition table type o this will erase the partitions currently on the SD card.

There are 3 partitions that need to be created, screens, kernel, and rootfs. Each one is nearly the same, so repeat this 3 times, only the partition sizes and names change.

Add a partition by typing n

It will ask you extended or primary type p for primary.

For the number, 1 for screens, 2 for kernel, 3 for rootfs.

Next it will ask you for the First sector, just hit return to accept the default.

For Last sector, you'll need to determine the size for each, screens +1M for kernel +8M is good, and for the last, rootfs just leave it blank and accept the default by hitting return. If you try and get bulk/ mounted, pick a reasonable value here like +150M, and then leave bulk/ to fill up the rest.

Repeat adding partitions until all 3 are completed.

Once all done, type w to write the settings.

Once the partitions are created, you will need to unmount then format the rootfs as ext3:

umount /dev/sdf3
sudo mkfs.ext3 -L "rootfs" /dev/sdf3

Write Data to SD Card

For the screens and kernel, you'll need to write the data directly, for the rootfs, you'll be able to mount the SD card and copy the files and directories that way. Again be sure to double check everything, as these commands could have disastrous effects if aimed at the wrong places. In this example we will be using /dev/sdf as the device.

First to copy <EB_UART/SD Patch>/packages/screens/HEALTH_AND_SAFETY.32.rle to the screens partition:

dd if=HEALTH_AND_SAFETY.32.rle of=/dev/sdf1 bs=512

Then copy the kernel.cbf file to its partition:

dd if=kernel.cbf of=/dev/sdf2 bs=512

You should now be able to remount the SD Card and rootfs will automount on your host PC.

For your root file system you can copy it from the LeapFrog firmware package. And then mount the ubi image. You can then copy the files over:

sudo cp -R /erootfs/mount/point/* /media/rootfs

Your SD card should be all ready to boot.