Android Tablets Forum banner
1 - 20 of 82 Posts

·
Registered
Joined
·
1,851 Posts
Helpful Links - Firmware Development / Tweaking / Hacking

As you can see, Geodex just created the "Firmware / Development" sub-forum for us. I'm going to compile some useful links for new amateur developers. I am not a developer and have just starting learning about these things. At the very least these links should give people like me a starting point to check out what's inside the files that make up our firmware.

Elf II Source Code:- Since Ainol hasn't released the Crystal Source Code yet and the Crystal is basically an Elf II with a different screen and different WiFi chip, these should be useful starting points.
Ainol Official Release
fards github
My Development Tools Folder on MediaFire

At the moment I am just working with the stock firmware. You can download the stock firmware and then extract the .zip file to get started. I've been told the real development work is done in the kernel though. I'd like to get into the kernel and touchscreen drivers after I've created a stable custom ROM.

RESOURCES AND SCRIPTS

DragonDev's Learning Center - Not a lot here but this is where I write up things that I've learned along the way and post it for other people to learn as well.

XDA-University - Lots of great starter information from the people behind XDA-Developers.

XDA Developers Forum - One of the best places to do your research.

Android Terms, Slang and Definitions - Super handy for understanding terms you may not have run into before.

Update.zip - Ainol Zip Signer - Thanks to Soulflier we can easily sign our update.zip files. You'll need this to be able to make a flashable .zip file.

Unpack and Repack Boot.img - Thanks to Christian Troy for these scripts. You need them to be able unpack and repack the boot.img. They will also unpack and repack the uImage which, as far as I know, is the same thing. Here are some alternative scripts.

Add Root to your ROM - Thanks to Soulflier on this one. I packaged this as the files you need and the folders you need to move those files into. Then open the add-to-updater-script file and add the lines in there to your updater-script.

Add Init.d Support - These are the files and folders you need to add init.d support to your ROM.

Kernel Governors, Modules, I/O Schedulers, CPU Tweaks, AIO App Configs - Giant reference guide.

Alternate ways to Sign packages and ROM's - SignAPK or AutoSign. You would need to re-work them though with the signing keys from the Ainol Signer.

Decompile/Recompile Android applications - This may or may not end up being useful for customized Flash/YouTube/Netflix.

Creating your own UPDATE.zip - For adding or deleting apps from an UPDATE.zip.

SOFTWARE

Android Developer Tools (ADT) Bundle - This is the official Android SDK developers package.

Cygwin - Limited Linux capabilities and terminal in Windows.

dsixda's Android Kitchen, v0.218 - ROM Kitchen that runs in Cygwin. A collection of scripts to help you build/extract, deodex, root, zip-align, sign APK and ZIP files, etc. The boot.img extraction does not work and neither does the update.zip signing. I haven't figured out how to build the working scripts for those options into the Kitchen, so I use the stand alone versions listed in the scripts section. You'll also have to manually fix issues when converting between update-script (Amend) and updater-script (Edify), so you'll have to know how to read that and what to be looking for. What this kitchen will do is deodex your apps/framework and zipalign.

ONDA Kitchen - ROM Kitchen that works in Cygwin. Mostly works fine with the Crystal but it's not as stable as dsixda's kitchen. It seems to work better with the Crystal because it uses the same CPU as the ONDA (I think), but I get a lot of freezes/crashes using it.

VirtualBox - Run a complete Linux operating system inside of Windows.

Ubuntu - This is one of the Linux operating systems I've used over the years. I've found it to be one of the easier ones to get used to if you've never used Linux before.

Linux Mint - Another Linux OS that looks pretty nice and seemed easy to get adjusted to but I ended up going back to Ubuntu.
 

·
Registered
Joined
·
1,851 Posts
Place Holder - What's in the folders - In Progress

I'm just compiling what I learn as I go so please correct me if any of this information is wrong. I've mostly been playing around with the stock firmware.

Files in an update Package

1. factory_update_param.aml - Commands for updating your package.

--wipe_data
--wipe_cache
--wipe_media
--update_package=/sdcard/g06refe2-ota-eng.grady.wang.zip
2. update.zip - The firmware you are flashing.

3. u-boot.bin - U- Boot (Universal Bootloader) is mostly used to load and boot a kernel image, but it also allows to change the kernel image and the root filesystem stored in flash. It also initializes the CPU and onboard hardware.

4. uImage - Contains Kernel and Ramdisk. Same as a boot.img.

5. uImage_recovery - Recovery that loads before firmware starts

---

Files for AML Image Burn Tool

This is all totally theoretically and based off of a post in the AML Flash Tool thread and my exploration on the files.

1. config_progress.xml - This contains the commands for the AML Image Burn Tool software.

2. u-boot-orig.bin - I think this then loads a basic bootloader allowing the USB tool to interact with the device and change the kernel image and root filesystems stored in the NAND. My guess is that it also configures the CPU and onboard hardware at this point.

3. uImage_usb_burning - This is the uImage and appears to be the recovery but contains some extra commands in the "etc" folder and a complete build.prop in "default.prop." It also contains images for the auto-flash android icon in the "res" folder.

4. usb_spl.bin - "Second Program Loader." This is a second stage bootloader protocol for ROM (Read Only Memory) access. It allows M3 or M6-Chip Configuration and installs a small, basic bootloader that allows u-boot-orig.bin to run.

5. update.zip - Your basic firmware package.

This is the code inside the config_progress.xml for the Fire2 with notations:

<?xml version="1.0" encoding="UTF-8"?>
<progress_configs>
<command sn="0" path="usb_spl.bin" address="0xd9000000" run="true">load spl</command> (Loads SPL into RAM buffer)
<command sn="1" path="u-boot-orig.bin" address="0x8f800000" run="true">load uboot</command> (Loads basic bootloader into RAM buffer)
<command sn="2" >crc 0x8f800000 size value</command> (Checks for errors in bootloader in RAM buffer location)
<command sn="3" >run 0x8f800000</command> (Runs the bootloader)
<command sn="4">set_chgcur 0</command> (Sets charger current to zero)
<command sn="5">video dev bl_off</command> (Video device backlight off)
<command sn="6">video dev disable</command> (Video device disabled)
<command sn="7">sf probe 2</command> (Detects SPI - the low level flash memory)
<command sn="8">sf erase 0 100000</command> (Erases SPI - the low level flash memory)
<command sn="9">nand erase 4000000</command> (Erases the nand memory)
<command sn="10">defenv</command> (Setting the environment)
<command sn="11">setenv bootargs ${bootargs} a9_clk_max=600000000</command> (Set environments boot arguments - cortex-a9 clock frequency)
<command sn="12" cmd="setenv recovery_command --usb_burning" address="0x82000000">load addr</command> (Set location to load uImage recovery into RAM and set the environment)
<command sn="13">cmd_in_mem 0x82000000</command> (Store the above command in memory)
<command sn="14">save</command> (Save progress in memory)
<command sn="15" path="uImage_usb_burning" address="0x82000000" run="false">load uimage</command> (Loads uImage recovery - is set to false)
<command sn="16" >crc 0x82000000 size value</command> (Checks for errors in uImage recovery)
<command sn="17">bootm 0x82000000</command> (Boot uImage recovery from RAM)
<command sn="18">wipe_data</command> (Wipe /data)
<command sn="19">wipe_cache</command> (Wipe /cache)
<command sn="20" count="150">update:update_qimei.zip</command> (Flash firmware)
<command sn="21" count="150">update:patch_ainol_e4.zip</command> (Flash Patch)
<command sn="22">copy_media</command> (Copy /media)
<command sn="23">shutdown</command> (Shutdown)
</progress_configs>
---


Files in a zipped ROM


First folder:

1. meta-inf - contains the script needed to install the rom.
2. system - contains the system files and folder of the custom rom
3. additional file - additional file that contains scripts needed to install additional features (eg: busybox, additional app in data/app, and install custom kernel) in the custom rom.
4. boot.img - bootloader and kernel

In system folder:

1. app - contains all the system apps
2. bin - contains the command and bin files for the rom
3. etc - additional settings and files for the rom
4. font - the fonts
5. framework - system's framework
6. lib - drivers and modules
7. media - alarms, notifications, ringtones, system sounds and boot animation
8 package_config - Unsure what this is.
9. resource - contains pictures for the battery image
10. tts - languages for text-to-speech
11. usr - files needed for keyboard, bluetooth, etc.
12. xbin - additional command and bin files (busybox, superuser and bash)
13. build.prop - modify some content like name of ROM, build date, dpi, etc.

---


Files in an unpacked boot.img/uImage


First folder:

1. initramfs - unpacked initramfs.cpio folder or RAMdisk. The RAMdisk is a small partition image that is mounted read-only by the kernel at boot time. It only contains init and config files. It is used to start init which will mount the rest of the system images properly and run the init procedure.
2. image - Kernel image.
3. image-ext - uncompressed "image" file.
4. initramfs.cpio - packaged initramfs.

In initramfs folder:

1. boot -
2. data -
3. dev -
4. proc -
5. sbin -
6. sys -
7. system -
8 default.prop -
9. init -
10. init.factorytest.rc -
11. init.goldfish.rc -
12. init.trace.rc -
13. init.usb.rc -
15. initlogo.rle.bak -
16. ueventd.amlogic.rc -
17. ueventd.goldfish.rc -
18. ueventd.rc -

---

System App Customization

Deodexed vs. Odexed ROM - Almost every stock app in android consist of two parts; *apk files and *dex/odex files. Deodexed ROM's make it easier to apply themes and customize your system apps. Odexed ROM's consume less memory (RAM) and initial booting is quicker.

Odexed -The *dex file needed to run the app is placed in the same folder with the *apk files (/system/app). They consume less memory (RAM) but take up more storage space in your "/data" partition.

Deodexed - The *dex is compiled back into the *apk file and extracted into /data/dalvik-cache when you boot. The apps can be themed and consume less space in your "/data" partition, also allowing you to put more apps in the "/system/app" folder. Deodexed apps use more RAM though.

You can add or remove any app in /system/app folder as long as you don't exceed the space in your system partition (220MB?). You can not remove any apps that are essential to your operating system. It is important to leave at least 20mb of free space in system partition.

The Android Kitchen can be used to automatically deodex your ROM.
 

·
Registered
Joined
·
1,851 Posts
Placeholder - Mods & Tweaks
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #4 ·
Place Holder - FAQ
 

·
Registered
Joined
·
49 Posts
Did someone actually try to build a custom Kernel for the Crystal? Could it be tested by loading it from SD?

I think, it kind of works to dualboot the Tablet from microsd without modifing the content of the tablet. Sadly it's a bit over my head.
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #6 ·
Did someone actually try to build a custom Kernel for the Crystal? Could it be tested by loading it from SD?

I think, it kind of works to dualboot the Tablet from microsd without modifing the content of the tablet. Sadly it's a bit over my head.
As far as I know there are no custom Kernels for the Crystal yet. Unless one of the firmware developers here made changes for their release and didn't rename the Kernel, when I loaded SoulGem, Jasper and CM10 onto my tablet, they all showed the same Kernel. From what I understand, a custom Kernel can either be flashed like any other zip and injected into the firmware or it can be built into a custom ROM. I think it would be possible to use the ELF II kernel to build a custom Crystal kernel but I'm not entirely sure.

I've been working with the official 9-28 firmware to start out, since I have a legacy first batch Crystal and can't test the g-sensor and camera problems. I've unpacked the boot.img and I've been taking a look at everything but, although I wouldn't say it's over my head, I'm learning as I go so it is sort of slow and I wouldn't expect much out of me unless suddenly a bunch of people started getting interested and sharing on this thread.

I must say that it's all really interesting and I've learned a whole lot of Java & XML language over the last week.
 

·
Registered
Joined
·
9 Posts
- Update.zip Signer
- Unpack and Repack Boot.img
- Add Root to your ROM
- Add Init.d Support

broken links...
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #8 ·
- Update.zip Signer
- Unpack and Repack Boot.img
- Add Root to your ROM
- Add Init.d Support

broken links...
Fixed. I had to change over to mediafire.com because I ran out of bandwidth on Box.com.
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #10 ·

·
Registered
Joined
·
50 Posts
Hi fuser-invent,

real nice collection of tools and knowledge to step into androids world.

Lets get started to cook an amlogic rom.


JDfense
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #12 ·
I would love to see some more ROM development around here. So far it looks like only Christian Troy and I are left.
 

·
Registered
Joined
·
50 Posts
Yes the hype around a tablet could suddenly end. For my other tablets I have no more traffic. The crystal is my new one. I want to learn how modding with amlogic works, so I began to read your collection. For shure, I will stay for a while.

I have a tradition of the topic, while a thread is sleeping, some music always helps.

My link

JDfense
 

·
Registered
Joined
·
50 Posts
I'm back again with a question. Possible a real stupid one. I began with stockrom for my batch2 crystal. First I wanted to root the room and copied the files and script files from Troy in the rom. I have only opened the rom with 7zip(tried it with winrar, too), not extracted for doing the changes, but I got always a status 7 failure, while I was flashing the rom. I have used stock recovery and TWRP - same result.
What did I miss?

JDfense
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #15 ·
The best thing to do is use the crystal_signer files to officially sign your package, just in case. If you want to flash in the stock recovery use the META folder from a stock zip, if you want to flash in TWRP then use a META folder from a TWRP zip. Make sure to check your updater-script to see if everything is correct. You can always look at another ROM's updater-script if you have a question but you need to add this to yours:

Code:
set_perm_recursive(0, 0, 0755, 0644, "/system/app");<br />
set_perm(0, 0, 6755, "/system/xbin/su");<br />
symlink("/system/xbin/su", "/system/bin/su");
 

·
Registered
Joined
·
50 Posts
Tried to fix it with changing the meta-inf, but
i have still error messages, but rom flashed complete. Parts of the script must fail.
JDfense

edit:
Now I got a rooted and deodexed stock rom with Meta-inf from TWRP.zip, but flashing works only with stock recovery so fare.
This evil permission stuff.
 

·
Registered
Joined
·
50 Posts
Has someone an idea, why the signer for the amlogic roms does not work on winXP for me. I get a zero KB zip always, but on my win7 the same modded rom with the samer signer works perfect.


JDfense
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #18 ·
What errors are you getting? I have no idea why the scripts don't work in XP, I've been using Windows 7 for a pretty long time now. Are you using cygwin or the windows command prompt?
 

·
Registered
Joined
·
50 Posts
What errors are you getting? I have no idea why the scripts don't work in XP, I've been using Windows 7 for a pretty long time now. Are you using cygwin or the windows command prompt?
Both. But I thought for the signapk.jar I don't need any extra tools.Only the unsigned zip rom with the fitting name in the batch in the same folder. Then double click on the batch file. Waiting. Ready.

Only one error while signing. A signed.zip file with zero kilobyte and thats not funny.


JDfense

PS.: Forgot to mention, I have a batch2 crystal and my rom in progress based on 1119 stock rom.
 

·
Registered
Joined
·
1,851 Posts
Discussion Starter · #20 ·
double clicking on the bat file doesn't work for me. I navigate to the folder with cygwin and type ./signerscript.bat
 
1 - 20 of 82 Posts
Top