I have several devices sharing the same serial (namely the phantastic
0123456789ABCDEF), so I've been looking for a solution as well a few years ago, and found it. Of course, it requires a rooted device.
adb shell su mount -o remount,rw /system vi /system/etc/install-recovery.sh # edit, save and exit mount -o reount, ro /system
And here comes the line to add to
/system/etc/install-recovery.sh to make the magic happen:
echo -n NEWSERIAL123 > /sys/class/android_usb/android0/iSerial
Of course, replace
NEWSERIAL123 by the serial you want the device to use. After the next reboot, this should be in effect.
As for the IMEI, you'd better not touch that. Legal issues xe2x80x93 apart from the fact that different brands deal with it differently.