2012年5月18日 星期五

Unpack, modify, and repack an A10 Image file

http://www.slatedroid.com/topic/28942-50-to-the-first-person-to-figure-this-out/


Usage:
- Installation:
Extract the zip file somewhere. Copy any image next to the two bat files and go on the next point.
- Extract firmware:
Using Windows Command Line, cd into the directory with the bat files and issue the following command:
extract_img.bat [img_name]

This will extract the image and set up the working folders.
- Edit the extracted firmware:
The files you might want to edit are the RFSFAT16 ones. BOOTFS is a simple FAT16 image, use MagicISO (or any other ISO managing app) to open and edit it. SYSTEMFS, ROOTFS, and RECOVERYFS are all ext4 images, you can't directly edit them on Windows (atleast by my information). But you can mount them on any Linux machine. SYSTEMFS holds the /system file structure, ROOTFS is the initram (init.rc, default.prop, initlogo, etc), and RECOVERYFS is the recovery.
- Repack the firmware
Still using WCL, use the following:
repack_img.bat [output_img_name]

This will take some time, but will create proper hash verification files for the four checked image: SYSTEMFS, BOOTFS, ROOTFS and RECOVERYFS. After that it will use my config file and eDragonEx to repack the image.

IT IS VERY IMPORTANT TO DO NOT CHANGE ANY NAMINGS IN THE DIRECTORIES, MOSTLY WORK! IF YOU DO, BUILDING WILL BREAK.
eDragonEx is the property of AllWinner Technologies Inc., and this package should not be distributed or used in any commercial way. If you do upload it somewhere other place than this, I ask you to copy this exact tutorial and licensing information with it, and also link back to this post. It would be nice to see my name there too ;D

================================================================================================================================

Maddog, OK, here is what I did from start to finish:

- Unpack the Onda standard firmware using ImageSuite (extract_img.bat). This creates a folder called "image.img.dump".

- Copy the 2 files RFSFAT16_SYSTEM_000000000 & RFSFAT16_BOOTLOADER_00000 into the ext4_utils directory on your Linux machine

- Under Linux:
cd ext4_utils

- Unpack the sparse "system" image into a mountable ext4 image called SYSTEM.img:
./simg2img RFSFAT16_SYSTEM_000000000 SYSTEM.img

(This will give a warning about CRC, but don't worry about it)

- Create a "mount point" (a directory to mount the image under) for the SYSTEM image:
mkdir SYSTEM

- Mount the filesystem under your mountpoint:
sudo mount -o loop SYSTEM.img SYSTEM

You need to run the "mount" command as "root" (the system administrator), which is what "sudo" does (sudo means "Super User DO the following"). You may have to enter your password.

- Now you can delete the Chinese apps in SYSTEM/app & SYSTEM/preinstall & install the ones you want & edit build.prop, etc/permissions etc

- When you are ready to create the new image, create another mount point for "mkuserimg.sh" (if it doesn't already exist):
mkdir temp

- Rebuild the sparse image (make sure that you did the mod to output_file.c & ran "make" before you do this):
sudo ./mkuserimg.sh -s SYSTEM RFSFAT16_SYSTEM_000000000 ext4 temp 400M

- If you updated build.prop, you will also need to update the copy in the BOOTLOADER filesystem. As this is a FAT filesystem which is not compressed, you can mount it directly:
mkdir BOOTLOADER
sudo mount -o loop RFSFAT16_BOOTLOADER_00000 BOOTLOADER

- Copy the new build.prop into BUILDLOADER/system/vendor

- Unmount the 2 filesystems (SYSTEM & BOOTLOADER):
sudo umount SYSTEM BOOTLOADER

Note: the command is "umount" not "unmount". (If you get a "busy" error unmounting, it means that somewhere you have a window that is under the SYSTEM or BOOTLOADER directory. Change directory so you aren't & try again). It is important to unmount because otherwise the image files may be corrupt because the files you copied in or changed may still be in RAM if you copy the image file while it is mounted.

- Move the 2 files RFSFAT16_SYSTEM... & RFSFAT16_BOOTLOADER... back to image.img.dump on your Windows system, and use "repack_ics.bat" in ImageSuite to build the new firmware image.

That's it!

Because I am using my tablet I haven't had a chance to reflash it and verify that it still works. I sure hope it does!

Regarding your "padlock" - I assume that this is appearing under Nautilus on the mount point of SYSTEM? If so, that isn't a problem, I get it too - it just means that you (the user you logged into Linux as) do not have access to create files under that directory. However as "root" (using sudo) you can. This should not cause a problem creating the sparse image because you do so using "sudo mkuserimg.sh ...", so it is running as "root".

沒有留言:

張貼留言