www.chinaphonearena.com

Full Version: [Tutorial] Linux Backup NVRAM Script.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
If you use my scripts or work in your own scripts, your scripts or license should reflect that.


This is a script to backup your NVRAM, this is a Linux script can be modified to work on windows as a batch file.

open terminal

Code:
adb shell cat /proc/dumchar_info

find your nvram
Code:
nvram        0x0000000000500000   0x0000000000400000   2   /dev/block/mmcblk0


copy hex into [Only registered and activated users can see links Click here to register]

type dec into calculator ÷ 4096

example below first # = count, second # = skip

Code:
5242880÷4096=1280
4194304÷4096=1024


Linux users connect rooted phone to pc, have adb setup and working, copy and paste script, set permissions change count and skip numbers to your own numbers if different than mine, open terminal run from a directory of choice.

Code:
#!/bin/bash

adb shell su -c "busybox tar -czvf /sdcard/nvram.tgz /data/nvram"

adb pull /sdcard/nvram.tgz

rm -r /sdcard/nvram.tgz

adb shell su -c "dd if=/dev/block/mmcblk0 of=/sdcard/nvram.bin bs=4096 count=1280 skip=1024"

adb pull /sdcard/nvram.bin

rm -r /sdcard/nvram.bin
vampirefo

I have not completed this script

I have made a few modifications for a number of reasons
namely....on my distro....usb devices are not given execute permissions to the local user
2) I want to make it easy for a new Linux user.....but I do not claim to be an expert
----and may be wrong.....but tested script so far

This script is a work in progress and misses the action bit for a reason
I am not sure why you are choosing output file to Android device
b) if you prefer not to adopt it ....I don't want to waste your time any further

Let me know what you think

As I have questions feel free to ask yours

cheers

[Only registered and activated users can see links Click here to register]

I have not added a MIT license to this script as I prefer you adopt it but I can not forecast the future either.......grins like a sheep
(2014-04-27, 17:52)aus9 Wrote: [Only registered and activated users can see links Click here to register]

I have not added a MIT license to this script as I prefer you adopt it but I can not forecast the future either.......grins like a sheep
Your script looks good, as far as your distro not given permissions, to usb, depends on distro, you might need to grant user permission via 51-android.rules
I run Mepis, pclinuxos,Mint, Ubuntu

I have 4 distros installed on my computer, plus Windows XP, for small windows jobs, mainly to run livesuit when needed.

With Mint and Ubuntu, 51-android.rules are required for user, as these distro use sudo commands.

anyway setting up 51-android.rules allows users to use adb usb support.

You script should be very useful keep at it.
great will do, now, for the nastier questions

Why aren't you saving to your trusty Linux PC?
or are you trying to make it universal to Windows users?

I could do a HERE variable or to keep it simple use PC /root to save to eg
Code:
HERE=`pwd`
echo "$HERE"
/home/gordon/Desktop

2) Have you successfully restored?
what command did you use, as we can build from my initial script and make a backup and a restore script

to confess, I am a Linux user but new to Android

cheers
(2014-04-28, 07:37)aus9 Wrote: [ -> ]great will do, now, for the nastier questions

Why aren't you saving to your trusty Linux PC?
or are you trying to make it universal to Windows users?

I could do a HERE variable or to keep it simple use PC /root to save to eg
Code:
HERE=`pwd`
echo "$HERE"
/home/gordon/Desktop

2) Have you successfully restored?
what command did you use, as we can build from my initial script and make a backup and a restore script

to confess, I am a Linux user but new to Android

cheers
My script saves to linux, it saves the files in same directory the script is ran from.
ahhh well in that case, your outfile is not universal as my Debian does not use that pathway for a mounted internal storage or removeable storage

I have taken the liberty of fixing this universal issue with the HERE as now showing here
[Only registered and activated users can see links Click here to register]

dropbox shows command syntax in pretty colours on my PC if I use a sh extension

2) Have you tested restore please?
(2014-04-28, 08:24)aus9 Wrote: [Only registered and activated users can see links Click here to register]

dropbox shows command syntax in pretty colours on my PC if I use a sh extension

2) Have you tested restore please?

My script works on every distro ever created, have you even ran my script?
To restore is just reverse.
Hi

Quote:My script works on every distro ever created, have you even ran my script?
To restore is just reverse.

I hope you forgive me if you feel I insulted you. I repeat that the pathway on my Debian does not enjoy the same level of success you have tested. That is one of the reasons why I offer a script for your adoption.

My feelings were not be hurt if you are not interested.

I repeat I am an Android newbie and seeking confirmation that you personally have restored from backup.

I have not run your script in reverse because I am a scaredy cat. However in light of your last reply I will delete some posts but will post my improved script if you are still interested.

BTW, I do understand that your distros may have their own udev rules. What I am trying to do is make a more universal script that ignores what distro we may be using.

feel free to comment etc......this is your tutorial and I am not trying to hijack or troll you.
I understand you want to make a script, that requires user interaction for newbies or people who want to interact with a script, in the end your script will work exactly like the one I posted.

I am simply using adb commands to pull the files, to restore I use adb push, which is the opposite of pull.

Nothing wrong with the way you want to make your script, I am not into interactive scripts, I make scripts that only require them to be ran, that way they can be ran automatically or remotely.

I can backup or restore my phone from, a computer from another phone or from another device remotely, an interactive script can't do that cause each time it needs input from user.
For yourself or people who want the interaction they can use your script, others can use mine or make one they like.
vampirefo

I just looked at this tut
[Only registered and activated users can see links Click here to register]

it suggests you need a backup of both
/dev/nvram
/data/nvram

your thoughts Sir?

2) Fair enough I will contine with my script for my own evil purposes then......grins
Pages: 1 2 3