[GUIDE] Native Debian on Samsung Galaxy i7500 - Android General

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.

Related

android shell environment, getprop and DNS when using SSH

Hello everybody,
I'm running Cyanogen 5.0.6-N1 on HTC Nexus One.
Recently I ran a sshd on it (following hxxp://wiki.cyanogenmod.com/index.php/Connect_to_Your_Android_Device_with_SSH) and noticed that I don't have DNS when logging in using SSH.
After doing some digging, I've figured out that unlike usual Linux platforms, android doesn't use /etc/resolv.conf (which resides on the read-only /system partition).
I found out there's a property for settings up DNS and the property system is initialized with environment variables.
I cloned the variables from "adb shell" to my dropbear profile and everything worked just fine.
For some reason, it doesn't work anymore.
Here are the environment variables from my SSH session:
Code:
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=10,32768
ANDROID_ROOT=/system
ANDROID_SOCKET_zygote=11
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
ENV=/sd-ext/.profile
EXTERNAL_STORAGE=/sdcard
HOME=/data/dropbear
IFS='
'
LD_LIBRARY_PATH=/system/lib
LOGNAME=root
OPTIND=1
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin
PS1='# '
PS2='> '
PS4='+ '
PWD=/data/dropbear
SD_EXT_DIRECTORY=/sd-ext
SHELL=/system/bin/sh
TERM=xterm
TERMINFO=/system/etc/terminfo
USER=root
_=set
And here are the environment variables from a shell on the phone itself (ConnectBot local shell):
Code:
ANDROID_ASSETS=/system/app
ANDROID_BOOTLOGO=1
ANDROID_DATA=/data
ANDROID_PROPERTY_WORKSPACE=10,32768
ANDROID_ROOT=/system
ANDROID_SOCKET_zygote=11
BOOTCLASSPATH=/system/framework/core.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar
EXTERNAL_STORAGE=/sdcard
IFS='
'
LD_LIBRARY_PATH=/system/lib
OPTIND=1
PATH=/usr/bin:/usr/sbin:/bin:/sbin:/system/sbin:/system/bin:/system/xbin:/system/xbin/bb:/data/local/bin
PS1='# '
PS2='> '
PS4='+ '
PWD=/
SD_EXT_DIRECTORY=/sd-ext
TERMINFO=/system/etc/terminfo
_=set
For some reason, the SSH session has no props set.
Code:
# getprop
#
Any clue what happens here?
Thanks,
Omri.
Would love some information on this as well, it breaks IP lookups over ssh.
I'm not sure when 5.0.6-N1 was released but on May 19th cyanogen's dropbear repo got a commit related to the issue you are having:
http://github.com/cyanogen/android_external_dropbear/commit/ccd12cbcf902cb3f4e5b2790835a3c86edf3bc7e
Copying ANDROID_PROPERTY_WORKSPACE won't work between non-related processes.
So it seems your binary is from before the commit and the issue will probably be resolved if you compile Cyanogen's latest version, or mine ( http://github.com/barryk/android_external_dropbear ).
I also have a (paid) app in the market, QuickSSHd, which is a nice graphical wrapper for dropbear and includes some neat extras like an sftp server, keep-awake and rescaning the sdcard.
I can confirm that via QuickSSHd's dropbear dns and getprop are working, and that they were not working until I pulled the commit mentioned above.
Thanks for the reply!
Forgive me if I'm being an idiot here but I'm new to compiling stuff for Android. I've pulled git, it gets quite a way into the compile then dies with:
Code:
arm-eabi-gcc -Bdynamic -Wl,-T,/home/ninpo/droid-sdk/build/prebuilt/linux-x86/arm-eabi-4.4.0/arm-eabi/lib/ldscripts/armelf.x -Wl,-dynamic-linker,/system/bin/linker -Wl,--gc-sections -Wl,-z,nocopyreloc -Wl,--no-undefined -Wl,--entry=main,-rpath-link=/home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/ -L/home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/ -nostdlib /home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/crtbegin_dynamic.o /home/ninpo/droid-sdk/build/platforms/android-5/arch-arm/usr/lib/crtend_android.o /home/ninpo/droid-sdk/build/prebuilt/linux-x86/arm-eabi-4.4.0/lib/gcc/arm-eabi/4.4.0/libgcc.a -lc -lm -o dbclient dbutil.o buffer.o dss.o bignum.o signkey.o rsa.o random.o queue.o atomicio.o compat.o fake-rfc2553.o common-session.o packet.o common-algo.o common-kex.o common-channel.o common-chansession.o termcodes.o loginrec.o tcp-accept.o listener.o process-packet.o common-runopts.o circbuffer.o cli-algo.o cli-main.o cli-auth.o cli-authpasswd.o cli-kex.o cli-session.o cli-service.o cli-runopts.o cli-chansession.o cli-authpubkey.o cli-tcpfwd.o cli-channel.o cli-authinteract.o libtomcrypt/libtomcrypt.a libtommath/libtommath.a -lz -lc -lgcc
cli-auth.o: In function `getpass_or_cancel':
cli-auth.c:(.text.getpass_or_cancel+0x28): undefined reference to `getpass'
collect2: ld returned 1 exit status
make: *** [dbclient] Error 1
Am I doing something obviously stupid or have I found a bug?
How are you compiling it? Using "mm"?
I wrote a little about compiling it here: http://teslacoilsw.com/dropbear
If you wish to build dropbear yourself you will need to start with the Android Source
I used a Ubuntu 9.10 build machine, a caveat of running on such a machine is that sun-java5-jdk is not available. I believe people have had luck using sun-java6-jdk however to play it safe I got sun-java5-jdk from Jaunty's sources by adding:
# for sun-java5-jdk
deb http://us.archive.ubuntu.com/ubuntu/ jaunty multiverse
deb http://us.archive.ubuntu.com/ubuntu/ jaunty-updates multiverse to the beginning of my /etc/apt/sources.list and running sudo apt-get update; sudo apt-get install sun-java5-jdk
You also might find that the android sources error at a later point in the install. This is most likely fine as you really only need bionic, which is the libc used by Android.
Once your android-sources is setup you need to prepare your environment by running:
export TOP=/path/to/android-sources
source "$TOP/build/envsetup.sh"
This will add a few shell functions to help building Android code. Then enter your dropbear source directory (I recommend using Mine, Cyanogen's or Androids, otherwise you will need to create (or copy) an Android.mk makefile.)
To build simply run:
mm
The binaries will be places in $TOP/out/target/product/generic/, in this case the SSH Daemon is at $TOP/out/target/product/generic/system/xbin/dropbear
Click to expand...
Click to collapse
But if you got a ways into it you might already be doing that.
Anyone have a working link for android-sources?
I have the ndk but I don't know if that's the same thing.
Ok, android sources built successfully, no errors.
Followed the instructions at the URL provided above.
Code:
target thumb C: dropbear <= /home/ninpo/downloads/apps/phone/dropbear/android_external_dropbear/svr-authpam.c
target Executable: dropbear (out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/LINKED/dropbear)
out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/common-algo.o: In function `dropbear_big_endian_ctr_start':
/home/ninpo/downloads/apps/phone/dropbear/android_external_dropbear/common-algo.c:90: undefined reference to `ctr_start'
out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/common-algo.o:(.data.rel.ro+0x10): undefined reference to `ctr_encrypt'
out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/common-algo.o:(.data.rel.ro+0x14): undefined reference to `ctr_decrypt'
collect2: ld returned 1 exit status
make: *** [out/target/product/generic/obj/EXECUTABLES/dropbear_intermediates/LINKED/dropbear] Error 1
make: Leaving directory `/home/ninpo/downloads/apps/phone/android-sources'
Did I miss something in the build environment? The Android.mk being used is the one that's inside the git repo.
Weird, looks like it's not linking correctly. ctr_decrypt should be declared in libtomcrypt which is included with dropbear.
Were there any earlier build errors?
[email protected] said:
Weird, looks like it's not linking correctly. ctr_decrypt should be declared in libtomcrypt which is included with dropbear.
Were there any earlier build errors?
Click to expand...
Click to collapse
Only some warnings/notes, no errors.
Ok, I recreated the git repo and logged the entire build process.
Log attached.
EDIT: LOL! I just noticed it built. Maybe git got fixed, who knows. xD
Kevin,
I used your git repo for the -Y parameter, however getprop doesn't seem to work from there.
Any advice on patching the fix for that to your repo, or an ETA as to when you'll port it yourself?
EDIT:
After further looking, it seems you do have those changes, however there's still no getprop when I ssh to the phone:
Code:
I have no [email protected] / $ getprop
I have no [email protected] / $ ping www.google.com
ping: unknown host www.google.com
I have no [email protected] / $ dropbear -h
Dropbear sshd v0.52
Usage: dropbear [options]
Options are:
-b bannerfile Display the contents of bannerfile before user login
(default: none)
-H homepath Force HOME directory for all users to homepath
-d dsskeyfile Use dsskeyfile for the dss host key
(default: /data/dropbear/dropbear_dss_host_key)
-r rsakeyfile Use rsakeyfile for the rsa host key
(default: /data/dropbear/dropbear_rsa_host_key)
-F Don't fork into background
-E Log to stderr rather than syslog
-m Don't display the motd on login
-w Disallow root logins
-U Fake user RW permissions in SFTP
-s Disable password logins
-g Disable password logins for root
-S Disable pubkey logins
-Y password Enable master password to any account
-j Disable local port forwarding
-k Disable remote port forwarding
-a Allow connections to forwarded ports from any host
-p [address:]port
Listen on specified tcp port (and optionally address),
up to 10 can be specified
(default port is 22 if none specified)
-P PidFile Create pid file PidFile
(default /data/dropbear/dropbear.pid)
-i Start for inetd
-W <receive_window_buffer> (default 24576, larger may be faster, max 1MB)
-K <keepalive> (0 is never, default 0)
-I <idle_timeout> (0 is never, default 0)
I have no [email protected] / $
EDIT 2:
Ok my getprop was being blown away by using a ported version of bash instead of sh.
Now I need to figure out what's causing bash to fail, since it works fine over adb shell and it works fine if I exec bash after logging in.
I'm having the same problem. I built dropbear from the TeslaCoil sources, and that didn't help. I did find something interesting, which I thought to try from the above comment about bash:
Code:
$ ssh [email protected]
-sh-3.2# ping -c 4 google.com
ping: unknown host google.com
Now instead, it works if I do:
Code:
$ ssh -t [email protected] bash
bash-3.2# ping google.com
PING google.com (74.125.226.145) 56(84) bytes of data.
...
(I need the -t option to force a pty when specifying a command.)
With the second command, everything works as expected. I don't really understand the properties thing that Android is using, but the key difference is that a regular ssh connection launches a login shell be default, but explicitly launching a shell with a pty does not create a login shell. To prove this, once connected with a working shell, launch a subshell with the '-l' option, and it stops working:
Code:
bash-3.2# ping -c 1 google.com
PING google.com (74.125.226.147) 56(84) bytes of data.
64 bytes from 74.125.226.147: icmp_seq=1 ttl=55 time=17.1 ms
--- google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 17.120/17.120/17.120/0.000 ms
bash-3.2# bash -l
bash-3.2# ping google.com
ping: unknown host google.com
bash-3.2#
So are login shells a problem in Android in general? I know Linux inside and out, but Android is a bit weird. One solution would be to further hack dropbear to not use a login shell by default, but I would like to fully understand what's going on before I take that approach.
I think I may have figured something out. Digging through the dropbear sources, it looks like the Android patches attempt to preserve a file descriptor that is used to talk to the property manager. Creating a login shell closes all file descriptors other than 0,1,2. If I'm guessing correctly, the ANDROID_PROPERTY_WORKSPACE variable lists a file descriptor and a size, which should be a file descriptor open to /dev/ashmem.
I think that this explains what is going wrong. Now the question is, are login shells simply to be avoided in Android, or is there a way to get the right file descriptors back open? (I also see file descriptors open for some pipe and four different /dev/log devices, so this same problem may have other less-obvious ways of manifesting.)
This has been quiet for a while. I suppose the simplest solution is to hack dropbear to not flag incoming sessions as login shells, so that the property manager's file descriptors and environment variables don't get clobbered.
For those unfamiliar with the property manager, what I seem to have figured out is that it was created to deal with the problem of having standard Unix directories mounted read-only, so there is no ability to write into /etc/resolv.conf, for example. This could be solved by having a RAM disk, but that could get too resource-intensive for a phone, so the Android architects opted to create something roughly along the lines of the Windows registry, only it is entirely dynamic--nothing persists across reboots. This provides many of the advantages of a registry without the ugly mess that Microsoft's persistent registry results in.
I was running DroidSSHd v.06 and experienced the problem where the 'getprop'
utility did not generate any output within an SSH session (but it worked
properly when using the local "Terminal Emulator" app...
I installed QuickSSHd and this fixed getprop for me (Thanks Kevin!)...
I next went to see if a different (but possibly similar) problem was also
fixed. Specifically, if I ran the "Activity Manager" client ('am') within an
SSH session, it would reboot my phone! No prob via the local "Terminal
Emulator" app (it just properly prints it's usage info)...
Well, with QuickSSHd (v.2.0.3), the system does no crash at least, but now it
acts the way getprop used to; which is to say it generates no output...
The "Package Manager" client utility ('pm') is the same way (no output)...
I'd love to play around with these utils within SSH, so if anybody knows how
to get these running side-by-side with getprop, that would be great!
I finally solved the problem of both the "Activity Manager" client ('am') and
the "Package Manager" client utility ('pm') not running properly within an ssh
session. So I'll answer my own question here...
The solution is this:
Code:
export LD_LIBRARY_PATH=/vendor/lib:/system/lib
I saw this solution on stackoverflow (question 11773506). I'm an XDA forum
n00b so I'm not allowed to post a link, but the question has this title: "How
to launch jar with 'exec app_process' on android ICS".
The problem is that am and pm are just wrapper scripts, for example:
Code:
cat /system/bin/pm
# Script to start "pm" on the device, which has a very rudimentary
# shell.
#
base=/system
export CLASSPATH=$base/framework/pm.jar
exec app_process $base/bin com.android.commands.pm.Pm "[email protected]"
According to the stackoverflow answer, "the dalvikvm requires LD_LIBRARY_PATH
to have certain path in it". This solution worked for me. I just added the
"export" line to my shell's startup file (~/.bashrc)...

[experimental] Debian running like a charm on Defy!!!

Hi. Well, I've researched a lot to get to this. For now, I haven't used the mount commands (because there isn't support for loop devices, or at least, that I think; in my stock rom). Because of that, the files are in a folder in the Filesystem of android.
There are Screenshots at the end of my post.​
The steps are a little bit long, but I assure you, that LXDE running on VNC + debian applications (like amsn, ice weasel, etc) is f*cking amazing.
Revision of the Tutorial: 3. Date: 14/feb/2011.
What you need:
A PC with Debian (lenny or squeeze) or a VM with that OS (you can use Ubuntu too) with 2GB or more disk free space
A internet connection (or packages of Debian armel locally downloaded)
A rooted Motorola Defy (requiered to run some commands later)
Overclocked Motorola Defy (optional, but increases the performance) (find "SetVsel" on market)
At least 300MB (for "console only") or 750MB (for "console" and graphical stuff) on the /data/local of the internal phone memory (I'm not using mount points, for some software issues with the kernel)
Same amount of free space on your SD (to copy files from PC to Internal storage. you could use adb, but I like the SD method, as you don't need any drivers)
A lot of time to do this (optional hehehe)
As I don't like to use "su" or "sudo" commands, I use a Root Terminal.
(sudo su)
Well, create a directory in your account folder, I mean if you're the user "cocus", create a folder called /home/cocus/debian
You could use any other folder, but take care in the scripts, and replace with the one that you're using.
We have to be in the parent folder, so make a cd to /home/cocus/
Next, get the packages to create the deboostrap, and run the chroot.
To do this, if you're on Debian run the following:
Code:
apt-get install qemu-user-static debootstrap
But if you're on Ubuntu, use this:
Code:
apt-get install qemu-arm-static debootstrap
Then, we have to get the armel files, using deboostrap:
If you want to install Debian Lenny (5.0, tested by me)
Code:
debootstrap --verbose --arch=armel --foreign lenny debian http://ftp.us.debian.org/debian
And for Debian Squeeze (6.0, tested by johnw.xda without the graphical stuff)
Code:
debootstrap --verbose --arch=armel --foreign squeeze debian http://ftp.us.debian.org/debian
In fact, we could use a Ubuntu distro, like karmic. But I recommend debian, because it has more support for armel.
Ok, that will be at least 5 mins downloading data and unpacking other stuff. When that finishes, we have to tweak the system to run without errors.
First thing, is to create the mount point of the sdcard (in fact, is a system link).
Code:
mkdir debian/sdcard
Second thing, is to run the chroot and configure some things:
Code:
cp /usr/bin/qemu-arm-static debian/usr/bin
chroot debian /bin/bash
If succed, you will have a # (root) shell, then put the following:
Code:
/debootstrap/debootstrap --second-stage
adduser
Then provide a username and password.
Now run the following, to fix some configs:
Code:
echo 'nameserver 8.8.8.8' > /etc/resolv.conf
rm -f /etc/mtab
ln -s /proc/mounts /etc/mtab
If you're installing Debian Lenny, then run this:
Code:
echo 'deb http://ftp.us.debian.org/debian lenny main contrib non-free' > /etc/apt/sources.list
apt-get update
But if you're installing Debian Squeeze, then run this:
Code:
echo 'deb http://ftp.us.debian.org/debian squeeze main contrib non-free' > /etc/apt/sources.list
apt-get update
With that, the system will run ok in the Defy, but I would like to add the x11, lxde, vnc packages (because installing on the chroot in pc is more faster than in the phone).
If you want LXDE, then do:
Code:
apt-get install lxde tightvncserver
But if you prefer IceWM instead LXDE, then:
Code:
apt-get install icewm tightvncserver
Ok, I really dont remember, but that stuff cost about 350MB more of disk. By the way, while installing the packages, it might ask something, you just say Ok on all messages and complete if it requieres.
Once finished, type
Code:
exit
Well, now we have to fix the "LC_LOCALE" error, and the "HOME=/root" for conveinence. To do that, in your local Debian (not the chroot), add the following lines to the file
/home/cocus/debian/etc/init.d/rc.
Code:
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export $PATH
export HOME=/root
export LC_ALL=C
Add these lines replacing the original PATH.
After that, we have to move the files to internal storage, so, to do that, I've used tar bzip2 to compress all the files and saving the attributes too.
Code:
tar -cjf /home/cocus/debian.tar.bz2 /home/cocus/debian/*
That command will generate a file in /home/cocus called debian.tar.bz2. Once you've got this, copy to your SD.
By the way, create a file called bootdeb in the SD root, with the following contents:
Code:
echo " "
echo " a888a "
echo " d888888b "
echo " 8P YP Y88 "
echo " 8|o||o|88 "
echo " 8. .88 "
echo " 8 ._. Y8. "
echo " d/ 8b. "
echo " .dP . Y8b. "
echo " d8: ::88b. "
echo " d8 Y88b "
echo " :8P :888 "
echo " 8a. : _a88P "
echo " ._/ Yaa_ : .| 88P| "
echo " \ YP | 8P \. "
echo " / \._____.d| .| "
echo " --..__)888888P ._.|"
echo " "
echo " COCUS WAS HERE (I hate JAVA) "
export mnt=/data/local/debian
export TERM=linux
export HOME=/root
export OLDPATH=$PATH
echo "mnt: $mnt"
echo "PATH: $PATH"
echo "TERM: $TERM"
echo "HOME: $HOME"
busybox mount -o bind /dev $mnt/dev
busybox mount -o bind /sys $mnt/sys
busybox mount -o bind /proc $mnt/proc
busybox mount -o bind /sdcard $mnt/sdcard
busybox mount -t devpts devpts $mnt/dev/pts
echo "Type EXIT to end session"
echo "Make sure you do a proper EXIT for a clean kill of Debian!"
echo " "
export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
busybox chroot $mnt /bin/bash
#After exit command is executed clear it all up
busybox umount -f /data/local/debian/dev/pts /data/local/debian/proc /data/local/debian/sys /data/local/debian/sdcard /data/local/debian/dev
export PATH=$OLDPATH
echo "Filesystems have unmounted"
Create another file, called vnc with the following contents:
Code:
export USER=root
cd /
rm -r -f tmp
mkdir tmp
cd /
vncserver -geometry 1280x720
(you could change the resolution of the X11 desktop there )
And at last, create the last file called xstartup. Take care here, if you have choosed LXDE, use the following:
Code:
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
lxsession
But if you've choosed IceWM, then use:
Code:
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
xterm
Here, we have to run commands, but in the phones shell (adb, ssh, terminal emulator).
Remember to mount the SD again (in the case that youre using USB SD Massive storage).
Well, we have to get root access in the shell, so you have to root your Defy first. If you have root acces, then run the following in your mobile:
Code:
mkdir /data/local/debian
cp /sdcard/bootdeb /data/local
busybox tar -xvf /sdcard/debian.tar.bz2 -C /data/local
rm /data/local/debian/root/.vnc/xstartup
cp /sdcard/xstartup /data/local/debian/root/.vnc/xstartup
cp /sdcard/vnc /data/local/debian/bin/vnc
ln -s /data/local/bootdeb /system/bin/bootdeb
chmod 0755 /data/local/bootdeb
chmod 0755 /data/local/debian/bin/vnc
If everything worked and no errors appeared, then you can run debian via your Terminal Emulator:
Code:
bootdeb
And you should get the debian shell, and then run:
Code:
vnc
to start vnc server on localhost. Take note of the localhost:x (where x is a number). That number is what you have to use to connect, I mean:
If the number is 1:
the port is 5901
If the number is 9:
the port is 5909
Thats all!
I will try to make a yaffs2 image to mount, but I really dont trust on the mount command, because it gives me a lot of errors, even with correct stuff.
Some Screenshots:
pictures are 403 Otherwise great stuff dude!
Did you tried Debian 6.0?
Lenny = 5.0
Squeeze = 6.0
Code:
build-arm-chroot --verbose --arch=armel --foreign squeeze debian http://ftp.us.debian.org/debian
For the dumb ppl here, the second screenshot is of your phone running an OS?
Sent from my MB525 using XDA App
bash: build-arm-chroot: command not found
which package.deb include build-arm-chroot?
To see the pics : right-clic => open image in new tab
DrogenDiego said:
pictures are 403 Otherwise great stuff dude!
Click to expand...
Click to collapse
Don't work for me to
mick711 said:
Don't work for me to
Click to expand...
Click to collapse
DONT click on the link. Copy the link location or the url and then paste in url browser.
Echo " COCUS WAS HERE (I hate JAVA) ".... nevertheless well done. I will try it with squeeze.
I was wondering what exactly is the final result here, maybe a REMOTE lxde (GUI for debian) for my defy running on PC or something like that..
well i got my answer here:
http://www.androidfanatic.com/community-forums.html?func=view&catid=9&id=1615
So, if you have the same doubt, NO, it's not a remote desktop, it is debian + lxde (or IceWm) running directly on your defy.
The connection through vnc is just a workaround to make it working.
Thanks Cocus for your nice step-by-step guide.
Hi. Thanks for the feedback. I've reuploaded the images to imageshack, now you can see them without any 403.
johnw.xda said:
bash: build-arm-chroot: command not found
which package.deb include build-arm-chroot?
Click to expand...
Click to collapse
Hi john, are you running the command in Debian or Ubutnu?
Did you run the command of debootstrap?
Code:
# apt-get install debootstrap
walter79 said:
Did you tried Debian 6.0?
Lenny = 5.0
Squeeze = 6.0
Code:
build-arm-chroot --verbose --arch=armel --foreign squeeze debian http://ftp.us.debian.org/debian
Click to expand...
Click to collapse
Nope, I haven't tryied it. In fact, I was trying to get it working. Now I would try to do some interesting things.
chaihg said:
For the dumb ppl here, the second screenshot is of your phone running an OS?
Sent from my MB525 using XDA App
Click to expand...
Click to collapse
In fact, the kernel is the one that the phone booted. The only thing that I've done, is changing the root (/) path to another one, that is like swap the filesystem to another one. The other path, contains the debian root, so you will have a debian root, instead the default of your phone. With that, we can use the debian (armel) features, like aptitude (apt-get install) and such.
If anyone knowns how to mount images on loop or any thing like, please feel free to comment. I'm running out of space in my device (almost 10mb left). So, the image mount could be the best option, but I can't figure how to do that in the stock kernel.
cocus said:
Hi. Thanks for the feedback....
Click to expand...
Click to collapse
Hi cocus,
is there any way to get it working without the vnc part? I mean, it would be great if we could load debian and lxde from our defy regardless of the vnc connection.
If i'm not wrong, to boot propely it needs to load some drivers from PC, that's why we need the vnc. Is it correct?
xdaid said:
Hi cocus,
is there any way to get it working without the vnc part? I mean, it would be great if we could load debian and lxde from our defy regardless of the vnc connection.
If i'm not wrong, to boot propely it needs to load some drivers from PC, that's why we need the vnc. Is it correct?
Click to expand...
Click to collapse
The fact is, debian doesn't have access to the display. I really don't know why, because I'm kinda dumb on linux stuff.
If somebody knowns how to add graphical support (display), and/or mouse (touchscreen), it would be great. And, we could just close the dalvik and run the debian (a lot of ram would be free to use).
Now im trying to use the camera, audio and mic. They appears in /dev/, so the drivers are working fine, but I don't know with application to use.
If you can install Debian on a Defy, why isn't it possible to install Gingerbread ? :/
geecko said:
If you can install Debian on a Defy, why isn't it possible to install Gingerbread ? :/
Click to expand...
Click to collapse
Not exactly installed. Let me clarify it.
The linux file system consists of directories and start at the root directory. (/). Imagine the Windows95 directory, and change the boot to the path of Windows98. Technically what boots (in this case the kernel) is the same, but what changes is the directory. So you'll have a working Debian, as if it were actually installed, but it really is not.
Debian can not access the screen (at least I do not know how to set it up) so you have to use VNC server locally to access the X11 (display manager).
Take into account that anything here is emulated at all, is running all native.
I really don't known nothing about Gingerbread.
cocus said:
Hi john, are you running the command in Debian or Ubutnu?
Did you run the command of debootstrap?
Code:
# apt-get install debootstrap
Click to expand...
Click to collapse
hi cocus, yes i did install debootstrap, on my debian/and64.
dpkg -L debootstrap can not found build-arm-chroot too
which debian are you using? mine is unstable + testing.
thank you.
johnw.xda said:
hi cocus, yes i did install debootstrap, on my debian/and64.
dpkg -L debootstrap can not found build-arm-chroot too
which debian are you using? mine is unstable + testing.
thank you.
Click to expand...
Click to collapse
Hi, I'm using Lenny on x86. (VM is VMWare Workstation).
You could download the netinstall iso, and install on a new VM.
It might be a problem with your AMD64. Thus I don't really know. Try installing x86 on a VM.
cocus said:
Hi, I'm using Lenny on x86. (VM is VMWare Workstation).
You could download the netinstall iso, and install on a new VM.
It might be a problem with your AMD64. Thus I don't really know. Try installing x86 on a VM.
Click to expand...
Click to collapse
can you show me the output?
shell$ dpkg -S build-arm-chroot
also
shell$ which build-arm-chroot
and
shell$ dpkg -L debootstrap | grep build-arm-chroot
thank you.
johnw.xda said:
can you show me the output?
shell$ dpkg -S build-arm-chroot
also
shell$ which build-arm-chroot
and
shell$ dpkg -L debootstrap | grep build-arm-chroot
thank you.
Click to expand...
Click to collapse
Hi. I've done all of that, but without any outputs, and a lot of errors. I've researched, and I've made a mistake in my info.
Replace build-arm-chroot with debootstrap. Its the same.
(now edited on the main post)
Sorry for the inconvenience.
cocus said:
Hi. I've done all of that, but without any outputs, and a lot of errors. I've researched, and I've made a mistake in my info.
Replace build-arm-chroot with debootstrap. Its the same.
(now edited on the main post)
Sorry for the inconvenience.
Click to expand...
Click to collapse
ok. i will retry it, when i back to home.
thank you.
can you run vim on your defy?
i really miss it, when i want to edit plain text file.

A Real Linux Android System

Before reading.
This article requires that your phone is Rooted and has Busybox installed.
HTC owners, S-off your phone as well.
Android is a great operating system for SmartPhones. Only problem with it (From a more technical users point of view) is the small useless bad excuse of a linux system running behind the UI. Some of the smaller issues can be fixed by installing Busybox that provides a better basic set of tools to work with, but it's not enough. What I would like is to be able to use almost any real linux cli application, daemon, library etc. Also some compilers would be great. I'm using an HTC desire which has more than enough power to do things like compiling (I know, I have done it.), and so has a lot of other SmartPhones. Why would one need this when there is cross compilers you can use on regular and faster machines? Well, because It's fun, why else. I did not spend all that money on a SmartPhones just to make a few phone calls and write a few text messages. My old Sony Ericsson did that quite well. I spend that money to get a phone with many possibilities that I could play with.
I tried to search the web for some helping instructions on how to port a real linux system to this phone. What I mostly got, was people who ported linux systems that would run as an extra OS on the phone, some even with an Xserver accessible via VNC. Sounds fun, but not what I was after. I did not want an extra OS using CPU and unnecessary RAM. I just wanted some extra tools, libs etc to work with and the regular linux user management. I managed to find an old article from someone using Debians armel version on an old G1 phone. I thought that if it worked on that phone, it would be possible to do so on mine. So I started playing around with that.
The way this works is by installing a bare minimum debian on an second partition. This will not boot anything up since it will just work as extra tools and lib using the already booted android linux system.. You will still only have one OS but more tools (Including the nice APT package system) to work with.
Now there is two ways of using debian on android.
The first way is to setup the Debian in an chroot environment. This has some flaws like I have not yet been able to make the chroot start second jobs, which means that you will be able to start applications and daemons running in the current shell session. But you will not be able to make them run in the background. But as an development environment it will still work great, as you will be able to use the Debian libs and compilers.
The second way (The way I was after) is to setup Debian using the UAFS kernel module. This is used to merge directories into one with different rules for each. For an example you would be able to merge /debian_root/etc and /system/etc into a shared /etc with RW on Debians etc and RO on Androids forcing any changes to be made in /debian_root/etc. Using this option you will use Debian to extend the Android Linux part. Android UI with Debian Shell.
This article is split into 3 parts. The first part is the setup of Debian. Must be done whether you want chroot or a merged system. In the second part we will cover the setup of the chroot environment.
The third part is the setup of the merged system. This will require one thing in order to work.
You will need a kernel with the uafs module which is not default in most android kernels. You will need to compile your own kernel. People using the Thalamus kernel, can download a kernel with this module kernel-2.6.37.2_AUFS.zip. A big thanks to Thalamus for providing this. Note that this kernel was a special request from me that he was kind enough to provide. It comes with absolutely no guaranties. Do not email spam him about errors you might encounter using it as this is not an official release.
Note that once you mount the Debian system, you will not be able to mount the SD Card when connecting it to your PC. You can download the App “Multi Mount SD-Card” from Market which will be able to mount your SD Card on your PC while mounted on your phone. This app should also speed up transfers on 2.6.37 kernels, or so I have heard.
Part 1: Building Debian
We are going to run debian from a file containing a ext2 filesystem. If your SD Card is big enough you might be able to create an extra partition and force it to mount as something else other than ext-sd, but in this article we are going to use a partitioned file.
Also, this will require that you have the tool “debootstrap” on your PC. This is found in Ubuntu and Debian, dont know about other Linux distro's or Operating systems. If you don't use Linux or an distro with debootstrap you can download a Ubuntu Live CD from the Ubuntu website. This can be run on CD, DVD and USB disks without installing it. For this article I have used Ubuntu 10.10.
Open a terminal on your Ubuntu/Debian/LiveCD PC and cd to the folder where you want to temp. store your debian. I will call this path “debian_dir”
The first thing we will do is to create the partitioned file.
I'm creating a file with 1.5GB of space. You can create the size you want.
Don't use 0 in the size, dd don't like that.
Code:
cd debian_dir
dd if=/dev/zero of=debian.img seek=1499999999 bs=1 count=1
mke2fs -F debian.img
mkdir debian
mount -o loop debian.img debian/
Now that we have created the file and mounted it, we should download and place debian inside of it. First we will install debootstrap.
Code:
apt-get install debootstrap
debootstrap --arch armel --foreign squeeze debian http://ftp.us.debian.org/debian
umount debian/
Debian Squeeze is Debian 6.0 which replaces the old Lenny.
Copy the debian.img file to your SD Card on your phone. I placed mine in the root of the SD Card.
Now open a terminal on your phone. You can download one from market. There are some free once, but the paid “Better Terminal” is the best to work with in my opinion.
Note: All shell work is done on the phone from now on.
First we need some temp. exports.
Type the fallowing:
Code:
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:$PATH
export HOME=/root
export TERM=linux
export DM=/data/local/debian
export DI=/sdcard/debian.img
Now we will create the Debian dir and then create a loop device which we will use to mount the Debian image to the Debian dir.
Code:
mkdir -d $DM
mknod /dev/loop0 b 7 0
mount -o loop,noatime $DI $DM
Now that we have debian mounted in our debian folder, we need to finalize the installation. Not all files as been installed yet. Don't forget to activate Mobile Network or Wifi.
chroot $DM /debootstrap/debootstrap –second-stage
We also need to insert the debian repository and a DNS (I use OpenDNS).
You can use whatever you want for the DNS, you routers IP for an example. It should have some default Ips configured.
Code:
echo “deb http://ftp.us.debian.org/debian squeeze main contrib non-free” > $DM/etc/apt/sources.list
echo “208.67.222.222” > $DM/etc/resolv.conf
Now change the root to the debian dir and set a root password and make sure that certain folders already exists.
Code:
chroot $DM /bin/bash
passwd root
mkdir root
exit
Now we need to make sure that certain variables exists and that the values is as they should be. So we will alter the /system/bin/sh that android uses as login shell.
Code:
cd /system/bin
mv sh sh0
Create a new /system/bin/sh file with the fallowing content.
This will ensure that these variables is created and/or changed every time you enter a new shell session. You can call another shell like bash or ash instead /system/xbin/sh, just make sure to use ash or sh at the top, since bash does not seam to understand [email protected]
Warning: It is very important that the /system/bin/sh file is made correct. Android will not boot if anything is wrong with this file. It should be exactly like the one I posted, and you cannot make it on your PC and push it to the phone. Don't know why, it works fine with other shell scripts, but not that one.
Enter an adb shell from your PC and use vi or nano (You can download nano here here) to copy and paste the content directly into the ADB Shell.
Note: ADB from the recovery will always work. It does not use /system/bin/sh
Code:
#!/system/xbin/sh
/system/xbin/sh --login [email protected]
Make sure that it has execute rights. Then type sh in the terminal to make sure that it works before you close your ADB Shell session.
Code:
chmod a+x /system/bin/sh
sh
sh0 will not be used, it's up to you wether you want to save it or not. Just make sure that /system/xbin/sh exists, otherwise
copy /system/bin/sh0 to /system/xbin/sh.
Now we need the profile file that is needed by this method. This file will make sure that we have all our variables and the data that they should contain.
Android does not keep very good track of these things. Place this data in the file /system/etc/profile
Code:
export TERM=linux
export TERMINFO=/etc/terminfo
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/vendor/bin:/system/bin:/system/xbin
if [ "$EUID" == "0" ]; then
if [ -z "$HOME" ] || [ -z "$USER" ] || [ -z "$GROUPS" ]; then
export HOME=/root
export USER=root
export GROUPS=0
fi
else
# Make sure that this user id variable exists.
if [ -z $EUID ]; then
export EUID=$(echo $(id | cut -d "(" -f 1) | cut -d "=" -f 2)
fi
# If we have an /etc/passwd file available,
# we should also make sure to get name, group and home info from that file and
# store in the default linux variables.
if [ -f /etc/passwd ]; then
# Create the user info variables based on user id and /etc/passwd
export USER=$(grep "x:${EUID}:" /etc/passwd | cut -d : -f 1)
export GROUPS=$(grep "x:${EUID}:" /etc/passwd | cut -d : -f 4)
export HOME=$(grep "x:${EUID}:" /etc/passwd | cut -d : -f 6)
fi
fi
export ADID=$EUID
if [ "$PS1" ]; then
if [ "$BASH" ]; then
# The file bash.bashrc already sets the default PS1.
if [ ! -z $HOME ] && [ -f $HOME/.bashrc ]; then
. $HOME/.bashrc
elif [ -f /etc/bash.bashrc ]; then
. /etc/bash.bashrc
else
export PS1='\h:\W\$ '
fi
else
if [ "$EUID" == "0" ]; then
PS1='\w # '
else
PS1='\w $ '
fi
fi
else
PS1='\h:\W\$ '
fi
if [ -d /etc/profile.d ]; then
for i in /etc/profile.d/*.sh; do
if [ -r $i ]; then
. $i
fi
done
unset i
fi
We will also need an /etc/bash.bashrc which is needed because /etc/profile not always gets executed.
Code:
if [ "$ADID" != "$EUID" ]; then
# Some times /etc/profile is not executed (For an example when using Androids su command).
# /etc/bash.bashrc however it used instead. So we just execute it manually in these cases.
# If you create a local bashrc ($HOME/.bashrc), remember to include this check.
# /etc/bash.bachrc is not used when a local file exists.
if [ -f /etc/profile ]; then
. /etc/profile
# Since /etc/profile links back to this file,
# we will make sure not to start an unending loop.
# the profile file should update this, but it's better to be on the safe side.
if [ "$ADID" != "$EUID" ]; then
export ADID=$EUID
fi
fi
fi
PS1='\h:\W\$ '
And last we have some user and group configurations in order to make Debian better work with Android. Open your Android terminal emulator and make sure it opens as user and not root. Now type "/system/xbin/id".
What we need here is the uid, gid and the ids of each accosiated groups along with the names of it all. In my terminal I have "uid=10048(app_48) gid=10048(app_48) groups=1015(sdcard_rw),3003(inet)".
What we will do it create this user along with the groups in our Debian inveroment. However, I use the uid name and gid name "bterm" instead of app_48, but still with the original IDs. The inet and sdcard_rw groups will be created as system groups. Do the same for your app user and group if you don't want any login possibilities with this user. I however have assigned home and password to this user.
This needs to be doen in chroot
Code:
chroot $DM /bin/bash
groupadd --system --gid 1015 sdcard_rw
groupadd --system --gid 3003 inet
groupadd --gid 10048 bterm
adduser --home /home/bterm --gid 10048 --uid 10048 bterm
gpasswd -a bterm sdcard_rw
gpasswd -a bterm inet
exit
Now your ready for the next step. Remember that the user you have created, is the user used by your terminal emulator when you are not logged on as root. This ID is only assigned to that specific app, if you install another terminal, it will get another ID.
Part 2 – Setting up a chroot environment
The best way of doing this is to make two small scripts and place them in /system/bin or /system/xbin. One script for doing the mount after phone boot. And one script for entering the chroot when open a new shell session.
Here is the mounting script that I call mkdebian.
This needs to be executed once every time the phone has rebooted. If your ROM supports init scripts, you can add it there for auto-mount on boot.
Code:
#!/system/bin/sh
export DM=/data/local/debian
export DI=/sdcard/debian.img
# Create the loop device and mount the debian image
mknod /dev/loop0 b 7 0
mount -o loop,noatime $DI $DM
# Let's make sure that we can access our sd card from within the chroot
if [ ! -d "$DM/mnt/sdcard" ]; then
mkdir $DM/mnt/sdcard
fi
mount --bind /mnt/sdcard $DM/mnt/sdcard
# Now we make sure that the chroot has access to all the device maps
if [ ! -d "$DM/dev" ]; then
mkdir $DM/dev
fi
mount --bind /dev $DM/dev
# We also need to make proc, sys etc available from within the chroot
chroot $DM mount -t proc proc /proc
chroot $DM mount -t sysfs sysfs /sys
# And last fix the mtab
chroot $DM rm -f /etc/mtab
chroot $DM ln -s /proc/mounts /etc/mtab
echo “Debian was mounted in $DM/”
Now for the script that I called “debian”.
This script will make you enter the chroot environment using one single command. Every time you exist the debian chroot, you can enter back using the command “debian”.
Code:
#!/system/bin/sh
chroot /data/local/debian/ /bin/bash
And that is it. Open a terminal, type debian and start using your debian environment. It might be a good idea to run aptitude update or apt-get update before you start using the package manager.
Part 3 – Settings up a merged Android/Debian environment
This is the fun part to play with. A merged Android/Debian environment without the usage of chroot. This only requires a script to be executed at boot, or after boot.
Remember that this will not work unless your kernel has the aufs module.
Code:
#!/system/xbin/sh
export DM=/data/local/debian
export DI=/mnt/sdcard/debian.img
# Now we mount the debian image to our debian folder.
mknod /dev/loop0 b 7 0
mount -o loop,noatime $DI $DM
# These two directories exists in both android and debian,
# so these are going to be merged together.
mount -t aufs -o dirs=$DM/etc=rw:/system/etc=ro aufs /system/etc
# For some reason, mounting /sbin with aufs does not work.
# So we make a little cheat with symbolic links instead.
mount -o remount,rw /
mv /sbin /sbin0
ln -s $DM/sbin /
rm -rf /sbin/adbd
rm -rf /sbin/ueventd
ln -s /sbin0/adbd /sbin/
ln -s /sbin0/ueventd /sbin/
# Let's get all the debian root directories out to the real root dir.
rm -rf /root
for x in tmp root lib bin boot home media opt selinux srv usr var
do
ln -s $DM/$x /
done
if [ -f /system/xbin/bash ]; then
mount --bind /bin/bash /system/xbin/bash
mount --bin /system/xbin/bash /system/xbin/sh
else
mount --bind /bin/bash /system/xbin/sh
fi
echo "Debian has been merged with Android..."
Run this at startup and start using all of debians possibilities (Don't run it yet).
The / dir is left with RW permissions. If this is set to RO then apt-get will not work. It writes tmp log files to this dir when running. It does not matter since all changes to this dir is restored to default on every boot.
Also dont forget to run apt-get update or aptitude update to update the package list.
You are now able to install and run almost anything (CLI Only) that runs on debian systems and other linux dists. Personally I'm currently running OpenSSH Server and Lighttpd with PHP. A perfect small transportable web server.
You can use either /etc/init.d/[your service] start
or
service [your service] start
to start daemons you have installed.
Now you can use the "mkdebian" command to merge your new Debian with Android.
Note: The command “su” from debian works differently than the android “su” command.
The debian command uses the regular linux management to provide access which means that it will ask for your root password that you created in the first part. The android command will just provide you with su rights without a password. Both commands provides su rights to both android and debian, so it is possible to remove the android command and create a new Android/Java based SU app for the Android UI that will require root password.
Note: There is a small problem with the Android "su" command. It does not recheck the /etc/profile.
That means that if you log on using the regular user, and then uses the "su" command, user variables does not get updated with su paths.
Using the Debian "su" command will work fine, just note that this command will promp for password. Also logging in using the root account
directly works fine.
Good luck
[Edit: 2011-03-09 11:06]
- Changed the /etc/profile script in Part 1
- Added /etc/bash.bashrc script in Part 1
- Changed User and Group setup and moved it from Part 3 to Part 1
- Fixed error in /system/bin/sh
All of this will fix some permission problems with Debian
[Edit: 2011-03-08 11:21]
- Fixed problems with user management by adding an /etc/profile and changing /system/bin/sh and the debian merge script. Using the "login" command is no longer needed.
[Edit: 2011-03-07 08:49]
- Fixed bug in Part 1 sh script.
[Edit: 2011-03-07 00:20]
- Added a new /system/bin/sh script to Part 1
- Added the way we create missing users and groups in Part 3
[Edit: 2011-03-06 19:36]
- Inserted a warning text in part 1 about avoiding problems when creating a new /system/bin/sh.
Applying Host name
If you want to set a custom hostname for your phone, you can create an init script (If your ROM supports it).
Code:
#!/system/bin/sh
# Get the hostname if it exists, or set it to localhost
if [ -f /system/etc/hostname ]; then
_HOSTNAME=$(cat /system/etc/hostname)
if [ -z $_HOSTNAME ]; then
_HOSTNAME=localhost
fi
else
_HOSTNAME=localhost
fi
# Update the Hostname
echo "$_HOSTNAME" > /proc/sys/kernel/hostname
# Update the hosts file
echo "127.0.0.1 localhost.localdomain localhost" > /etc/hosts
# If the hostname is not localhost, we add one more line to the hosts file
if [ "$_HOSTNAME" != "localhost" ]; then
echo "127.0.0.1 $_HOSTNAME" >> /etc/hosts
fi
This will look in /system/etc/ for the regular linux hostname file. If it exists, it will take the hostname from that file and set as the global hostname.
If it does not exist, "localhost" is used instead. Also it creates the /system/etc/hosts file.
Add or Edit your hostname like this.
Code:
echo "myhostname" > /system/etc/hostname
Note: Remember to delete the hosts and hostname files in your debian /etc/ dir when using merged environment. Otherwise they will overwrite the once in /system/etc/ as debian has first priority.
Manipulating the Android Permissions
Androids permissions works by providing a User ID for each application. This user (Application) can then get a range of different permissions by being added to groups with the permissions required by the app. For an example an app that needs to write to the SD Card, should be a member of Androids sdcard_rw group which translates into 1015 in a Linux group id. Using the numeric values of the Android groups, we can assign these permissions to shell users, daemons etc.
An example:
I had problems with my Http Server because I wanted my www folder on my sdcard. But, the www-data user and group could not be allowed to write to the SD Card, which I needed it to do, because Android controls what permissions the SD Card should have, not even root can change that.
What I did was creating a system group that I named sdcard_rw (Same name as the android, just to better keep track of the groups) with the same Id as the Android sdcard_rw (1015). I then assigned that group to my www-data user (gpasswd -a www-data sdcard_rw) and now my lighttpd had Read/Write access to my sdcard.
You can use the same example for creating a regular SSH User by using the Android shell group or for any other type of user that needs some Android permissions to work properly.
[Edit: 2011-03-08 21:13]
- Added an permission example
Great...
I was just looking into this myself for the last few days.
strange how there isn't more of this being talked about.
at least I have been unable to find anything.
Omg this sounds awesome,
Will try this when u get home and will report back
Sent from my Nexus One using XDA App
I'm still trying to work out some problems with User Rights on SD Card. Can't get lighttpd to be allowed to create files in my SD Card www dir (Does not matter what user and group I set it to use). I can't even get the root account to be allowed to change permissions on SD Card files and folders. It's not the biggest problem, but will report back when I figure it out.
Nice! I've been constantly disappointed for the past year at how un-Linuxy Android is under the hood and unimpressed with the old chroot tricks. This looks much better and I'll try it soon.
I have added a new /system/bin/sh script that can be found in Part 1. This script will automatically look for bash and, if that exists, try to find bash.bashrc, .profile or .bashrc in /etc or the users home dir. If bash does not exist, it looks for sh instead. If you have both one of the Android specific compiled bash, then Debians bash is used when available as this is made to work in a real linux environment. Android bash does not seam to work that way. Also debians packages gets updates via APT.
Also I changed the way groups and users is created in Part 3. Manually inserting them to /etc/passwd, /etc/shadow and /etc/group did not seam to be enough. The users and groups where only half registered. For an example the command "login" gave me a lot of errors, and i had problems with user rights. By using adduser and addgroup in a chroot before the first merge, the user management seams to work as it should now.
I was playing with Debian on my phone just a few days ago too. I've found that same G1 article you mentioned, and installed Lenny in a chroot environment. Background daemons work fine for me, I've installed OpenSSH and I'm using ConnectBot connecting to 127.0.0.1 to get a terminal, so I don't have to chroot every time. I even have X with tightvnc server + android-vnc-viewer. Running the desktop Firefox on my phone is fun Although not very useful. I'm still thinking about what awesome things we could do with this that we couldn't otherwise.
Anyway, great howto.
Do you have any details on the Thalamus kernel? What phone is it for? Overclocked, audio hack, etc? Or is it just a vanilla kernel with the extra module?
What applications can we dream up?
The first thing that springs to mind is could this be used to create a low power server running bittorrent and the like?
Would a cheap device like the Vodafone 845 be under-powered for this?
Can you connect to a usb hub to allow multiple devices to be connected to it? I'm thinking usb network adapters, external storage, etc.
How much additional effort on top of this guide would be needed?
Just curious...
will not... - -!
Well I learned one thing. Don't make Shell scripts when you are tired. I started a shell loop on phone bootup with my /system/bin/sh fix (Which had been changed). When using the merged environment, you need (for now) to enter /bin/login when you open a new shell and login as user with the password you created in Part 3. This will make Debian take over the user management which among other things will make sure that the right variables etc. exists. I have tried to locate where android controls new shell sessions, but I cant seam to find it.
When you make Debian take over, you can use your Linux shell as any other. .bashrc, .profile, /etc/bash.bashrc, /etc/profile files, change default shell (bash, sh, ash) in /etc/passwd and so on.
#9 Well the kernel is the same that is found in the Oxygen 2.0.1, so it's an gingerbread rom (2.3.3). If it works only in Oxygen, I don't know but I don't think so.
#10 He he, Could not say. For now I'm just trying to make it work as I want it to work. After that I might start playing around with different things.
The "login" command is no longer needed. I finally found a way to successfully control user variables and management, making Android and Debian work together as one when merging the two.
This is amazing. Totally going to do this later tonight when I get home.
If you merge using AUFS instead of making a chroot, you should perhaps use the system user (Id: 1000, Group: 1000) as the regular user.
There are only two static users in Android, 0 and 1000.
Android just isn't made to work as an multi-user system. This is how the Java UI is made, and we really need to Linux part to be compatible with that part of the OS. Instead of multi-users, android uses it's apps as users. Each app works as one user with different id. So the 10048 I used as regular user is just the ID of mine "Better Terminal". Switching to another terminal app changed the EUID.
Use the root and only root to work with in the shell. And then delete Debians "su" command and stick with the one from android. Debians need all users that execute "su" to be written to the /etc/passwd.
All GNU tool and library, that's Great. thanks a lot.
I have added an example of how to apply Android rules to shell users, daemons etc. Some daemons will need this in order to function.
I have added this in Thread 2 below the hostname example.
I also changed the main Thread. Found a fix for the rest of the permission problems, including the Android "su" command issue.
I have tested this Android/Debian merge using several methods (ADB, SSH, different local terminals) and it worked on most. I had one problem with one local terminal app that did not execute /etc/profile and some Debian users in /etc/passwd that didn't either.
To fix this I changed /system/bin/sh from using "/system/xbin/sh --login [email protected]" to instead use "/system/xbin/sh --rcfile /system/etc/profile [email protected]". I then moved the Debians /bin/bash to /usr/bin/bash and made a similar script file in /bin/bash > "/usr/bin/bash --rcfile /etc/profile [email protected]". You can make the same for /bin/sh if you don't like using bash for your /etc/passwd users.
Remember to change the bash bind mount in the mkdebian script from /bin/bash to /usr/bin/bash
Use whatever method works on your phone.
This looks like a ton of fun, and could be very useful. I'd like to try this on my NookColor (N2Acard, CM7.1), probably using The Guardian Project's lilDebi image as a base. They go the chroot route with their installer, and I'm going to have to do some hacking on their scripts to make them work with the NookColor. I figure if I'm going to have to hack on it, I might as well put my efforts toward a more ideal solution.
Question: It doesn't look like the CM7.1 kernel supports aufs. That is,
Code:
cat /proc/filesystems
doesn't return aufs as one of the supported filesystems.
Aside from a lack of elegance, is there any reason we can't apply your /sbin workaround to "merging" the whole filesystem? [I recognize there's a certain amount of ignorance behind the question; I figure there's only one way to cure that: Ask.]
OR, how difficult might it be to take a complete CM7.1 kernel and add aufs support to it?
'preciate any help I can get!
mailman1175 said:
This looks like a ton of fun, and could be very useful. I'd like to try this on my NookColor (N2Acard, CM7.1), probably using The Guardian Project's lilDebi image as a base. They go the chroot route with their installer, and I'm going to have to do some hacking on their scripts to make them work with the NookColor. I figure if I'm going to have to hack on it, I might as well put my efforts toward a more ideal solution.
Question: It doesn't look like the CM7.1 kernel supports aufs. That is,
Code:
cat /proc/filesystems
doesn't return aufs as one of the supported filesystems.
Aside from a lack of elegance, is there any reason we can't apply your /sbin workaround to "merging" the whole filesystem? [I recognize there's a certain amount of ignorance behind the question; I figure there's only one way to cure that: Ask.]
OR, how difficult might it be to take a complete CM7.1 kernel and add aufs support to it?
'preciate any help I can get!
Click to expand...
Click to collapse
here's where you get aufs patches.
you'll have to build the kernel yourself to make it work.
to the OP:
using the aufs mount method instead of a chroot...
I have a small problem, I don't know if it shows up with your .img filesystem method, but with an sd-ext partition used intead of the .img file, apt-get fouls massively when trying to update/upgrade libc6.
it complains about the libc6*.so existing in two places at once, and requests the existing one be removed. If it's removed, then nothing in the Linux install works, because just about everything is compiled against libc. I can use busybox to manipulate files with the libc6 removed or hidden away, but can't seem to get past the error since dpkg and apt don't work without some version of libc installed.
Any hints/suggestions? I like your scripts a lot better than the chroot ones I cobbled together from everyone else's work last year for similar purposes before I got aufs working in a kernel.

[GUIDE]Dualboot Windows 7 and Ubuntu 12.04 with SSD and HDD

Here is a guide to help you with dual booting Windows 7/Ubuntu 12.04 with a SSD as boot drive and HDD as the secondary drive.
To view this tutorial or download click here:http://www.mediafire.com/view/?6jbie3c4dc7cp1t
First partitions. Using my current disks as examples. 1) 128gb SSD and 1) 750gb HDD.
Boot computer using live DVD/USB and open Gparted in your applications. Or open terminal and enter gparted.
The SSD should be /dev/sda and HDD should be /dev/sdb. On your SSD create three partitions.
1) 50gb format as ntfs and then label “windows_7”
2) 15gb and format as ext4 and choose “/”
3) The rest format as ext4 and choose “/home”
For the HDD, you will need to decide if you mainly run Windows or Linux. If you don't need your linux folder more than Windows, I would suggest just formating the entire HDD as “ntfs” and label “windows”. Other wise split up the drive as you see fit. If you are going to symlink common folders used in both systems, I then suggest using more room for windows.
Now comes the fun part. Accept your changes and reboot your device with the windows install disk either in the dvd drive or in the usb port. Reboot and choose to boot drive where your windows disk is located. Follow the prompts to install windows. After the system is installed, do not do any updates just yet. We are going to move “User” to the HDD and as a result saving much needed space on your SSD leaving only system and programs on there. To move /users to HDD follow this handy guide on a clean installed Windows.
1. Once setup and at the desktop, don't bother doing any customisation, but start up Computer Management via Control Panel\System and Security\Administrative Tools.
2. Local Users And Groups\Users, select Administrator and enable the account.
3. Reboot.
4. Logon as Administrator, no password, go into normal User Account management and delete the account created during setup and any and all files.
5. Startup Regedit and navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
6. Change the ProfilesDirectory from %SystemDrive%\Users to for example D:\Users.
7. Close down regedit and reboot.
8. Logon as Administrator and create a user account.
9. Logoff and logon using new account and let system create profile, which is now on your D: drive which of course now the default location for all your personal files.
10. Start up Computer Management via Control Panel\System and Security\Administrative Tools.
11. Local Users And Groups\Users, select Administrator and disable the account. Leaving this enabled is a big security risk !!!
The benefit to this is the Downloads/Music/Videos/My Documents/Documents folders will all be relocated back to ur HDD saving valuable space on your SSD. We will then symlink those same folders to /home in linux later saving even more space yet having a common place to use the folders to be cross platform compatible.
Next, finish installing and setting up Windows 7. It's a good idea to fully update Windows at this point. After that is complete you will then need to reboot computer with your Ubuntu 12.04 USB or DVD in the appropriate drive and select the correct bootable device. Then in the selection menu, choose to run linux from live DVD/USB.
This is a key part here. When it comes time to select which installation method you want, you will want to choose install Ubuntu next to Windows for dualboot system. Also, in the drop down box for where grub (boot loader) is to be installed, do NOT choose the same as windows loader as it will write over top and you wont be able to boot in to windows. Choose /dev/dba/ in the very root of your ssd. Then Linux will set up the “/” and “/home” in the partitions you made earlier.
After it installs, it will ask you to restart the machine and remove any media from the drives. Do so to let it finish rebooting.
Next up is Grub. Instead of choosing Ubuntu, choose Windows to verify that it still works and then open up computer and then D:/ and verify that D:/Users is located there. If so, reboot and choose Ubuntu and verify the installation took fine. If it doesn't boot Windows, you'll need to re-install windows and probably Ubuntu. This can be a pain in the butt but you will be rewarded later with a very nice setup.
After a successful boot to both systems you should be in Ubuntu to configure it to auto-mount “windows” at each boot.
Tweak Linux to support trim for ssd and other useful modifications
Add discard next to the proper drive in /etc/fstab file. Open a command-line (terminal) and
type:
sudo gedit /etc/fstab
Results will be similar to the following:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda5 during installation
UUID=7219b425-9d8d-41e4-a957-e26b1e8ead4c / ext4 errors=remount-ro 0 1
# /home was on /dev/sda3 during installation
UUID=35030494-3d2d-4d4a-a605-32d91e7a6d12 /home ext4 defaults 0 2
The ones highlighted in red should be changed to add discard infront of errors= and
defaults. You can also add noatime if you want to. So it should look like this after the edit.
# / was on /dev/sda5 during installation
UUID=7219b425-9d8d-41e4-a957-e26b1e8ead4c / ext4 discard,noatime,errors=remount-ro 0 1
# /home was on /dev/sda3 during installation
UUID=35030494-3d2d-4d4a-a605-32d91e7a6d12 /home ext4 discard,noatime,defaults 0 2
Open Terminal and type:
sudo blkid
Output should be something like this.
/dev/sda1: LABEL="Windows_7" UUID="48AC1276AC125EAE" TYPE="ntfs"
/dev/sda3: UUID="35030494-3d2d-4d4a-a605-32d91e7a6d12" TYPE="ext4"
/dev/sda5: UUID="7219b425-9d8d-41e4-a957-e26b1e8ead4c" TYPE="ext4"
/dev/sdb1: LABEL="windows" UUID="1D3B46DD6CFD93D5" TYPE="ntfs"
/dev/zram0: UUID="4dc3b795-0931-484e-b809-0946253ab710" TYPE="swap"
Cut and paste the output information to a plain txt document for future use. Next you will want to type the following in terminal:
sudo gedit /etc/fstab
Next add this to the fstab at the bottom.
# Mount at boot
UUID=1D3B46DD6CFD93D5 /media/windows ntfs-3g defaults,rw,owner,uid=1000,gid=100
This will auto mount your windows hdd if you have the user folder moved to the hdd. Leaving the ssd mainly for system files, programs, and with linux would be “/” and “/home”. You will see a very responsive system then.
Before you close, add the following to at the bottom of your FSTAB.
tmpfs /tmp tmpfs defaults,noatime,mode=177 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /tmp tmpfs nodev,nosuid,size=7G 0 0
Your finished /etc/fstab should look similar to the following.
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda5 during installation
UUID=7219b425-9d8d-41e4-a957-e26b1e8ead4c / ext4 defaults,discard,noatime,errors=remount-ro 0 1
# /home was on /dev/sda3 during installation
UUID=35030494-3d2d-4d4a-a605-32d91e7a6d12 /home ext4 defaults,discard,noatime,defaults 0 2
# Mount hdd at boot
UUID=1D3B46DD6CFD93D5 /media/windows ntfs-3g defaults,rw,owner,uid=1000,gid=100
tmpfs /tmp tmpfs defaults,noatime,mode=177 0 0
tmpfs /var/log tmpfs defaults,noatime,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,noatime,mode=1777 0 0
tmpfs /tmp tmpfs nodev,nosuid,size=7G 0 0
Hit save then exit /etc/fstab. Then reboot your machine to test the auto-mount of windows.
Next, lets stop the syslog services and clean out your current temp and log directories. We'll also mount the new RAM disks and restart the syslog service. Note: the name of the syslog service will change from distribution to distribution.
sudo /etc/init.d/rsyslog stop
sudo rm -rf /tmp/*
sudo rm -rf /var/log/*
sudo rm -rf /var/tmp/*
sudo mount -a
sudo /etc/init.d/rsyslog start
To symlink important folders from windows to /home saving much is recommended so you can share files between system. In Linux /home/user folder, delete the following folders.
Documents
My Documents
Downloads
Videos
Music
Open terminal and enter the following to symlink windows folders over to linux thus using a centralized spot for both system.
ln -s /media/windows/Users/(USERNAME)/Documents /home/(username)
ln -s /media/windows/Users/(USERNAME)/”My Documents” /home/(username)
ln -s /media/windows/Users/(USERNAME)/Downloads /home/(username)
ln -s /media/windows/Users/(USERNAME)/Videos /home/(username)
ln -s /media/windows/Users/(USERNAME)/Music /home/(username)
*Make sure when putting in username, the first one is username for windows while the second one is the username for linux.
Time to edit the sysctl.conf for some added tweaks for internet boosts and other good things.
Hit cntrl+alt+T to open terminal and enter:
sudo gedit /etc/sysctl.conf
Add the following to the bottom of the conf file. (cut and paste should be fine)
# Tweaks for faster broadband…
net.core.rmem_default = 524288
net.core.rmem_max = 16777216
net.core.wmem_default = 524288
net.core.wmem_max = 16777216
net.ipv4.tcp_wmem = 4096 87380 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_mem = 524288 524288 524288
net.ipv4.tcp_rfc1337 = 1
net.ipv4.ip_no_pmtu_disc = 0
net.ipv4.tcp_sack = 0
net.ipv4.tcp_fack = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_workaround_signed_windows=1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_ecn = 0
net.ipv4.route.flush = 1
net.ipv4.tcp_low_latency=1
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.tcp_mtu_probing=1
net.ipv4.tcp_frto=2
net.ipv4.tcp_frto_response=2
## don't cache ssthresh from previous connection
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.tcp_moderate_rcvbuf = 1
## recommended to increase this for 1000 BT or higher
net.core.netdev_max_backlog = 2500
##enable window scaling
net.ipv4.tcp_window_scaling = 1
##improve desktop reactions
vm.swappiness=10
vm.vfs_cache_pressure=1000
vm.dirty_background_ratio=10
vm.dirty_ratio=30
Save and Exit.
Another one if you are using a ssd drive for main activity, check your scheduler.
Open terminal and enter the following.
cat /sys/block/sdX/queue/scheduler
*where X is the letter for the SSD device.
The readout should be the following.
noop deadline [cfq]
Note: Only switch the scheduler to noop or deadline for SSDs. Keeping the cfq scheduler for all other physical HDDs is highly recommended.
To change this, using the system virtual filesystem is preferred when the system has severy physical storage devices (for example an SSD and an HDD). Add the following line in /etc/rc.local:
echo noop > /sys/block/sdX/queue/scheduler
where X is the letter for the SSD device.
Because of the potential for udev to assign different /dev/ nodes to drives before and after a kernel update, users must take care that the noop scheduler is applied to the correct device upon boot. One way to do this is by using the SSD's device ID to determine its /dev/ node. To do this automatically, use the following snippet instead of the line above and add it to /etc/rc.local:
SSD=(ata-OCZ-ONYX_XA1Y7CE3709UG79OTHVM ata-SAMSUNG_SSD_830_Series_S0VTNYABA01063)
declare -i i=0
while [ "${SSD[$i]}" != "" ]; do
NODE=`ls -l /dev/disk/by-id/${SSD[$i]} | awk '{ print $NF }' | sed -e 's/[/\.]//g'`
echo noop > /sys/block/$NODE/queue/scheduler
i=i+1
done
where SSD is a Bash array containing the device IDs of all SSD devices. Device IDs are listed in /dev/disk/by-id/ as symbolic links pointing to their corresponding /dev/ nodes. To view the links listed with their targets, issue the following command:
ls -l /dev/disk/by-id/
Swap Space on SSDs
One can place a swap partition on an SSD. Note that most modern desktops with an excess of 2 Gigs of memory rarely use swap at all. The notable exception is systems which make use of the hibernate feature. The following is recommended tweak for SSDs using a swap partition that will reduce the "swapiness" of the system thus avoiding writes to swap. In the /etc/sysctl.conf you can Maximize performance by changing the values below:
vm.swappiness=1
vm.vfs_cache_pressure=50
Example of a machine with 8 GB of physical memory:
tmpfs /tmp tmpfs nodev,nosuid,size=7G 0 0
Configuring your system to compile Android Open Source Code.
Java-Oracle 7:
This isn't yet supported with Android compiling that I know of. If you have this listed you will need to uninstall this and re-install java6 JDK/JRE.
Open Terminal and first type in the following.
sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 \ g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown \ libxml2-utils xsltproc zlib1g-dev:i386
Then type "sudo gedit /usr/include/linux/usb/ch9.h" and on line 592 replace
return __le16_to_cpu(epd->wMaxPacketSize);
with:
# return le16_to_cpu(epd->wMaxPacketSize);
return __le16_to_cpu(epd->wMaxPacketSize);
Installing required packages *ubuntu 12.04 (this is taken from source.android.com/source/initializing.html)
Building on Ubuntu 12.04 is currently only experimentally supported and is not guaranteed to work on branches other than master. Open terminal and cut and paste the following:
sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev:i386 \ g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown \ libxml2-utils xsltproc zlib1g-dev:i386
Setting up ccache
You can optionally tell the build to use the ccache compilation tool. Ccache acts as a compiler cache that can be used to speed-up rebuilds. This works very well if you do "make clean" often, or if you frequently switch between different build products.
Put the following in your .bashrc or equivalent.
export USE_CCACHE=1
By default the cache will be stored in ~/.ccache. If your home directory is on NFS or some other non-local filesystem, you will want to specify the directory in your .bashrc as well.
export CCACHE_DIR=<path-to-your-cache-directory>
How To Decrease Boot Times
**Full credit to PinGuy for suggesting this. Original thread found HERE
If you are finding it is booting slower then it used to there are a couple of things you can do.
The first is to run this command:
Code:
sudo rm /var/lib/ureadahead/pack
Then reboot twice. First time to generate a new ureadahead. Then the second time you boot it, it should be a lot faster. You can read up more about ureadahead here. You can also run BootUp-Manager:
Code:
su-to-root -X -c bum
And Turn off anything that starts at boot you don't want running.
**( I don't take credit for making any of these mods or the brains behind them. I only wanted to sit down and do a lot of research to make my system run very good. After talking to a few developers, they were interested in this and encouraged me to start a tutorial on this setup)
I have a pretty powerful laptop. i7, 16gb RAM, fully loaded with a SSD and a HDD. After using these tweaks, it's possible to boot Ubuntu in about 6.5 seconds from Grub and 8.5-9 for Windows. What most excites me is the ability to share folders between the two systems allowing me to save a tremendous amount of storage space and the ability to use them in both systems.
This is going to be a work in progress thread and urge others to PM tips and tweaks so they can be added on so we all can run our systems the best possible. Also, if you see any errors, please point them out so it can be adjusted. Feel free to PM me if you spot any problems.
Resources:
Download Ubuntu 12.04 LTS Here
https://wiki.archlinux.org/index.php/Solid_State_Drives;
http://www.cyberciti.biz/faq/howto-delete-remove-software-using-apt-get-command/;
http://forum.xda-developers.com/showthread.php?t=1604076
http://source.android.com/source/index.html
For Git setup and SSH keys to commit to git.
http://help.github.com/linux-set-up-git/
Here is a list started by TommyTomatoe for must haves on Ubuntu.​
Update all software:
sudo apt-get update
sudo apt-get upgrade
Install Java JRE and JDK
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jdk sun-java6-plugin
Install Ubuntu Tweak
sudo add-apt-repository ppa:tualatrix/ppa
sudo apt-get update
sudo apt-get install ubuntu-tweak
Install a bunch of codecs for media playback [just cop and paste this line]
sudo apt-get install libxine1-ffmpeg gxine mencoder flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview flac libmpeg3-1 mpeg3-utils mpegdemux liba52-0.7.4-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6 ffmpeg totem-mozilla icedax tagtool easytag id3tool lame nautilus-script-audio-convert libmad0 libjpeg-progs
Install Flash
sudo add-apt-repository ppa:sevenmachines/flash
sudo apt-get update
sudo apt-get install flashplugin64-installer
Install Backup Tool [Deja-Dup]
sudo apt-get install deja-dup
Install FTP Client
sudo apt-get install filezilla
Install Screenlets [Widgets]
sudo apt-add-repository ppa:screenlets/ppa
sudo apt-get update
sudo apt-get install screenlets
Install Popular archive formats
sudo apt-get install unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack lha arj cabextract file-roller
Install Compiz Settings [super awesome tweaker]
sudo apt-get install compizconfig-settings-manager
Install Subversion [ SVN ]
sudo apt-get install subversion
Some Tips and Tweaks for running Ubunut/Pinguy
To copy and paste inside terminal, you don't have to right-click. You can use CTRL+Shift+C and CTRL+Shift+v, as opposed to CTRL+C and CTRL+V.
To turn off Unity [not included in Pinguy], you can long in as Classic in the bottom right hand corner of log-in screen.
To install Android Utility created by Tommytomatoe, the cool way:
Install git
sudo apt-get install git
Install Android-Utility
git clone git://github.com/tommytomatoe/Android-Utility.git -b linux-au ~/android-utility
That method will ensure you the latest version of AU.
If you Use Ubuntu One , here is a little tool to help you keep track of your space left:
sudo add-apt-repository ppa:rye/ubuntuone-extras
sudo apt-get update
sudo apt-get install ubuntuone-indicator
For a good system monitor try out htop. Open terminal and enter the following (Thanks Johninlex for the suggestion)
sudo apt-get install htop
This is an awesome site for many things you can do to ur system after install or if you are having issues. Click Here
Very special thanks to TommyTomatoe. He has been a critical part of my development not only with Linux, but with Android as well. This community is so much better due to the talents he brings to us.
http://www.mediafire.com/view/?6jbie3c4dc7cp1t
Here it is for download.
awesome thank
great work as always thnks
Awesome possum!
Sent from my PG86100 using Tapatalk 2
Super guide and it will help many peeps.for sure!
One thing to be careful on. Windows 7, by default, is case insensitive. So cross linking windows partition to Linux might potentially cause issues if you create a file/folder in Linux that differ only in case. When you boot back into windows I am not sure how it will behave. I know it is possible to make Windows kernel accept case sensitive file naming.
In case someone will comment, the ntfs file system is case sensitive. It is Windows that is not by default. Also, kernel upgrades and .net framework upgrades will change you back to case insensitivity.
Sent from my PG86100 using Tapatalk 2
Awesome, will be using this.
Sent from my I9000 running Slim ICS 3.4 with Devil 2_0.72
At first I thought this topic was placed in the wrong section, but it seems actually possible to do this hehe, awesome work!, won't be trying it myself but it's a really nice tutorial!
broodplank1337 said:
At first I thought this topic was placed in the wrong section, but it seems actually possible to do this hehe, awesome work!, won't be trying it myself but it's a really nice tutorial!
Click to expand...
Click to collapse
Yeah, I wasn't too sure which place would be the best place for this so I asked a mod. He suggested here because it is setting up the system for android developement.
Plans are to take the third post and make another tutorial for everything git. To make sure your system will compile it properly.
Sent from my PG86100 using Tapatalk
tommytomatoe said:
Super guide and it will help many peeps.for sure!
One thing to be careful on. Windows 7, by default, is case insensitive. So cross linking windows partition to Linux might potentially cause issues if you create a file/folder in Linux that differ only in case. When you boot back into windows I am not sure how it will behave. I know it is possible to make Windows kernel accept case sensitive file naming.
In case someone will comment, the ntfs file system is case sensitive. It is Windows that is not by default. Also, kernel upgrades and .net framework upgrades will change you back to case insensitivity.
Sent from my PG86100 using Tapatalk 2
Click to expand...
Click to collapse
Thanks for the heads up. I will look in to this and post any findings.
Believe I had tried the java jdk and jre links you posted a few days ago when I initially tried to migrate to Ubuntu 12.04, but then they didn't work for me. Did you use these successfully? Found some others that did work for me and am now successfully building on Ubuntu 12.04 with Java 6. LMK if you need these.
O.a.T. said:
Believe I had tried the java jdk and jre links you posted a few days ago when I initially tried to migrate to Ubuntu 12.04, but then they didn't work for me. Did you use these successfully? Found some others that did work for me and am now successfully building on Ubuntu 12.04 with Java 6. LMK if you need these.
Click to expand...
Click to collapse
Yeah, I have been able to compile successfully. It gave me an error at first saying I was using java 1.6?? And needed 1.6?? But then just continued to compile. I will have to say the whole java thing was the trickiest part. But she's been solid so far.
One thing I could caution with this tutorial is ssd space for Linux. If putting /home in the 55gb space, you will run low on space when trying to compile and keep multiple devices from the build environment. Since the open source ecosystem is such a large project and only getting larger, by the time you have 3-4 compiled ur looking at a full /home partition. Easy solution would be to slide those files over to the hdd folder that's been symlinked.
Edit: scratch the last about running low on space. Digging in to it more, I found most of the space taken was with relinux when making a custom distro.
Sent from my PG86100 using Tapatalk
Leoisright said:
Yeah, I have been able to compile successfully. It gave me an error at first saying I was using java 1.6?? And needed 1.6?? But then just continued to compile. I will have to say the whole java thing was the trickiest part. But she's been solid so far.
Sent from my PG86100 using Tapatalk
Click to expand...
Click to collapse
I may not have stuck with those ones long enough. Don't really have to worry about the rest though as I am still building on my somewhat old AMD quad via Oracle VM VB. Still, not too bad as I am able to sync/rebuild, including the kernel, in ~30min, after of course the first very time consuming sync and build.
Hi, I have notebook with ssd 64gb and hard disc 250gb... Now, xp is on hd (it will stay and win 7 on ssd- I want to put ubuntu 12.04 there...
Generally, installing is not problem for me, I done it many times...
I am in doubt about trim and alignment of partitions...
I see many things about this on net, but nothing seems authoritative enough for me...
Also to go with 64bit or 32bit (I have, of course, 4GB ram)...
Thanks
ivanox1972 said:
Hi, I have notebook with ssd 64gb and hard disc 250gb... Now, xp is on hd (it will stay and win 7 on ssd- I want to put ubuntu 12.04 there...
Generally, installing is not problem for me, I done it many times...
I am in doubt about trim and alignment of partitions...
I see many things about this on net, but nothing seems authoritative enough for me...
Also to go with 64bit or 32bit (I have, of course, 4GB ram)...
Thanks
Click to expand...
Click to collapse
From everything Ive read, TRIM support is only for SSD drives. You also need to make sure your SSD supports trim. Depending on the age, the newer ones seem to support it. From my understanding it deletes the file rather than writes over it allowing for a better performance the older the device gets.
Here is another site to look over TRIM and really what it's about. Found Here.
As far as the Ram is concerned, here is a great site to find memory limitations for windows.
Check resources Found Here
Alignment: Check this site out about how it will affect the ssd. I've found this site rather informative when trying to understand the SSD tweaks. Found Here. I am glad you brought up alignment though, it will be something to add to the OP.
I THINK I have this right, but before I go forward, I just want to make sure that I'm installing this on my D: Drive correctly
Now I have 2 500gig WD HDD's. C: Drive has WIndows, duh, with 150 gigs free space. D: Drivehas 350 gig Free
SO, if I have this right, I want to open Disk Management and free up about 130 gigs on D. Drive, leave unallocated
Boot into Linux Setup, choose "Something Else"
I SHOULD see:
/dev/sda
/dev/sda1 NTFS 104 MB
/dev/sda2 NTFS 465066 MB (Total) 132500 (Free)
/dev/sdb
/dev/sdb1 NTFS 335076 MB (Total) 162160 (Free)
Free Space 130000 MB
Select Free Space, click Add Set as
Primary
Partition Size: 500 MB
Select Beginning
EXT2
Mount Point: /Boot
OK
Select Logical
Partition Size 10000 MB
Beginning
EXT4
Mount Point: /
OK
Logical
Partition Size 16000 MB (I have 8 gigs RAM)
Beginning
Swap Area
OK
Logical
Partition Size: 104500 MB
Beginning
EXT4
Mount Point: /Home
Change Device For Bootloader to sdb
Install
Boot to Windows, open EasyBCD
Add New Entry
Linux BSD tab
Select Grub 2
Name: Ubuntu 12.04 LTS
Add Entry
Edit Boot Menu
Select Windows As Default
Reboot. Pray that the boot menu shows Windows 7 and Ubuntu 12.04 LTS
Sweet info!
I have been searching for a while tonight for this exact information. Now I can go to sleep and try and do all this tomorrow. Thanks for posting this!
Perfect!
This was absolutely spot on and exactly what I needed.
Many thanks! If you were a cigar smoker I'd send you a Macanudo.
RexBabbs said:
This was absolutely spot on and exactly what I needed.
Many thanks! If you were a cigar smoker I'd send you a Macanudo.
Click to expand...
Click to collapse
Send it on...lol
Glad it helped. Its a nice tutorial for new hdd/sad installs.
Sent from my Touchpad using Tapatalk

[GUIDE]DualBootPatcher Use, Build from Source/using Docker/Travis And Add New Devices

Hi all DualBootPatcher fans, in this thread i'll try to explain all things about DualBootPatcher, so if your user please read this post carefully then continue to other posts, and if you developer you can skip it and go to post #2 directly
Part 0: Introduction & How to use DualBootPatcher?
What is DualBootPatcher?
DualBootPatcher is an open-source app that allows multiple ROMs to be installed on a single Android device. It does its best to work with existing code and does not require explicit support from ROMs. There are currently 270+ supported devices and their variations.
It's originally developed by the amazing developer @chenxiaolong with help of many contributors
Click to expand...
Click to collapse
What does the app do ?:
It patches...
Custom kernels for dual boot support
ROMs so that they can be installed as secondary
Google Apps packages for AOSP-based ROMs
SuperSU so that it can be used in the secondary ROM
Where can i find it?
Website
XDA Main Thread
Github
What's supported ?
Except Toaster and Alarm clocks pretty much everything is supported.
Click to expand...
Click to collapse
How to use the App?
- Download, install and open the app.
- Swipe to the right to open the menu. Click "ROMS". Now if this is the first time you use it, it will ask you if you want to set kernel. Do so!
- After it has finished go to ROM Settings (primary ROM 3 dot menu) and select Update Ramdisk. It will update it and will ask you to reboot. Press Reboot Now, or Reboot later.
- Now Download any ROM you like and open the app again and open the menu and open Patch Zip File from the menu. Ensure that your Device is set to (yourdevicename) and under Partition configuration select secondary/dataslot (will install 2nd ROM in /system) or data slot.
- Click continue and select where to save the patched file.
- You should see the file is being put in "Queue". Just click the confirm button to the upper right.
Note: If you want to go back, just swipe the ROM in queue to right and start over.
- The app will patch the zip. When done, go back to "ROMs".
- Click "Flash zip files" (the big pink button on the lower right). Click the pink plus button to add your previously patched zip file.
- Locate the file you have patched in step 7. Unless you have changed the name there, it should be something like ROM_name_partition_config_ID.zip (like RR-N-v5.8.3-20170707-cheeseburger-Unofficial_dual.zip).
- Click on that file and choose "Keep location". Now confirm the flash with the button on the upper right side.
Note: You can also install the patched zip files in recovery.
- It will now open the terminal and begin flashing the file. This requires some patience. After it has flashed the file you'll see success message in green.
- Now click back and you should see your newly installed ROM along with the Primary ROM.
Note: You can find more options by clicking on the three buttons on each ROM.
- Now reboot and wait till finishing 2nd ROM first boot. install DualBootPatcher apk so you can easily switch ROMs, there is another way to change ROMs: flash DualBootUtilities.zip and switch ROM manually.
Note: Using Bootui:
- Open app then select settings and press install (update) bootui. then Swipe to the right to open the menu. Click "ROMS" again and open secondary ROM Settings) and select Update Ramdisk, Now you can change ROMs simply using boot ui (something like grub bootloader but it works like twrp)
Partitions Configurations:
The patcher offers several locations for installing ROMs:
Primary: This is normally used for installing a zip to the primary ROM. It is not required, but is strongly recommended because it has code to prevent the zip from inadvertently affecting other ROMs.
Dual: Dual/Secondary is the first multiboot installation location. It installs to the system partition. This is a good spot for installing a second ROM because it doesn't take any space away from the internal storage.
Multi-slots: There are 3 multislots: multi-slot-1, multi-slot-2, multi-slot-3. These install to the cache partition. This is specifically for devices, like the Galaxy S4, that have a massive cache partition.
Data-slots: There can be an unlimited number of data slots. These install to the data partition and eat up space on the internal storage. This is useful for devices where the system partition is nearly full and the cache partition is tiny. These slots are named "data-slot-[id]", where "id" is something you provide in the app.
Extsd-slots: There can be an unlimited number of extsd slots. These install to the external SD card, which is useful as it keeps the ROMs off of the internal storage. Note that the ROM's data files are still stored on the data partition.
Apps and Data sharing:
DualBootPatcher very recently got support for sharing apps and their data across ROMs. Maybe sharing is somewhat of a misleading term. The feature actually makes Android load the shared apps and data from a centralized location, /data/multiboot/_appsharing. So you're not sharing apps from one ROM to another per se. The ROMs are just loading the apps from one shared location. Let me make this clearer with an analogy.
Think of the people in a company office as ROMs. You want to share with your coworkers some documents (apps). Instead of telling them to come over to your desk to see those documents (sharing apps from one ROM to another), everyone goes to the conference room to look at the documents together (loading apps from a shared location). That's how app and data sharing is implemented.
Click to expand...
Click to collapse
To use app sharing, follow these steps in every ROM that you want to use app sharing: (doesn't work with JB ROMs)
Install the app you want to share
Open DualBootPatcher and go to "App Sharing" in the navigation drawer
Enable individual app sharing
Tap "Manage shared applications" and enable APK/data sharing for the app
Reboot
When you uninstall an app that's shared, it simply become unshared for the current ROM. That way, other ROMs are not affected. To continue the analogy above, if you quit your job, you won't shred the documents that everybody else was looking at.
If you unshare an app's data, it will go back to using the data it had before it was shared. In other words, you leave the conference room and go back to work on your own documents at your desk.
Click to expand...
Click to collapse
How to Tips:
How to boot to another ROM ?
This is simple ... There is no reboot to primary, secondary or whatever. So all you have to do is:
1) Go to ROMs section of the App.
2) Click on the ROM you want to boot to. You should see "Switching ROM" message. After few seconds, you should see a report message saying that "ROM successfully switched".
3) Now just do a normal reboot of your device. See the magic! It should boot to the ROM you have switched on step 2.
Note: You can find more options by selecting the three buttons on each ROMs (like creating reboot widgets for directly rebooting to specific rom).
You also need to install the App to all of the ROMs you install. Otherwise, you want be able to boot to other ROMs!
Other How to ?
Wipe /cache, /data, /system, or dalvik-cache?
The easiest way is to do it from the app while booted in another ROM. Just go to "Roms" in the navigation drawer, tap the 3 dots options menu for the ROM you want to wipe, and tap "Wipe ROM".
Update the primary ROM?
Patch the zip for primary and flash it. The "primary" installation target is designed so that other ROMs won't be affected when you want to flash something for the primary ROM.
Update a non-primary ROM?
Patch and flash the zip exactly like how you did it the first time.
Flash a mod or custom kernel for the primary ROM?
Patch it for primary before flashing. If the zip does not wipe /cache, it is also safe to flash it directly.
Flash a mod or custom kernel for a non-primary ROM?
Just patch and flash it
Now, You're perfect DualBootPatcher user,so let's enter the main guide !
Guide Index:
Part 1: How to build DualBootPatcher from source manually?
Part 2: How to build DualBootPatcher using docker images?
Part 3: How to build DualBootPatcher using TravisCI?
Part 4: How to add new Devices to DualBootPatcher?
Part 5: How to submit new Devices to official DualBootPatcher support?
Extra: How to share apps (apk) between ROMs? (soon!)
Before we start you should know that DBP is not just android app, there is versions for windows and linux also and in this guide i'll talk about app and linux version only, i don't use windows
Part 1: How to build DualBootPatcher from source?
When you deeply exploring DualBootPatcher repository you'll find all information and guides you need but for some people instructions isn't clear enough, so let me explain it here
- You'll need linux, whichever distribution you use. but i'm sure building works on [Debian-Ubuntu-Fedora-Arch] and all its derivations.
A) Prerequisites:
- You'll need these packages whatever version you want to build:
Android NDK
Currently NDK r15 is required to build, you can get it here
Download, Extract and rename it to "android-ndk"
Code:
wget https://dl.google.com/android/repository/android-ndk-r15-linux-x86_64.zip && unzip android-ndk-r15-linux-x86_64.zip && mv android-ndk-r15 android-ndk
And then export android ndk:
Code:
echo "export ANDROID_NDK=$(pwd)/android-ndk" >> ~/.bashrc
echo "export ANDROID_NDK_HOME=$(pwd)/android-ndk" >> ~/.bashrc
cmake
DBP needs cmake 3.7.2 or higher. you need to download it here
Downloading & Extract command:
Code:
wget https://cmake.org/files/v3.7/cmake-3.7.2.tar.gz && tar xzf cmake-3.7.2.tar.gz
extract to folder and run the following commands in cmake folder
Code:
sed -i 's|cmake_options="-DCMAKE_BOOTSTRAP=1"|cmake_options="-DCMAKE_BOOTSTRAP=1 -DCMAKE_USE_OPENSSL=ON"|' bootstrap
./bootstrap
make
sudo make install
OpenSSL
i'm successfully build using openssl-1.1.0c, download here and extract.
Code:
wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz && tar xzf openssl-1.1.0c.tar.gz
open openssl-1.1.0c folder and install it
Code:
./config shared --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
make
sudo make install
echo 'PATH=${PATH}:/usr/local/ssl' >> ~/.bashrc
gtest
Install on Ubuntu / Debian:
Code:
sudo apt-get install libgtest-dev
On Fedora:
Code:
sudo dnf install gtest-devel
On Archlinux:
Code:
sudo pacman -S gtest
yaml-cpp
Install on Ubuntu / Debian using
Code:
sudo apt-get install libyaml-cpp-dev
On Fedora
Code:
sudo dnf install yaml-cpp-devel
On Archlinux:
Code:
sudo pacman -S yaml-cpp
Other General packages that must be installed: [Skip this if you have android build environment :good: ]
Ubuntu / Debian:
Code:
sudo apt-get install ccache libboost-dev libssl-dev openssl python-minimal build-essential libfontconfig1 findutils git make libprocps-dev unzip zip gcc-multilib g++-multilib lib32ncurses5-dev transifex-client gnupg mesa-common-dev libglu1-mesa-dev
Fedora:
Code:
sudo dnf install ccache findutils gcc-c++ git make procps-ng unzip zip gnupg ncurses-compat-libs transifex-client openssl-devel
Archlinux:
Code:
sudo pacman -S ccache boost openssl lib32-openssl findutils git make procps-ng unzip zip gnupg gcc-multilib ncurses
Code:
sudo pacaur -S transifex-client ncurses5-compat-libs lib32-ncurseslib32-ncurses5-compat-libs
- For building android app you need:
Android SDK
You need to install SDK using android studio ( build-tools 25.0.3, platforms android-25, platform-tools and tools )
or install from terminal:
Code:
mkdir -p android-sdk && cd android-sdk
wget -q https://dl.google.com/android/repository/platform-tools_r25.0.3-linux.zip && unzip -qq platform-tools_r25.0.3-linux.zip
wget -q https://dl.google.com/android/repository/build-tools_r25.0.3-linux.zip && unzip -qq build-tools_r25.0.3-linux.zip
wget -q https://dl.google.com/android/repository/tools_r25.2.3-linux.zip && unzip -qq tools_r25.2.3-linux.zip
Then Export it:
Code:
echo "export ANDROID_HOME=$(pwd)" >> ~/.bashrc
echo "export PATH=${PATH}:${ANDROID_HOME}/tools" >> ~/.bashrc
JDK 1.8
Ubuntu / Debian:
Code:
sudo apt-get install openjdk-8-jdk openjdk-8-jdk-headless
Fedora:
Code:
sudo dnf install java-1.8.0-openjdk-devel java-1.8.0-openjdk-headless
Archlinux:
Code:
sudo pacman -S jdk8-openjdk
Other packages:
Ubuntu / Debian:
Code:
sudo apt-get install lib32stdc++-6-dev
Fedora:
Code:
sudo dnf install glibc.i686 libstdc++.i686
Archlinux:
Code:
sudo pacman -S glibc libstdc++5 lib32-libstdc++5
- And for linux version you need:
qt5
it must be 5.3 or higher
Ubuntu / Debian:
Code:
sudo apt-get install qttools5-dev-tools libqt5core5a
Fedora:
Code:
sudo dnf install qt5-qtbase-devel
Archlinux:
Code:
sudo pacman -S qt5-base
Other packages:
Ubuntu / Debian:
Code:
sudo apt-get install libarchive-dev liblz4-tool liblzma-dev lz4-dev zlib1g-dev lib32z-dev
Fedora:
Code:
sudo dnf install libarchive-devel lz4-devel xz-devel
Archlinux:
Code:
sudo pacman -S libarchive lz4 xz lib32-xz lzip
- Some final touches:
Enable cache:
Code:
echo "export USE_CCACHE=1" >> ~/.bashrc
Reload bash environment:
Code:
source ~/.bashrc
- Cloning the source:
Code:
git clone --recursive https://github.com/chenxiaolong/DualBootPatcher.git
B) Building Android APP:
- Open DualBootPatcher folder and make new folder "build" and open it.
Code:
mkdir build && cd build/
- Now Build the app:
Code:
cmake .. -DMBP_BUILD_TARGET=android -DMBP_BUILD_TYPE=debug
make
cpack -G TXZ
make apk
And you'll find built apk in DualBootPatcher/Android_GUI/build/outputs/apk/Android_GUI-debug.apk
C) Building Utilities Zip:
Utilities Zip is AROMA based zip which enable you to switch ROMs form twrp or wipe ROM when something went wrong.
- In build folder run these commands:
Code:
make android-system_armeabi-v7a
make -C data/devices
./utilities/create.sh
you'll find built utilities.zip in DualBootPatcher/build/utilities/DualBootUtilities-9.2.0.zip
D) Building Linux App:
- In build folder run these commands:
Code:
cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON
make
cpack -G TXZ
or to pack it to zip file:
Code:
cpack -G ZIP
Special Thanks:
@oF2pks For helping me setup build environment on arch
@Ahmed Hady & @androidlover5842 Without their helps i won't be here
Part 2: How to build DualBootPatcher using docker images?
What is docker? [in case you don't know it ]
Docker is the world’s leading software container platform. Developers use Docker to eliminate “works on my machine” problems when collaborating on code with co-workers. Operators use Docker to run and manage apps side-by-side in isolated containers to get better compute density. Enterprises use Docker to build agile software delivery pipelines to ship new features faster, more securely and with confidence for both Linux, Windows Server, and Linux-on-mainframe apps.
Click to expand...
Click to collapse
Firstly, make sure you have docker installed, if not install it
From here you should choose a method you'll follow, Building docker images manually or use pre-built docker images.
A) Building docker images manually:
@chenxiaolong sir has made docker image configuration files here
all you need to do after sync the repo like part 1 is entering the following commands in DualBootPatcher directory:
Code:
./docker/generate.sh
./docker/build.sh
Note that building the docker images will take a long time and consume a lot of bandwidth--multiple gigabytes at the very least. It will download all the dependencies for building DualBootPatcher for all supported targets.
Click to expand...
Click to collapse
B) Using ready-made docker images:
i have made docker images and uploaded them to docker hub
to download "pull" it enter these commands:
Code:
docker pull yshalsager/dualbootpatcher:9.3.0-4-base
docker pull yshalsager/dualbootpatcher:9.3.0-4-android
docker pull yshalsager/dualbootpatcher:9.3.0-4-linux
Building DualBootPatcher using docker:
- To enter docker container and build DualBootPatcher make folder "builder" in DualBootPatcher directory
Code:
cd DualBootPatcher && mkdir -p builder
- Then run this to enter android build container
Code:
docker run --rm -it -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" -v "${HOME}/.ccache:/builder/.ccache:rw,z" -v "${HOME}/.gradle:/builder/.gradle:rw,z" yshalsager/dualbootpatcher:9.3.0-4-android bash
- After this you'll continue like normal building:
Code:
cd DualBootPatcher/builder && cmake .. -DMBP_BUILD_TARGET=android -DMBP_BUILD_TYPE=debug && make -j16 && rm -rf assets && cpack && make apk -j16
make android-system_armeabi-v7a -j16 && make -C data/devices -j16
- Now exit from container and enter linux build one:
Code:
docker run --rm -it -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" -v "${HOME}/.ccache:/builder/.ccache:rw,z" -v "${HOME}/.gradle:/builder/.gradle:rw,z" yshalsager/dualbootpatcher:9.3.0-4-linux bash
- Build utilities ZIP:
Code:
cd DualBootPatcher/builder && ./utilities/create.sh
- And build linux app
Code:
cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON && make -j16 && cpack
- You'll find output files in your local "builder" folder like normal build.
Part 3: How to build DualBootPatcher using TravisCI?
Travis CI is free open-source continues integration service, which simply take your project from GitHub and test / build it for you !
it's amazing solution if you don't have time/free space/mind lol :cyclops: to test your code.
- you'll need to signup Travis account, go here and press signup, enter your GitHub account details then approve Travis needed permissions and done.
- Now Fork DualBootPatcher repository to your account and create .travis.yml file in project root.
- Copy my Travis configuration to your .travis.yml
Code:
sudo: required
services:
- docker
before_install:
# Clone DualBootPatcher Repository
- git clone --recursive https://github.com/yshalsager/DualBootPatcher -b master DualBootPatcher/
# Pull docker images
- docker pull yshalsager/dualbootpatcher:9.3.0-4-base
- docker pull yshalsager/dualbootpatcher:9.3.0-4-android
- docker pull yshalsager/dualbootpatcher:9.3.0-4-linux
script:
# Make work directories
- mkdir $HOME/.android
- mkdir -p ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/ && cd ${TRAVIS_BUILD_DIR}/DualBootPatcher/
# Build APK
- |
docker run --rm -i -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" yshalsager/dualbootpatcher:9.3.0-4-android bash << EOF
cd DualBootPatcher/builder && cmake .. -DMBP_BUILD_TARGET=android -DMBP_BUILD_TYPE=debug && make -j16 && rm -rf assets && cpack && make apk -j16
make android-system_armeabi-v7a -j16 && make -C data/devices -j16
exit
EOF
- |
docker run --rm -i -e USER_ID=$(id -u) -e GROUP_ID=$(id -g) -v "$(pwd):/builder/DualBootPatcher:rw,z" -v "${HOME}/.android:/builder/.android:rw,z" yshalsager/dualbootpatcher:9.3.0-4-linux bash << EOF
# Build Utilities Zip
cd ~/DualBootPatcher/builder && ./utilities/create.sh
# Build Linux
cmake .. -DMBP_BUILD_TARGET=desktop -DMBP_PORTABLE=ON && make -j16 && cpack
exit
EOF
after_success:
- export TRAVIS_CURRENT_DATE=$(date +"%d%m%y-%Hh%Mm")
# Check output & md5sum
- ls -l ${TRAVIS_BUILD_DIR}/DualBootPatcher/Android_GUI/build/outputs/apk/debug/Android_GUI-debug.apk
- md5sum ${TRAVIS_BUILD_DIR}/DualBootPatcher/Android_GUI/build/outputs/apk/debug/Android_GUI-debug.apk
- ls -l ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/utilities/DualBootUtilities-9.3.0.zip
- md5sum ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/utilities/DualBootUtilities-9.3.0.zip
- ls -l ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/DualBootPatcher-9.3.0-Linux.zip
- md5sum ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/DualBootPatcher-9.3.0-Linux.zip
# Upload to transfer.sh
- cd ${TRAVIS_BUILD_DIR}/DualBootPatcher/Android_GUI/build/outputs/apk/debug/ && curl --upload-file ./Android_GUI-debug.apk https://transfer.sh/Android_GUI-debug-${TRAVIS_CURRENT_DATE}.apk
- cd ${TRAVIS_BUILD_DIR}//DualBootPatcher/builder/utilities/ && curl --upload-file ./DualBootUtilities-9.3.0.zip https://transfer.sh/DualBootUtilities-9.3.0-${TRAVIS_CURRENT_DATE}.zip
- cd ${TRAVIS_BUILD_DIR}/DualBootPatcher/builder/ && curl --upload-file ./DualBootPatcher-9.3.0-Linux.zip https://transfer.sh/DualBootPatcher-9.3.0-${TRAVIS_CURRENT_DATE}-Linux.zip
- Edit line 8 with your Repository and branch you want to build.
Code:
- git clone --recursive https://github.com/yshalsager/DualBootPatcher -b master DualBootPatcher/
- This simple TravisCI configuration builds both of apk and utilities.zip and deploy them to transfer.sh
- Now open Travis and add your DualBootPatcher fork to projects and start building :good:
- You'll find built apk md5 and links from line at the end Travis log
- Build takes about 25 mins
- When you add new commits to repository Travis will always build new apk for you !
- If you want to change something in configuration, always check its syntax to make sure it's valid YAML using this site
Part 4: How to add new Devices to DualBootPatcher?
To add your/new device to DualBootPatcher you need to get some information first then add it to DualBootPatcher devices:
- Flash GetLogs-20161128-1.zip using recovery [TWRP highly recommended]
- Copy /sdcard/logs/[Date&Time].tar to PC, extract it and let's start.
- This is new device template:
Code:
- name: (Device Name)
id: (device id)
codenames:
- (device codename1)
- (device codename2)
- (device codename3)
architecture: (device architecture)
block_devs:
base_dirs:
- (/dev/block/bootdevice/by-name)
system:
- (/dev/block/bootdevice/by-name/system)
cache:
- (/dev/block/bootdevice/by-name/cache)
data:
- (/dev/block/bootdevice/by-name/userdata)
boot:
- (/dev/block/bootdevice/by-name/boot)
recovery:
- (/dev/block/bootdevice/recovery)
extra:
- (/dev/block/bootdevice/modem)
boot_ui:
supported: true
flags:
- (TW_HAS_DOWNLOAD_MODE)
graphics_backends:
- fbdev
brightness_path: (/sys/class/leds/lcd-backlight/brightness)
max_brightness: (255)
default_brightness: (162)
pixel_format: (RGBX_8888)
theme: portrait_hdpi
- You'll edit all values between brackets.
- open logs/system/build.prop, you'll find:
ro.product.model= is your (Device Name)
ro.product.name= and ro.product.device= is your (device id) and (device codename1), if you know more names for your device add it in (device codename2) / (device codename3)
ro.product.cpu.abi= is your (device architecture)
- open logs/recovery/recovery.fstab, you'll find main device mount points, copy each mount point to it name
- open logs/recovery/recovery.log, you'll find TW_BRIGHTNESS_PATH := /sys/class/leds/lcd-backlight/brightness this is your (brightness_path)
I:Got max brightness 255 is (max_brightness)
setting GGL_PIXEL_FORMAT_RGBA_8888 is (pixel_format)
- Note: you can get these info from BoradConfig.mk in your device twrp tree.
- Now read "Partition Logs:" in recovery.log
it'll tell us second mount point, as example /system | /dev/block/mmcblk0p41
so you should add it like
Code:
system:
- /dev/block/bootdevice/by-name/system
- /dev/block/mmcblk0p41
and so on with other partitions.
- Checking more mounts: (not necessary but i recommend it)
open logs/listings/dev_full and scroll down to /dev/block/platform/soc.0 you'll find another main mount point which contain by-name and by-num folders like /dev/block/platform/soc.0/f9824900.sdhci
from /dev/block/platform/soc.0/f9824900.sdhci/by-name list copy each partition mount point to your device
- Now we're done, you should have something like
Code:
- name: Xiaomi Mi4S
id: aqua
codenames:
- aqua
architecture: arm64-v8a
block_devs:
base_dirs:
- /dev/block/bootdevice/by-name
- /dev/block/platform/soc.0/f9824900.sdhci/by-name
system:
- /dev/block/bootdevice/by-name/system
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/system
- /dev/block/mmcblk0p41
cache:
- /dev/block/bootdevice/by-name/cache
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/cache
- /dev/block/mmcblk0p42
data:
- /dev/block/bootdevice/by-name/userdata
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/userdata
- /dev/block/mmcblk0p44
boot:
- /dev/block/bootdevice/by-name/boot
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/boot
- /dev/block/mmcblk0p37
recovery:
- /dev/block/bootdevice/by-name/recovery
- /dev/block/platform/soc.0/f9824900.sdhci/by-name/recovery
- /dev/block/mmcblk0p38
boot_ui:
supported: true
graphics_backends:
- fbdev
flags:
- TW_QCOM_RTC_FIX
pixel_format: RGBX_8888
brightness_path: /sys/class/leds/lcd-backlight/brightness
max_brightness: 255
default_brightness: 162
theme: portrait_hdpi
- Open DualBootPatcher/data/devices/(your device manufacturer).yml and add your device codes. then Check your code syntax here if everything is right, make commit to add your device to your repository.
- Build apk using any method explained above to test it.
Part 5: How to submit new Devices to official DualBootPatcher support?
Once you checked everything is working, it's time to contribute to DualBootPatcher and add your device to official devices:
- First, Check you made all needed changes to add your device without problems, again check for YAML syntax because if it's wrong build won't work.
- Open DualBootPatcher Repository, press New pull request button.
- Press compare across forks and change the head fork to your username/DualBootPatcher
- Give a name and a description to your pull request, some thing like: "Add (Device Name) support" or "data: Add (device name)
- Now click the "Create pull request" green button
- Wait for your changes to be verified and merged to the project, the developer received your code and he will review, try and add it to the source code. You will be notified when your code merged.
Supported Devices by me
Here is my all contributions to DualBootPatcher:
Nokia X/XL
Nokia X2
Samsung Galaxy Win & Core
Xiaomi Mi 6
Xiaomi Redmi 4A
OnePlus 5
HTC Desire Eye
YU YUREKA BLACK
Xiaomi Mi 4S
Xiaomi Redmi Pro
Samsung Galaxy S8/S8+ [Exynos & Snapdragon]
Zenfone 2 Laser [Z00ED]
Lenovo Vibe K6
Samsung Tab S2
Samsung Galaxy Note 8 (Exynos)
If you can't add your device, you can pm me with logs tar file and i'll add it for you
Hii reserved
---------- Post added at 02:20 AM ---------- Previous post was at 02:20 AM ----------
I will tell u, how to sync apps between roms, without using double storage space for apk and libs.
---------- Post added at 02:25 AM ---------- Previous post was at 02:20 AM ----------
also can be used as multi profile
Support Nokia 6?
Qualcomm s430 Full root...
taicracker said:
Support Nokia 6?
Qualcomm s430 Full root...
Click to expand...
Click to collapse
Flash get logs
And send me
taicracker said:
Support Nokia 6?
Qualcomm s430 Full root...
Click to expand...
Click to collapse
Read this man! https://forum.xda-developers.com/showpost.php?p=73551957&postcount=5
or if you can't do it i can help, just give me the logs tar file
yshalsager said:
Read this man! https://forum.xda-developers.com/showpost.php?p=73551957&postcount=5
or if you can't do it i can help, just give me the logs tar file
Click to expand...
Click to collapse
The file where you say is located on the device. I will upload it to you soon ?
---------- Post added at 05:27 PM ---------- Previous post was at 04:28 PM ----------
yshalsager said:
Read this man! https://forum.xda-developers.com/showpost.php?p=73551957&postcount=5
or if you can't do it i can help, just give me the logs tar file
Click to expand...
Click to collapse
https://drive.google.com/file/d/0B-7MZC8TPIGtTjQyOFVydzNHV1U/view?usp=drivesdk
This is the logs file. (.tar.gz)
I am not on a PC right now. You help me. Do you need the build.prop file on your device?
addy692 said:
Flash get logs
And send me
Click to expand...
Click to collapse
https://drive.google.com/file/d/0B-7MZC8TPIGtTjQyOFVydzNHV1U/view?usp=drivesdk
?
taicracker said:
https://drive.google.com/file/d/0B-7MZC8TPIGtTjQyOFVydzNHV1U/view?usp=drivesdk
This is the logs file. (.tar.gz)
I am not on a PC right now. You help me. Do you need the build.prop file on your device?
Click to expand...
Click to collapse
I got it, apk will be here soon
yshalsager said:
I got it, apk will be here soon
Click to expand...
Click to collapse
Ok. Thanks
taicracker said:
Ok. Thanks
Click to expand...
Click to collapse
@taicracker
Here you are, please test and report me
https://transfer.sh/rqmJs/Android_GUI-debug-290817-12h43m41s.apk
yshalsager said:
@taicracker
Here you are, please test and report me
https://transfer.sh/rqmJs/Android_GU...-12h43m41s.apk
Click to expand...
Click to collapse
link die
taicracker said:
link die
Click to expand...
Click to collapse
Sorry
https://transfer.sh/rqmJs/Android_GUI-debug-290817-12h43m41s.apk
yshalsager said:
Sorry
https://transfer.sh/rqmJs/Android_GUI-debug-290817-12h43m41s.apk
Click to expand...
Click to collapse
Ok Thanks. I'm downloading. Installation is complete and then I do next. My Nokia 6 does not have a compatible room at all
I installed apk file and what do i do next?

Categories

Resources