Self Updating Android Problem

This forum is for users of Microchip MPUs and who are interested in using Android.

Moderator: nferre

gyurko
Posts: 5
Joined: Mon Jul 08, 2013 7:39 pm

Self Updating Android Problem

Fri Apr 10, 2015 9:18 pm

We have designed a product based on the SAMA5D3 which runs Android.  One of the features of the product is to be able to perform software updates via a USB stick.
The Android app looks for a shell script file on the USB stick, and if it sees it, it launches it in a shell.
The shell script will, erase the proper NAND blocks for the Android system partition, and then reflash the partition with the Android system image.  I'm using flash_erase and nandwrite that I built from buildroot.  
The process has a problem where the first reboot after reflashing works fine, but when rebooting the second time the unit will hang due to a PMECC error in the Android partition.
Here's a section of the boot outputs




On the first reboot I see this:




UBIFS: mounted UBI device 0, volume 0, name "system"
UBIFS: mounted read-only
UBIFS: file system size:   118702080 bytes (115920 KiB, 113 MiB, 230 LEBs)
UBIFS: journal size:       10452992 bytes (10208 KiB, 9 MiB, 21 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  0 bytes (0 KiB)
usb 2-2.1: New USB device found, idVendor=0eef, idProduct=7200
usb 2-2.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-2.1: Product: eGalaxTouch EXC7200-0007v1001
usb 2-2.1: Manufacturer: eGalax Inc.
input: eGalax Inc. eGalaxTouch EXC7200-0007v1001 as /devices/ahb.0/600000.ohci/usb2/2-2/2-2.1/2-2.1:1.0/input/input1
hid-multitouch 0003:0EEF:7200.0001: input,hidraw0: USB HID v2.10 Pointer [eGalax Inc. eGalaxTouch EXC7200-0007v1001] on usb-at91-2.1/input0
UBIFS: recovery needed




On the second boot, this:
atmel_nand 60000000.nand: PMECC: Too many errors
UBI warning: ubi_io_read: error -5 while reading 516096 bytes from PEB 3:8192, read only 4096 bytes, retry
atmel_nand 60000000.nand: PMECC: Too many errors
UBI warning: ubi_io_read: error -5 while reading 516096 bytes from PEB 3:8192, read only 4096 bytes, retry
atmel_nand 60000000.nand: PMECC: Too many errors
UBI warning: ubi_io_read: error -5 while reading 516096 bytes from PEB 3:8192, read only 4096 bytes, retry
atmel_nand 60000000.nand: PMECC: Too many errors
UBI error: ubi_io_read: error -5 while reading 516096 bytes from PEB 3:8192, read 4096 bytes
[<c00124fc>] (unwind_backtrace+0x0/0xec) from [<c0226434>] (ubi_io_read+0x218/0x2e0)
[<c0226434>] (ubi_io_read+0x218/0x2e0) from [<c0224788>] (ubi_eba_read_leb+0x2b8/0x3bc)
[<c0224788>] (ubi_eba_read_leb+0x2b8/0x3bc) from [<c022319c>] (ubi_leb_read+0xd4/0x130)
[<c022319c>] (ubi_leb_read+0xd4/0x130) from [<c0147cc4>] (ubifs_leb_read+0x28/0x80)
[<c0147cc4>] (ubifs_leb_read+0x28/0x80) from [<c014e838>] (ubifs_start_scan+0x74/0xe8)
[<c014e838>] (ubifs_start_scan+0x74/0xe8) from [<c014ea88>] (ubifs_scan+0x24/0x2c0)
[<c014ea88>] (ubifs_scan+0x24/0x2c0) from [<c014d830>] (ubifs_read_master+0x44/0xd38)
[<c014d830>] (ubifs_read_master+0x44/0xd38) from [<c0143774>] (ubifs_fill_super+0x8d0/0x15c8)
[<c0143774>] (ubifs_fill_super+0x8d0/0x15c8) from [<c01455c0>] (ubifs_mount+0x3b4/0x448)
[<c01455c0>] (ubifs_mount+0x3b4/0x448) from [<c007ae2c>] (mount_fs+0x14/0xb8)
[<c007ae2c>] (mount_fs+0x14/0xb8) from [<c008fdec>] (vfs_kern_mount+0x50/0xbc)
[<c008fdec>] (vfs_kern_mount+0x50/0xbc) from [<c008fe8c>] (do_kern_mount+0x34/0xc8)
[<c008fe8c>] (do_kern_mount+0x34/0xc8) from [<c0090550>] (do_mount+0x630/0x6a4)
[<c0090550>] (do_mount+0x630/0x6a4) from [<c0091198>] (sys_mount+0x84/0xc4)
[<c0091198>] (sys_mount+0x84/0xc4) from [<c000de80>] (ret_fast_syscall+0x0/0x30)
UBIFS error (pid 1): ubifs_leb_read: reading 516096 bytes from LEB 1:0 failed, error -5
[<c00124fc>] (unwind_backtrace+0x0/0xec) from [<c0147d08>] (ubifs_leb_read+0x6c/0x80)
[<c0147d08>] (ubifs_leb_read+0x6c/0x80) from [<c014e838>] (ubifs_start_scan+0x74/0xe8)
[<c014e838>] (ubifs_start_scan+0x74/0xe8) from [<c014ea88>] (ubifs_scan+0x24/0x2c0)
[<c014ea88>] (ubifs_scan+0x24/0x2c0) from [<c014d830>] (ubifs_read_master+0x44/0xd38)
[<c014d830>] (ubifs_read_master+0x44/0xd38) from [<c0143774>] (ubifs_fill_super+0x8d0/0x15c8)
[<c0143774>] (ubifs_fill_super+0x8d0/0x15c8) from [<c01455c0>] (ubifs_mount+0x3b4/0x448)
[<c01455c0>] (ubifs_mount+0x3b4/0x448) from [<c007ae2c>] (mount_fs+0x14/0xb8)
[<c007ae2c>] (mount_fs+0x14/0xb8) from [<c008fdec>] (vfs_kern_mount+0x50/0xbc)
[<c008fdec>] (vfs_kern_mount+0x50/0xbc) from [<c008fe8c>] (do_kern_mount+0x34/0xc8)
[<c008fe8c>] (do_kern_mount+0x34/0xc8) from [<c0090550>] (do_mount+0x630/0x6a4)
[<c0090550>] (do_mount+0x630/0x6a4) from [<c0091198>] (sys_mount+0x84/0xc4)
[<c0091198>] (sys_mount+0x84/0xc4) from [<c000de80>] (ret_fast_syscall+0x0/0x30)
UBIFS error (pid 1): ubifs_start_scan: cannot read 516096 bytes from LEB 1:0, error -5




I'm not sure why the file system is being corrupted after the first reboot.




Is there something I'm missing?




Thanks,




Greg
willstrout
Posts: 1
Joined: Sat Apr 16, 2016 9:45 am

Re: Self Updating Android Problem

Sat Apr 16, 2016 10:13 am

I think some files might have been missed after the first boot. Therefore you have gotten the result during the second. I can't recognize this issue with these results. Would you please elaborate the code you have done?
blue_z
Location: USA
Posts: 1560
Joined: Thu Apr 19, 2007 10:15 pm

Re: Self Updating Android Problem

Mon Apr 18, 2016 10:35 pm

gyurko wrote:The shell script will, erase the proper NAND blocks for the Android system partition, and then reflash the partition with the Android system image.  I'm using flash_erase and nandwrite that I built from buildroot.
Your summary is omitting salient details.
What is the format of this image, e.g. UBIFS or UBI (ubinize output)?
gyurko wrote:Is there something I'm missing?
You shouldn't erase a UBI volume with MTD tools that will reset the erase counters (and reduce wear-leveling effectiveness).
You're not using the proper tools for UBI volumes and UBIFS filesystem.
See http://free-electrons.com/blog/managing ... ith-linux/

Regards

Return to “ANDROID”

Who is online

Users browsing this forum: No registered users and 1 guest