Android Image content using DragonFace (and ImgRepacker, a bit)

19 16699
Adromir  
After doing a lot of Research, I am getting more and more certain, that we are maybe trying the unsolveable. I mean there must be a reason, that on the Internernet you can't find a complete guide to unpack and repack ext4 Images. As dlanor correctly states, if you extract the Image, you loose all of your permissions, Owners and symlinks in that Image.

As I am having the Impression, DragonFace is not doing a full un- and repack either, because as mattrix experienced, that changes in files not edible in DragonFace are ignored (liab experienced something similiar here: http://forum.lemaker.org/forum.p ... amp;page=5#pid42797 new files added to an image didnt get packed).

I think the only way we might be able to achieve that is to mount the image as a virtual drive, which Windows natively isnt able to achieve in the way we need, because the image must be rewritable and Windows must "learn" to handle the ext4 filesystem.

After some research I found several Tools being able to do that, but every of them has some kind of Problem:

1. Working perfectly and up to date, but closed source
2. Open source but not maintained anymore and lacking some features which might or might not be needed.

My Favourites at the Moment from the Open Source front are:
For ext Support: ExtFsd (http://www.ext2fsd.com/) but doesnt Support ext4 fully (maybe not needed)
mount image rw: filedisk www.acc.umu.se/~bosse/

As closed source
Filesystem: ExtFS from Paragon https://www.paragon-software.de/de/home/extfs-windows/
Mount: OSFMount http://www.osforensics.com/tools/mount-disk-images.html  

mattrix  
I think the solution is doing it in a linux VM.
Eg: The same one we using to build the kernel.

Use ImgRepacker to extract .fex's then there are tools to extract those.
Then build again.

I did this on Windows, but got to the stage of having the system ext4 partion but couldn't find a nice way to extract that.
However, lots of tools for Linux that do it (well, linux can mount it natively)

Adromir  
Either a Linux-VM or maybe the Way i described with mounting the Image as a writable drive, after you installed a ext4 ready driver on your System. If somebody can try if that works with one of the tools i mentioned, we might be a big deal ahead (i am not able to do a lot today, my girfriend passed her bachelor degree today, so...)

ext4_unpacker has a cli mode according to this: http://sourceforge.net/p/android ... al/thread/e19f81b6/

ChrisP  
I think as Mattrix than the realistic way is to do it from linux itself, which is the standard environnent for Android development, and where every of the tools needed is already available. DragonFace is a great tool to do a lot of tweaking of existing images, but to go further in image advanced tweaking should be harder to transpose to Windows environnement.

And using Vagrant, which I didn't know before, is helping in a massive way to implement quickly an out of the box environment for that.

mattrix  
Edited by mattrix at Tue Nov 11, 2014 18:21

yes

In reality, we don't use the dragonface GUI much at all.
We are just using it to extract and rebuild images for us.

It's therefore quite "heavy" for our needs.

My plan is to update my Vagrant to also set up a an easy command line tool for image unpacking repacking
Would work as follows

1) Put your base image in the AndroidBuilder folder (eg: mattrix.img)
2) Run "vagrant up"
3) The vagrant sets up the environment etc
4) It then runs the commands in the new VM to extract the image into a folder within the AndroidBuilder
   eg: AndroidBuilder/Extracted
5) You can then modify the files directly through the host OS (eg: Windows)
6) Within the VM, you run the "./build" command
7) This then builds the new firmware, copies the new firmware and modules into the correct extracted image folder
8) Now it packages the folders back into a new "newimage.img"
9) Burn

How easy would that be

mattrix  
Edited by mattrix at Tue Nov 11, 2014 18:30

Filesystem Layout in VM would be

/BUILD
   /firmware
       build.sh
   /filesystem
      build.sh
   build.sh

That way, you can CD into firmware or filesystem and build them independently.
Or, run the build command in the BUILD folder which would build both.


Filesystem Layout in host (after a build) would be

AndroidBuilder
   VagrantFile
   install.sh
   image.img (VM could search for any '.img' in this folder)
   /OUTPUT
        new.image.img
        /Firmware
            vmlinux
            /Modules
                wifi.ko
        /Filesystem
             /System
             /BootFs
             /SDCard  (Hehe)
             /Data (Hehe)

Adromir  
I was able to mount the system.fex.iso and write files on it, using ext2fsd and osfmount, mounting the iso as a harddrive. I am just trying out, if the unpacker is using this iso for further use

ChrisP, how could you open the Android rom with Dragonface?
I cannot open with below message.
[Firmware does not support the tools to modify, make sure that the firmware version]
I'm using Dragonface (2.1.2 / 2.1.2r1 / 2.2.0 / 2.2.3).
And all of Android rom from LeMaker.
I've tested on PC Windows 7 / Mac Bootcamp Windows7

jaejeongkim replied at Jun 21, 2015 12:03
ChrisP, how could you open the Android rom with Dragonface?
I cannot open with below message.
[Firmw ...

Did you resolve your problem?
I continue to have the same problem as you and I cannot open any image
I am with Windows 10 64 bit

Hello,

I want to mount the my new partition(mmcblk0p14) as system partition not existing system partition(mmcblk0p7)  I have added new partition(mmcblk0p14) to sys_partition.fex file

;------------------------------>mmcblk0p14/nandm
[partition]
    name         = mysys
    size         = 1048576
    downloadfile = "mysys.fex"    -----> this is copy of system.fex file
    user_type    = 0x1

also did required changes in env.cfg

mmc_root=/dev/mmcblk0p14

and init.sun7.rc

on early-fs
    dispe2fsck
    mount ext4 /dev/block/mysys /system wait noatime nodev barrier=0

After pack when I boot with image I am getting following error.

---------------------------------------------------------------------------------

-total partitions:12-
-name-        -start-       -size-      
bootloader  : 1000000       1000000     
env         : 2000000       1000000     
boot        : 3000000       1000000     
system      : 4000000       20000000   
data        : 24000000      40000000   
misc        : 64000000      1000000     
recovery    : 65000000      2000000     
cache       : 67000000      14000000   
private     : 7b000000      1000000     
databk      : 7c000000      10000000   
mysys       : 8c000000      20000000   
UDISK       : ac000000      0           
-----------------------------------
base bootcmd=run setargs_mmc boot_normal
bootcmd set setargs_mmc
key 0
recovery key high 6, low 4
cant find fstbt value
to be run cmd=run setargs_mmc boot_normal
the user data'magic is bad
WORK_MODE_BOOT
board_status_probe
sunxi_bmp_display
WORK_MODE_BOOT
[      0.738]Hit any key to stop autoboot:  0
read boot or recovery all
[      1.232]sunxi flash read ffset 3000000, 11602020 bytes OK
[      1.240]ready to boot
[      1.243]
Starting kernel ...

[    0.651924] aw_pm_init: not support super standby.
[    0.690629] sw_ahci sw_ahci.0: SATA power enable do not exist!!
[    0.701475] can't get item for emac_power gpio !
[    1.042335] [hdmi]hdmi module init
[    1.047524] ##fb init:w=1280,h=720,fbmode=0
[    1.067651] init: /init.rc: 389: ignored duplicate definition of service 'console'
[    1.403036] init: start e2fsck listening...
[    1.407594] EXT4-fs (mmcblk0p14): VFS: Can't find ext4 filesystem
[    1.452423] EXT4-fs (mmcblk0p8): VFS: Can't find ext4 filesystem
[    1.510841] init: buffer : /dev/block/mmcblk0p8
[    1.516627] init: do_umount: /data
[    1.520535] init: do_umount error = Invalid argument
[    1.529734] EXT4-fs (mmcblk0p11): VFS: Can't find ext4 filesystem
[    1.580827] init: buffer : /dev/block/mmcblk0p11
[    1.586648] init: do_umount: /cache
[    1.590689] init: do_umount error = Invalid argument
[    1.601390] init: dont need format /dev/block/UDISK
[    1.609713] init: start format /dev/block/private
[    1.615190] init: wait for format /dev/block/private
[    1.615375] init: fork to format /dev/block/private
[    1.626236] init: format /dev/block/private ok
[    1.633097] FAT-fs (mmcblk0p12): invalid media value (0x92)
[    1.672404] EXT4-fs (mmcblk0p13): VFS: Can't find ext4 filesystem
[    1.730851] init: buffer : /dev/block/mmcblk0p13
[    1.736711] init: do_umount: /databk
[    1.740848] init: do_umount error = Invalid argument
[    1.754851] init: cannot find '/system/bin/servicemanager', disabling 'servicemanager'
[    1.763749] init: cannot find '/system/bin/vold', disabling 'vold'
[    1.770720] init: cannot find '/system/bin/netd', disabling 'netd'
[    1.777620] init: cannot find '/system/bin/debuggerd', disabling 'debuggerd'
[    1.785647] init: cannot find '/system/bin/rild', disabling 'ril-daemon'
[    1.793151] init: cannot find '/system/bin/surfaceflinger', disabling 'surfaceflinger'
[    1.802005] init: cannot find '/system/bin/app_process', disabling 'zygote'
[    1.803354] init: HDMI status = 1, try 11 times!TV status = 0
[    1.816227] init: cannot find '/system/bin/drmserver', disabling 'drm'
[    1.823536] init: cannot find '/system/bin/mediaserver', disabling 'media'
[    1.831223] init: cannot find '/system/bin/installd', disabling 'installd'
[    1.838897] init: cannot find '/system/etc/install-recovery.sh', disabling 'flash_recovery'
[    1.848270] init: cannot find '/system/bin/keystore', disabling 'keystore'
[    1.855969] init: cannot find '/system/bin/u3gmonitor', disabling 'u3gmonitor'
[    1.864051] init: cannot find '/system/bin/securefileserver', disabling 'securefile'
[    1.872701] init: cannot find '/system/bin/isomountmanagerservice', disabling 'isomountmanager'
[    1.882420] init: cannot find '/system/bin/gpioservice', disabling 'gpio'
[    1.889997] init: cannot find '/system/bin/systemmixservice', disabling 'property'
[    1.898633] init: cannot find '/system/bin/sh', disabling 'console'
[    1.905929] android_usb: already disabled
-------------------------------------------------------------------------------------------------------------------------------------

and android is failed to boot.  It is clear that the new created partition is failed to mount.

then I dump the content of mmcblk0p7 to mmcblk0p14

root@test# dd=/dev/sdc7 (mmcblk0p7)  of=/dev/sdc14 (mmcblk0p14)

after this system is booted as due to dd file system is written to /dev/sdc14(mmcblk0p14)

I am not able to get this behaviour.  Why it is fails to mount without dd.

Thanks in advance

You have to log in before you can reply Login | Sign Up

Points Rules