Difference between revisions of "How to edit prebuilt Android images"

 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Introduction ==
 
 
The article discusses the steps to follow in order to connect a display to your OLinuXino-LIME board.
 
 
Before continuing, please note that there are two major scenarios, depending on the display version you have available. The newer generation of displays require just a cable to connect to, while older generation of displays require additional adapter of the pitch.
 
 
=== How to determine whether you have newer generation or older generation display? ===
 
 
The names of the newer displays follow the pattern LCD-OLinuXino-XXX or LCD-OLinuXino-XXXTS. New ones were made with the idea to be able to connect to every OLinuXino or SOM board via one single cable. They have three LCD connectors at the back - one with 0.1 inch pitch; and two with 0.05 inch pitch. The first connector is used to connect the display to boards with 0.1 inch LCD connector. There are two 0.05 inch step ones because of the different layouts of LIME and LIME2 boards.
 
 
When you have determined whether you have newer or older display refer to the respective sub-chapter in the hardware setup below.
 
 
== Hardware setup ==
 
 
=== If you own a newer display ===
 
 
You would need a cable to connect to your board. LIME boards have a 0.05 inch step LCD connector so the proper cable is CABLE-40-40-10CM that also has 0.05 step. Product page of the cable [https://www.olimex.com/Products/Components/Cables/CABLE-40-40-10CM/ CABLE-40-40-10CM]
 
 
Skip to the software setup further below.
 
 
=== If you own an older display ===
 
 
'''The information in this chapter is suitable only for A10-OLinuXino-LIME and A20-OLinuXino-LIME. The customers with LIME2 board might follow the guide but instead of A10-OLinuXino-LIME-UEXT should use another adapter board specifically made for LIME2. The reason is that LIME2 LCD connector has a different layout compared to the previous LIME boards.'''
 
 
For the hardware connection would need two different cables and a small adapter board. The cables are called CABLE-40-40-10CM and CABLE-IDC40-15CM. The first one has different size connectors on each end – one of the ends has 0.05<nowiki>''</nowiki> step connector – the other 0.<nowiki>1''</nowiki> step connector. The second cable has same size connectors (both 0.1<nowiki>''</nowiki> step). The adapter is A10-OLinuXino-LIME-UEXT.
 
 
The connection goes like this:
 
 
OLinuXino-LIME BOARD –> CABLE-40-40-10CM –> A10-OLinuXino-LIME-UEXT –> CABLE-IDC40-15CM –> DISPLAY
 
 
To connect the display you would need to place CABLE-40-40-10CM between the LIME board and the small connector of A10-OLinuXino-LIME-UEXT. Then you need to place CABLE-IDC40-15CM between the display and the big connector of A10-OLinuXino-LIME-UEXT.
 
 
Be careful when disconnecting the pieces – especially around the 0.05<nowiki>''</nowiki> step connectors – attempting to pull the connector off the pins completely in one go, would probably result in bent pins or a broken connector. Try to lever the sides bit by bit with a suitable object.
 
 
We know that this is not the most convenient solution. We have improved the hardware design and future revisions of the displays would have a 0.05’’ connector at the back (while retaining the default 0.1<nowiki>''</nowiki> one). This would mean that a single CABLE-40-40-10CM would be required (no adapter or second cable). Such displays would be probably available by the end of 2014.
 
 
== Software setup ==
 
 
Once the hardware is ready-and-set we have to enable the video output configuration for our specific display.
 
 
The most important part is to use an official software distribution downloaded from the board’s wiki article. Then there are two major scenarios: using official Android or using official Debian Linux.
 
 
If you are using Android you would need to download a specific Android release from the wiki article that has support for your display. Currently there is a limited support under Android for NAND memory – typically, there are only two images with support for both HDMI + 7<nowiki>''</nowiki> display and HDMI + 10<nowiki>''</nowiki> display. The Android for microSD card can be modified easier but yet the ready images lack all video output options.
 
 
If you are using Debian Linux there is a ready script to execute. It lets you choose between a greater number of video output methods and resolutions. To be able to execute the script you would need some sort of connection to the board (either a default for the distribution display or HDMI monitor or serial debug cable or successful SSH connection). When you are logged in the board type:
 
 
  ./change_display* (* = press ‘tab’)
 
 
or
 
 
  ./change_display_aXX_lime.sh (XX processor of specific Lime board)
 
 
and press "Enter".
 
 
Then choose the resolution and the interface(LCD, HDMI). Note that the selection of a specific resolution is done by navigating with the arrow keys and pressing "space" button. Make sure the asterisk marks your selection properly.
 
 
The supported resolutions are:
 
  
 
==How to edit the parameters in Android distributions==  
 
==How to edit the parameters in Android distributions==  
Line 61: Line 4:
 
For almost any Olimex Allwinner board there are Android images provided. These are ready-to-use images with all the settings already configured. The images are generally two types: suitable for NAND memory boot of the boards; or suitable for a microSD card boot.
 
For almost any Olimex Allwinner board there are Android images provided. These are ready-to-use images with all the settings already configured. The images are generally two types: suitable for NAND memory boot of the boards; or suitable for a microSD card boot.
  
We often get asked to provide Android images with different set of settings or support for custom resolutions. Unfortunately, we are unable to compile Android images for every possible resolution and every possible Alwinner board.
+
We often get asked to provide Android images with different set of settings or support for custom resolutions. Unfortunately, we are unable to compile Android images for every possible resolution and every possible Alwinner board. This article would provide algorithms that would allow you to edit the Android parameters by yourself.
 
   
 
   
 
The easiest approach is to edit an already existing image as explained below. The other method would be to create an Android image from scratch.
 
The easiest approach is to edit an already existing image as explained below. The other method would be to create an Android image from scratch.
Line 67: Line 10:
 
<b> Note that the method for editing Android image suitable for NAND memory is completely different compared to the method for editing Android image suitable for microSD card.</b>
 
<b> Note that the method for editing Android image suitable for NAND memory is completely different compared to the method for editing Android image suitable for microSD card.</b>
  
===The algorithm to edit the Android image for the NAND memory:===
+
The sources for the Android images can be found in this repository (if decide to rebuild the images from scratch): [https://github.com/hehopmajieh/olinuxino_configs https://github.com/hehopmajieh/olinuxino_configs]
 +
 
 +
===The algorithm to edit the Android image for the NAND memory===
  
  1. Download the latest official Android image for NAND from the wiki article of your board.
+
To edit the configuration of official Android image suitable for the NAND memory follow the algorithm below:
  
  2. Download and extract the program used for editing the parameters of a ready image. The program is called DragonFace. It can be downloaded from here: https://github.com/OLIMEX/OLINUXINO/raw/master/SOFTWARE/dragonface/Dragonface_V2.1.2.zip
+
*1. Download the latest official Android image for NAND from the wiki article of your board.
  
  3. Start the program from DragonFace.exe and let it update on first launch.  
+
*2. Download and extract the program used for editing the parameters of a ready image. The program is called DragonFace. It can be downloaded from here: [https://github.com/OLIMEX/OLINUXINO/raw/master/SOFTWARE/dragonface/Dragonface_V2.1.2.zip download DragonFace 2.1.2 from Olimex GitHub]
  
  4. After the update is complete and the interface of the program is available click on the "Firmware" button and then load the *.img file that we got in point 1.
+
*3. Start the program from DragonFace.exe and let it update on first launch.  
  
During the opening of the firmware additional processes might attempt to start. Windows user account control might prompt for your approval. Make sure that you allow those.
+
*4. After the update is complete and the interface of the program is available click on the "Firmware" button and then load the *.img file that we got in point 1.
 +
**During the opening of the firmware additional processes might attempt to start. Windows user account control might prompt for your approval. Make sure that you allow those.
 +
**If you receive an error loading the image: ensure that the torrent program or any local or remote program or process that might interfere with the image had been closed and the link to the image had been terminated. If the image you are going to edit is open by another program you will not be able to edit it via DragonFace - the error that usually gets displayed in such a case is: "DragonFace: Firmware does not support the tools to modify, make sure that the firmware version: OK".
  
If you receive an error loading the image: ensure that the torrent program or any local or remote program or proccess that might interfere with the image had been closed and the link to the image had been terminated. If the image you are goind to edit is open by another program you will not be able to edit it via DragonFace - the error that usually gets displayed in such a case is: "DragonFace: Firmware does not support the tools to modify, make sure that the firmare version: OK".
+
*5. After the load is complete navigate to the "Advanced Settings" tab. In the tab select "System Configuration". This would open the configuration in simple text form in your default text editor. Refer to the picture below:<br>[[File:Df1.png|600px]]<br>
  
  5. After the load is complete navigate to the "Advanced Settings" tab. In the tab select "System Configuration". This would open the configuration in simple text form in your default text editor.
+
*6. Now we can edit parameters. More information on what the parameters mean and what values they might have is found here: [http://linux-sunxi.org/Fex_Guide http://linux-sunxi.org/Fex_Guide]
 +
**For example, to enable FullHD video output at 60Hz we need to change screen0_output_type and screen0_output_mode as follows: screen0_output_type = 3; screen0_output_mode = 10
  
  6. Now we can edit parameters. More information on what the parameters mean and what values they might have is found here: http://linux-sunxi.org/Fex_Guide
+
*7. After we are done we save the text file and close it. Then we click the button "Save" at the bottom of the DragonFace interface. A prompt windows would appear and would allow us to specify a save location and name for the edited image.
 +
**During the save operation of the firmware additional processes might attempt to start. Windows user account control might prompt for your approval. Make sure that you allow those.
  
For example, to enable FullHD video output at 60Hz we need to change screen0_output_type and screen0_output_mode as follows:
+
*8. Voila - we have an image with custom settings. We are ready to burn it to the NAND memory of the board.
  
screen0_output_type = 3
+
<br>
  
screen0_output_mode = 10, for 60 Hz
+
===The algorithm to edit the Android image for microSD card===
  
Under screen0_xxx_xxx it should be the HDMI settings.
+
To edit the configuration of official Android image suitable for the micrSD card memory follow the algorithm below:
  
  7. After we are done we save the text file and close it. Then we click the button "Save" at the bottom of the DragonFace interface. A prompt windows would appear and would allow us to specify a save location and name for the edited image.
+
*1. Identify what type of Android image for microSD card you have downloaded
 +
**There are two types of Android images for microSD card that we usually provide and each of them can be edited in a different way. The image provided for microSD card is either the native Android image that can be edited with a tool like the DragonFace mentioned above or an image taken from an already prepared microSD card which can't be loaded in DragonFace.
 +
**'''It is possible that only one of the types mentioned above is available for a specific board.'''
 +
**'''Why did you make two types of images microSD card images with Android?''' The original image was a bit hard to load to a microSD card and you had to use PhoenixSuit - a not-so-consistent program. Something more - it had no Linux alternative. The images that were a copy of a prepared microSD card are easier to deploy and use - just write the image to the microSD card.
 +
**'''But how to tell which image is which?''' It's simple - if the Android image for microSD card (that you downloaded from the wiki) opens successfully in DragonFace then it is the first type. If it doesn't load successfully - it is the second type. If the image is the first type go to step 2. If the image is the second type skip to step 3.
  
During the save operation of the firmware additional processes might attempt to start. Windows user account control might prompt for your approval. Make sure that you allow those.
+
*2. If the image is the first type (an image suitable for DragonFace) then simply follow the algorithm in the previous section: "The algorithm to edit the Android image for the NAND memory". That would allow you to modify the configuration and then you can upload it to your board using PhoenixSuit.
 +
**Note that the images suitable for DragonFace, generally, are  smaller than 1 GB of size, while the images that were copied off a prepared card are 4GB or 8GB of size.
  
  8. Voila we have an image with custom settings. We are ready to burn it to the NAND memory of the board.
+
*3. It is most likely that the image is the second type - not the original Android image card, but a copy of the memory of an already-prepared card. In that case to edit the configuration you would need to download the image to the card and edit the script.bin file located inside the card. You would need a card reader to do so.
 +
**Note that the card is prepared in EXT4 file system which is not native for Windows. This means that if you are using Windows you would probably have trouble editing the image and saving the changes. I've tested Windows tools that are supposed to do the job (like "Ext2Fsd", "ext2expolerer" and "DiskInternals Linux Reader") but I was unable to write the script.bin back onto the image. '''Thus, my only advice is to use a Linux computer or Linux virtual machine to explore the microSD card and change the configuration.'''
  
===The algorithm to edit the Android image for microSD card:===
+
*4 At this point you have located the script.bin file. However, you can't edit the script binary file directly so you would need to convert it to text format (it is called .fex in this case), then edit the parameters via a text editor and finally switch it back to the binary format.
 +
**The different options for the script are explained here: [http://linux-sunxi.org/Fex_Guide SUNXI FEX GUIDE]
 +
**IMPORTANT! ADJUSTING SCRIPT.BIN WITH IMPROPER VALUES MIGHT BREAK YOUR ANDROID IMAGE AND IT IS ALWAYS RECOMMENDED TO KEEP A BACK-UP OF YOUR DEFAULT SCRIPT.BIN
 +
**To convert back and forth the script.bin you might use different tools. You can find Windows tools here: [https://github.com/OLIMEX/OLINUXINO/tree/master/SOFTWARE/fex-bin-convertor-windows SUNXI TOOLS FOR WINDOWS] . For Linux convertors please check the sunxi tools here: [https://github.com/linux-sunxi/sunxi-tools SUNXI TOOLS]

Latest revision as of 05:10, 23 December 2015

How to edit the parameters in Android distributions

For almost any Olimex Allwinner board there are Android images provided. These are ready-to-use images with all the settings already configured. The images are generally two types: suitable for NAND memory boot of the boards; or suitable for a microSD card boot.

We often get asked to provide Android images with different set of settings or support for custom resolutions. Unfortunately, we are unable to compile Android images for every possible resolution and every possible Alwinner board. This article would provide algorithms that would allow you to edit the Android parameters by yourself.

The easiest approach is to edit an already existing image as explained below. The other method would be to create an Android image from scratch.

Note that the method for editing Android image suitable for NAND memory is completely different compared to the method for editing Android image suitable for microSD card.

The sources for the Android images can be found in this repository (if decide to rebuild the images from scratch): https://github.com/hehopmajieh/olinuxino_configs

The algorithm to edit the Android image for the NAND memory

To edit the configuration of official Android image suitable for the NAND memory follow the algorithm below:

  • 1. Download the latest official Android image for NAND from the wiki article of your board.
  • 3. Start the program from DragonFace.exe and let it update on first launch.
  • 4. After the update is complete and the interface of the program is available click on the "Firmware" button and then load the *.img file that we got in point 1.
    • During the opening of the firmware additional processes might attempt to start. Windows user account control might prompt for your approval. Make sure that you allow those.
    • If you receive an error loading the image: ensure that the torrent program or any local or remote program or process that might interfere with the image had been closed and the link to the image had been terminated. If the image you are going to edit is open by another program you will not be able to edit it via DragonFace - the error that usually gets displayed in such a case is: "DragonFace: Firmware does not support the tools to modify, make sure that the firmware version: OK".
  • 5. After the load is complete navigate to the "Advanced Settings" tab. In the tab select "System Configuration". This would open the configuration in simple text form in your default text editor. Refer to the picture below:
    Df1.png
  • 6. Now we can edit parameters. More information on what the parameters mean and what values they might have is found here: http://linux-sunxi.org/Fex_Guide
    • For example, to enable FullHD video output at 60Hz we need to change screen0_output_type and screen0_output_mode as follows: screen0_output_type = 3; screen0_output_mode = 10
  • 7. After we are done we save the text file and close it. Then we click the button "Save" at the bottom of the DragonFace interface. A prompt windows would appear and would allow us to specify a save location and name for the edited image.
    • During the save operation of the firmware additional processes might attempt to start. Windows user account control might prompt for your approval. Make sure that you allow those.
  • 8. Voila - we have an image with custom settings. We are ready to burn it to the NAND memory of the board.


The algorithm to edit the Android image for microSD card

To edit the configuration of official Android image suitable for the micrSD card memory follow the algorithm below:

  • 1. Identify what type of Android image for microSD card you have downloaded
    • There are two types of Android images for microSD card that we usually provide and each of them can be edited in a different way. The image provided for microSD card is either the native Android image that can be edited with a tool like the DragonFace mentioned above or an image taken from an already prepared microSD card which can't be loaded in DragonFace.
    • It is possible that only one of the types mentioned above is available for a specific board.
    • Why did you make two types of images microSD card images with Android? The original image was a bit hard to load to a microSD card and you had to use PhoenixSuit - a not-so-consistent program. Something more - it had no Linux alternative. The images that were a copy of a prepared microSD card are easier to deploy and use - just write the image to the microSD card.
    • But how to tell which image is which? It's simple - if the Android image for microSD card (that you downloaded from the wiki) opens successfully in DragonFace then it is the first type. If it doesn't load successfully - it is the second type. If the image is the first type go to step 2. If the image is the second type skip to step 3.
  • 2. If the image is the first type (an image suitable for DragonFace) then simply follow the algorithm in the previous section: "The algorithm to edit the Android image for the NAND memory". That would allow you to modify the configuration and then you can upload it to your board using PhoenixSuit.
    • Note that the images suitable for DragonFace, generally, are smaller than 1 GB of size, while the images that were copied off a prepared card are 4GB or 8GB of size.
  • 3. It is most likely that the image is the second type - not the original Android image card, but a copy of the memory of an already-prepared card. In that case to edit the configuration you would need to download the image to the card and edit the script.bin file located inside the card. You would need a card reader to do so.
    • Note that the card is prepared in EXT4 file system which is not native for Windows. This means that if you are using Windows you would probably have trouble editing the image and saving the changes. I've tested Windows tools that are supposed to do the job (like "Ext2Fsd", "ext2expolerer" and "DiskInternals Linux Reader") but I was unable to write the script.bin back onto the image. Thus, my only advice is to use a Linux computer or Linux virtual machine to explore the microSD card and change the configuration.
  • 4 At this point you have located the script.bin file. However, you can't edit the script binary file directly so you would need to convert it to text format (it is called .fex in this case), then edit the parameters via a text editor and finally switch it back to the binary format.
    • The different options for the script are explained here: SUNXI FEX GUIDE
    • IMPORTANT! ADJUSTING SCRIPT.BIN WITH IMPROPER VALUES MIGHT BREAK YOUR ANDROID IMAGE AND IT IS ALWAYS RECOMMENDED TO KEEP A BACK-UP OF YOUR DEFAULT SCRIPT.BIN
    • To convert back and forth the script.bin you might use different tools. You can find Windows tools here: SUNXI TOOLS FOR WINDOWS . For Linux convertors please check the sunxi tools here: SUNXI TOOLS