Hi Everyone!
I have managed to hack a new UBI image (based on the Dingo golden update one) with a larger space for applications (taken from the storage volume, since that can go into the SD card).
This is
*NOT* user-friendly, and I am not sure it works properly. I have found the following issues after flashing with the new image:
- The modified Dingo seems to work, but it is impossible to install applications using the Package Manager (it complains that there is not enough free space
). However, installing APKs widh ADB works. Go figure...
- Sometimes, you can't even download files from the browser!
- You can upgrade to Ermine (I went to Ermine 1.02), and there you can install applications from the web or files apparently without problems.
- In Ermine, the Calendar shortcut in the home screen did not work, but I just erased and re-added it and it works.
- In Ermine, also, the "x" for applications does not slide anymore, but the applications only appear when you tap on it (that might be normal AFAIK, I never ran the normal Ermine
).
- I cannot guarantee everything works; the system might be f****d-up a thousand different ways which I don't recognize from my lack of experience.
On the other hand, if things go bad the device should be recoverable using the Dingo golden update (I lost count of the number of times I have flashed that

).
In order to make run the script that makes the new image you need:
- A GNU/Linux system, with a recent kernel (3.0 works, 2.6.32 does not) with nandsim and ubifs compiled as modules (ubifs can be probably compiled in).
- A recent version of mtd-utils.
- The android_ubi.img.crc and update.sh from the Dingo golden update.
- sed
- Root access in the computer, not the PE (you need to run this as root).
Other technical notes:
- The image needs to be flashed with ubiformat 1.5 or higher. The one in the Dingo maint ramdisk does not work (it seems it is a known bug), I have used the one in the Ermine maint ramdisk and added it to the tools.zip file.
- For some reason, the CRC of the flashed image fails verification, even though the image is properly flashed (I think it has to do with the newer ubiformat you have to use but I don't know for sure). That means that you need to hack update.sh so that it ignores the CRC check.
- I've done the flashing over a Dingo image, it might work over Ermine but I don't know for sure.
The script I have used follows. Again,
*DO NOT USE* unless you know exactly what you are doing!
Code:
#! /bin/sh
# This script grabs the UBI image from the Pocket Edge Dingo golden update and
# creates a modified UBI image where the "userdata" (where apps are installed)
# and the "storage" (where the library resides) can be custom-sized (with some
# restraints).
#
# Requires:
# * A recent enough kernel with nandsim and ubifs.
# * mtd-utils (probably a recent version)
# * sed
# * The android_ubi.img.crc file from the Dingo Golden update.
# * The update.sh file from the Dingo Golden update.
# * It needs to be run as root.
#
# Creates new-android_ubi.img.crc and new-update.sh. Put these two files into
# the original update.zip and update the system in your Pocket Edge.
# New size for the storage volume and userdata volume in logical eraseblocks
# (LEBs); each LEB is 504Kb long. The sum of these must be equal or less to
# 6357 (if it's less it will work, but you will be wasting space).
# NOTE: Keep in mind that the actual usable space will be at least ~70 Mib
# smaller because of filesystem structures.
STO_SIZE=1200 # ~590 MiB
USD_SIZE=5157 # ~2.5 GiB
# Temporary directory. BE CAREFUL, it will be wiped out and created each time!
TMPDIR=/tmp/muckrom
# It should not be necessary to edit anything below this.
# File names.
CRC_IMAGE=android_ubi.img.crc
IMAGE=android_ubi.img
# Check for an image without CRC. If there is none, and the CRC image is
# present, remove it.
if [ ! -r $IMAGE ]
then
echo "Eliminating the CRC from the image file $CRC_IMAGE."
dd if=$CRC_IMAGE of=$IMAGE bs=512k count=327
fi
# First, load up the NAND simulator, trying to reproduce the layout in the PE.
# The first partition will be unused, and the second one is the one with the
# UBI volumes (the total NAND size is 8192 LEBs, and the second partition size
# is 7864 LEBs.
echo "Loading the NAND simulator."
modprobe ubifs
modprobe nandsim first_id_byte=0xec second_id_byte=0xd7 third_id_byte=0x00 fourth_id_byte=0x36 parts=328,7864 cache_file=/tmp/nand.img
# This will be the MTD device to use.
MDEV=/dev/mtd1
# Copy (bit-for-bit) the image into the simulated NAND partition.
echo "Uploading image into simulated NAND."
dd if=$IMAGE of=$MDEV bs=512k count=327
# Verify the copy, to make sure nothing went wrong.
echo "Verifying the image copied to the simulated NAND."
nanddump -o -b -l `echo 327*512*1024 | bc` -s 0 -f verify.img $MDEV
cmp $IMAGE verify.img
if [ $? -ne 0 ]
then
echo "Problem copying the image to the simulated NAND!"
rm verify.img
modprobe -r nandsim
rm -f /tmp/nand.img
exit 1
fi
echo "Dump verified OK!"
rm verify.img
# Attach the UBI volumes (force UBI not to use subpages, for some reason the
# NAND simulator reports 1Kb subpagesm while the PE hardware does not seem to
# support them).
echo "Attaching UBI device."
ubiattach -p $MDEV -O 4096
# Create the temporary directory.
echo "Creating the temporary directory $TMPDIR."
rm -r $TMPDIR
mkdir -p $TMPDIR
# Create the directories and mount the UBI images.
echo "Mounting original UBI images."
for vol in system userdata cache storage
do
mkdir $TMPDIR/$vol
mount -t ubifs ubi:$vol $TMPDIR/$vol
done
# Make the UBI filesystem images.
echo "Making the new UBI filesystem images..."
echo " ...system"
mkfs.ubifs -v -r $TMPDIR/system -m 4096 -e 516096 -c 712 -j 10584KiB -R 0 -x favor_lzo -X 1 new-system.img
echo " ...userdata"
mkfs.ubifs -v -r $TMPDIR/userdata -m 4096 -e 516096 -c $USD_SIZE -j 10584KiB -R 0 -x favor_lzo -X 1 new-userdata.img
echo " ...cache"
mkfs.ubifs -v -r $TMPDIR/cache -m 4096 -e 516096 -c 712 -j 17640KiB -R 4536KiB -x favor_lzo -X 1 new-cache.img
echo " ...storage"
mkfs.ubifs -v -r $TMPDIR/storage -m 4096 -e 516096 -c $STO_SIZE -j 32760KiB -R 4536KiB -x favor_lzo -X 1 new-storage.img
# Unmount the UBI images.
echo "Unmounting original UBI images."
for vol in system userdata cache storage
do
umount $TMPDIR/$vol
done
# Then, let's detach UBI from the device.
echo "Detaching UBI device."
ubidetach -p $MDEV
# We can remove the NAND simulator now.
echo "Removing the NAND simulator."
modprobe -r nandsim
rm -f /tmp/nand.img
modprobe -r ubifs
# Make the big, ubinized, image.
cat <<EOF > new-ubinize.cfg
[system]
mode=ubi
image=./new-system.img
vol_size=358848KiB
vol_id=0
vol_type=dynamic
vol_name=system
[userdata]
mode=ubi
image=./new-userdata.img
vol_size=`echo 504*$USD_SIZE | bc`KiB
vol_id=1
vol_type=dynamic
vol_name=userdata
[cache]
mode=ubi
image=./new-cache.img
vol_size=358848KiB
vol_id=2
vol_type=dynamic
vol_name=cache
[storage]
mode=ubi
image=./new-storage.img
vol_size=`echo 504*$STO_SIZE | bc`KiB
vol_id=3
vol_type=dynamic
vol_name=storage
EOF
echo "Running ubinize."
ubinize -o new-$IMAGE -p 512KiB -m 4096 new-ubinize.cfg
# Add the CRC to the end.
# After this, the image should be ready to put in a custom "update.zip" file.
echo "Adding CRC to the modified image."
CRC=`/usr/sbin/ubicrc32 new-$IMAGE`
perl -e "print pack L, ${CRC}" > crc_file.dat
cat new-$IMAGE crc_file.dat > new-$IMAGE.crc
rm -f crc_file.dat
# NOTE: The custom "update.sh" should have VFAT_NUM_BLOCKS equal to
# $STO_SIZE*504 (the new number of blocks in the storage filesystem)
# To that, we substract the journal and root reserved space to make sure the
# image will never be larger than the available space.
NEW_BLOCKS=`echo $STO_SIZE*504-32760-4536 | bc`
sed s/VFAT_NUM_BLOCKS=2617152/VFAT_NUM_BLOCKS=${NEW_BLOCKS}/ update.sh > new-update.sh