Extract symbol table from zImage without actual loading - android

I have a Android kernel boot image -- zImage.
How to extract the symbol table from it? Maybe it is in a compressed form.
The system is 32-bit ARM.
I do not have the actual device to load this zImage, and get symbols from /proc/ksyms or /proc/kallsyms or system.map.
I can extract vmlinux from zImage, but still no symbols after objdump.

Related

OTA update fails, can't mount /data/ partition

I am trying to implement OTA functionality for a msm8998 board running Android 8.1.
I've generated the OTA file and followed the standard way of doing it,
I've run into two problems, solving either one would solve the issue:
OTA size is bigger than /cache, therefore even though recovery can mount /cache, the image cannot fit there. How would I increase the /cache size, and is it a good idea to do so?
If I put the OTA zip in /data/ or /sdcard/, I have an error during recovery, seemingly it can't mount it. How would I make /data/ mountable?
...
Finding update package...
I:Update location: /data/update.zip
Opening update package...
E:Failed to mount /data: Invalid argument
E:Unable to open '/data/update.zip': No such file or directory
E:failed to map file
W:failed to read uncrypt status: No such file or directory
W:Failed to read /sys/class/thermal/thermal_zone28/temp: Invalid argument
W:Failed to read /sys/class/thermal/thermal_zone27/temp: Invalid argument
I:current maximum temperature: 44756
I:/data/update.zip
I:0
I:time_total: 0
I:retry: 0
I:temperature_start: 44814
I:temperature_end: 44756
I:temperature_max: 44814
I:
Installation aborted.
Turns out you have to use RecoverySystem.installPackage(...) method AND have the OTA file be in /data/.
Previously I had tried RecoverySystem.installPackage(...) method but with file in /sdcard/, and separately by setting /cache/recovery/command myself and using /data/
When using RecoverySystem.installPackage(...) and the file in /data/, seems uncrypt is run on it before reboot, and that makes the update accessible to the recovery.

Out of space while building android Rom

I'm getting the below error while making system.img
there are all files like boot.img, vendor.img but not system img
Allocating group tables: done
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
set_selinux_xattr: No such file or directory searching for label
"/bt_firmware" e2fsdroid: No such file or directory while configuring
the file system loaded 3450 fs_config entries
Out of space? Out of inodes? The tree size of
/home/prashi_kadasi/arrow10/out/soong/.temp/tmpP2XFd3 is 1272721408
bytes (1213 MB), with reserved space of 0 bytes (0 MB). The max image
size for filesystem files is 4294967296 bytes (4096 MB), out of a
total partition size of 4294967296 bytes (4096 MB). 01:24:45 ninja
failed with: exit status 1
failed to build some targets (01:02 (mm:ss))
Check that you include this
/bt_firmware(/.*)? u:object_r:bt_firmware_file:s0
in your file_contexts and this
type bt_firmware_file, file_type;
in your file.te (and that you have your sepolicy included)
I know the solution to this was given for the most part, but I see this asked quite a lot and I figure this a good place to give a little background.
So the answer is usually given in some form of "add the offending label to file_contexts and and make sure its labeled", apart from that, rebuilding file_contexts and sepolicy/sepolicy.recovery and starting a new build fixes it.
The issue stems fro selabel_lookup failing, and in my experience this is usually due to additions to device trees and or changes that weren't accounted for before file_contexts.bin is created by the build system. You can learn a lot more about the issue from this now obscure commit

How to handle a system.img file size larger than the partition size declared inside BoardConfig.mk file?

while trying to build my image, I am getting the following error: "ext4_allocate_best_fit_partial: failed to allocate 20001 blocks, out of space?"
I don't want to change the partition table inside bootloader of dev as there are other dependencies. What other solutions I can explore.

System can't find specifed path ndkbuild in android

I want to build an ocr app in android.For that i am using tessaract library.I am following this turorial ocr tutoial it says follow below steps
Download the NDK & extract to C:\ drive-Done
Set NDK Path & Android SDK path to PATH variable in Enviorment Variable.-Done
Download tessaract library and extract it to C:-Done
open command line & go inside tessract folder ibn downloaded library.-
Write ndk-build-Not Done
When i write ndk-build it says the system can't find the specified path.
Please tell me how to resolve this issue.I have already spent lot of hard time on this.
Thanks in advance.
If you re-read the link you posted, you may notice this line from the author:
Attention: if you fail at any of the above steps, you are not ready for this shit yet. Better grab an introduction to android development course, read a book, then come back to this tutorial. You’ll just waste time and nerves and you’ll bitch about it in the comments that this crash, this doesn’t work. (PS. no, I will not send you the source code on your email, stop spamming k thx.)
You should seriously consider his advice - working with the Android NDK only gets more difficult from here.
You're probably getting that error message because cmd couldn't find the ndk-build program, which is located inside the root of android-ndk-r10e. Possible causes:
You made an error when editing your PATH variable - make sure each file path is separated by a semicolon and that you provided the full path to your NDK install.
Your PATH is too long - the max length is 260 characters. See this page for more info. tl;dr: prefix \?\ to your PATH to get around this length limit.
You had cmd open when you set the variables - try restarting the cmd
program or even restarting your machine.

Android Gdb gcore "command not implemented for this target"

I am using gdb for dumping core file for an android process. I am running gdbserver on the device on tcp port and gdb client on the desktop. When i do gcore on client i get the below error.
Does any one know why i'm getting this error , any help much appreciated.
(gdb) gcore
Command not implemented for this target.
The reason i'm doing this to dump process memory and extract Classes.dex file from the memory using core file. I've tried doing this using /proc/pid/mem and proc/pid/maps and dump memory but that has too many mapped regions , i couldn't find the area where the Classes.dex file is. Any other alternate approach is also welcome. Thanks for your help.
First of all, you can only dump odex from memory (because dex compiled to odex for execute). But its not a big deal to convert odex to dex using baksmali-smali.
To find odex in memory you can use gdb for checking magic number for every begin-address of mapped memory(proc/pid/maps - first column):
gdb --batch --pid "pid_task" -ex x/s "mem_start"
So, when returned value equal to "dey\n036", you can dump this memory region via gdb.
Try to begin checking memory addresses from the end of file "proc/pid/maps", it will be much faster.
PS Sorry for my english, but hope it will help.
#Chris Stratton, the memory mapped classes.dex file will be different from the dex file inside apk on disk, for example in cases of packed dex files, some part of dex will be deobfuscated, question is to dump the memory mapped classes.dex file by getting the process memory.
You can use GameGuardian for this. Need root.
Memory editor tab - menu - memory dump - input 0-0 as range and folder - press ok - wait for toast Dump end.
Go to selected folder - open maps file - search needed odex in regions - remember start address of region - open GameGuardian - menu - memory dump - input remembered address in both field as range - press ok - wait for toast Dump end.
Now you have in your folder .bin file with dumped odex file.
Also you can find address in drop down list in GameGuardian UI. Press drop down icon on right with dump range field.
Here some video examples how to do this:
How to dump odex file from memory on Android -
GameGuardian

Categories

Resources