[CLOSED]How make copy all android via adb - ASUS ROG Phone II Questions & Answers

Mod edit: @Vergiliusz Thread closed as duplicate of
Ho to back up of the whole memory block (via adb)
Dears maybe now I can make double post but I hang on that step from guide from this site. Phone is after wipe data and I need rescue data from it for that I want to make RAW image to recover data. What I do until now: adb forward tcp:5555...
forum.xda-developers.com
Please review the XDA Forum Rules with special emphasis on rule no. 5 and post only once - and such a subject not in development!
Regards
Oswald Boelcke
Dears maybe now I can make double post but I hang on that step from guide from this site.
Phone is after wipe data and I need rescue data from it for that I want to make RAW image to recover data.
What I do until now:
adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0
but in results get:
1|ASUS_I001_1:/ # /system/xbin/busybox nc -1 -p 5555 -e /system/xbin/busybox dd
5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0 <
nc: invalid option -- 1
BusyBox v1.32.0-Stericson (2020-07-18 18:33:24 EDT) multi-call binary.
Usage: nc [OPTIONS] HOST PORT - connect
nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen
-e PROG Run PROG after connect (must be last)
-l Listen mode, for inbound connects
-lk With -e, provides persistent server
-p PORT Local port
-s ADDR Local address
-w SEC Timeout for connects and final net reads
-i SEC Delay interval for lines sent
-n Don't do DNS resolution
-u UDP mode
-v Verbose
-o FILE Hex dump traffic
-z Zero-I/O mode (scanning)
1|ASUS_I001_1:/ #
Why I get that this parameter is invalid:
nc: invalid option -- 1
And to

Related

[Q] Full linux on G1?

Hey everyone!!
Since if got new phone (Moto Milestone), i was wondering is it possible to install linux (gentoo, debian) on my old G1?
So, not in chroot, but as only OS on device! i dont need GUI, just shell. I was thinking that /, boot, etc, bin and maybe some more would be in device rom, and rest on sdcard!!
3g modem is not important to work, but wifi and gps are must!!
can this be done? i want to find some use of my old, but faithfull, G1!!
P.S. mods, if I posted this in wrong topic, I appologize!
thx for any hints. i have 6+ years on linux experience, mostly with gentoo, so recompiling and configuring isn't big problem!!
Sent from my Milestone
amossam said:
Hey everyone!!
thx for any hints. i have 6+ years on linux experience, mostly with gentoo, so recompiling and configuring isn't big problem!!
Click to expand...
Click to collapse
so do it then
not sure why you think its difficult
Firerat said:
so do it then
not sure why you think its difficult
Click to expand...
Click to collapse
well, i think it wouldn't be easy, and I'm asking is it possible!
with all due respect, i don't think that yours tone is in place.
so just for your info, i appreciate your work werry much!
i don't know too much about booting process of G1, but i know that SPL transfers boot process to kernel, so i assume that there is no boot flag! and i cannot find any detailed explanation of booting process that is detailed and easy to understand...
so, instead of using that tone, i would be gratefull if you have any link to share!!
Sent from my Milestone
amossam said:
well, i think it wouldn't be easy, and I'm asking is it possible!
with all due respect, i don't think that yours tone is in place.
so just for your info, i appreciate your work werry much!
i don't know too much about booting process of G1, but i know that SPL transfers boot process to kernel, so i assume that there is no boot flag! and i cannot find any detailed explanation of booting process that is detailed and easy to understand...
so, instead of using that tone, i would be gratefull if you have any link to share!!
Sent from my Milestone
Click to expand...
Click to collapse
i have 6+ years on linux experience, mostly with gentoo, so recompiling and configuring isn't big problem!!
Click to expand...
Click to collapse
here is a very usefull link
http://www.google.com
it is great for doing internet searches
don't clam to be some linux guru if you are not
http://www.unixweblog.com/2010/03/htc-dreamg1-dual-boot-native-debian/
and here is how I found it
I googled
native linux on g1
you will see links to xda
its been done, and done and done
there is absolutely nothing wrong with the firerat's tone. I actually thanked him for that post... it was classic firerat!
I think if you learned how to use the search function.. you will see it haz been done. google is your best friend!! hey, bing works as well. ask jeeves may not... but such is the element of being a man of linus -- most linux people dont go into a police station and ask for the number to dial 911 and where they can dial this number to get some police help.
jesus.......i just did a search... it goes all the way back to the days of jesus h freke. 1998.
just frigging search. how can you operate a phone and not be able to operate a basic google search..
hold one second... my 4 year old dog who has half his chromosomes just did it...wow.... here it is.. http://forum.xda-developers.com/showthread.php?t=444419&page=40
plz dont thank me either. if you must thank someone, thank firerat... but i dont know if he wants your thanx.
have fun chrootin! and its good to see people care enough about their dream to not toss it in the recycle bin at tmobile. those things are powerful.
Firerat said:
here is a very usefull link
http://www.google.com
it is great for doing internet searches
don't clam to be some linux guru if you are not
http://www.unixweblog.com/2010/03/htc-dreamg1-dual-boot-native-debian/
and here is how I found it
I googled
native linux on g1
you will see links to xda
its been done, and done and done
Click to expand...
Click to collapse
its like watching fire be invented all over again!
i humbly applogise that i asked one question. i did some research but i couldn't get the right keywords...
btw, i didn't said that i'm linux guru, only that i have experience...
nwm, i'll move on on my own...
can please mod lock this or delete, obviously this is another stupid duplicate post...
Sent from my Milestone
amossam said:
i humbly applogise that i asked one question. i did some research but i couldn't get the right keywords...
btw, i didn't said that i'm linux guru, only that i have experience...
nwm, i'll move on on my own...
can please mod lock this or delete, obviously this is another stupid duplicate post...
Sent from my Milestone
Click to expand...
Click to collapse
install linux on g1
http://www.htc-dream-g1.net/en/Linux/Debian/Native
currently the 4th hit
Firerat said:
install linux on g1
http://www.htc-dream-g1.net/en/Linux/Debian/Native
currently the 4th hit
Click to expand...
Click to collapse
how simple can you get? lol
{Mod edit}
Here's how to do this:
HTC Dream Native Debian Linux - bibanon/android-development-codex Wiki​This guide was mostly organized by Novaspirit, refined on the Debian Wiki, and based on notes from XDA-Developers.
Here, we've fixed some glaring errors and updated it for Debian squeeze.
This guide will create a dual-boot Linux and Android system. The phone will boot normally into Android; just hold home+power when turning on to enter Debian Linux.
Working / Not Working​Working
Phone can boot!
SDCard reader/writer
Keyboard
LEDs
Touchscreen
Vibrator
USB Ethernet
Xorg with OpenMoko Kernel
Phone Call : I am able to answer an incomming call from console!
Unlock SIM Card and register on Network
Working with bugs
Trackball - No event on click with ball - must click and move ball slightly
TouchScreen (MonoTouch) - I can use it in console FBDEV, but with Xorg, the calibration doesn’t work - calibration is very difficult but doable
ALSA - Sound is low, when phone works, sound is very low, and alsamixer, for select OutPut has device bugs.
Xorg with my Kernel - The phone crashes (freeze) when you leave Xorg found this only happens sometimes not all
Not working
WiFi card is detected, but crashes when doing “ifconfig wlan0 up”.
Not tested
GPS
Accelerometers/Compas
Other USB Gadgets, like Storage
Bluetooth
Internet throug GSM/3G APN
Power management
Accelerated GL
Camera
TouchScreen (MultiTouch)
HOWTO​You will need:
A laptop with Debian-based Linux (Ubuntu, Debian, Linux Mint, etc.)
Just run it off a live CD
An HTC Dream/G1 or MyTouch 3G
8GB or larger SDCard
4GB for Linux, 4GB for Android
An Android 1.6 or higher Custom ROM that supports EXT2/3
only a few older Android versions lack it.
USB Debugging Enabled
HardSPL and Engineering SPL
gives you fastboot support
ADB and Fastboot
The easiest way to install them is to use Minimal ADB.
Partitioning the SDCard​
It's possible to use Android itself to partition it, but that's another guide...
Click to expand...
Click to collapse
obtain gparted using:
sudo apt-get install gparted
select your sdcard and select it on the top right menu
You will need three partitions:
fat32 (android)
ext3 (android apps and stuff if you got app2sd)
ext3 (debian)
For example, an 8GB SDCard would be partitioned like this:
2 GB FAT32 for Android
2 GB EXT3 for app2sd
4 GB EXT3 for my real Debian
After creating the partitions, make sure to record the names, found in gparted's top-right corner (ex. /dev/sdb1, /dev/sdc6).
The G1 will see those partitions with names: /dev/mmcblk0p3 or whatnot. Just add the last number of the /dev/sdb1 name, replacing that 3.
Keep your SDCard plugged in.
Generate the Debian Root Filesystem with debootstrap​We will use debootstrap to install all the necessary system packages to an image, which you will flash onto the G1.
mkdir debdroid
sudo /usr/sbin/debootstrap --foreign --arch armel squeeze debdroid/ http://http.debian.net/debian
Copy debootstrap to the SDCard​We now need to copy the system image to the G1. Change /dev/sdb3 to the EXT3 partition for Debian on your SDCard (The names were previously obtained from GParted).
mount /dev/sdb3 /mnt/memory # change correct device
sudo cp -pfr debdroid/* /mnt/memory/
umount /mnt/memory
debootstrap Second Stage​Now reboot into your G1, and connect it to the computer to begin the second phase of installation. Make sure USB Debugging is enabled, and your phone is recognized by ADB.
Mount the debian EXT3 partition:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Now your debian partition should be mounted to file system at /data/mnt
Next, we will chroot into the debian partition to start the second stage of installation. This will take about 25 minutes, so be patient and keep your phone charged.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /debootstrap/debootstrap --second-stage
umount /data/mnt
rmdir /data/mnt
Set the SSH service to start on boot​We will need an SSH service running on the G1 for internet tethering from the PC. We have to install Galoula's SSH modules, and edit configuration files to start SSH on boot.
Insert the sdcard back into your Linux PC and run these commands:
(replace /dev/sdb2 with the name of your debian EXT3 partition)
(the package links will have to be updated for squeeze)
mount /dev/sdb2 /mnt
cd /mnt/tmp
wget http://www.galoula.net/fr/Tutoriels...ALOULA-001/Modules-2.6.32_GALOULA-001.tar.bz2
tar -jxvf Modules-2.6.32_GALOULA-001.tar.bz2 -C ..
echo g_ether >> ../etc/modules
echo "auto lo" >> ../etc/network/interfaces
echo "iface lo inet loopback" >> ../etc/network/interfaces
echo "auto usb0" >> ../etc/network/interfaces
echo "iface usb0 inet static" >> ../etc/network/interfaces
echo " address 192.168.0.202" >> ../etc/network/interfaces
echo " netmask 255.255.255.192" >> ../etc/network/interfaces
echo " network 192.168.100.0" >> ../etc/network/interfaces
echo " gateway 192.168.0.200" >> ../etc/network/interfaces
echo "none /sys sysfs rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "none /proc proc rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "udev /dev tmpfs rw,size=10240k,mode=755 0 0" >> ../etc/fstab
echo "devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0" >> ../etc/fstab
echo "HTC-Dream" > ../etc/hostname
echo "127.0.0.1 localhost HTC-Dream" > ../etc/hosts
cat /etc/resolv.conf > ../etc/resolv.conf
mkdir ../dev/pts
sync
cd
umount /mnt
Later on, we will also install the SSH packages on the phone itself.
Now insert the sdcard back into the G1, and plug the G1 into the computer.
Chroot Setup​
Note: Don't worry; we are still installing Native Debian Linux. We are only temporarily using a chroot for greater convenience when pumping in commands.
Click to expand...
Click to collapse
Make sure your Android G1 has a WiFi internet connection and USB Debugging enabled.
Set your phone to Stay Awake, so the phone will not suddenly cut off your wifi connection. Settings->Application->Development->Stay Awake
Disable WiFi sleep, which will cause download issues. Settings->Wifi->Menu Button->Advanced->Wifi Sleep Policy->Never sleep when plugged in
Enter the chroot​First, mount the Debian partition on the G1 from your PC, using these commands:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Then, enter the chroot:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /bin/bash
Set up Squeeze Package Repositories​This will install the necessary Debian repositories and some basic packages to the G1.
Type the commands below to add squeeze package repositories:
echo "deb http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install bzip2 build-essential
Install SSH​Finally, we can install the openssh packages. An SSH server allows you to access a USB connected phone from your computer, so you can pump in terminal commands using copy and paste.
Type this command in the same chroot at your computer:
apt-get install openssh-server openssh-client libkrb53 openssh-blacklist libedit2 udev libvolume-id0 libkeyutils1
/etc/init.d/ssh stop
Note: During installation, the G1 might restart unexpectedly. Simply enter the chroot again (see previous section).
Click to expand...
Click to collapse
Create a Root user password and exit the Chroot​We will want to create a root user password.
passwd
Type in the password you want to use (make sure that you only use numbers and letters! special characters cannot be easily entered).
As a security measure, text will not appear onscreen, so just keep typing and press enter when you've put it in.
Exit the Chroot​We're all done, so you can exit the chroot.
sync
exit # exits the chroot
umount /mnt
rmdir /data/mnt
exit # exits `adb shell`
Boot Linux​Put the sdcard back into your G1, Plug in your G1 to the PC, and type this command to enter fastboot mode:
adb reboot bootloader
Type this command on your Linux PC to download and boot the kernel.
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
fastboot -c "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" boot ./zImage
Your phone will now boot into Debian.
Type in the Username and Password​As a security feature, nothing will be displayed while you type your password.
username: root
password: <the password that you created>
Tether your G1's internet connection to the PC​We have to forward your PC's internet connection to your G1. Type these commands in the computer:
ifconfig usb0 192.168.0.200/26
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
(not tested) Alternatively, use these commands: (recommended by Jorge Peñalba)
ifconfig usb0 192.168.0.200/26\
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 1 \> /proc/sys/net/ipv4/ip\_forward\
ssh 192.168.0.202 -l root\
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 0 \> /proc/sys/net/ipv4/ip\_forward
SSH into the G1​Use this command to SSH into the G1's command line, so you can send commands to it from your computer. Log into your phone with the same username and password you set before.
ssh 192.168.0.202
Enable Dual Boot (optional)​We will create a custom kernel for the phone to dual-boot between Android and Linux. This way, you will be able to hold power+home to boot Linux.
Use your computer to SSH into the G1 and run these commands:
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/mkboot.tar.bz2
tar -jxvf mkboot.tar.bz2
cd mkboot
make && make install
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/android-imagetools.tar.bz2
tar -jxvf android-imagetools.tar.bz2
cd android-imagetools
make && make install
cd /tmp
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
wget http://wiki.openmoko.org/images/f/f6/Newramdisk.cpio.gz
mkbootimg --cmdline "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" \
--kernel zImage --ramdisk ./Newramdisk.cpio.gz -o Recovery-boot.img
cat /dev/zero > /dev/mtd1
mkdir /dev/mtd
cd /dev/ && for i in `ls -w1 mtd?`;do ln -s /dev/$i /dev/mtd/$i; done && cd - || cd -
flash_image recovery Recovery-boot.img
Normal boot will get you into Android
Holding home and power will boot into debian
Galoula's Netinstall​How to Install Ubuntu with Ubuntu-Install.img ?
Download Ubuntu-Install.img on your Linux-PC.
Turn off your HTC G1.
Turn On HTC G1 in FastBosst mode : Power on with hold the camera button, if it's OK, you can see 3 Android on Skateboards.
In this screen press Back.
Connect USB cable betweek PC and G1.
On your Linux PC type this command : "fastboot boot Ubuntu-Install.img" without quotes.
If the G1 don't start, press the back button on G1.
The G1 start the Ubuntu Installer.
Warning ! My image is set for a French G1 keymap.
The special keys are :
Up : End
Down : Back
Left : Home
Right : Call
Escape : menu (on keyboard)
Tab : Right alt with Q.
Control : Search Button
For get networking works : This kernel use USB-NET.
To configure IT :​On the Linux PC :
sudo ifconfig usb0 192.168.0.200 netmask 255.255.255.0 up
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
sysctl -w net.ipv4.ip_forward=1
On the G1 :​When the installer tell you for Networking Configuration, chose usb0
You can cancel the DHCP discover.
Type this settings :
IP Address : 192.168.0.202
NetMask : 255.255.255.0
GateWay : 192.168.0.200
DNS : Your DNS
The setup tell you because it can't download "kernel modules", chose continue, my kernel can read the SDCARD for the installation, but it can't read internal partition for more secure.
The setup can tell you a warning because the kernel can't be installed, please continue (and ignore it) because, Ubuntu-Rescue.img contain the appropriate kernel.
Actualy, the file is : boot-recovery.img
Now, you can setup your Ubuntu !
Galoula's Netinstall images
Page Index for this GitHub Wiki
Source: Github
ppp- said:
Here's how to do this:
HTC Dream Native Debian Linux - bibanon/android-development-codex Wiki​This guide was mostly organized by Novaspirit, refined on the Debian Wiki, and based on notes from XDA-Developers.
Here, we've fixed some glaring errors and updated it for Debian squeeze.
This guide will create a dual-boot Linux and Android system. The phone will boot normally into Android; just hold home+power when turning on to enter Debian Linux.
Working / Not Working​Working
Phone can boot!
SDCard reader/writer
Keyboard
LEDs
Touchscreen
Vibrator
USB Ethernet
Xorg with OpenMoko Kernel
Phone Call : I am able to answer an incomming call from console!
Unlock SIM Card and register on Network
Working with bugs
Trackball - No event on click with ball - must click and move ball slightly
TouchScreen (MonoTouch) - I can use it in console FBDEV, but with Xorg, the calibration doesn’t work - calibration is very difficult but doable
ALSA - Sound is low, when phone works, sound is very low, and alsamixer, for select OutPut has device bugs.
Xorg with my Kernel - The phone crashes (freeze) when you leave Xorg found this only happens sometimes not all
Not working
WiFi card is detected, but crashes when doing “ifconfig wlan0 up”.
Not tested
GPS
Accelerometers/Compas
Other USB Gadgets, like Storage
Bluetooth
Internet throug GSM/3G APN
Power management
Accelerated GL
Camera
TouchScreen (MultiTouch)
HOWTO​You will need:
A laptop with Debian-based Linux (Ubuntu, Debian, Linux Mint, etc.)
Just run it off a live CD
An HTC Dream/G1 or MyTouch 3G
8GB or larger SDCard
4GB for Linux, 4GB for Android
An Android 1.6 or higher Custom ROM that supports EXT2/3
only a few older Android versions lack it.
USB Debugging Enabled
HardSPL and Engineering SPL
gives you fastboot support
ADB and Fastboot
The easiest way to install them is to use Minimal ADB.
Partitioning the SDCard​
obtain gparted using:
sudo apt-get install gparted
select your sdcard and select it on the top right menu
You will need three partitions:
fat32 (android)
ext3 (android apps and stuff if you got app2sd)
ext3 (debian)
For example, an 8GB SDCard would be partitioned like this:
2 GB FAT32 for Android
2 GB EXT3 for app2sd
4 GB EXT3 for my real Debian
After creating the partitions, make sure to record the names, found in gparted's top-right corner (ex. /dev/sdb1, /dev/sdc6).
The G1 will see those partitions with names: /dev/mmcblk0p3 or whatnot. Just add the last number of the /dev/sdb1 name, replacing that 3.
Keep your SDCard plugged in.
Generate the Debian Root Filesystem with debootstrap​We will use debootstrap to install all the necessary system packages to an image, which you will flash onto the G1.
mkdir debdroid
sudo /usr/sbin/debootstrap --foreign --arch armel squeeze debdroid/ http://http.debian.net/debian
Copy debootstrap to the SDCard​We now need to copy the system image to the G1. Change /dev/sdb3 to the EXT3 partition for Debian on your SDCard (The names were previously obtained from GParted).
mount /dev/sdb3 /mnt/memory # change correct device
sudo cp -pfr debdroid/* /mnt/memory/
umount /mnt/memory
debootstrap Second Stage​Now reboot into your G1, and connect it to the computer to begin the second phase of installation. Make sure USB Debugging is enabled, and your phone is recognized by ADB.
Mount the debian EXT3 partition:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Now your debian partition should be mounted to file system at /data/mnt
Next, we will chroot into the debian partition to start the second stage of installation. This will take about 25 minutes, so be patient and keep your phone charged.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /debootstrap/debootstrap --second-stage
umount /data/mnt
rmdir /data/mnt
Set the SSH service to start on boot​We will need an SSH service running on the G1 for internet tethering from the PC. We have to install Galoula's SSH modules, and edit configuration files to start SSH on boot.
Insert the sdcard back into your Linux PC and run these commands:
(replace /dev/sdb2 with the name of your debian EXT3 partition)
(the package links will have to be updated for squeeze)
mount /dev/sdb2 /mnt
cd /mnt/tmp
wget http://www.galoula.net/fr/Tutoriels...ALOULA-001/Modules-2.6.32_GALOULA-001.tar.bz2
tar -jxvf Modules-2.6.32_GALOULA-001.tar.bz2 -C ..
echo g_ether >> ../etc/modules
echo "auto lo" >> ../etc/network/interfaces
echo "iface lo inet loopback" >> ../etc/network/interfaces
echo "auto usb0" >> ../etc/network/interfaces
echo "iface usb0 inet static" >> ../etc/network/interfaces
echo " address 192.168.0.202" >> ../etc/network/interfaces
echo " netmask 255.255.255.192" >> ../etc/network/interfaces
echo " network 192.168.100.0" >> ../etc/network/interfaces
echo " gateway 192.168.0.200" >> ../etc/network/interfaces
echo "none /sys sysfs rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "none /proc proc rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "udev /dev tmpfs rw,size=10240k,mode=755 0 0" >> ../etc/fstab
echo "devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0" >> ../etc/fstab
echo "HTC-Dream" > ../etc/hostname
echo "127.0.0.1 localhost HTC-Dream" > ../etc/hosts
cat /etc/resolv.conf > ../etc/resolv.conf
mkdir ../dev/pts
sync
cd
umount /mnt
Later on, we will also install the SSH packages on the phone itself.
Now insert the sdcard back into the G1, and plug the G1 into the computer.
Chroot Setup​
Make sure your Android G1 has a WiFi internet connection and USB Debugging enabled.
Set your phone to Stay Awake, so the phone will not suddenly cut off your wifi connection. Settings->Application->Development->Stay Awake
Disable WiFi sleep, which will cause download issues. Settings->Wifi->Menu Button->Advanced->Wifi Sleep Policy->Never sleep when plugged in
Enter the chroot​First, mount the Debian partition on the G1 from your PC, using these commands:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Then, enter the chroot:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /bin/bash
Set up Squeeze Package Repositories​This will install the necessary Debian repositories and some basic packages to the G1.
Type the commands below to add squeeze package repositories:
echo "deb http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install bzip2 build-essential
Install SSH​Finally, we can install the openssh packages. An SSH server allows you to access a USB connected phone from your computer, so you can pump in terminal commands using copy and paste.
Type this command in the same chroot at your computer:
apt-get install openssh-server openssh-client libkrb53 openssh-blacklist libedit2 udev libvolume-id0 libkeyutils1
/etc/init.d/ssh stop
Create a Root user password and exit the Chroot​We will want to create a root user password.
passwd
Type in the password you want to use (make sure that you only use numbers and letters! special characters cannot be easily entered).
As a security measure, text will not appear onscreen, so just keep typing and press enter when you've put it in.
Exit the Chroot​We're all done, so you can exit the chroot.
sync
exit # exits the chroot
umount /mnt
rmdir /data/mnt
exit # exits `adb shell`
Boot Linux​Put the sdcard back into your G1, Plug in your G1 to the PC, and type this command to enter fastboot mode:
adb reboot bootloader
Type this command on your Linux PC to download and boot the kernel.
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
fastboot -c "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" boot ./zImage
Your phone will now boot into Debian.
Type in the Username and Password​As a security feature, nothing will be displayed while you type your password.
username: root
password: <the password that you created>
Tether your G1's internet connection to the PC​We have to forward your PC's internet connection to your G1. Type these commands in the computer:
ifconfig usb0 192.168.0.200/26
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
(not tested) Alternatively, use these commands: (recommended by Jorge Peñalba)
ifconfig usb0 192.168.0.200/26\
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 1 \> /proc/sys/net/ipv4/ip\_forward\
ssh 192.168.0.202 -l root\
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 0 \> /proc/sys/net/ipv4/ip\_forward
SSH into the G1​Use this command to SSH into the G1's command line, so you can send commands to it from your computer. Log into your phone with the same username and password you set before.
ssh 192.168.0.202
Enable Dual Boot (optional)​We will create a custom kernel for the phone to dual-boot between Android and Linux. This way, you will be able to hold power+home to boot Linux.
Use your computer to SSH into the G1 and run these commands:
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/mkboot.tar.bz2
tar -jxvf mkboot.tar.bz2
cd mkboot
make && make install
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/android-imagetools.tar.bz2
tar -jxvf android-imagetools.tar.bz2
cd android-imagetools
make && make install
cd /tmp
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
wget http://wiki.openmoko.org/images/f/f6/Newramdisk.cpio.gz
mkbootimg --cmdline "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" \
--kernel zImage --ramdisk ./Newramdisk.cpio.gz -o Recovery-boot.img
cat /dev/zero > /dev/mtd1
mkdir /dev/mtd
cd /dev/ && for i in `ls -w1 mtd?`;do ln -s /dev/$i /dev/mtd/$i; done && cd - || cd -
flash_image recovery Recovery-boot.img
Normal boot will get you into Android
Holding home and power will boot into debian
Galoula's Netinstall​How to Install Ubuntu with Ubuntu-Install.img ?
Download Ubuntu-Install.img on your Linux-PC.
Turn off your HTC G1.
Turn On HTC G1 in FastBosst mode : Power on with hold the camera button, if it's OK, you can see 3 Android on Skateboards.
In this screen press Back.
Connect USB cable betweek PC and G1.
On your Linux PC type this command : "fastboot boot Ubuntu-Install.img" without quotes.
If the G1 don't start, press the back button on G1.
The G1 start the Ubuntu Installer.
Warning ! My image is set for a French G1 keymap.
The special keys are :
Up : End
Down : Back
Left : Home
Right : Call
Escape : menu (on keyboard)
Tab : Right alt with Q.
Control : Search Button
For get networking works : This kernel use USB-NET.
To configure IT :​On the Linux PC :
sudo ifconfig usb0 192.168.0.200 netmask 255.255.255.0 up
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
sysctl -w net.ipv4.ip_forward=1
On the G1 :​When the installer tell you for Networking Configuration, chose usb0
You can cancel the DHCP discover.
Type this settings :
IP Address : 192.168.0.202
NetMask : 255.255.255.0
GateWay : 192.168.0.200
DNS : Your DNS
The setup tell you because it can't download "kernel modules", chose continue, my kernel can read the SDCARD for the installation, but it can't read internal partition for more secure.
The setup can tell you a warning because the kernel can't be installed, please continue (and ignore it) because, Ubuntu-Rescue.img contain the appropriate kernel.
Actualy, the file is : boot-recovery.img
Now, you can setup your Ubuntu !
Galoula's Netinstall images
Page Index for this GitHub Wiki
Source: Github
Click to expand...
Click to collapse
Wow. That's a ton of info! I'll try.
ppp- said:
{Mod edit}
Here's how to do this:
Click to expand...
Click to collapse
@ppp- I've edited your post above and removed the part that was simply intended to offend another user. Be aware that XDA is not like the common social media, and we're enforcing the XDA Forum Rules that have been established, and to which you agreed to adhere when you registered on this private platform a few days ago. Please review the forum rules with special emphasis on rule no. 2 regarding member conduct. Thanks for your cooperation.
Regards
Oswald Boelcke
Senior Moderator
ppp- said:
{Mod edit}
Here's how to do this:
HTC Dream Native Debian Linux - bibanon/android-development-codex Wiki​This guide was mostly organized by Novaspirit, refined on the Debian Wiki, and based on notes from XDA-Developers.
Here, we've fixed some glaring errors and updated it for Debian squeeze.
This guide will create a dual-boot Linux and Android system. The phone will boot normally into Android; just hold home+power when turning on to enter Debian Linux.
Working / Not Working​Working
Phone can boot!
SDCard reader/writer
Keyboard
LEDs
Touchscreen
Vibrator
USB Ethernet
Xorg with OpenMoko Kernel
Phone Call : I am able to answer an incomming call from console!
Unlock SIM Card and register on Network
Working with bugs
Trackball - No event on click with ball - must click and move ball slightly
TouchScreen (MonoTouch) - I can use it in console FBDEV, but with Xorg, the calibration doesn’t work - calibration is very difficult but doable
ALSA - Sound is low, when phone works, sound is very low, and alsamixer, for select OutPut has device bugs.
Xorg with my Kernel - The phone crashes (freeze) when you leave Xorg found this only happens sometimes not all
Not working
WiFi card is detected, but crashes when doing “ifconfig wlan0 up”.
Not tested
GPS
Accelerometers/Compas
Other USB Gadgets, like Storage
Bluetooth
Internet throug GSM/3G APN
Power management
Accelerated GL
Camera
TouchScreen (MultiTouch)
HOWTO​You will need:
A laptop with Debian-based Linux (Ubuntu, Debian, Linux Mint, etc.)
Just run it off a live CD
An HTC Dream/G1 or MyTouch 3G
8GB or larger SDCard
4GB for Linux, 4GB for Android
An Android 1.6 or higher Custom ROM that supports EXT2/3
only a few older Android versions lack it.
USB Debugging Enabled
HardSPL and Engineering SPL
gives you fastboot support
ADB and Fastboot
The easiest way to install them is to use Minimal ADB.
Partitioning the SDCard​
obtain gparted using:
sudo apt-get install gparted
select your sdcard and select it on the top right menu
You will need three partitions:
fat32 (android)
ext3 (android apps and stuff if you got app2sd)
ext3 (debian)
For example, an 8GB SDCard would be partitioned like this:
2 GB FAT32 for Android
2 GB EXT3 for app2sd
4 GB EXT3 for my real Debian
After creating the partitions, make sure to record the names, found in gparted's top-right corner (ex. /dev/sdb1, /dev/sdc6).
The G1 will see those partitions with names: /dev/mmcblk0p3 or whatnot. Just add the last number of the /dev/sdb1 name, replacing that 3.
Keep your SDCard plugged in.
Generate the Debian Root Filesystem with debootstrap​We will use debootstrap to install all the necessary system packages to an image, which you will flash onto the G1.
mkdir debdroid
sudo /usr/sbin/debootstrap --foreign --arch armel squeeze debdroid/ http://http.debian.net/debian
Copy debootstrap to the SDCard​We now need to copy the system image to the G1. Change /dev/sdb3 to the EXT3 partition for Debian on your SDCard (The names were previously obtained from GParted).
mount /dev/sdb3 /mnt/memory # change correct device
sudo cp -pfr debdroid/* /mnt/memory/
umount /mnt/memory
debootstrap Second Stage​Now reboot into your G1, and connect it to the computer to begin the second phase of installation. Make sure USB Debugging is enabled, and your phone is recognized by ADB.
Mount the debian EXT3 partition:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Now your debian partition should be mounted to file system at /data/mnt
Next, we will chroot into the debian partition to start the second stage of installation. This will take about 25 minutes, so be patient and keep your phone charged.
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /debootstrap/debootstrap --second-stage
umount /data/mnt
rmdir /data/mnt
Set the SSH service to start on boot​We will need an SSH service running on the G1 for internet tethering from the PC. We have to install Galoula's SSH modules, and edit configuration files to start SSH on boot.
Insert the sdcard back into your Linux PC and run these commands:
(replace /dev/sdb2 with the name of your debian EXT3 partition)
(the package links will have to be updated for squeeze)
mount /dev/sdb2 /mnt
cd /mnt/tmp
wget http://www.galoula.net/fr/Tutoriels...ALOULA-001/Modules-2.6.32_GALOULA-001.tar.bz2
tar -jxvf Modules-2.6.32_GALOULA-001.tar.bz2 -C ..
echo g_ether >> ../etc/modules
echo "auto lo" >> ../etc/network/interfaces
echo "iface lo inet loopback" >> ../etc/network/interfaces
echo "auto usb0" >> ../etc/network/interfaces
echo "iface usb0 inet static" >> ../etc/network/interfaces
echo " address 192.168.0.202" >> ../etc/network/interfaces
echo " netmask 255.255.255.192" >> ../etc/network/interfaces
echo " network 192.168.100.0" >> ../etc/network/interfaces
echo " gateway 192.168.0.200" >> ../etc/network/interfaces
echo "none /sys sysfs rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "none /proc proc rw,nosuid,nodev,noexec 0 0" >> ../etc/fstab
echo "udev /dev tmpfs rw,size=10240k,mode=755 0 0" >> ../etc/fstab
echo "devpts /dev/pts devpts rw,nosuid,noexec,gid=5,mode=620 0 0" >> ../etc/fstab
echo "HTC-Dream" > ../etc/hostname
echo "127.0.0.1 localhost HTC-Dream" > ../etc/hosts
cat /etc/resolv.conf > ../etc/resolv.conf
mkdir ../dev/pts
sync
cd
umount /mnt
Later on, we will also install the SSH packages on the phone itself.
Now insert the sdcard back into the G1, and plug the G1 into the computer.
Chroot Setup​
Make sure your Android G1 has a WiFi internet connection and USB Debugging enabled.
Set your phone to Stay Awake, so the phone will not suddenly cut off your wifi connection. Settings->Application->Development->Stay Awake
Disable WiFi sleep, which will cause download issues. Settings->Wifi->Menu Button->Advanced->Wifi Sleep Policy->Never sleep when plugged in
Enter the chroot​First, mount the Debian partition on the G1 from your PC, using these commands:
adb shell
mkdir /data/mnt
mount -t ext3 /dev/block/mmcblk0p3 /data/mnt
Then, enter the chroot:
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
chroot /data/mnt /bin/bash
Set up Squeeze Package Repositories​This will install the necessary Debian repositories and some basic packages to the G1.
Type the commands below to add squeeze package repositories:
echo "deb http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib" >> /etc/apt/sources.list
echo "deb http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://security.debian.org/ squeeze/updates main contrib non-free" >> /etc/apt/sources.list
echo "deb http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian squeeze-updates main contrib non-free" >> /etc/apt/sources.list
apt-get update
apt-get install bzip2 build-essential
Install SSH​Finally, we can install the openssh packages. An SSH server allows you to access a USB connected phone from your computer, so you can pump in terminal commands using copy and paste.
Type this command in the same chroot at your computer:
apt-get install openssh-server openssh-client libkrb53 openssh-blacklist libedit2 udev libvolume-id0 libkeyutils1
/etc/init.d/ssh stop
Create a Root user password and exit the Chroot​We will want to create a root user password.
passwd
Type in the password you want to use (make sure that you only use numbers and letters! special characters cannot be easily entered).
As a security measure, text will not appear onscreen, so just keep typing and press enter when you've put it in.
Exit the Chroot​We're all done, so you can exit the chroot.
sync
exit # exits the chroot
umount /mnt
rmdir /data/mnt
exit # exits `adb shell`
Boot Linux​Put the sdcard back into your G1, Plug in your G1 to the PC, and type this command to enter fastboot mode:
adb reboot bootloader
Type this command on your Linux PC to download and boot the kernel.
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
fastboot -c "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" boot ./zImage
Your phone will now boot into Debian.
Type in the Username and Password​As a security feature, nothing will be displayed while you type your password.
username: root
password: <the password that you created>
Tether your G1's internet connection to the PC​We have to forward your PC's internet connection to your G1. Type these commands in the computer:
ifconfig usb0 192.168.0.200/26
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE
(not tested) Alternatively, use these commands: (recommended by Jorge Peñalba)
ifconfig usb0 192.168.0.200/26\
iptables -A POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 1 \> /proc/sys/net/ipv4/ip\_forward\
ssh 192.168.0.202 -l root\
iptables -D POSTROUTING -t nat -s 192.168.0.0/24 -j MASQUERADE\
echo 0 \> /proc/sys/net/ipv4/ip\_forward
SSH into the G1​Use this command to SSH into the G1's command line, so you can send commands to it from your computer. Log into your phone with the same username and password you set before.
ssh 192.168.0.202
Enable Dual Boot (optional)​We will create a custom kernel for the phone to dual-boot between Android and Linux. This way, you will be able to hold power+home to boot Linux.
Use your computer to SSH into the G1 and run these commands:
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/mkboot.tar.bz2
tar -jxvf mkboot.tar.bz2
cd mkboot
make && make install
cd /usr/src
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Outils/android-imagetools.tar.bz2
tar -jxvf android-imagetools.tar.bz2
cd android-imagetools
make && make install
cd /tmp
wget http://www.galoula.net/fr/Tutoriels/HTC-DREAM-G1/FTP/Native_Debian/2.6.32_GALOULA-001/zImage
wget http://wiki.openmoko.org/images/f/f6/Newramdisk.cpio.gz
mkbootimg --cmdline "console=tty0 no_console_suspend=1 root=/dev/mmcblk0p3 rootdelay=2 fbcon=rotate:1" \
--kernel zImage --ramdisk ./Newramdisk.cpio.gz -o Recovery-boot.img
cat /dev/zero > /dev/mtd1
mkdir /dev/mtd
cd /dev/ && for i in `ls -w1 mtd?`;do ln -s /dev/$i /dev/mtd/$i; done && cd - || cd -
flash_image recovery Recovery-boot.img
Normal boot will get you into Android
Holding home and power will boot into debian
Galoula's Netinstall​How to Install Ubuntu with Ubuntu-Install.img ?
Download Ubuntu-Install.img on your Linux-PC.
Turn off your HTC G1.
Turn On HTC G1 in FastBosst mode : Power on with hold the camera button, if it's OK, you can see 3 Android on Skateboards.
In this screen press Back.
Connect USB cable betweek PC and G1.
On your Linux PC type this command : "fastboot boot Ubuntu-Install.img" without quotes.
If the G1 don't start, press the back button on G1.
The G1 start the Ubuntu Installer.
Warning ! My image is set for a French G1 keymap.
The special keys are :
Up : End
Down : Back
Left : Home
Right : Call
Escape : menu (on keyboard)
Tab : Right alt with Q.
Control : Search Button
For get networking works : This kernel use USB-NET.
To configure IT :​On the Linux PC :
sudo ifconfig usb0 192.168.0.200 netmask 255.255.255.0 up
iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
sysctl -w net.ipv4.ip_forward=1
On the G1 :​When the installer tell you for Networking Configuration, chose usb0
You can cancel the DHCP discover.
Type this settings :
IP Address : 192.168.0.202
NetMask : 255.255.255.0
GateWay : 192.168.0.200
DNS : Your DNS
The setup tell you because it can't download "kernel modules", chose continue, my kernel can read the SDCARD for the installation, but it can't read internal partition for more secure.
The setup can tell you a warning because the kernel can't be installed, please continue (and ignore it) because, Ubuntu-Rescue.img contain the appropriate kernel.
Actualy, the file is : boot-recovery.img
Now, you can setup your Ubuntu !
Galoula's Netinstall images
Page Index for this GitHub Wiki
Source: Github
Click to expand...
Click to collapse
Could you provide the ROM, HardSPL, and EngeneeringSPL?

Xiaomi Mi A2, auto reboot on usb power on

Hello people,
I need a xiaomi phone to boot when usb power is turned on.
Stock boot image
Android 9 PKQ1.180904.001.V10.0.8.0.PDIMIXM
What I tried so far:
#1 Battery animation file
I found some solutions for samsung smartphones modifing charger animation files.
system/bin/lpd
system/bin/lpod
--> Did not find such file. My /System/bin/ contains:
Code:
acpi dd input mknod rmdir tc-wrapper-1.0
am debuggerd insmod mkswap rmmod tee
app_process dex2oat ionice mktemp run-as telecom
app_process32 dexdiag iorenice modinfo runcon time
app_process64 dexdump ip modprobe schedtest timeout
applypatch dexlist ip-wrapper-1.0 monkey screencap tinycap
appops df ip6tables more screenrecord tinymix
appwidget diff ip6tables-restore mount secdiscard tinypcminfo
atrace dirname ip6tables-save mountpoint secilc tinyplay
awk dmesg ip6tables-wrapper-1.0 move_time_data.sh sed toolbox
base64 dos2unix iptables mv sendevent top
basename dpm iptables-restore ndc sensors_test touch
bcc du iptables-save ndc-wrapper-1.0 sensorservice toybox
blockdev dumpsys iptables-wrapper-1.0 netstat seq tr
bmgr echo iw newfs_msdos service true
bu egrep keystore_cli_v2 nice setenforce truncate
bugreport env kill nl setprop tty
bugreportz expand killall nohup setsid tzdatacheck
bunzip2 expr ld.mc oatdump settings uiautomator
bzcat fallocate linker od sh ulimit
bzip2 false linker64 paste sha1sum umount
cal fgrep linker_asan patch sha224sum uname
cat file linker_asan64 patchoat sha256sum uniq
chcon find ln perfetto sha384sum unix2dos
chgrp flock load_policy pgrep sha512sum update_engine_client
chmod fmt locksettings pidof simg2img uptime
chown free log ping sleep usleep
chroot getenforce logcat ping6 sm uudecode
chrt getevent logname pkill sort uuencode
cksum getprop logwrapper pm split vmstat
clear grep losetup pmap start vr
cmd groups ls ppd stat wc
cmp gunzip lshal printenv stop which
comm gzip lsmod printf strings whoami
content head lsof ps stty wigig_logcollector
cp hid lspci pvclicense_sample svc wigig_remoteserver
cpio host_manager_11ad lsusb pwd swapoff wigig_wiburn
crash_dump32 hostname md5sum readlink swapon wm
crash_dump64 hw media realpath sync xargs
curl hwclock microcom reboot sysctl xxd
cut id mkdir renice tac yes
dalvikvm ifconfig mkfifo requestsync tail zcat
dalvikvm32 ime mkfs.ext2 resize2fs tar
dalvikvm64 incident mkfs.ext3 restorecon taskset
date inotifyd mkfs.ext4 rm tc
#2 Ram Disk modification
I pulled the /System/bin/reboot file using adb shell and extracted the boot.img using android kitchen 3.5 from the forum.
Verified that everything works by unpacking/repacking/flasing boot image.
https://forum.xda-developers.com/showthread.php?t=2073775
- replaced the /ramdisk/sbin/charger file with the reboot file
--> battery animation is still there but nothing happens
- modified the charger file according to this discussion: https://forum.xda-developers.com/ga...-os-auto-boot-charge-connected-t3626364/page2
--> battery animation gone but stuck at google logo
- modified /ramdisk/init.rc and added:
on charger
trigger late-init
--> battery animation gone but stuck at google logo
- deleted /sbin/charger and charger service in init.rc and flashed image to both boot slots
--> changes nothing, battery animation will still show up.
- searched for battery/animation files / images in the ramdisk, but there seems to be nothing.
What else could I try?
Why isnt it working as expected?
Would flashing LineageOS or getting root access change anything?
UPDATE
--> here you can find a solution
[Q] Power on when plugged in (boot when docked)?
Many Greetings & Thanks alot,
himi

Ho to back up of the whole memory block (via adb)

Dears maybe now I can make double post but I hang on that step from guide from this site.
Phone is after wipe data and I need rescue data from it for that I want to make RAW image to recover data.
What I do until now:
adb forward tcp:5555 tcp:5555
adb shell
su
/system/xbin/busybox nc -l -p 5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0
but in results get:
1|ASUS_I001_1:/ # /system/xbin/busybox nc -1 -p 5555 -e /system/xbin/busybox dd
5555 -e /system/xbin/busybox dd if=/dev/block/mmcblk0 <
nc: invalid option -- 1
BusyBox v1.32.0-Stericson (2020-07-18 18:33:24 EDT) multi-call binary.
Usage: nc [OPTIONS] HOST PORT - connect
nc [OPTIONS] -l -p PORT [HOST] [PORT] - listen
-e PROG Run PROG after connect (must be last)
-l Listen mode, for inbound connects
-lk With -e, provides persistent server
-p PORT Local port
-s ADDR Local address
-w SEC Timeout for connects and final net reads
-i SEC Delay interval for lines sent
-n Don't do DNS resolution
-u UDP mode
-v Verbose
-o FILE Hex dump traffic
-z Zero-I/O mode (scanning)
1|ASUS_I001_1:/ #
Why I get that this parameter is invalid:
nc: invalid option -- 1
And to the end, if that don't work to me, next step also don't work.
Open another Cygwin terminal and type:
Code:
adb forward tcp:5555 tcp:5555
cd /path/to/store/the/backup ---> this is correct, should I creat some folder on HHD and insert here his name?
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0.raw --> that means I should have ftp serwer?

How To Guide How to backup the data from the phone using rsync and ssh (including some hints for using sshd on an Android phone)

How to backup the data from the phone using rsync and ssh (including some hints for using sshd on an Android phone)
Like for all computer it's important to have a backup of the data on the phone.
For those who like me don't like to store their private data in one of the suspicious clouds there is a solution with standard Linux tools:
Use rsync and ssh to backup the data from the phone to your local workstation (see the man page for rsync for details regarding rsync and why it is useful for this task)
The neccessary tools for Android for this method can be installed with the Magisk Module MagiskSSH.
Download the Magisk Module with MagiskSSH from here
https://gitlab.com/d4rcm4rc/MagiskSSH_releases
Copy the ZIP file with the Magisk Module to the phone :
Code:
adb push magisk_ssh_v0.14.zip /sdcard/Download/
and install it via the module installation from within the Magisk App or manuell using :
Code:
adb shell su - -c /data/adb/magisk/magisk64 --install-module /sdcard/Download/magisk_ssh_v0.14.zip
Sample output of the installation:
Code:
ASUS_I006D:/ # /data/adb/magisk/magisk64 --install-module /sdcard/Download/magisk_ssh_v0.14.zip
- Current boot slot: _a
- Device is system-as-root
*******************************
OpenSSH for Android
*******************************
[0/7] Preparing module directory
[1/7] Extracting architecture unspecific module files
[2/7] Extracting libraries and binaries for arm64
[3/7] Configuring library path wrapper
[4/7] Recreating symlinks
[5/7] Creating SSH user directories
[6/7] Found sshd_config, will not copy a default one
[7/7] Cleaning up
- Setting permissions
- Done
ASUS_I006D:/ #
A reboot is required now.
Code:
adb shell reboot
For the next tasks open an adb shell and become root user.
Next create the authorized_keys file for the user root :
Code:
touch /data/ssh/root/.ssh/authorized_keys
chmod 600 /data/ssh/root/.ssh/authorized_keys
and add your public ssh key to the file /data/ssh/root/.ssh/authorized_keys.
To make sure that the keys and other data files for the MagiskSSH module are not removed while deinstalling the module you should create the file /data/ssh/KEEP_ON_UNINSTALL:
Code:
touch /data/ssh/KEEP_ON_UNINSTALL
The MagiskSSH module also installs a service to start sshd after each reboot: to disable this start create the file /data/ssh/no-autostart:
Code:
touch /data/ssh/no-autostart
To manually start or stop the sshd use the script /data/adb/modules/ssh/opensshd.init :
Code:
# start the sshd (as user root)
#
/data/adb/modules/ssh/opensshd.init start
# to stop the sshd (as user root)
#
/data/adb/modules/ssh/opensshd.init stop
Now test the access via ssh from your Linux workstation:
Code:
ssh -l root <phone_ip_address> id
Use this command to retrieve the current IP address of the phone:
Code:
PHONE_IP_ADDRESS=$( adb shell ifconfig wlan0 | grep "inet addr:" | sed -e "s/.*inet addr://g" -e "s/[[:space:]]*Bcast.*//g" )
example :
Code:
[[email protected] ~]$ ssh -l root ${PHONE_IP_ADDRESS} id
uid=0(root) gid=0(root) groups=0(root) context=u:r:magisk:s0
[[email protected] ~]$
Now you can use rsync to backup the data from the phone, e.g. to backup the photos from the phone do :
Code:
# on your local Linux workstation do:
# start the sshd on the phone via adb if not already running
#
adb shell su - -c /data/adb/modules/ssh/opensshd.init start
# retrieve the current IP address from the phone
#
PHONE_IP_ADDRESS=$( adb shell ifconfig wlan0 | grep "inet addr:" | sed -e "s/.*inet addr://g" -e "s/[[:space:]]*Bcast.*//g" )
# backup the new photos from the phone to the Linux workstation (rsync only copies new files from the phone)
# to the local directory /data/backup/ASUS_ZENFONE8/DCIM
#
rsync -av --rsync-path /data/adb/modules/ssh/usr/bin/rsync [email protected]${PHONE_IP_ADDRESS}:/sdcard/DCIM/ /data/backup/ASUS_ZENFONE8/DCIM
# optional stop the sshd on the phone via adb
#
adb shell su - -c /data/adb/modules/ssh/opensshd.init stop
Note: The sshd configuration file used is /data/ssh/sshd_config
Sample Script to backup all data in the directory /sdcard
Code:
##!/bin/bash
#
# simple script to backup the data of an phone using adb, ssh, and rsync
#
# History
# 27.06.2022 /bs
# initial release
#
# for testing
#
#RSYNC_OPTIONS="${RSYNC_OPTIONS} --dry-run"
RSYNC_OPTIONS="${RSYNC_OPTIONS} --del "
# default is to backup the phone connected via adb over LAN
#
[ $# -ne 0 ] && ADB_OPTIONS="$*" || ADB_OPTIONS="-e"
# retrieve the serial number of the attached phone
#
SERIAL_NO="$( adb ${ADB_OPTIONS} shell getprop ro.serialno )"
if [ "${SERIAL_NO}"x = ""x ] ; then
echo "ERROR: Can not read the serial number of the connected phone"
exit 89
fi
VENDOR_MODEL="$( adb ${ADB_OPTIONS} shell getprop ro.product.vendor.model )"
# directory for the backup
#
BACKUP_DIR="/data/backup/ASUS_ZENFONE8/data_backup/${VENDOR_MODEL}_${SERIAL_NO}"
if [ ! -d "${BACKUP_DIR}" ] ; then
echo "ERROR: The directory \"${BACKUP_DIR}\" does not exist"
exit 99
fi
PHONE_IP_ADDRESS="$( adb ${ADB_OPTIONS} shell ifconfig wlan0 | grep "inet addr:" | sed -e "s/.*inet addr://g" -e "s/[[:space:]]*Bcast.*//g" )"
if [ "${PHONE_IP_ADDRESS}"x = ""x ] ; then
echo "ERROR: Can not detect the IP address of the phone"
exit 100
fi
echo "Updating a backup of the data on the phone with the serial number \"${SERIAL_NO}\" and the IP \"${PHONE_IP_ADDRESS}\" to the directory \"${BACKUP_DIR}\" ..."
set -x
# start the sshd if neccessary
#
adb ${ADB_OPTIONS} shell su - -c /data/adb/modules/ssh/opensshd.init start
# do the backup
#
time rsync ${RSYNC_OPTIONS} -av --rsync-path /data/adb/modules/ssh/usr/bin/rsync [email protected]${PHONE_IP_ADDRESS}:/sdcard/ "${BACKUP_DIR}/"
# stop the sshd
#
adb ${ADB_OPTIONS} shell su - -c /data/adb/modules/ssh/opensshd.init stop
set +x
How to enable access via ssh for non-root user
In the standard configuration installed by MagiskSSH ssh access is only allowed as user root because the ssh keys are in the directory /data and all non-root user can not read files in the directory /data. Therefor some efforts are neccessary to add ssh access for non-root user.
e.g. To enable the ssh access for the user shell do:
To configure ssh access for the user shell we must create a .ssh directory for the user shell in a directory tree owned by the user shell. The only directory on the phone owned by the user shell that can be used for this purpose is /storage :
Code:
ASUS_I006D:/ # ls -ld /storage
drwx--x--- 4 shell everybody 80 2022-06-26 18:37 /storage
ASUS_I006D:/ #
But unfortunately all files and directories in this directory are temporary and will be deleted after a reboot of the phone.
Therefor we configure a startup script in Magisk to create this directory tree after each reboot, e.g.
/data/adb/service.d/create_ssh_dir_for_shell.sh:
Code:
# /data/adb/service.d/create_ssh_dir_for_shell.sh
#
mkdir -p /storage/shell/.ssh
chmod -R 700 /storage/shell/
touch /storage/shell/.ssh/authorized_keys
echo "<ssh_public_key>" > /storage/shell/.ssh/authorized_keys
chmod 600 /storage/shell/.ssh/authorized_keys
chown -R shell:shell /storage/shell
Make the script executable:
Code:
su - -c chmod +x data/adb/service.d/create_ssh_dir_for_shell.sh
To test the script just execute it one time manually as user root.
Code:
su - -c sh data/adb/service.d/create_ssh_dir_for_shell.sh
Now create a backup of the sshd config file
Code:
su - -c cp /data/ssh/sshd_config /storage/ssh/sshd_config.org.$$
and add these lines at the end of the file /data/ssh/sshd_config
Code:
Match User shell
AuthorizedKeysFile /storage/shell/.ssh/authorized_keys
Restart the sshd if it's already running
Now test the access as user shell, example:
Code:
[[email protected] ~]$ ssh -l shell 192.168.1.148 id
uid=2000(shell) gid=2000(shell) groups=2000(shell) context=u:r:magisk:s0
[[email protected] ~]$
The reason for this config is the setting "StrictMode yes" in the sshd config file /data/ssh/sshd_config (see the man page for sshd_config for details). So another "solution" is to change this setting:
With the setting "StrictModes no" in the file sshd_config the directory with the authorized_keys file for the non-root users can be anywhere (for example in /sdcard/shell)
Execute as user root:
Code:
sed -i -e "s/.*StrictModes.*//g" -e "s/UsePrivilegeSeparation/StrictModes no\nUsePrivilegeSeparation/g" /data/ssh/sshd_config
and change the entry in the file /data/ssh/sshd_config for the authorized_keys file for the user shell, for example:
Code:
Match User shell
AuthorizedKeysFile /sdcard/shell/.ssh/authorized_keys
Afterwards restart the sshd:
Code:
/data/adb/modules/ssh/opensshd.init stop
/data/adb/modules/ssh/opensshd.init start
Now create the directories and files neccessary for the ssh access (see above) in the directory /sdcard/shell:
Code:
SUS_I006D:/ # find /sdcard/shell -exec ls -ld {} \;
drwxrws--- 3 u0_a118 media_rw 3452 2022-06-26 18:32 /sdcard/shell
drwxrws--- 2 u0_a118 media_rw 3452 2022-06-26 18:32 /sdcard/shell/.ssh
-rw-rw---- 1 u0_a118 media_rw 408 2022-06-26 18:32 /sdcard/shell/.ssh/authorized_keys
ASUS_I006D:/ #
and the access as user shell via ssh should work

How To Guide How to configure the WiFI in Android via script

In the current version of Android the WiFi configuration is stored in the file
/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
e.g.
Code:
ASUS_I006D:/ # ls -lZtr /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
-rw------- 1 system system u:object_r:apex_system_server_data_file:s0 4884 2023-01-29 08:55 /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
ASUS_I006D:/ #
The file is in plain ASCII xml format so it can be processed by any executable to change text files (editor, sed, etc).
But IMHO it's better to configure the WiFi manually via GUI and then use the file WifiConfigStore.xml with that configuration for configuring the WiFi via script. Therefor I use this code in the post install script to install and configure my phone (see How to install and configure the Android OS via Script):
Spoiler: script commands to enable and configure WiFi
Bash:
#
# sample post install script for the customizing of the phone
#
# This script will be copied to the phone and executed there
#
# The script is executed by the user shell; use "su - -c <command>" to execute commands as user root
#
echo ""
echo "*** Postinstall script is running ..."
echo ""
# ... other customizations ....
#
# create the WiFi config file
#
# -rw------- 1 system system u:object_r:apex_system_server_data_file:s0 4884 2023-01-29 08:55 /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
#
WIFI_CONFIG_FILE="/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml"
WIFI_CONFIG_FILE_BACKUP="${WIFI_CONFIG_FILE}.$$.bkp"
NEW_WIFI_CONFIG_FILE="/sdcard/Download/WifiConfigStore.xml"
if [ -r "${WIFI_CONFIG_FILE}" ] ; then
echo "Creating a backup of the file \"${WIFI_CONFIG_FILE}\" in \"${WIFI_CONFIG_FILE_BACKUP}\" ...."
cp "${WIFI_CONFIG_FILE}" "${WIFI_CONFIG_FILE_BACKUP}"
fi
echo "Creating the file \"${NEW_WIFI_CONFIG_FILE}\" ..."
cat >"${NEW_WIFI_CONFIG_FILE}" <<-\EOT
*** add here the contents of the file /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml from the phone after manually configuring the WLAN
EOT
if [ $? -eq 0 ] ; then
echo "Creating the file \"${WIFI_CONFIG_FILE}\" ..."
su - -c cp "${NEW_WIFI_CONFIG_FILE}" "${WIFI_CONFIG_FILE}" && \
su - -c chmod 600 "${WIFI_CONFIG_FILE}" && \
su - -c chown system:system "${WIFI_CONFIG_FILE}" && \
su - -c chcon -v "u:object_r:apex_system_server_data_file:s0" "${WIFI_CONFIG_FILE}"
if [ $? -ne 0 ] ; then
echo "Error creating the file \"${WIFI_CONFIG_FILE}\" "
fi
else
echo "Error creating the file \"${NEW_WIFI_CONFIG_FILE}\" "
fi
# enable WiFi
#
echo "Enabling WiFi ..."
svc wifi enable
# optional: Disable mobile data connections
#
echo "Disabling mobile data ..."
svc data disable
# Now reboot the phone to activate the new WiFi config ..
#
echo "Waiting 15 seconds now before rebooting - press CTRL-C to abort ...."
i=0
while [ $i -lt 15 ] ; do
(( i = i + 1 ))
printf "."
sleep 1
done
printf "\n"
echo "Now rebooting the phone ..."
reboot
#
Notes:
Be aware the the file /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml contains the passwords for all configured WLANs in plain text.
There should be a command to force Android to reread the file WifIConfigStore.xml but I don't know that.
Android can be forced to re-read the file WifIConfigStore.xml by killing the process system_server, e.g:
Bash:
pkill system_server
But that is more or less a warm reboot and I do not know what other side effects that restart triggers
There is an app to configure WiFi via adb command
https://github.com/steinwurf/adb-join-wifi
Bash:
adb shell am start -n com.steinwurf.adbjoinwifi/.MainActivity -e ssid myssid -e password mywlan_password -e password_type WPA
The app works but unfortunately it does not support enabling the setting to use the device MAC instead of the random MAC so it's not usable in my environment.
Another app to configure WiFi via adb command is available here:
https://github.com/pr4bh4sh/adb-wifi-setting-manager
Unfortunately that app also does not support enabling choosing the MAC address for the connection.
There is also a script to convert an old Android wpa_supplicant.conf file to the newer (post-Oreo) WifiConfigStore.xml file (not tested):
https://github.com/mnalis/android-wifi-upgrade
It's also possible to use the command wpa_cli to configure WiFi but be aware the wpa_cli only works if selinux is (temporary) disabled, example:
Spoiler: wpa_cli example
Code:
ASUS_I006D:/ $ su -
ASUS_I006D:/ #
ASUS_I006D:/ # setenforce 0
ASUS_I006D:/ #
ASUS_I006D:/ #
ASUS_I006D:/ # wpa_cli
wpa_cli v2.10-devel-11
Copyright (c) 2004-2019, Jouni Malinen <[email protected]> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Using interface 'wlan0'
Interactive mode
<3>Control interface command 'BSS RANGE=ALL MASK=0x2'
<3>Control interface command 'LIST_CREDS'
<3>Control interface command 'LIST_NETWORKS'
<3>Control interface command 'STA-FIRST'
>
> list_networks
network id / ssid / bssid / flags
0 Zeilsheim any [CURRENT]
1 any [DISABLED]
<3>Control interface command 'LIST_NETWORKS'
>
> quit
ASUS_I006D:/ #
Note: Use help to get list of known commands
Test Environment
I tested the WiFi config via script described above in these Android distributions:
OmniROM 13 (Android 13)
OmniROM 12 (Android 12)
ASUS Android 12
ASUS Android 13
This method seems not to work in Android 11

Categories

Resources