Warning, flashing your didj or the cart could brick it, you have been warned

+

This tutorial explains how to create a usable NAND if you have a modified [[LeapFrog_Pollux_Platform:_Cartridge| LeapFrog Cartridge or Homebrew]], this is by no means complete but should get you well on your way to creating your own recovery cartridge. It will also show you the beginnings of being able to create your own partition structure for the NAND devices, which in turn should eventually lead us to being able to run a full kernel and rootfs without having to do too much to the codebase.

−

If you have a modified game cart with the otp chip replaced with a rw nand chip or a NHE cart then this tutorial is for you, this is by no means complete but should get you well on your way to creating your own recovery cartridge. It will also show you the beginnings of being able to create our own partition structure for the nand devices, which in turn should eventually lead us to being able to run a full lx kernel and rootfs without having to do too much to the codebase.

+

== Prerequisites ==

+

[[Didj_USB_Mounting| Mount Didj USB Partition on Host]]

−

'''PREREQUISITES'''

+

[[LeapFrog_Pollux_Platform:_Extract_Archives| Extract lfp Files]]

+

== Software Needed ==

+

[[LeapFrog_Pollux_Platform:_Source_Code#Didj 2009 Didj Sources]]

−

Some form of writable nand cartridge

+

[[LeapFrog_Pollux_Platform:_Extract_Archives| Extract Archives]]

−

Didj-Linux-4222-20090422-1236 sources

+

−

ftdi cable

+

−

bootstrap-LF_LF1000-0.33.5.3186_ATAP.lfp

+

−

firmware-LF_LF1000-0.33.5.3186-ATAP.lfp

+

−

.lfp files are in /Didj-Linux-4222-20090422-1236/packages/mfg-cart/Base2ATAP/Atap_FW

we need to get a custom firmware onto the Didj so that it can 'see' the extra mtd partitions on the cart, fortunately for us, leapfrog provided those in the form of the bootstrap/firmware ATAP.lfp files in /Didj-Linux-4222-20090422-1236/packages/mfg-cart/Base2ATAP/Atap_FW :)

+

Read/Write NAND Cartridge

+

== Preparing the Didj ==

−

mount the /Didj partition on your ubuntu system:

+

We need to get a custom firmware onto the Didj so that it can 'see' the extra mtd partitions on the cart, fortunately for us, LeapFrog provided those in the form of the bootstrap/firmware ATAP.lfp files in /Didj-Linux-4222-20090422-1236/packages/mfg-cart/Base2ATAP/Atap_FW

−

dmesg|tail

+

−

sudo ./scsi_custom -c unlock /dev/sg<sg number returned from dmesg, usually sg2>

+

−

if you don't want to do the scsi_custom command you can do the following:

+

Mount the Didj Partition on the host PC

−

echo "UNLOCKED" > /flags/usb_mass_storage

+

Extract each of the ATAP lfp files into /Base/

−

bear in mind that this will leave your didj in a permanent state of readiness, as soon as you plug your didj cable in it should automount, although it doesn't auto-remount when you reboot, simply unplug/replug the cable and your devices will show up in ubuntu.

doing a cat /proc/mtd shows us that the mappings are not direct 1:1, our Brio/Didj partition gets moved all the way to mtd18 for some reason, not sure why it does this but I think it creates an ubi volume it then creates an extra mtd partition and mounts either the ubi volume to it or the new mtd partition to the ubi volume. It does more of the same to the cart once its formatted correctly. More on this later

+

Doing a cat /proc/mtd shows us that the mappings are not direct 1:1, our Brio/Didj partition gets moved all the way to mtd18 for some reason, not sure why it does this but I think it creates an ubi volume it then creates an extra mtd partition and mounts either the ubi volume to it or the new mtd partition to the ubi volume. It does more of the same to the cart once its formatted correctly. More on this later.

# cat /proc/mtd

# cat /proc/mtd

Line 106:

Line 101:

mtd18: 0d812000 0001f800 "ubi_Brio"

mtd18: 0d812000 0001f800 "ubi_Brio"

−

+

== Preparing the MTD Partitions ==

−

'''Preparing the mtd partitions for mkbase.sh'''

+

−

+

−

+

mkbase.sh will flash the nhe cart with the same nand layout as the didj nand, at this moment in time the partitions don't exist, so it will fail, the flash_eraseall functions don't seem to work correctly so we do it ourselves.

mkbase.sh will flash the nhe cart with the same nand layout as the didj nand, at this moment in time the partitions don't exist, so it will fail, the flash_eraseall functions don't seem to work correctly so we do it ourselves.

Line 118:

Line 110:

mtd17: 10000000 00020000 "prg_EXT"

mtd17: 10000000 00020000 "prg_EXT"

−

I'll show you the first one (prg_Linux_RFS0) as an example, to do this we use mtd_debug on the didj to get mtd.size:

+

I'll show you the first one (prg_Linux_RFS0) as an example, to do this we use mtd_debug on the Didj to get mtd.size:

−

+

# mtd_debug info /dev/mtd13

# mtd_debug info /dev/mtd13

mtd.type = MTD_NANDFLASH

mtd.type = MTD_NANDFLASH

Line 129:

Line 120:

regions = 0

regions = 0

−

then on your ubuntu machine convert the mtd.size to something we can use in mtd_debug:

+

Convert the mtd.size to something we can use in mtd_debug:

−

+

'' On Host ''

−

# echo 'obase=16; 14680064' | bc

+

# echo 'obase=16; 14680064' | bc E00000

−

E00000

+

−

then on the didj do:

+

'' On Didj ''

−

+

mtd_debug erase /dev/mtd13 0 0x00E00000

mtd_debug erase /dev/mtd13 0 0x00E00000

−

repeat this whole process for mtd15,16 and 17, then reboot the didj, you will see it complain that it couldn't find something on prg_EXT, and it will format it for you (it might do the same to mtdblock16) if not then do:

+

Repeat this whole process for mtd15,16 and 17, then reboot the didj, you will see it complain that it couldn't find something on prg_EXT, and it will format it for you (it might do the same to mtdblock16) if not then do:

−

+

mkfs.vfat -n Didj -S 512 /dev/mtdblock16

mkfs.vfat -n Didj -S 512 /dev/mtdblock16

−

'''Run the mkbase.sh script'''

+

== Flash the NAND ==

−

+

At this point you should be ready for mkbase.sh to run to completion. give it a try, from the didj do:

−

at this point you should be ready for mkbase.sh to run to completion. give it a try, from the didj do:

+

+

'' On Didj ''

# mkbase.sh

# mkbase.sh

Mounting /dev/mtdblock18 on /Didj as rw

Mounting /dev/mtdblock18 on /Didj as rw

Line 184:

Line 172:

As you can see, there are a couple of issues, No Startup scripts and No files found to preload proably mean there are some more bits we need to to fill in to make this a completely working atap cartridge.

As you can see, there are a couple of issues, No Startup scripts and No files found to preload proably mean there are some more bits we need to to fill in to make this a completely working atap cartridge.

−

you should now do a reboot, check whether the cart prg_EXT partition has been mounted on the didj:

+

You should now do a reboot, check whether the cart prg_EXT partition has been mounted on the didj:

our prg_EXT partition was on mtd17, its now been mounted as an ubi volume to mtdblock19 you can find it in /opt/prg_mfg, this is similar behavour to the Brio:/Didj partition, it starts on mtd7, without a cart its put onto mtdblock9 as an ubi volume, with a cart /Didj ends up on mtdblock18!!

+

Our prg_EXT partition was on mtd17, its now been mounted as an ubi volume to mtdblock19 you can find it in /opt/prg_mfg, this is similar behavour to the Brio:/Didj partition, it starts on mtd7, without a cart its put onto mtdblock9 as an ubi volume, with a cart /Didj ends up on mtdblock18.

−

+

−

do a reboot, then plug your usb cable in and mount the partitions in ubuntu(unecessary if you did the 'echo UNLOCKED > /flags/usb_mass_storage' command earlier on':

+

−

+

−

dmesg|tail

+

−

sudo ./scsi_custom -c unlock /dev/sg3

+

+

Reboot, then plug your usb cable in and mount the partitions.

−

You'll notice that we get sdb and sdc which translated to sg2 and sg3, you should now see both the Brio:/Didj partition and the prg_EXT:/opt/prg_mfg partitions, /Didj will be 'DIDJ' and /opt/prg_mfg will be 'MFG_PAYLOAD'

+

You should now see both the Brio:/Didj partition and the prg_EXT:/opt/prg_mfg partitions, /Didj will be 'DIDJ' and /opt/prg_mfg will be 'MFG_PAYLOAD'

−

I think we need to look at all of the /scripts files to glean more information about how to truly make an atap cart, I think make_release.sh shows us how to package some files for the mfg-cart ATAP stuff so they can be installed on the didj, I think we can probably make up the rest of the files needed from mfg-cart and leapfrog lfp files

+

I think we need to look at all of the /scripts files to glean more information about how to truly make an ATAP cart, I think make_release.sh shows us how to package some files for the mfg-cart ATAP stuff so they can be installed on the Didj, I think we can probably make up the rest of the files needed from mfg-cart and leapfrog lfp files.

−

What next and what have we found out?

+

== Notes ==

+

Whats next?

It would obviously be nice to make the prg_Brio partition show up automatically, I'd like to work out how we can get it to show up as an ubi volume, not entirely sure what the mechanism is there yet.

It would obviously be nice to make the prg_Brio partition show up automatically, I'd like to work out how we can get it to show up as an ubi volume, not entirely sure what the mechanism is there yet.

Line 225:

Line 211:

We should probably look at a lot more of the scripts that are dotted all over the sources, the emeraldmfgtest folder found on an original lx firmware gives us some hints, as does make_release.sh, mkbase.sh mkSuperATAP.sh and many others.

We should probably look at a lot more of the scripts that are dotted all over the sources, the emeraldmfgtest folder found on an original lx firmware gives us some hints, as does make_release.sh, mkbase.sh mkSuperATAP.sh and many others.

+

[[Category:Didj]]

+

[[Category:LeapFrog_Pollux_Platform]]

Latest revision as of 23:43, 22 July 2011

Contents

Summary

This tutorial explains how to create a usable NAND if you have a modified LeapFrog Cartridge or Homebrew, this is by no means complete but should get you well on your way to creating your own recovery cartridge. It will also show you the beginnings of being able to create your own partition structure for the NAND devices, which in turn should eventually lead us to being able to run a full kernel and rootfs without having to do too much to the codebase.

Hardware Needed

Preparing the Didj

We need to get a custom firmware onto the Didj so that it can 'see' the extra mtd partitions on the cart, fortunately for us, LeapFrog provided those in the form of the bootstrap/firmware ATAP.lfp files in /Didj-Linux-4222-20090422-1236/packages/mfg-cart/Base2ATAP/Atap_FW

Mount the Didj Partition on the host PC

Extract each of the ATAP lfp files into /Base/

You'll end up with 2 extra folders in /Base:

/Didj/Base/bootstrap-LF_LF1000/
/Didj/Base/firmware-LF_LF1000/

The bootstrap directory contains a Lightning-Boot and firmware contains the kernel and rootfs files.

Make sure you are booted from RFS0 (we'll keep this as the original for now) and make sure the Didj knows that you've got a mfcart in the unit, once done reboot:

echo RFS0 > /flags/rootfs
touch /flags/mfcart
reboot

Flashing the Didj with the ATAP files will load a bootloader kernel1 and RFS1 to your didj's nand.

I'm not certain that you need to update the bootloader but for the sake of completeness I did, on the Didj do the following to update the bootloader and firmware:

blupdate
fwupdate

Reboot and you should now be in the ATAP firmware on RFS1, you should see an extra 9 mtd partitions being created.

Doing a cat /proc/mtd shows us that the mappings are not direct 1:1, our Brio/Didj partition gets moved all the way to mtd18 for some reason, not sure why it does this but I think it creates an ubi volume it then creates an extra mtd partition and mounts either the ubi volume to it or the new mtd partition to the ubi volume. It does more of the same to the cart once its formatted correctly. More on this later.

Preparing the MTD Partitions

mkbase.sh will flash the nhe cart with the same nand layout as the didj nand, at this moment in time the partitions don't exist, so it will fail, the flash_eraseall functions don't seem to work correctly so we do it ourselves.

Repeat this whole process for mtd15,16 and 17, then reboot the didj, you will see it complain that it couldn't find something on prg_EXT, and it will format it for you (it might do the same to mtdblock16) if not then do:

mkfs.vfat -n Didj -S 512 /dev/mtdblock16

Flash the NAND

At this point you should be ready for mkbase.sh to run to completion. give it a try, from the didj do:

As you can see, there are a couple of issues, No Startup scripts and No files found to preload proably mean there are some more bits we need to to fill in to make this a completely working atap cartridge.

You should now do a reboot, check whether the cart prg_EXT partition has been mounted on the didj:

Our prg_EXT partition was on mtd17, its now been mounted as an ubi volume to mtdblock19 you can find it in /opt/prg_mfg, this is similar behavour to the Brio:/Didj partition, it starts on mtd7, without a cart its put onto mtdblock9 as an ubi volume, with a cart /Didj ends up on mtdblock18.

Reboot, then plug your usb cable in and mount the partitions.

You should now see both the Brio:/Didj partition and the prg_EXT:/opt/prg_mfg partitions, /Didj will be 'DIDJ' and /opt/prg_mfg will be 'MFG_PAYLOAD'

I think we need to look at all of the /scripts files to glean more information about how to truly make an ATAP cart, I think make_release.sh shows us how to package some files for the mfg-cart ATAP stuff so they can be installed on the Didj, I think we can probably make up the rest of the files needed from mfg-cart and leapfrog lfp files.

Notes

Whats next?

It would obviously be nice to make the prg_Brio partition show up automatically, I'd like to work out how we can get it to show up as an ubi volume, not entirely sure what the mechanism is there yet.

We should be able to boot from the cart, not sure how that works yet either, but something along the lines of:

echo RFS2 > /flags/rootfs

should be enough, it will be in the sources, just need to track it down (lightning boot uses RFS0, RFS1, NFS0, NFS1 currently, will probably need extra flags)

I'd like to make a full cart, there are some bits missing, which I think are in the mfg-cart folders or at least the info.

I think we've learnt how to format a nhe cart, with the same partition structure as a didj nand unit, so we now know how to roughly deal with rebuilding a didj, so by extension we are not that far removed from being able to rebuild an LX partartition structure on a didj.

If you do cat /proc/cmdline you will notice that it builds the mtd partition structure for the cart in there, I think we should be able to use the same technique to make a custom SD booting kernel that can see a cart, this way we probably wouldn't need to flash the didj at all with the atap firmware. we can use root=31:04 technique to boot from the NHE, for instance from 31:12 :) once we know that we can boot from a cart we should be able to leverage an lx kernel with sufficient mtd2/ubi utils (will need to make ubiformat etc. ourselves from the new-utils).

We should probably look at a lot more of the scripts that are dotted all over the sources, the emeraldmfgtest folder found on an original lx firmware gives us some hints, as does make_release.sh, mkbase.sh mkSuperATAP.sh and many others.