Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- The problem
- 12-16 09:18:44.677 6154 22401 E NFCJNI : phLibNfc_Mgt_ConfigureDriver() returned 0x0106[NFCSTATUS_INVALID_DEVICE]
- 12-16 09:18:44.677 6154 22401 E NFCJNI : phLibNfc_Mgt_Initialize() returned 0x0001[NFCSTATUS_INVALID_PARAMETER]
- 12-16 09:18:44.678 6154 22401 E NFCJNI : phLibNfc_Mgt_ConfigureDriver() returned 0x0106[NFCSTATUS_INVALID_DEVICE]
- 12-16 09:18:44.689 6154 22401 E linker : library "/vendor/firmware/libpn544_fw.so" ("/system/vendor/firmware/libpn544_fw.so") needed or dlopened by "/system/lib/libnfc.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/system/app/Nfc/lib/arm:/system/app/Nfc/Nfc.apk!/lib/armeabi-v7a:/system/lib:/system/vendor/lib", permitted_paths="/data:/mnt/expand:/data/data/com.android.nfc:/system/lib:/system/vendor/lib"]
- 12-16 09:18:44.689 6154 22401 E NFC-HCI : Could not open /vendor/firmware/libpn544_fw.so
- 12-16 09:18:44.689 6154 22401 D NFCJNI : phLibNfc_Mgt_UnConfigureDriver() returned 0x0000[NFCSTATUS_SUCCESS]
- 12-16 09:18:44.689 6154 22401 E NFCJNI : phLibNfc_Mgt_Initialize() (download) returned 0x0001[NFCSTATUS_INVALID_PARAMETER]
- 12-16 09:18:44.689 6154 22401 W NFCJNI : Firmware update FAILED
- 12-16 09:18:44.689 6154 22401 E NFCJNI : phLibNfc_Mgt_ConfigureDriver() returned 0x0106[NFCSTATUS_INVALID_DEVICE]
- 12-16 09:18:44.702 6154 22401 E linker : library "/vendor/firmware/libpn544_fw.so" ("/system/vendor/firmware/libpn544_fw.so") needed or dlopened by "/system/lib/libnfc.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/system/app/Nfc/lib/arm:/system/app/Nfc/Nfc.apk!/lib/armeabi-v7a:/system/lib:/system/vendor/lib", permitted_paths="/data:/mnt/expand:/data/data/com.android.nfc:/system/lib:/system/vendor/lib"]
- 12-16 09:18:44.702 6154 22401 E NFC-HCI : Could not open /vendor/firmware/libpn544_fw.so
- 12-16 09:18:44.702 6154 22401 D NFCJNI : phLibNfc_Mgt_UnConfigureDriver() returned 0x0000[NFCSTATUS_SUCCESS]
- 12-16 09:18:44.702 6154 22401 E NFCJNI : phLibNfc_Mgt_Initialize() (download) returned 0x0001[NFCSTATUS_INVALID_PARAMETER]
- 12-16 09:18:44.702 6154 22401 W NFCJNI : Firmware update FAILED
- 12-16 09:18:44.702 6154 22401 E NFCJNI : phLibNfc_Mgt_ConfigureDriver() returned 0x0106[NFCSTATUS_INVALID_DEVICE]
- 12-16 09:18:44.713 6154 22401 E linker : library "/vendor/firmware/libpn544_fw.so" ("/system/vendor/firmware/libpn544_fw.so") needed or dlopened by "/system/lib/libnfc.so" is not accessible for the namespace: [name="classloader-namespace", ld_library_paths="", default_library_paths="/system/app/Nfc/lib/arm:/system/app/Nfc/Nfc.apk!/lib/armeabi-v7a:/system/lib:/system/vendor/lib", permitted_paths="/data:/mnt/expand:/data/data/com.android.nfc:/system/lib:/system/vendor/lib"]
- 12-16 09:18:44.713 6154 22401 E NFC-HCI : Could not open /vendor/firmware/libpn544_fw.so
- 12-16 09:18:44.713 6154 22401 D NFCJNI : phLibNfc_Mgt_UnConfigureDriver() returned 0x0000[NFCSTATUS_SUCCESS]
- 12-16 09:18:44.713 6154 22401 E NFCJNI : phLibNfc_Mgt_Initialize() (download) returned 0x0001[NFCSTATUS_INVALID_PARAMETER]
- 12-16 09:18:44.713 6154 22401 W NFCJNI : Firmware update FAILED
- 12-16 09:18:44.713 6154 22401 E NFCJNI : Unable to update firmware, giving up
- 12-16 09:18:44.763 6154 22401 D NFCJNI : Terminating client thread...
- 12-16 09:18:44.764 6154 22401 W NfcService: Error enabling NFC
- The solution (created by Matt Mower)
- https://paste.ubuntu.com/18137835/
- I read the contents of nxp_nfc_full_version[] and nxp_nfc_fw[] using a simple executable linked to
- libpn544_fw.so. I didn't want to deal with Android denying me the ability to load the library,
- but I needed a linker available, so I prepared these instructions for use with TWRP.
- 1) Save http://paste.ubuntu.com/18137145/ as a patch (e.g. pnfw.patch)
- 2) In your device tree:
- $ git am /path/to/pnfw.patch
- 3) Copy the libpn544_fw.so blob to the pnfw/ subdirectory
- 4) Read the symbols from the libpn544_fw.so blob:
- $ ./prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-readelf -Ws vendor/lge/ls990/proprietary/vendor/firmware/libpn544_fw.so
- Sample output: http://paste.ubuntu.com/18137244/
- 5) What matters to me is:
- a) nxp_nfc_fw has size 66504
- b) nxp_nfc_full_version has size 12
- 6) Edit pnfw/pnfw.c to adjust the size of nxp_nfc_fw_len and nxp_nfc_full_version_len accordingly
- 7) From the top of your cm tree, lunch for your device and then build the module: mka pnfw
- 8) For reasons unknown to me, the linker renames the shared lib in the executable, so the following
- replacement was necessary:
- $ strings $OUT/recovery/root/sbin/pnfw | grep libpn544_fw
- libpn544_fw_C3_1_41_SP.so
- $ sed -i "s|libpn544_fw_C3_1_41_SP.so|libpn544_fw.so\x0\x0\x0\x0\x0\x0\x0\x0\x0\x0|g" $OUT/recovery/root/sbin/pnfw
- Make sure the replacement string is the same length as the original, hence the \x0 fillers.
- 9) In TWRP, the linker is in /sbin:
- $ sed -i "s|/system/bin/linker\x0|/sbin/linker\x0\x0\x0\x0\x0\x0\x0|g" $OUT/recovery/root/sbin/pnfw
- 10) Push the files to your device
- $ adb push $OUT/recovery/root/sbin/pnfw /sbin/pnfw
- $ adb push $OUT/recovery/root/sbin/libpn544_fw.so /sbin/libpn544_fw.so
- 10) Run the executable (in TWRP):
- $ adb shell
- $ pnfw > /tmp/fw.c
- $ exit
- $ adb pull /tmp/fw.c
- ./prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-readelf -dW vendor/lge/ls990/proprietary/vendor/firmware/libpn544_fw.so
- produces
- Dynamic section at offset 0xd014 contains 23 entries:
- Tag Type Name/Value
- 0x00000003 (PLTGOT) 0xd0dc
- 0x00000002 (PLTRELSZ) 8 (bytes)
- 0x00000017 (JMPREL) 0x390
- 0x00000014 (PLTREL) REL
- 0x00000011 (REL) 0x398
- 0x00000012 (RELSZ) 16 (bytes)
- 0x00000013 (RELENT) 8 (bytes)
- 0x6ffffffa (RELCOUNT) 2
- 0x00000006 (SYMTAB) 0x168
- 0x0000000b (SYMENT) 16 (bytes)
- 0x00000005 (STRTAB) 0x288
- 0x0000000a (STRSZ) 261 (bytes)
- 0x00000004 (HASH) 0xd4
- 0x00000001 (NEEDED) Shared library: [libc.so]
- 0x00000001 (NEEDED) Shared library: [libstdc++.so]
- 0x00000001 (NEEDED) Shared library: [libm.so]
- 0x0000000e (SONAME) Library soname: [libpn544_fw_C3_1_41_SP.so]
- 0x00000019 (INIT_ARRAY) 0xd000
- 0x0000001b (INIT_ARRAYSZ) 8 (bytes)
- 0x0000001a (FINI_ARRAY) 0xd008
- 0x0000001c (FINI_ARRAYSZ) 12 (bytes)
- 0x00000016 (TEXTREL) 0x0
- 0x00000010 (SYMBOLIC) 0x0
- ./prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-readelf -Ws vendor/lge/ls990/proprietary/vendor/firmware/libpn544_fw.so
- Symbol table '.dynsym' contains 18 entries:
- Num: Value Size Type Bind Vis Ndx Name
- 0: 00000000 0 NOTYPE LOCAL DEFAULT UND
- 1: 0000cca0 12 OBJECT GLOBAL DEFAULT 8 nxp_nfc_full_version
- 2: 000003d8 51397 OBJECT GLOBAL DEFAULT 8 nxp_nfc_fw
- 3: 00000000 0 FUNC GLOBAL DEFAULT UND __cxa_finalize
- 4: 0000d0f0 0 NOTYPE GLOBAL DEFAULT 13 __dso_handle
- 5: 0000d000 0 NOTYPE GLOBAL DEFAULT 9 __INIT_ARRAY__
- 6: 0000d008 0 NOTYPE GLOBAL DEFAULT 10 __FINI_ARRAY__
- 7: 0000ccac 0 NOTYPE GLOBAL DEFAULT ABS __exidx_end
- 8: 0000ccac 0 NOTYPE GLOBAL DEFAULT ABS __exidx_start
- 9: 0000d0ec 0 NOTYPE GLOBAL DEFAULT ABS __data_start
- 10: 0000d0ec 0 NOTYPE GLOBAL DEFAULT ABS _edata
- 11: 0000d0ec 0 NOTYPE GLOBAL DEFAULT ABS __bss_start
- 12: 0000d0ec 0 NOTYPE GLOBAL DEFAULT ABS __bss_start__
- 13: 0000d100 0 NOTYPE GLOBAL DEFAULT ABS _bss_end__
- 14: 0000d100 0 NOTYPE GLOBAL DEFAULT ABS __bss_end__
- 15: 0000d100 0 NOTYPE GLOBAL DEFAULT ABS __end__
- 16: 0000d100 0 NOTYPE GLOBAL DEFAULT ABS _end
- 17: 00080000 0 NOTYPE GLOBAL DEFAULT ABS _stack
Advertisement
Add Comment
Please, Sign In to add comment