Reprinted, please indicate the source and author of the article!
Source: http://blog.csdn.net/xl19862005
By xandy)
Today, when we added the rescale mode upgrade feature to Ti omap3's Android system, we found that this part of Ti was not done at all and can only be handled by ourselves. refer to the previous Freescale I. the procedure of the mx53 platform is as follows:
1. Modify the bootloader part
1.1 add cache and recovery Partition
/* Initialize the name of fastboot flash name mappings */
Fastboot_ptentry PTN [] = {
{
. Name = "xloader ",
. Start = 0x0000000,
. Length = 0x0020000,
/* Written into the first 4 0x20000 Blocks
Use hw ecc */
. Flags = fastboot_ptentry_flags_write_ I |
Fastboot_ptentry_flags_write_hw_ecc |
Fastboot_ptentry_flags_hw_ecc_layout_2 |
Fastboot_ptentry_flags_repeat_4,
},
{
. Name = "bootloader ",
. Start = 0x0080000,
. Length = 0x01c0000,
/* Skip Bad blocks on write
Use hw ecc */
. Flags = fastboot_ptentry_flags_write_ I |
Fastboot_ptentry_flags_write_hw_ecc |
Fastboot_ptentry_flags_hw_ecc_layout_2,
},
{
. Name = "environment ",
. Start = smnand_env_offset,/* set in config file */
. Length = 0x0040000,
. Flags = fastboot_ptentry_flags_write_hw_ecc |
Fastboot_ptentry_flags_hw_ecc_layout_1 |
Fastboot_ptentry_flags_write_env,
},
{
. Name = "kernel ",
/* Test with start close to Bad Block
The is dependent on the individual board.
Change to what is required */
/*. Start = 0x0a00000 ,*/
/* The real start */
. Start = 0x0280000,
. Length = 0x0500000,
. Flags = fastboot_ptentry_flags_write_hw_ecc |
Fastboot_ptentry_flags_hw_ecc_layout_1 |
Fastboot_ptentry_flags_write_ I,
},
{
. Name = "cache ",
/* Test with start close to Bad Block
The is dependent on the individual board.
Change to what is required */
/*. Start = 0x0a00000 ,*/
/* The real start */
. Start = 0x00780000,
. Length = 0x0100000,
. Flags = fastboot_ptentry_flags_write_hw_ecc |
Fastboot_ptentry_flags_hw_ecc_layout_1 |
Fastboot_ptentry_flags_write_ I,
},
{
. Name = "recovery ",
/* Test with start close to Bad Block
The is dependent on the individual board.
Change to what is required */
/*. Start = 0x0a00000 ,*/
/* The real start */
. Start = 0x00880000,
. Length = 0x0500000,
. Flags = fastboot_ptentry_flags_write_hw_ecc |
Fastboot_ptentry_flags_hw_ecc_layout_1 |
Fastboot_ptentry_flags_write_ I,
},
{
. Name = "system ",
. Start = 0x01380000,
. Length = 0x1f280000,
. Flags = fastboot_ptentry_flags_write_hw_ecc |
Fastboot_ptentry_flags_hw_ecc_layout_1 |
Fastboot_ptentry_flags_write_ I,
},
};
Note the relationship between start and length. length must be larger than the imgfile to be flushed into the partition. After compilation, my recovery. the IMG size is about 2 MB. Here I partition the size of 5 MB of the recovery partition.
1.2 modify bootcommand
/* Ubi. MTD = 5 indicates that the root file system of the entire system is on the fifth MTD.
** It corresponds to the fastboot_ptentry PTN partition in board/CSST/zt6810.c.
***/
/* Xandy add for recovery */
# Ifdef config_android_recovery
/* SD/MMC card boot */
# Define config_android_recovery_bootargs_mmc \
"Setenv bootargs $ {bootargs} init =/init root =/dev/mmcblk1p4 rootfs = ext4"
# Define config_android_recovery_boot1__mmc \
"Run bootargs_android_recovery; MMC read 0 $ {loadaddr} 0x800 0x2000; bootm"
/* Nand flash Boot */
# Define config_android_recovery_bootargs_nand \
"Setenv bootargs $ {bootargs} init =/init console = ttyo2, 115200n8 noinitrd IP = OFF "\
"Rootwait mem = 512 m rw ubi. MTD = 5, 2048 rootfstype = ubifs root = ubi0: rootfs rootdelay = 2 "\
"Omapdss. def_disp = LCD "\
"VRAM = 8 m omapfb. VRAM = 0: 8 m mpurate = 1000 \ 0"
# Define config_android_recovery_boot1__nand \
"Run bootargs_android_recovery; NAND read $ {loadaddr} 280000 500000; bootm"
# Define config_android_recovery_assist_file "/recovery/command"
# Define config_android_system_partition_mmc 2
# Define config_android_recovery_partition_mmc 4
# Define config_android_cache_partition_mmc 6
# Endif
/* "Bootargs = init =/init console = ttyo2, 115200n8 no_console_suspend noinitrd IP = off"
* The serial port does not sleep after no_console_suspend system suspend
*/
# Ifdef config_sys_use_ubi
# Define config_extra_env_settings \
"Loadaddr = 0x82000000 \ 0 "\
"Nandboot = echo booting from NAND ...;"\
"NAND read $ {loadaddr} 280000 500000; bootm $ {loadaddr} \ 0 "\
"Bootcmd = run nandboot \ 0 "\
"Bootargs = init =/init console = ttyo2, 115200n8 noinitrd IP = OFF "\
"Androidboot. Console = ttyo2 rootwait mem = 512 m rw ubi. MTD = 6, 2048 "\
"Rootfstype = ubifs root = ubi0: rootfs rootdelay = 2 "\
"Omapdss. def_disp = LCD "\
"VRAM = 8 m omapfb. VRAM = 0: 8 m mpurate = 1000 \ 0"
# Endif
Note that
UBI. MTD = 6, 2048. this parameter is set to ubi. MTD = x. Here, X corresponds to the partitions in 1.1, and the partition number starts from 0!
1.3 add librecovery.
This part directly introduces the recovery from the Freescale bootloader. C and. copy the H file and modify it. At first, I put these files under the "/"/recovery directory (the "vendor" directory corresponds to the current project directory) and added the corresponding makefile, during compilation, I found out why this part of the source code does not reference compilation. Later I checked the MAKEFILE file in the root directory of Bootloader and found the following content:
Libs + = $ (shell if [-F board/$ (vendor)/common/makefile]; Then ECHO \
"Board/$ (vendor)/common/Lib $ (vendor). A"; FI)
Therefore, we found that we did not add the added files to the makefile in the root directory, so we could not get the expected. file a, rename the recovery directory to common, compile, OK, and pass.
1.4 judgment on adding the recovery system to start_armboot
Void start_armboot (void)
{
.
.
.
.
# Ifdef config_android_recovery
Check_recovery_mode ();
# Endif
# If defined (config_cmd_net)
# If defined (config_net_multi)
Puts ("Net :");
# Endif
Eth_initialize (Gd-> BD );
# If defined (config_reset_phy_r)
Debug ("Reset Ethernet PHY \ n ");
Reset_phy ();
# Endif
# Endif
/* Main_loop () can return to retry autoboot, if so just run it again .*/
For (;;){
Main_loop ();
}
/* Notreached-No Way Out of command loop handle T booting */
}
How does check_recovery_mode determine whether to implement the recovery mode?
This part of content is detailed in the blog "android recovery mode and Rom production" I wrote last year. The original Article address:
Http://blog.csdn.net/xl19862005/article/details/8517918
(Subsequent updates ......)