JesusFreke / smali

smali/baksmali
6.29k stars 1.07k forks source link

Unable to deodex odex files when system.img is 'Linux rev 1.0 ext2 filesystem data' format #775

Open neo1949 opened 4 years ago

neo1949 commented 4 years ago

The miui rom was download from here, the rom is based on Android 10. After generating the system.img file and mount it to the system directory, using the baksmali-2.4.0.jar to deodex an odex file get following messages:

$ file miui/umi/system.img 
miui/umi/system.img: Linux rev 1.0 ext2 filesystem data (mounted or unclean), UUID=4729639d-b5f2-5cc1-a120-9ac5f788683c (extents) (large files) (huge files)

$ sudo mount miui/umi/system.img miui/system/

$ java -jar romutils/baksmali-2.4.0.jar x miui/system/system/framework/oat/arm64/services.odex 
Exception in thread "main" java.lang.RuntimeException: "miui/system/system/framework/oat/arm64/services.odex" has no dex files
    at org.jf.baksmali.DexInputCommand.loadDexFile(DexInputCommand.java:167)
    at org.jf.baksmali.DisassembleCommand.run(DisassembleCommand.java:162)
    at org.jf.baksmali.Main.main(Main.java:102)

# specify directory where miui/system/system/framework/arm64/boot.oat locates
$ java -jar romutils/baksmali-2.4.0.jar x miui/system/system/framework/oat/arm64/services.odex -d miui/system/system/framework/arm64/
Exception in thread "main" java.lang.RuntimeException: "miui/system/system/framework/oat/arm64/services.odex" has no dex files
    at org.jf.baksmali.DexInputCommand.loadDexFile(DexInputCommand.java:167)
    at org.jf.baksmali.DisassembleCommand.run(DisassembleCommand.java:162)
    at org.jf.baksmali.Main.main(Main.java:102)

Maybe the baksmali-2.4.0.jar does not support Android 10? Or the root cause is the ext2 file format?

JesusFreke commented 3 years ago

Are you sure it needs to be deodexed? If the .odex file has no dex files, it's likely the original dex files are still in the .jar file.