Putting Linux on your Android device using debootstrap and chroot
- A rooted android device of sorts with debugging enabled and busybox installed
- An sdcard to store the debian image on
- A Linux machine (or live cd) to prepare the debian system image
- ADB for remounting the system partition and pushing startup scripts
- A terminal application installed on your droid
- and about an hour of free time
open up a terminal, and make a directory that you will be storing all of the files and things we create for easy cleanup later. I called mine linux_on_android. change to that directory, all instructions from here on out will be relative to whatever directory you are currently residing in after this step.
Next, we create an empty raw disk image, make a directory to mount it under, create a filesystem on the image, and mount it under our new mount point.
Now lets change into our mnt directory, install debootstrap, and use it to install a base system into our mounted image for the architecture of our android device, in this case it is i386, in most cases this will actually be armhf especially if this is being done on a phone.
Once this has finished, we now need to push the debian system image to the sdcard, go get some coffee lol, or mount your sdcard and transfer it using the file manager, this just makes it easier for me, because I was doing this to a VM lol.
Now that we have that bit done, we move onto the fun bits. lets start adb shell, setup a chroot environment, and chroot into our new debian image :D
the long haul is almost done :D make sure you are somehow connected to the internet on your device, and lets install some packages.
Update package lists |
install ssh server |
build utilities and nmap |
The following are an example startup, and shutdown script for debian. start_debian: http://pastebin.com/5Ujk3TKa
stop_debian: http://pastebin.com/CkGMA4ty
Now you can open up your terminal, and start and stop debian at will. to log into your new debian image, connect using your ssh client of choice, I kinda like connectbot, so that is what i will use in the screenshots:
stop_debian: http://pastebin.com/CkGMA4ty
Now you can open up your terminal, and start and stop debian at will. to log into your new debian image, connect using your ssh client of choice, I kinda like connectbot, so that is what i will use in the screenshots:
Comments
Post a Comment