I just tested it out. I flashed my ROM using this kernel with this partition layout...
Code:
Filesystem Size Used Available Use% Mounted on
/dev/block/mtdblock4 25.0M 2.3M 22.7M 9% /cache
/dev/block/mtdblock3 695.0M 407.0M 288.0M 59% /data
/dev/block/mtdblock2 250.0M 206.2M 43.8M 82% /system
I then flashed a kernel with the following partition layout...
Code:
Filesystem Size Used Available Use% Mounted on
/dev/block/mtdblock4 50.0M 2.3M 47.7M 5% /cache
/dev/block/mtdblock2 250.0M 206.2M 43.8M 82% /system
/dev/block/mtdblock3 670.0M 407.0M 263.0M 61% /data
...and the partitions mounted just fine, with different sizes!
Unfortunately, after flashing Tortell's MTD kernel which has the "stock" partition layout (a different size for /system), I got this message when trying to mount system partition:
Code:
Failed to mount /dev/block/mtdblock2 on /system: Invalid argument
/data and /cache still mounted.
Flashing back the original kernel allowed my to mount to all partitions again.
No, it just checks to see if the device is MTD or BML. If it is BML, it flashes the MTD kernel and reboots. I added a part to that script which checks the partition sizes and if they don't match up with what they should be, it does the same thing - flashes the kernel and reboots. I inserted the code into updater.sh. This could be put into a seperate shell script. Here is the code. It's adapted from the code that checks for BML/MTD.
Code:
# check to see if partition sizes are correct
/tmp/busybox mount -t yaffs2 /dev/block/mtdblock2 /system
/tmp/busybox mount -t yaffs2 /dev/block/mtdblock3 /data
if (! df /dev/block/mtdblock2 | grep "256000") || (! df /dev/block/mtdblock3 | grep "711680"); then
# Our partition sizes are not correct
# unmount, format and mount system
/tmp/busybox umount -l /system
/tmp/erase_image system
# unmount and format cache
/tmp/busybox umount -l /cache
/tmp/erase_image cache
# unmount and format datadata
/tmp/busybox umount -l /data
/tmp/erase_image userdata
# make sure sdcard is mounted
if ! /tmp/busybox grep -q /mnt/sdcard /proc/mounts ; then
/tmp/busybox mkdir -p /mnt/sdcard
/tmp/busybox umount -l /dev/block/mmcblk0p1
if ! /tmp/busybox mount -t vfat /dev/block/mmcblk0p1 /mnt/sdcard ; then
/tmp/busybox echo "Cannot mount sdcard."
exit 1
fi
fi
# remove old log
rm -rf /mnt/sdcard/cyanogenmod_bml.log
# everything is logged into /sdcard/cyanogenmod.log
exec >> /mnt/sdcard/cyanogenmod_bml.log 2>&1
# write the package path to sdcard cyanogenmod.cfg
if /tmp/busybox test -n "$UPDATE_PACKAGE" ; then
PACKAGE_LOCATION=${UPDATE_PACKAGE#/mnt}
/tmp/busybox echo "$PACKAGE_LOCATION" > /mnt/sdcard/cyanogenmod.cfg
fi
# Scorch any ROM Manager settings to require the user to reflash recovery
/tmp/busybox rm -f /mnt/sdcard/clockworkmod/.settings
# write new kernel to boot partition
/tmp/flash_image boot /tmp/boot.img
if [ "$?" != "0" ] ; then
exit 3
fi
/tmp/busybox sync
/sbin/reboot now
exit 0
fi
Exactly.
---------- Post added at 12:14 PM ---------- Previous post was at 12:04 PM ----------
Let me add one very important note. After flashing those different kernels and mounting partitions with them, when I finally booted my phone, it booted fine, but my home screen layout has reverted to stock layout, which suggests that some of my data was munched when I mounted /data using different sizes. My downloaded apps still show up in my launcher, so some of my data is still there, but obviously some of it was lost.
I think it's safe to say that if partition layouts are changed, partitions will need to be erased and recreated.