[Galaxy S II General] ammadeusy:
in case of Galaxy Nexus (or X, or Nexus 3, or i9250) the IMEI is not stored on /efs, rather it is in /factory with lots of other important files.

root@maguro:/factory # ls -al

drwx------ root root 1969-12-31 21:00 lost+found

drwxrwx--- system radio 2014-01-24 15:30 wifi

drwxrwxr-x radio radio 2014-01-24 15:32 imei

-rwx------ radio radio 1048576 2014-01-24 16:09 .nv_core.bak

-rwx------ radio radio 32 2014-01-24 16:09 .nv_core.bak.md5

-rwx------ radio radio 2097152 2014-01-24 16:09 .nv_data.bak

-rwx------ radio radio 32 2014-01-24 16:09 .nv_data.bak.md5

drwxr-xr-x radio radio 2014-01-24 16:09 bluetooth

-rw------- radio radio 1 2014-01-24 16:09 .nv_state

-rwx------ radio radio 2097152 2014-01-24 16:10 nv_data.bin

-rw------- radio radio 381 2014-01-24 16:09 nv.log

-rwx------ radio radio 32 2014-01-24 16:10 nv_data.bin.md5

Jan 24 17:30:43 2014 is date when my IMEI was restored

it is very odd that ../wifi and ../imei are created first. and only after half hour later the other files. have no idea why.

if you cross reference the exact times of the process with the other log (see below) maybe few assumptions can be made.

consider time difference between then (maybe the to share different coordinates in the globe, cause one is 2 hours dettached from the other LOL).

contents of /factory/.nv.log

cat nv.log

Fri Jan 24 17:30:43 2014: MD5 is turned on.

Fri Jan 24 17:30:43 2014: nv_data.bin does not exist.

Fri Jan 24 17:30:46 2014: default NV restored.

Fri Jan 24 17:30:47 2014: default NV restored.

Fri Jan 24 18:09:25 2014: MD5 is turned off on 0

Fri Jan 24 18:09:27 2014: NV data back-up begin.

Fri Jan 24 18:09:27 2014: secondary NV built.

Fri Jan 24 18:09:27 2014: NV data back-uped.

conclusions:

at xx:30

../wifi was created, MD5 was turned on, no NV was found, two new NV were created (perhaps nv_core and nv_data.bak) and then ../imei was created.

at xx:09

(39 mins later) ../bluetooth/.nv_state was created and set to 0 (whilst MD5 was turned off on 0), backups and secondary NV was created.

for further reference here are some details that may help:

** directories wifi and bluetooth only stores MAC ADDRESSes of those network adapters

** .nv_data.bak equals nv_data.bin, and so equivalent *.md5

** .nv_state equals 0, dunno why

** directory imei store a file called mps_code.dat that contents ZTO, due mine is brazilian edition

contents of /data/radio

root@maguro: # ls -al /data/radio

drwxrwxr-x radio radio 2014-01-24 20:37 log

-rwx------ radio radio 2097152 2014-01-24 22:14 nv_data.bin

-rwx------ radio radio 32 2014-01-24 22:14 nv_data.bin.md5

root@maguro: # cat /data/radio/log/nv.log

cat nv.log

Fri Jan 24 22:37:04 2014: nv data does not exist (GED)

Fri Jan 24 22:37:04 2014: nv data does not exist

/data/radio is always rewritten every boot, meaning there is no way to define based on log files what is its purpose in the process of repairing IMEI code. one can conclude that based on Jan 24 22:37:04 2014 file log, moment of latest boot up log.

the story behind this post

I have formatted my /factory contents thinking about privacy matters since i was about to sell my nexus, resulting in generic IMEI (004999010640000).

tried this and this method for recover. but none resulted ok.

/data/radio do create new nv_data* files every boot but it cannot check with an empty /factory, that's why there is no way to restore it other than with side hardware recalculating.

i had it to service repair. they did not used "the box" rather samsung's own equipments. someone was wondering on how IMEI MD5 was calculated and stored in nv_bin files. The fact is that IMEI is calculated with side hardware and inserted into /factory with chown radio.radio and chmod 700 to protect it. there is no script or blop inside Nexus' own sys files.

would like to thank all efforts the xda devs has granted on helping us, the desperated mobile brickers.