Jump to content


Photo

AVIC Development Mod - Device Backup

bsp backup nor development mod xda linux avic development kernel boot dev

  • Please log in to reply
37 replies to this topic

#1 bass_rock

bass_rock

    Member

  • Members
  • 166 posts

Posted 10 August 2015 - 11:33 PM

Introduction

 

With the Introduction of the AVIC Development Mod (http://avic411.com/i...evelopment-mod/). We would like to encourage you to backup your AVIC Internal SD Card and its NOR Flash.  Lets also keep all backup links and discussion here 

 

NEVER ENTER COPY DEVICE MODE, YOU WILL BRICK YOUR DEVICE!

 

The following will show you how to do that:

 

1. Backup your current BSP and Nor Flash.

 

A. Download the attached NORFlashBackup.zip
B. Extract the contents to a FAT32 or NTFS USB Stick.
C. Insert the USB Stick to USB Port 1 on the device.
D. Follow the "Copy Script Mode" steps. On http://avic411.com/i...evelopment-mod/
E. Grab the USB Stick and save off the mtd0_backup1 -3 files. (Should your device ever brick, these can be used with a JTAG to fully restore your NOR flash or to find out your default BSP Settings)

 

2. Backup your Internal SD Card (Skip to 3 if you have an unlocked image you want to use)

A. Download the attached InternalSDCardBackup.zip
B. Extract the contents to a NTFS (IMPORTANT as FAT32 can not store files bigger than 4GB) USB Stick (You can also use a SD Card on the external SD Card if you edit the script). ALSO: The USB Stick must be bigger then your internal SD Card, to store the image. Known sizes are: 4000 - 4GB, 5000-7000 - 8GB, 8000 - 16GB. THIS IS A CURRENT GUESS. To be safe, use a USB Stick larger than 16GB.
C. Insert the USB Stick to USB Port 1 on the device.
D. Follow the "Copy Script Mode" steps.  http://avic411.com/i...evelopment-mod/

 

(NOTE: This can take a long time depeneding on your device's intenral SD Card size. It can also timeout, Pressing the Vol - while this is running every 15 min seems to keep it from turning off.) It took us 45 min to copy the 4GB card on the 4000 NEX copying to USB1. It took ~40 minutes for a 16GB internal card and 64GB external SD Card (copyscript copying data to external SD, instead of the USB) with 1MB block size (bs=1048576 parameter). For someone else it took ~80 minutes for a 16GB SD Card copying to USB.

 

E. Grab the USB Stick and save off the AVIC.img file to your computer. This is the full Unlocked SD Card Image of your device.

Attached Files



#2 e0x70i

e0x70i

    Member

  • Members
  • 23 posts

Posted 12 August 2015 - 05:36 AM

NOR Backup and SD Card backup worked. NOR backup completed instantly to USB1.

 

Backing up to /sdcard/ for the SDcard backup took about 30 minutes. Pressed the volume minus button a handful of times. 

 

After putting the SD Card back into my computer, however, windows gave the error  "found errors on this drive. to prevent data loss, repair this drive now." After scanning the drive, it said no errors were found. Maybe I ejected it wrong from my machine initially, or the linux NTFS drivers on the next are causing weirdness. 

 

I copied the avic.img over . Despite the windows error message, the file looks fine. it is 16,130,244,608 bytes (15.0 GB). I may try one more time and see if I still get that error. 

 

 

 

 

 

 

 



#3 WhatIsWhatIsWhatIsWhat

WhatIsWhatIsWhatIsWhat

    Member

  • Members
  • 234 posts

Posted 12 August 2015 - 11:04 AM

For 16GB cards I saw two sizes of backup image:

16 130 244 608 bytes

16 138 633 216 bytes

Difference is exactly 8 megabytes. I think this is due to the peculiarities of the sd card itself.

 

If you want to check contents of this backup image:

 

If you have access to *nix system, you can call fdisk -l ./avic.img to show partition information in this image and then mount partitions manually by mount + mount offset parameter. Also, you can use easy to use utility kpartx to mount this backup image and view files.

 

As for Windows - at least FAR Manager is able to view and extract whole partitions from this image. This partitions is ext4-filesystems, so then you will need to extract data from ext4-partitions. You can google for ImgExtractor or something another to do this.


Please join our Pioneer-related groupchat to get help. Sorry, I do not read or respond to private messages. Please contact me via groupchat.

#4 e0x70i

e0x70i

    Member

  • Members
  • 23 posts

Posted 13 August 2015 - 04:12 PM

kpartx -l AVIC.img gives me no output.

 

fdisk -l   AVIC.img gives me 

              Device Boot      Start         End      Blocks   Id  System
/wordlists/AVIC.img1         1050624     1071103       10240   83  Linux
/wordlists/AVIC.img2         1071104     1091583       10240   83  Linux
/wordlists/AVIC.img3         1091584     3573759     1241088    5  Extended
/wordlists/AVIC.img4         3573760    30197759    13312000   83  Linux
/wordlists/AVIC.img5         1091585     1153023       30719+  83  Linux
/wordlists/AVIC.img6         1153025     1214463       30719+  83  Linux
/wordlists/AVIC.img7         1214465     2263039      524287+  83  Linux
/wordlists/AVIC.img8         2263041     2525183      131071+  83  Linux
/wordlists/AVIC.img9         2525185     3573759      524287+  83  Linux

and partedx  AVIC.img gives me

# 1:   1050624-  1071103 (    20480 sectors,     10 MB)
# 2:   1071104-  1091583 (    20480 sectors,     10 MB)
# 3:   1091584-  3573759 (  2482176 sectors,   1270 MB)
# 4:   3573760- 30197759 ( 26624000 sectors,  13631 MB)
# 5:   1091585-  1153023 (    61439 sectors,     31 MB)
# 6:   1153025-  1214463 (    61439 sectors,     31 MB)
# 7:   1214465-  2263039 (  1048575 sectors,    536 MB)
# 8:   2263041-  2525183 (   262143 sectors,    134 MB)
# 9:   2525185-  3573759 (  1048575 sectors,    536 MB)

The only partition I can mount is # 4,  with 

 

Logical partiations of 3 seem to mount fine from the ones I have tried

mount -o loop,offset=1829765120  AVIC.img /mnt/avic4
mount -o loop,offset=621806080  AVIC.img /mnt/avic7
mount -o loop,offset=1292894720 AVIC.img /mnt/avic9
 
 

 

 
EDIT:Doh! was trying tou mount Extended partition directly, so the below error is expected. partitions 1-2 also error out. guessing this aren't ext4, some kind of bootloader? I'll re-read the first post and the github page to make sure I understand the structure correctly. 
 

the rest of them error out.  just 1-3 error out  For example trying to mount #3 I get:

 

mount -o loop,offset=558891008 -t ext4 AVIC.img /mnt/avic3
mount: wrong fs type, bad option, bad superblock on /dev/loop1,
       missing codepage or helper program, or other error
       In some cases useful info is found in syslog - try       dmesg | tail  or so 

 

Are you able to mount the other partitions? Or is 4 the only valid one. 



#5 WhatIsWhatIsWhatIsWhat

WhatIsWhatIsWhatIsWhat

    Member

  • Members
  • 234 posts

Posted 13 August 2015 - 05:05 PM

This my F960BT backup (16GB, file size is 16 138 633 216 bytes):

#fdisk -l fullsd.test

Disk fullsd.test: 15 GiB, 16138633216 bytes, 31520768 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device       Boot   Start      End  Sectors  Size Id Type
fullsd.test1      1050624  1071103    20480   10M 83 Linux
fullsd.test2      1071104  1091583    20480   10M 83 Linux
fullsd.test3      1091584  3573759  2482176  1,2G  5 Extended
fullsd.test4      3573760 30197759 26624000 12,7G 83 Linux
fullsd.test5      1091585  1153023    61439   30M 83 Linux
fullsd.test6      1153025  1214463    61439   30M 83 Linux
fullsd.test7      1214465  2263039  1048575  512M 83 Linux
fullsd.test8      2263041  2525183   262143  128M 83 Linux
fullsd.test9      2525185  3573759  1048575  512M 83 Linux

Partition table entries are not in disk order.

kpartx output, please check command parameters (-av):

#partx -av fullsd.test
add map loop0p1 (252:4): 0 20480 linear /dev/loop0 1050624
add map loop0p2 (252:5): 0 20480 linear /dev/loop0 1071104
add map loop0p3 (252:6): 0 2 linear /dev/loop0 1091584
add map loop0p4 (252:7): 0 26624000 linear /dev/loop0 3573760
add map loop0p5 : 0 61439 linear /dev/loop0 1091585
add map loop0p6 : 0 61439 linear /dev/loop0 1153025
add map loop0p7 : 0 1048575 linear /dev/loop0 1214465
add map loop0p8 : 0 262143 linear /dev/loop0 2263041
add map loop0p9 : 0 1048575 linear /dev/loop0 2525185

Mounted partitions can be found in /media/username folder:

/dev/mapper/loop0p9           480M   14M  441M   4% /media/username/DATA
/dev/mapper/loop0p7           496M  333M  154M  69% /media/username/very-long-guid
/dev/mapper/loop0p4            13G  4,1G  8,4G  33% /media/username/very-long-guid1
/dev/mapper/loop0p8           120M  1,6M  113M   2% /media/username/CACHE

And my system is:

#uname -a
Linux Xubuntu 3.19.0-23-generic #24-Ubuntu SMP Tue Jul 7 18:52:55 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

loop0p9 - android data partition

loop0p7 - system partition

loop0p4 - extdata partition (iGo navigation maps and so on)

loop0p8 - empty cache partition


Please join our Pioneer-related groupchat to get help. Sorry, I do not read or respond to private messages. Please contact me via groupchat.

#6 e0x70i

e0x70i

    Member

  • Members
  • 23 posts

Posted 13 August 2015 - 05:15 PM

Thanks, 

 

Sorry just made a ton of edits to my first post!

 

Just tried out kpartx with your flags, nifty. 

 

It didn't automatically mount the drives it set up for me, but I just had to mount manually and it worked fine:

mount /dev/mapper/loop3p7 /mnt/avic7


#7 WhatIsWhatIsWhatIsWhat

WhatIsWhatIsWhatIsWhat

    Member

  • Members
  • 234 posts

Posted 13 August 2015 - 06:07 PM

partitions 1-2 also error out. guessing this aren't ext4, some kind of bootloader? I'll re-read the first post and the github page to make sure I understand the structure correctly.

 
Partitions with size 10MB and 30MB is two sides (side A and side B) of normal boot and two sides (A/B) of recovery boot. This partitions is starting with "ANDROID!" and can be extracted with special software too. Normal boot partition is almost empty, recovery boot partition contains testmode files.

 

Also, mtd2 nor flash backup contains fifth boot partition with EasyRecovery boot. This EasyRecovery is called then system cannot boot properly from SD Card.


Please join our Pioneer-related groupchat to get help. Sorry, I do not read or respond to private messages. Please contact me via groupchat.

#8 e0x70i

e0x70i

    Member

  • Members
  • 23 posts

Posted 13 August 2015 - 10:17 PM

 
Partitions with size 10MB and 30MB is two sides (side A and side B) of normal boot and two sides (A/B) of recovery boot. This partitions is starting with "ANDROID!" and can be extracted with special software too. Normal boot partition is almost empty, recovery boot partition contains testmode files.

 

Also, mtd2 nor flash backup contains fifth boot partition with EasyRecovery boot. This EasyRecovery is called then system cannot boot properly from SD Card.

 

Ah, thanks! So it looks just like normal android /boot and /recovery partitions.

 

Any gotchas with checksums on /boot when I modify the partition on the SD card directly? Or is that a problem only when updating from the PRG file? Either way, I'll avoid making changes to boot since it looks like no-one has found out a way to package modifications to boot.img in a PRG update file yet. 



#9 bass_rock

bass_rock

    Member

  • Members
  • 166 posts

Posted 13 August 2015 - 10:25 PM

Ah, thanks! So it looks just like normal android /boot and /recovery partitions.

 

Any gotchas with checksums on /boot when I modify the partition on the SD card directly? Or is that a problem only when updating from the PRG file? Either way, I'll avoid making changes to boot since it looks like no-one has found out a way to package modifications to boot.img in a PRG update file yet. 

 

You can modify the boot partition by dd'ing it to a separate image and then running mkboot on it. That will create a folder where you can edit the boot init scripts and such. Then run mkboot again to create a new image that you just dd back.

 

 

As far as modifying and packaging the images. We can repackage images, and create updates for them, we just haven't created any nifty tools to do it. But if you have scripting knowledge, you can see the script here: https://github.com/bassrock/AVIC-NEX

 

That unpacks an update file, allows for you to make changes and then repacks it into a PRG. The only issue is the SNAPSHOT, but new post shortly on a new menu we found that recreates the snapshot.



#10 e0x70i

e0x70i

    Member

  • Members
  • 23 posts

Posted 13 August 2015 - 10:49 PM

You can modify the boot partition by dd'ing it to a separate image and then running mkboot on it. That will create a folder where you can edit the boot init scripts and such. Then run mkboot again to create a new image that you just dd back.

 

 

As far as modifying and packaging the images. We can repackage images, and create updates for them, we just haven't created any nifty tools to do it. But if you have scripting knowledge, you can see the script here: https://github.com/bassrock/AVIC-NEX

 

That unpacks an update file, allows for you to make changes and then repacks it into a PRG. The only issue is the SNAPSHOT, but new post shortly on a new menu we found that recreates the snapshot.

 

I took a look at your script earlier, awesome stuff! Was going to mess with it later tonight to try and pull a 8100 image from the update file. 

 

The main question I had was related to this comment 

 

 

Any modifications made to the BOOT.img kernel/prg cause the deck to not boot. There is a checksum that we have not yet figured out on the Boot partiton.

 

Is modifying boot still a hurdle? have you guys modified boot on the sdcard directly without issue? 



#11 bass_rock

bass_rock

    Member

  • Members
  • 166 posts

Posted 13 August 2015 - 10:51 PM

I took a look at your script earlier, awesome stuff! Was going to mess with it later tonight to try and pull a 8100 image from the update file. 

 

The main question I had was related to this comment 

 

Is modifying boot still a hurdle? have you guys modified boot on the sdcard directly without issue? 

 

 

Ah. Yes. With warp turned off, you can modify the boot partition accordingly. Where is this comment so I can adjust it?



#12 e0x70i

e0x70i

    Member

  • Members
  • 23 posts

Posted 13 August 2015 - 11:00 PM

https://github.com/b...le-modification

 

Advice is specific to update files so you probably don't need to edit :). But if we want to create a custom rom and package it up for people to update, could modifying boot.img still be an issue? 



#13 bass_rock

bass_rock

    Member

  • Members
  • 166 posts

Posted 13 August 2015 - 11:04 PM

https://github.com/b...le-modification

 

Advice is specific to update files so you probably don't need to edit :). But if we want to create a custom rom and package it up for people to update, could modifying boot.img still be an issue? 

 

 

I don't believe so because we would also be creating a new snapshot. But we will cross that bridge when we have a rom to package ;)



#14 seneka1

seneka1
  • Members
  • 4 posts

Posted 28 August 2015 - 11:45 PM

Hi,

 

I need some help how to unpack the AVIC.img to a SD-Card.All attempts were without success. Is there any little tool to unpack the image to a SD-Card?

 

thanks in advance



#15 SilentViper

SilentViper
  • Members
  • 8 posts

Posted 29 August 2015 - 09:14 PM

I'm having problems getting my unit to recognize a NTFS USB drive for Internal SD Card backup but it recognizes a FAT32 USB no problem, anyone have any recommendations? I've tried formatting using Tuxera NTFS on my mac and I've tried using a windows VM. Neither time was it recognized after being formatted. the same USB drives work on FAT32, so i know it's not a hardware issue.







Also tagged with one or more of these keywords: bsp, backup, nor, development mod, xda, linux, avic, development, kernel boot, dev

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users