If you're interested in running more complete Unix/Linux environment on your Android device, you might have heard about Optware for Android, here is thread for example.
Well, that project had few issues, like: shipping binaries of unknown origin and running them on user's device as root; coded and advertised as applying to one particular device; making too much changes on the device in one turn (like alter rootfs image).
That's why I decided to create another Optware install script to address those points. It is explicitly envisioned to support Android as an OS/Platform, i.e. all devices, not one particular model. Well, that may be not exactly easy, but that's at least good aim to pursue. It also doesn't come with any random binaries, but instead downloads them from a trusted source during the installation process (sources being Optware itself for bootstrap packages and CodeSourcery toolchain package for libc on which Optware depends).
Due to the last point, the installation script runs on a Linux host, so ADB connection to the device is required. Device also should have working "su" command (i.e. be rooted).
The source code is on github: https://github.com/pfalcon/optware-android
Just a bit of DISCLAIMER: you should run this script only if you understand what Optware is, and how to use it. Some experience with Unix/Linux command line and shell scripts is required, in particular you should skim thru the install script before running it.
Otherwise, it works quite well on my Nook Tablet, and I'd be happy to receive suggestions, success/bug reports, patches, etc.
Great work.
I took the liberty of using your script as a base to install OpenSSH. Should work on any device. I can't post links so I attached an archive with the script and the necessary files.
CyanogenMod on my Touchpad has some sort of sysinit '/etc/init.d', so I initialize Optware and Optware init scripts from there. I don't know how other mods handle this, probably different. SSH authentication is key-based, since passwords are not set. Have a look at the script to figure out how to deal with that.
Glad it was useful for you. Issue how to automatically start up daemons on Android indeed exists. The native Android way is /init.rc config file (of adhoc format). The problem is that this file is located on rootfs, which is ramdisk, i.e. any changes are lost and not available during boot. And initial content of that ramdisk comes from initramfs/initrd, but it has many ways to be implemented - compiled into kernel or on separate partition, checksumed against any changes, etc. So, in general case it's not possible to update, and even if it is, a mistake can lead to bricked device.
So, I for now skipped that issue altogether in my installer, but hope to get to it eventually (have some ideas).
So, if you have CyanogenMod, then using /etc/init.d is for sure a good solution.
One suggestion/question... is it possible to alter the script to run directly off of the device's command line? That would eliminate the Linux (and optionally would eliminate the ADB requirement).
I'm sure there's a static wget binary for ARM already compiled somewhere, and the rest can be done through busybox.
That would really make it universal. I'm a Windows user, and haven't had the time to parse out your script and figure out what the end result is supposed to look like on the device
merwin said:
One suggestion/question... is it possible to alter the script to run directly off of the device's command line?
Click to expand...
Click to collapse
There's now FAQ at http://sf.net/p/optware-android which discusses why this isn't possible on pristine Android system (lack of basic POSIX utilities and wget). It also has a suggestion for Windows users ;-).
That would eliminate the Linux (and optionally would eliminate the ADB requirement).
I'm sure there's a static wget binary for ARM already compiled somewhere, and the rest can be done through busybox.
Click to expand...
Click to collapse
The question is not if it's available, but whether you can trust such binary. The responsible user's answer is "No". Nook Color's optware installer does exactly that - ships binaries of unknown origin, and dissatisfaction with such approach is what prompted be to develop alternative installer.
The only way you can trust it if [easily buildable] source is provided, then it's up to the user to either compile it themselves or on their own risk to use provided binary. I don't have such source at my hands, and not interested to make it zillion's time just for this adhoc purpose - instead, there should be well-established community project to provide such build framework for all other projects to reuse. I hope, we'll tackle that under auspices of f-droid.org project.
That would really make it universal. I'm a Windows user, and haven't had the time to parse out your script and figure out what the end result is supposed to look like on the device
Click to expand...
Click to collapse
Other possible approach is to just skip "shell script" (and need for busybox) thing at all, and write installer in Java, to be run as normal Android app. That's certainly neat idea which will make users' life easier, and I have that on my (very long) TODO list ;-).
awesome! great work!
i have one small issue though: /etc/hosts doesnt seem to have any effect. a lot of stuff won't work because localhost cant be resolved. any suggestions?
2 onemandivision: Confirmed this issue, looking into it.
Ok, it turns out that GLibc's nsswitch default is weird in favoring DNS over /etc/hosts, and with Google DNS it didn't even look in the latter. Fixed by installing explicit nsswitch.conf:
# ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: seq=0 ttl=64 time=0.274 ms
Let's dub this 1.0 then (tagged).
pfalcon said:
There's now FAQ at http://sf.net/p/optware-android which discusses why this isn't possible on pristine Android system (lack of basic POSIX utilities and wget). It also has a suggestion for Windows users .
The question is not if it's available, but whether you can trust such binary. The responsible user's answer is "No". Nook Color's optware installer does exactly that - ships binaries of unknown origin, and dissatisfaction with such approach is what prompted be to develop alternative installer.
The only way you can trust it if [easily buildable] source is provided, then it's up to the user to either compile it themselves or on their own risk to use provided binary. I don't have such source at my hands, and not interested to make it zillion's time just for this adhoc purpose - instead, there should be well-established community project to provide such build framework for all other projects to reuse. I hope, we'll tackle that under auspices of f-droid.org project.
Other possible approach is to just skip "shell script" (and need for busybox) thing at all, and write installer in Java, to be run as normal Android app. That's certainly neat idea which will make users' life easier, and I have that on my (very long) TODO list .
Click to expand...
Click to collapse
Most phones that are rooted have a fairly recent version of busybox on it, which includes wget. Also, standard practice on kernels these days (non stock ones) is to have all scripts that exist in /etc/init.d execute. That would solve any service startup issue.
I don't see any problems with requiring root and busybox
Solves all of the issues.
Hello
I tried the script and i was able to install ipkg on my Samsung Galaxy II
the only problem is... if i try to install any package... i get a segmentation fault error
Code:
[email protected]:/ # [B]cd /data/opt[/B]
[email protected]:/data/opt # [B]./start.sh[/B]
[B]BusyBox v1.10.3 (2012-02-14 09:43:47 UTC) built-in shell (ash)
Enter 'help' for a list of built-in commands.[/B]
$(precmd)[email protected]$HOSTNAME:${PWD:-?} #
$(precmd)[email protected]$HOSTNAME:${PWD:-?} # [B]ipkg install rsync[/B]
[B]Installing rsync (3.0.9-1) to root...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/rsync_3.0.9-1_arm.ipk
Segmentation fault[/B]
$(precmd)[email protected]$HOSTNAME:${PWD:-?} #
any advice? :'(
If you already have shell access to your device and don't want to connect via ADB, I modified the script to have the ability to run directly on your device (your device will need at least a functional wget executable already, which I had from SSHDroid):
Code:
# OPTWARE_DIR is where to install optware, it should be on a partition with
# normal Unix filesystem (permissions, etc.)
OPTWARE_DIR=/data/opt
# Particular field to install from, stable by default
FEED=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable
# DO NOT edit anything below this line unless you know what you are doing
start_script=start.sh
cs08q1_url=https://sourcery.mentor.com/sgpp/lite/arm/portal/package2549/public/arm-none-linux-gnueabi/arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
cs08q1_fname=$(basename $cs08q1_url)
libc_path=arm-2008q1/arm-none-linux-gnueabi/libc
libc_libs="lib/ld-2.5.so ld-linux.so.3 \
lib/libc-2.5.so libc.so.6 \
lib/libm-2.5.so libm.so.6 \
lib/librt-2.5.so librt.so.1 \
lib/libpthread-2.5.so libpthread.so.0 \
lib/libresolv-2.5.so libresolv.so.2 \
lib/libdl-2.5.so libdl.so.2 \
lib/libnss_dns-2.5.so libnss_dns.so.2 \
lib/libutil-2.5.so libutil.so.1 \
lib/libgcc_s.so.1 libgcc_s.so \
lib/libnsl-2.5.so libnsl.so.1 \
lib/libcrypt-2.5.so libcrypt.so.1 \
lib/libBrokenLocale-2.5.so libBrokenLocale.so.1 \
lib/libanl-2.5.so libanl.so.1 \
lib/libcidn-2.5.so libcidn.so.1 \
lib/libnss_compat-2.5.so libnss_compat.so.2 \
lib/libnss_files-2.5.so libnss_files.so.2 \
lib/libnss_hesiod-2.5.so libnss_hesiod.so.2 \
lib/libnss_nis-2.5.so libnss_nis.so.2 \
lib/libnss_nisplus-2.5.so libnss_nisplus.so.2 \
lib/libthread_db-1.0.so libthread_db.so.1 \
"
#
# On-target (device) commands
#
t_cp () {
# copy file on a device
cat $1 >$2
}
t_cd_ln () {
local dir=$1
shift
cd $dir; ln $*
}
t_ln () {
ln $*
}
t_chmod () {
chmod $*
}
t_mkdir_p () {
# This doesn't complain if dir exists, but can't create intermediate dirs
ls $1 >/dev/null 2>&1 || mkdir $1
}
t_rm_f () {
# Doesn't complain if file not there
ls $1 >/dev/null 2>&1 && rm $1
}
t_rm_rf () {
# Doesn't complain if dir not there
ls $1 >/dev/null 2>&1 && rm -r $1
}
t_remount_rw () {
mount -o rw,remount $1 $1
}
t_remount_ro () {
mount -o ro,remount $1 $1
}
extract_libc () {
if [ ! -d $(echo $libc_path | sed -e 's%/.*%%') ]; then
echo Extracting $cs08q1_fname
tar xjf $cs08q1_fname $list
fi
}
install_system_lib () {
local f=$(basename $1)
echo "Installing system lib: $f"
t_cp $libc_path/$1 /lib/$f
t_chmod 0755 /lib/$f
t_ln -s $f /lib/$2
}
install_system_bin () {
local f=$(basename $1)
echo "Installing system bin: $1"
t_cp $libc_path/$1 /bin/$f
t_chmod 0755 /bin/$f
}
install_libc () {
while [ -n "$1" ]; do
local lib=$1
shift
local symlink=$1
shift
install_system_lib $lib $symlink
done
}
install_bin () {
echo "Installing /opt/bin/$1"
t_cp opt/bin/$1 /opt/bin/$1
t_chmod 755 /opt/bin/$1
}
install_ipkg () {
t_mkdir_p /opt/bin
t_mkdir_p /opt/lib
install_bin ipkg
t_cp opt/lib/libipkg.so.0.0.0 /opt/lib/libipkg.so.0.0.0
t_ln -s libipkg.so.0.0.0 /opt/lib/libipkg.so.0
t_ln -s libipkg.so.0.0.0 /opt/lib/libipkg.so
}
fetch_package_index () {
if [ ! -f Packages ]; then
echo "Downloading Optware package index"
wget -q $FEED/Packages
else
echo "Using cached Optware package index"
fi
}
get_package_fname () {
awk "/^Filename: ${1}_/ {print \$2}" Packages
}
fetch_package () {
if [ -z "$1" ]; then
echo "Unexpected error: package '$1' not found in index"
exit 1
fi
if [ ! -f "$1" ]; then
echo "Downloading Optware package $1"
wget -q $FEED/$1
else
echo "Using cached package $1"
fi
}
fetch_toolchain () {
if [ ! -f $cs08q1_fname ]; then
echo "You need CodeSourcery ARM-Linux toolchain release 2008q1: $cs08q1_fname"
echo "if you have this file on your system already, press Ctrl-C now and copy"
echo "it into the current directory. Otherwise, press Enter to download it (65MB)."
read
wget $cs08q1_url
fi
}
optware_uninstall () {
t_remount_rw /
t_remount_rw /system
rm -r $OPTWARE_DIR
rm /lib
rm /bin
rm /opt
rm /tmp
t_remount_ro /
rm /etc/resolv.conf
rm /etc/mtab
rm /etc/passwd
rm /etc/group
t_remount_ro /system
echo "Optware sucessfully uninstalled"
}
#
# Main code
#
if [ "$1" == "" ]; then
echo "This script installs NSLU Optware on an Android device connected using ADB"
echo "Usage: $0 install|uninstall"
exit 1
fi
if [ "$1" == "uninstall" ]; then
optware_uninstall
exit
fi
fetch_toolchain
fetch_package_index
ipkg_fname=$(get_package_fname ipkg-opt)
wget_fname=$(get_package_fname wget)
busybox_fname=$(get_package_fname busybox-base)
fetch_package $ipkg_fname
fetch_package $wget_fname
fetch_package $busybox_fname
t_remount_rw /
t_remount_rw /system
# Start from scratch
echo "== Initializing optware environment =="
t_mkdir_p $OPTWARE_DIR
t_ln -s $OPTWARE_DIR /opt
t_mkdir_p $OPTWARE_DIR/rootbin
t_ln -s $OPTWARE_DIR/rootbin /bin
t_mkdir_p $OPTWARE_DIR/rootlib
t_ln -s $OPTWARE_DIR/rootlib /lib
t_mkdir_p $OPTWARE_DIR/tmp
t_ln -s $OPTWARE_DIR/tmp /tmp
t_mkdir_p $OPTWARE_DIR/home
t_mkdir_p $OPTWARE_DIR/home/root
t_mkdir_p $OPTWARE_DIR/home/user
echo "== Installing libc =="
extract_libc
install_libc $libc_libs
install_system_bin usr/bin/ldd
echo "== Installing bootstrap ipkg =="
rm -rf opt
tar -xOzf $ipkg_fname ./data.tar.gz | tar -xzf -
install_ipkg
echo "== Installing bootstrap wget =="
rm -rf opt
tar -xOzf $wget_fname ./data.tar.gz | tar -xzf -
install_bin wget
echo "== Installing bootstrap busybox =="
rm -rf opt
tar -xOzf $busybox_fname ./data.tar.gz | tar -xzf -
install_bin busybox
echo "== Initializing bootstrap /bin =="
# We need sane shell as /bin/sh
t_ln -s /opt/bin/busybox /bin/sh
# We need minimal set of sane shell commands to run update-alternatives
# script to properly (re)install busybox itself
t_ln -s /opt/bin/busybox /bin/echo
t_ln -s /opt/bin/busybox /bin/rm
t_ln -s /opt/bin/busybox /bin/rmdir
t_ln -s /opt/bin/busybox /bin/sed
t_ln -s /opt/bin/busybox /bin/mkdir
t_ln -s /opt/bin/busybox /bin/head
t_ln -s /opt/bin/busybox /bin/sort
t_ln -s /opt/bin/busybox /bin/dirname
t_ln -s /opt/bin/busybox /bin/ln
t_ln -s /opt/bin/busybox /bin/mv
t_ln -s /opt/bin/busybox /bin/cat
t_ln -s /opt/bin/busybox /bin/chown
t_ln -s /opt/bin/busybox /bin/chmod
# gzip and tar should be part of Android, but there were reports
# that some implementations may be broken
t_ln -s /opt/bin/busybox /bin/tar
t_ln -s /opt/bin/busybox /bin/gzip
echo "== Configuring package feed =="
t_mkdir_p /opt/etc
t_mkdir_p /opt/etc/ipkg
echo src cross $FEED >/opt/etc/ipkg/feeds.conf
echo "== Configuring domain name resolution =="
echo nameserver 8.8.8.8 >/opt/etc/resolv.conf
# On a normal Android system, /etc is symlink to /system/etc, but just in case...
t_mkdir_p /etc
# but for normal system, we need to remount /system
t_rm_f /etc/resolv.conf
t_ln -s /opt/etc/resolv.conf /etc/resolv.conf
echo "== Configuring GLIBC Namespace Switch =="
t_cp nsswitch.conf /etc/nsswitch.conf
t_chmod 0644 /etc/nsswitch.conf
echo "== Configuring /etc/mtab =="
t_ln -s /proc/mounts /etc/mtab
echo "== Configuring users =="
echo root:x:0:0:root:/opt/home/root:/bin/sh >/opt/etc/passwd
echo shell:x:2000:2000:shell:/opt/home/user:/bin/sh >>/opt/etc/passwd
t_ln -s /opt/etc/passwd /etc/passwd
echo "== Configuring groups =="
echo root:x:0:root >/opt/etc/group
echo shell:x:2000:shell >>/opt/etc/group
t_ln -s /opt/etc/group /etc/group
echo "== Creating optware init script =="
echo '#!/system/bin/sh' >/opt/optware-init.sh
echo 'ls /opt >/dev/null 2>&1 && exit' >>/opt/optware-init.sh
echo echo Reinitializing optware rootfs links >>/opt/optware-init.sh
echo mount -o rw,remount rootfs / >>/opt/optware-init.sh
echo ln -s $OPTWARE_DIR /opt >>/opt/optware-init.sh
echo ln -s $OPTWARE_DIR/rootlib /lib >>/opt/optware-init.sh
echo ln -s $OPTWARE_DIR/rootbin /bin >>/opt/optware-init.sh
echo ln -s $OPTWARE_DIR/tmp /tmp >>/opt/optware-init.sh
echo mount -o ro,remount rootfs / >>/opt/optware-init.sh
t_chmod 0755 /opt/optware-init.sh
echo "== Creating optware startup script =="
echo '#!/system/bin/sh' >/opt/$start_script
echo 'ls /opt >/dev/null 2>&1 ||' su -c $OPTWARE_DIR/optware-init.sh >>/opt/$start_script
echo '# You may want to add /opt/local/bin to PATH below' >>/opt/$start_script
echo export PATH=/opt/sbin:/opt/bin:/bin:/system/bin >>/opt/$start_script
echo 'if busybox test $(busybox id -u) = 0; then HOME=/opt/home/root; else HOME=/opt/home/user; fi' >>/opt/$start_script
echo export HOME>>/opt/$start_script
echo export TMPDIR=/tmp >>/opt/$start_script
echo umask 022 >>/opt/$start_script
echo /bin/sh >>/opt/$start_script
t_chmod 0755 /opt/$start_script
# Create "s" symlink to ease typing on touchscreen devices
t_ln -s $start_script /opt/s
t_remount_ro /
echo "== Reinstalling bootstrap packages =="
echo "Make sure that your device is woken up and connected to the Internet"
echo "Press Enter to continue"
read
#
# Now that we have all dependencies to run ipkg bootstraped on device,
# we need to use ipkg to reinstall itself and all those dependencies,
# to make sure they're installed and configured properly.
#
PATH=/opt/bin:/bin /opt/bin/ipkg update
PATH=/opt/bin:/bin /opt/bin/ipkg install ipkg-opt
PATH=/opt/bin:/bin /opt/bin/ipkg install wget
PATH=/opt/bin:/bin /opt/bin/ipkg install busybox
echo "== Cleaning local directory =="
rm -rf opt arm-2008q1
t_remount_ro /system
echo "Optware for Android installation complete."
echo "To start optware session, execute $OPTWARE_DIR/$start_script (aka $OPTWARE_DIR/s) on the device"
echo "Also, make sure you have mounted whichever partition contains Optware as rw when you execute an update"
pfalcon, let me know if you want me to add any license headers to this.
Related
Hi,
I don't know how-to detect if a device is 32B or 32A automatically.... Logically, if we do a free command during recovery install, we can AUTOMATICALLY check if it's a 32B/A, then, we create a gile on sdcard called 32B/A, or a prop, and when it flash kernel, or wifi module or sound things, we include this prop in the script
Can anyone create this script?
[EDIT]
Many Thanks to Firerat who mades the script, and a little to me, who has the idea!
So the script is here:
Code:
#!/sbin/sh
# Idea : Artifex14
# script : Firerat => THE BEST!
# 28.06.10
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
echo "32a"
else
model=32b
echo "This device is a 32b"
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
I thought about this too. It could be done at the time the rom is flashed, but up to now I only know how to make update-script, not updater-script or update-binary. You could pack all sorts of boot images, and then, say, a system-dream, system-sapphire, and system-magic folder and depending on the board version property, flash the appropriate versions of files, at least in theory that should work, plus it prevents you from having to flash extra files just for cross-device compatibility.
jubeh said:
I thought about this too. It could be done at the time the rom is flashed, but up to now I only know how to make update-script, not updater-script or update-binary. You could pack all sorts of boot images, and then, say, a system-dream, system-sapphire, and system-magic folder and depending on the board version property, flash the appropriate versions of files, at least in theory that should work, plus it prevents you from having to flash extra files just for cross-device compatibility.
Click to expand...
Click to collapse
Can you do the script? For the updaterscript, it's OK!
et a script to run
Code:
free|awk '/Mem/ { print $2 }'
and test that, e.g.
Code:
#!/sbin/sh
# KernelPrep.sh
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
else
model=32b
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
get your updater script to run that, then copy your kernels to /tmp/
Code:
package_extract_dir("kernels", "/tmp");
or
Code:
copy_dir PACKAGE:kernels TMP:
next you can
Code:
write_raw_image("/tmp/boot.img", "boot"),
or
Code:
write_raw_image TMP:boot.img BOOT:
edit:
ps, you don't really need the second if statement, but its easier to read like that
oops , nearly forgot about the kernel modules
Code:
mount /system
install -d /system/lib/modules
ln -s /system/lib/modules /tmp/modules32a
ln -s /dev/null /tmp/modules32b
Firerat said:
et a script to run
Code:
free|awk '/Mem/ { print $2 }'
and test that, e.g.
Code:
#!/sbin/sh
# KernelPrep.sh
ram=`free|awk '/Mem/ { print $2 }'`
if [ "ram" -gt "97884" ];
then
model=32a
else
model=32b
fi
if [ "model" = "32a" ];
then
ln -s /tmp/boot.img /tmp/boot32a.img
ln -s /dev/null /tmp/boot32b.img
else
ln -s /tmp/boot.img /tmp/boot32b.img
ln -s /dev/null /tmp/boot32a.img
fi
get your updater script to run that, then copy your kernels to /tmp/
Code:
package_extract_dir("kernels", "/tmp");
or
Code:
copy_dir PACKAGE:kernels TMP:
next you can
Code:
write_raw_image("/tmp/boot.img", "boot"),
or
Code:
write_raw_image TMP:boot.img BOOT:
edit:
ps, you don't really need the second if statement, but its easier to read like that
oops , nearly forgot about the kernel modules
Code:
mount /system
install -d /system/lib/modules
ln -s /system/lib/modules /tmp/modules32a
ln -s /dev/null /tmp/modules32b
Click to expand...
Click to collapse
I'll try that, THANK!
oops typo
if [ "ram" -gt "97884" ];
should be
if [ "$ram" -gt "97884" ];
i got bored looking at the standard # or $ in bash so modified my bashrc with something from bashstyle-ng.
does anyone else have a different bash? show it off!
replace /etc/bash/bashrc file with this one to get the same look
Code:
# /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output. So make sure this doesn't display
# anything or bad things will happen !
function pre_prompt {
newPWD="${PWD}"
user="whoami"
host=$(echo -n $HOSTNAME | sed -e "s/[\.].*//")
datenow=$(date "+%a, %d %b %y")
let promptsize=$(echo -n "+([email protected]$host ddd., DD mmm YY)(${PWD})+" \
| wc -c | tr -d " ")
let fillsize=${COLUMNS}-${promptsize}
fill=""
while [ "$fillsize" -gt "0" ]
do
fill="${fill}-"
let fillsize=${fillsize}-1
done
if [ "$fillsize" -lt "0" ]
then
let cutt=3-${fillsize}
newPWD="...$(echo -n $PWD | sed -e "s/\(^.\{$cutt\}\)\(.*\)/\2/")"
fi
}
# Test for an interactive shell. There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]] ; then
# Shell is non-interactive. Be done now!
return
fi
# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control. #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize
# Enable history appending instead of overwriting. #139609
shopt -s histappend
use_color=false
# set some environment variables
HOME=/sdcard
TERM=linux
PROMPT_COMMAND=pre_prompt
export black="\[\033[0;38;5;0m\]"
export red="\[\033[0;38;5;1m\]"
export orange="\[\033[0;38;5;130m\]"
export green="\[\033[0;38;5;2m\]"
export yellow="\[\033[0;38;5;3m\]"
export blue="\[\033[0;38;5;4m\]"
export bblue="\[\033[0;38;5;12m\]"
export magenta="\[\033[0;38;5;55m\]"
export cyan="\[\033[0;38;5;6m\]"
export white="\[\033[0;38;5;7m\]"
export coldblue="\[\033[0;38;5;33m\]"
export smoothblue="\[\033[0;38;5;111m\]"
export iceblue="\[\033[0;38;5;45m\]"
export turqoise="\[\033[0;38;5;50m\]"
export smoothgreen="\[\033[0;38;5;42m\]"
case "$TERM" in
xterm)
PS1="$bblue+-($orange\[email protected]\h \$(date \"+%a, %d %b %y\")$bblue)-\${fill}-($orange\$newPWD\
$bblue)-+\n$bblue+-($orange\$(date \"+%H:%M\") \$$bblue)->$white "
;;
screen)
PS1="$bblue+-($orange\[email protected]\h \$(date \"+%a, %d %b %y\")$bblue)-\${fill}-($orange\$newPWD\
$bblue)-+\n$bblue+-($orange\$(date \"+%H:%M\") \$$bblue)->$white "
;;
*)
PS1="+-(\[email protected]\h \$(date \"+%a, %d %b %y\"))-\${fill}-(\$newPWD\
)-|\n+-(\$(date \"+%H:%M\") \$)-> "
;;
esac
# Set up a ton of aliases to cover toolbox with the nice busybox
# equivalents of its commands
for i in cat chmod chown df insmod ln lsmod mkdir mount mv rm rmdir rmmod umount; do
eval alias ${i}=\"busybox ${i}\"
done
unset i
alias ls='busybox ls --color=auto'
alias sysro='mount -o remount,ro /system'
alias sysrw='mount -o remount,rw /system'
# Try to keep environment pollution down, EPA loves us.
unset use_color safe_term match_lhs
overkill
x3maniac said:
i got bored looking at the standard # or $ in bash so modified my bashrc with something from bashstyle-ng.
does anyone else have a different bash? show it off!
Click to expand...
Click to collapse
Your prompt takes too much space, and it contains date + time, which are already shown on the screen (top and bottom).
Just make the prompt PS1='\e[34m\[email protected]\h:\w \$ \e[0m' so it's ready for cut&paste, e.g. when you're copying files with scp.
Hello xda-developers!
I'm trying to port Tizen for samsung wave 1.
But now I'm doing some research.
This thread will be my research on doing a chrooted scripts and try to boot a Tizen 2 Alpha working through vnc-viewer.
I'll write here my scripts for everyone to test it.
After these scripts an app. But now scripts.
This thread will be updated everytime I get a spare time to write it.
Thanks!
Tutorial:
First download the image from the torrent file.
Copy it for your extsd or sdcard phone/tablet.
It's to copy the image file from Tizen 2 Alpha for these two places.
And on terminal emulator run the tizen_run bash file.
Test it and I will test it too as I'm writing this tutorial and post.
Rename the script tizen_run.sh.txt to tizen_run.sh
Thanks !
PS: This code was changed to work with Tizen 2 Alpha I'm going to test it now.
I've putted here for everyone can get work it too.
Code:
#!/bin/sh
# Modify this according to your needs
DEVICE="/dev/block/mmcblk1p2"
LOOP="yes"
# Maybe this as well
MNT_PATH="/mnt/extsd/tizen"
# Modify only if you know, what are you doing
BINDS="dev dev/pts proc sys mnt/extsd"
ANDROID_BINDS=" /system /data "
TMPS="tmp var/tmp var/log var/run"
MY_MOUNTS=""
unset PS1
# Helper functions
die() {
echo " $1"
exit 1
}
safe_mount() {
mkdir -p "$MNT_PATH""$2"
if [ "$3" ]; then
OPTION=" $3 "
else
OPTION=""
fi
if [ -z "`mount | grep " $MNT_PATH$2 "`" ]; then
mount $OPTION "$1" "$MNT_PATH$2" || die "Can't mount $2!!!"
fi
MY_MOUNTS="$MNT_PATH$2 $MY_MOUNTS"
}
# Real work
[ "`whoami || echo root`" = "root" ] || die "You must be root first!"
LOOP_ARG=""
[ "$LOOP" = "yes" ] || LOOP_ARG=" -o loop "
safe_mount $DEVICE "" "$LOOP_ARG -t ext4 "
for i in $BINDS; do
safe_mount "/$i" "/$i" " -o bind "
done
if [ -d /Removable ]; then
for i in /Removable/*; do
[ -d "$i" ] && safe_mount $i /mnt$i " -o bind "
done
fi
for i in $ANDROID_BINDS; do
safe_mount $i /mnt/android$i " -o bind "
done
for i in $TMPS; do
safe_mount none /$i " -t tmpfs "
done
mount -o remount,ro "$MNT_PATH"
chroot "$MNT_PATH" /sbin/fsck.ext2 -y "$DEVICE"
mount -o remount,rw "$MNT_PATH"
# Tweak configuration of the chroot during first start
if [ \! -f "$MNT_PATH"/etc/profile.d/tweak.sh ]; then
mkdir -p "$MNT_PATH"/home/demo
echo 'nameserver 8.8.8.8' > "$MNT_PATH"/etc/resolv.conf
echo 'net:x:3003:root,demo' >> "$MNT_PATH"/etc/group
echo 'demo:x:1000:100::/home/demo/bin/bash' >> "$MNT_PATH"/etc/passwd
echo 'demo:$1$joWqOQdr$YsapocP32UtdiR3PKBXVM1:15395:0:::::' \
>> "$MNT_PATH"/etc/shadow
sed -i 's|^root:.*|root:$1$joWqOQdr$YsapocP32UtdiR3PKBXVM1:15395:0:::::|' \
"$MNT_PATH"/etc/shadow
echo '#!/bin/sh
export TERM=linux
export LANG="en_US.utf-8"
export EDITOR="busybox vi"
alias vi="busybox vi"
precmd() { :; }
if [ "`whoami`" = root ]; then
export HOME=/root
export USER=root
hostname -F /etc/HOSTNAME
fi
if [ -z "$CHROOTED" ]; then
export CHROOTED=yes
export HOME="/home/demo"
export USER="demo"
su demo
fi
' > "$MNT_PATH"/etc/profile.d/tweak.sh
fi
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/system/xbin:/system/bin"
# Chroot
chroot "$MNT_PATH" /bin/bash
# Cleanup
echo "Umount everything (yes/NO)?"
read answer
if [ "$answer" = yes ]; then
for i in $MY_MOUNTS; do
umount -l $i
done
fi
For bada
And Bada there any way to run it there,,,, or only possible in Badadroid,,,,:good::,,,,
Only possible in badadroid.
astronfestmon said:
Hello xda-developers!
I'm trying to port Tizen for samsung wave 1.
But now I'm doing some research.
This thread will be my research on doing a chrooted scripts and try to boot a Tizen 2 Alpha working through vnc-viewer.
I'll write here my scripts for everyone to test it.
After these scripts an app. But now scripts.
This thread will be updated everytime I get a spare time to write it.
Thanks!
Tutorial:
First download the image from the torrent file.
Copy it for your extsd or sdcard phone/tablet.
It's to copy the image file from Tizen 2 Alpha for these two places.
And on terminal emulator run the tizen_run bash file.
Test it and I will test it too as I'm writing this tutorial and post.
Thanks !
PS: This code was changed to work with Tizen 2 Alpha I'm going to test it now.
I've putted here for everyone can get work it too.
Code:
#!/bin/sh
# Modify this according to your needs
DEVICE="/dev/block/mmcblk1p2"
LOOP="yes"
# Maybe this as well
MNT_PATH="/mnt/extsd/tizen"
# Modify only if you know, what are you doing
BINDS="dev dev/pts proc sys mnt/extsd"
ANDROID_BINDS=" /system /data "
TMPS="tmp var/tmp var/log var/run"
MY_MOUNTS=""
unset PS1
# Helper functions
die() {
echo " $1"
exit 1
}
safe_mount() {
mkdir -p "$MNT_PATH""$2"
if [ "$3" ]; then
OPTION=" $3 "
else
OPTION=""
fi
if [ -z "`mount | grep " $MNT_PATH$2 "`" ]; then
mount $OPTION "$1" "$MNT_PATH$2" || die "Can't mount $2!!!"
fi
MY_MOUNTS="$MNT_PATH$2 $MY_MOUNTS"
}
# Real work
[ "`whoami || echo root`" = "root" ] || die "You must be root first!"
LOOP_ARG=""
[ "$LOOP" = "yes" ] || LOOP_ARG=" -o loop "
safe_mount $DEVICE "" "$LOOP_ARG -t ext4 "
for i in $BINDS; do
safe_mount "/$i" "/$i" " -o bind "
done
if [ -d /Removable ]; then
for i in /Removable/*; do
[ -d "$i" ] && safe_mount $i /mnt$i " -o bind "
done
fi
for i in $ANDROID_BINDS; do
safe_mount $i /mnt/android$i " -o bind "
done
for i in $TMPS; do
safe_mount none /$i " -t tmpfs "
done
mount -o remount,ro "$MNT_PATH"
chroot "$MNT_PATH" /sbin/fsck.ext2 -y "$DEVICE"
mount -o remount,rw "$MNT_PATH"
# Tweak configuration of the chroot during first start
if [ \! -f "$MNT_PATH"/etc/profile.d/tweak.sh ]; then
mkdir -p "$MNT_PATH"/home/demo
echo 'nameserver 8.8.8.8' > "$MNT_PATH"/etc/resolv.conf
echo 'net:x:3003:root,demo' >> "$MNT_PATH"/etc/group
echo 'demo:x:1000:100::/home/demo/bin/bash' >> "$MNT_PATH"/etc/passwd
echo 'demo:$1$joWqOQdr$YsapocP32UtdiR3PKBXVM1:15395:0:::::' \
>> "$MNT_PATH"/etc/shadow
sed -i 's|^root:.*|root:$1$joWqOQdr$YsapocP32UtdiR3PKBXVM1:15395:0:::::|' \
"$MNT_PATH"/etc/shadow
echo '#!/bin/sh
export TERM=linux
export LANG="en_US.utf-8"
export EDITOR="busybox vi"
alias vi="busybox vi"
precmd() { :; }
if [ "`whoami`" = root ]; then
export HOME=/root
export USER=root
hostname -F /etc/HOSTNAME
fi
if [ -z "$CHROOTED" ]; then
export CHROOTED=yes
export HOME="/home/demo"
export USER="demo"
su demo
fi
' > "$MNT_PATH"/etc/profile.d/tweak.sh
fi
export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/system/xbin:/system/bin"
# Chroot
chroot "$MNT_PATH" /bin/bash
# Cleanup
echo "Umount everything (yes/NO)?"
read answer
if [ "$answer" = yes ]; then
for i in $MY_MOUNTS; do
umount -l $i
done
fi
Click to expand...
Click to collapse
what can we do with this file?
In badadroid vnc-viewer and terminal emulator You can run Tizen under android.
astronfestmon said:
In badadroid vnc-viewer and terminal emulator You can run Tizen under android.
Click to expand...
Click to collapse
sorry for the noobs questions, but how??
Edit 1:
I saw your tutorial just now, but I did not understand what to do in the terminal emulator?
There's no problem at all.
You need to copy the code into a file bash(.sh) with the name tizen_run.sh
Then in badadroid run it an app called terminal emulator to get into vnc-viewer.
As a loopback image inside android.
I'm trying to run it as an application like linuxonandroid.
astronfestmon said:
There's no problem at all.
You need to copy the code into a file bash(.sh) with the name tizen_run.sh
Then in badadroid run it an app called terminal emulator to get into vnc-viewer.
As a loopback image inside android.
I'm trying to run it as an application like linuxonandroid.
Click to expand...
Click to collapse
I think I am not smart enough to do understand you..
But thanks anyway..
Okay.
I'll upload here the file to run on terminal emulator.
I'm testing the app for android.
I'll upload it here.
Something wrong.There are no permission to tizen_run.sh
I can't test
New link for image tizen:
http://tizen-kernel-s8500.googlecode.com/files/tizen.7z.001
Try this command:
sh tizen_run.sh
or
./tizen_run.sh
Copied Tizen.img (latest one) to sd card
Copied tizen_run.sh to sd card
Then on Android (Nand Ver.) Emulator tried
sh tizen_run.sh ---> no such file or directory
./tizen_run.sh ---> not found
I'm going to check it out.
type this on terminal emulator:
cd /mnt/extsd - if exists
cd folder "where the Tizen.img and script is located"
then
sh tizen_run.sh
or
./tizen_run.sh
astronfestmon said:
I'm going to check it out.
type this on terminal emulator:
cd /mnt/extsd - if exists
cd folder "where the Tizen.img and script is located"
then
sh tizen_run.sh
or
./tizen_run.sh
Click to expand...
Click to collapse
Can't execute : Permission denied
I'll post a new file.
To see what happens.
in the first topic i have a txt file rename it on linux.
mv tizen_run.sh.txt tizen_run.sh
news??
Sorry about not saying any news.
Next week another build and a better script with an app for badadroid.
As I still don't made sufficient posts to put it directly to dev forum, it's here. Admins, please move it to correct sections as you desire.
I installed the latest version of Flashtool for Linux. I followed the instructions at flashtool. net/install. php and tried to run './Flashtool'. here is the output:
[[email protected] FlashTool]# ./FlashTool
Running as root.
JAVA_HOME not set. Using default value : ./x10flasher_lib/linjre64
libusb.LibUsbException: Libusb not found. Minimum libusb version is 1.0.15. It can be downloaded on libusbx. org
at libusb.UsbSystem.initSystem(UsbSystem.java:28)
at libusb.UsbSystem.<init>(UsbSystem.java:15)
at linuxlib.JUsb.init(JUsb.java:21)
at gui.Main.initLinuxUsb(Main.java:47)
at gui.Main.main(Main.java:34)
I have libusbx 1.0.16 and libusb 0.1.5 installed, so how can I debug this? if someone can forward this to Androxyde I will be very grateful.
I am running Fedora 19 x64 with both 32 and 64 bit libs installed, as per Flashtool site instructions. Current Java (Oracle) is Java(TM) SE Runtime Environment (build 1.7.0_45-b18), 64-bit version.
Thank you
***EDIT*** This post is no longer relevant, check the next post down.
luzemario said:
As I still don't made sufficient posts to put it directly to dev forum, it's here. Admins, please move it to correct sections as you desire.
I installed the latest version of Flashtool for Linux. I followed the instructions at flashtool. net/install. php and tried to run './Flashtool'. here is the output:
[[email protected] FlashTool]# ./FlashTool
Running as root.
JAVA_HOME not set. Using default value : ./x10flasher_lib/linjre64
libusb.LibUsbException: Libusb not found. Minimum libusb version is 1.0.15. It can be downloaded on libusbx. org
at libusb.UsbSystem.initSystem(UsbSystem.java:28)
at libusb.UsbSystem.<init>(UsbSystem.java:15)
at linuxlib.JUsb.init(JUsb.java:21)
at gui.Main.initLinuxUsb(Main.java:47)
at gui.Main.main(Main.java:34)
I have libusbx 1.0.16 and libusb 0.1.5 installed, so how can I debug this? if someone can forward this to Androxyde I will be very grateful.
I am running Fedora 19 x64 with both 32 and 64 bit libs installed, as per Flashtool site instructions. Current Java (Oracle) is Java(TM) SE Runtime Environment (build 1.7.0_45-b18), 64-bit version.
Thank you
Click to expand...
Click to collapse
I found on my system (arch linux) the libusbx libs were named differently from what flashtool is looking for.
FlashTool was looking for "/usr/lib/libusbx-1.0.so" and "/usr/lib/libusbx-1.0.so.0.1.0"
but what i had was "/usr/lib/libusb-1.0.so" and "/usr/lib/libusb-1.0.so.0.1.0" respectively.
I created Symbolic links so that flashtool would find what it was looking for...
"ln -s /usr/lib/libusb-1.0.so.0.1.0 /usr/lib/libusbx-1.0.so.0.1.0"
&
"ln -s /usr/lib/libusb-1.0.so /usr/lib/libusbx-1.0.so"
(Ran in root terminal without qoutes) That fixed it for me.
Perhaps those libs are also named differently on fedora too? i used "find / -name libusb*" (in root terminal without qoutes) to check for them on my system.
It's also possible to change the searched for filenames in "FlashTool" (the launching script) itself by editing it but that would need to be redone with every new version unless fixed/changed by the developers. the lines that would need changed are..
"ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so"
"ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so"
(I've bolded the part to be changed for flashtool-0.9.13.0, it might be different in the future)
Hope this helps :good:
I decided to change flashtool's script/launcher so it looks for libusbx in a more robust (i hope) way. i've attached the changed file. If this works for you then we can submit the changes to the devs for their consideration.
#!/bin/sh
export BASEDIR=$(dirname $0)
export system64=$(uname -m)
export OS=$(uname -s)
cd $BASEDIR
if test "$OS" = "Linux"
then
chmod 755 ./x10flasher_lib/adb.linux
chmod 755 ./x10flasher_lib/fastboot.linux
chmod 755 ./x10flasher_lib/unyaffs.linux
chmod 755 ./x10flasher_lib/bin2elf
chmod 755 ./x10flasher_lib/bin2sin
if [ "$(whoami)" != "root" ]
then
export HASRULES="false"
if test -d /etc/udev/rules.d
then
if grep -rl "0fce" /etc/udev/rules.d >/dev/null
then
export HASRULES="true"
fi
fi
if test "$HASRULES" = "true"
then
echo "Not running as root but Sony/SonyEriccson Vendor ID found on your udev rules"
echo "if Flashing didn't work well, run flashtool as root"
else
echo "Not running as root and there is no Sony/SonyEriccson Vendor ID on your udev rules"
echo "The user must be granted access to adb/flashmode/fastboot"
echo "If you are unsure what to do, run flashtool as root"
exit 1
fi
else
echo "Running as root."
fi
if test -z "${JAVA_HOME}"
then
if test "${system64}" = "x86_64"
then
export JAVA_HOME=./x10flasher_lib/linjre64
else
export JAVA_HOME=./x10flasher_lib/linjre32
fi
echo "JAVA_HOME not set. Using default value : ${JAVA_HOME}"
fi
if test -e ${JAVA_HOME}/bin/java
then
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib32
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib64:$LD_LIBRARY_PATH
#Begin changes by deagon 02/11/13
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib32/libusbx-1.0.so \;
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib64/libusbx-1.0.so \;
#End changes by deagon 02/11/13
ISJAVA6=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$($JAVA_HOME/bin/java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtlin/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtlin/swt.jar
fi
$JAVA_HOME/bin/java -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
else
echo "No Java in specified path in JAVA_HOME=${JAVA_HOME}"
echo "Set the variable to a valid Java installation"
fi
else
chmod 755 ./x10flasher_lib/adb.mac
chmod 755 ./x10flasher_lib/fastboot.mac
chmod 755 ./x10flasher_lib/unyaffs.mac
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib64:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib32:$DYLD_LIBRARY_PATH
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib64/libusbx-1.0.dylib
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib32/libusbx-1.0.dylib
ISJAVA6=$(java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$(java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$(java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtmac/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtmac/swt.jar
fi
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
java -XstartOnFirstThread -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
fi
let me know how you get on :good:
-- deagon
***EDIT*** I found a downside. The the new script/launcher is going to find and use either the old libusb or libusbx so it may create more problems than it solves for some users if they dont install libusbx before using flashtool.
Another problem will arise if the distro's libusbx package maintainers havent over written the old libusb libs to use libusbx as a drop in replacement like on arch and fedora 19 (i checked inside the fedora libusbx package before) because the changed script/launcher will likely link to libusb before libusbx if they are sitting next to each other.
Deagon said:
I decided to change flashtool's script/launcher so it looks for libusbx in a more robust (i hope) way. i've attached the changed file. If this works for you then we can submit the changes to the devs for their consideration.
#!/bin/sh
export BASEDIR=$(dirname $0)
export system64=$(uname -m)
export OS=$(uname -s)
cd $BASEDIR
if test "$OS" = "Linux"
then
chmod 755 ./x10flasher_lib/adb.linux
chmod 755 ./x10flasher_lib/fastboot.linux
chmod 755 ./x10flasher_lib/unyaffs.linux
chmod 755 ./x10flasher_lib/bin2elf
chmod 755 ./x10flasher_lib/bin2sin
if [ "$(whoami)" != "root" ]
then
export HASRULES="false"
if test -d /etc/udev/rules.d
then
if grep -rl "0fce" /etc/udev/rules.d >/dev/null
then
export HASRULES="true"
fi
fi
if test "$HASRULES" = "true"
then
echo "Not running as root but Sony/SonyEriccson Vendor ID found on your udev rules"
echo "if Flashing didn't work well, run flashtool as root"
else
echo "Not running as root and there is no Sony/SonyEriccson Vendor ID on your udev rules"
echo "The user must be granted access to adb/flashmode/fastboot"
echo "If you are unsure what to do, run flashtool as root"
exit 1
fi
else
echo "Running as root."
fi
if test -z "${JAVA_HOME}"
then
if test "${system64}" = "x86_64"
then
export JAVA_HOME=./x10flasher_lib/linjre64
else
export JAVA_HOME=./x10flasher_lib/linjre32
fi
echo "JAVA_HOME not set. Using default value : ${JAVA_HOME}"
fi
if test -e ${JAVA_HOME}/bin/java
then
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib32
export LD_LIBRARY_PATH=./x10flasher_lib/linux/lib64:$LD_LIBRARY_PATH
#Begin changes by deagon 02/11/13
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib32/libusbx-1.0.so
#ln -sf libusbx-1.0.so.0.1.0 ./x10flasher_lib/linux/lib64/libusbx-1.0.so
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib32/libusbx-1.0.so \;
find /*/lib -name 'libusb*.0.1.0' -exec ln -sf {\} ./x10flasher_lib/linux/lib64/libusbx-1.0.so \;
#End changes by deagon 02/11/13
ISJAVA6=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$($JAVA_HOME/bin/java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$($JAVA_HOME/bin/java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtlin/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtlin/swt.jar
fi
$JAVA_HOME/bin/java -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
else
echo "No Java in specified path in JAVA_HOME=${JAVA_HOME}"
echo "Set the variable to a valid Java installation"
fi
else
chmod 755 ./x10flasher_lib/adb.mac
chmod 755 ./x10flasher_lib/fastboot.mac
chmod 755 ./x10flasher_lib/unyaffs.mac
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib64:$DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=./x10flasher_lib/mac/lib32:$DYLD_LIBRARY_PATH
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib64/libusbx-1.0.dylib
ln -sf libusbx-1.0.0.dylib ./x10flasher_lib/mac/lib32/libusbx-1.0.dylib
ISJAVA6=$(java -version 2>&1|grep version|grep 1.6|wc -l)
ISJAVA7=$(java -version 2>&1|grep version|grep 1.7|wc -l)
ISJAVA64=$(java -version 2>&1|grep 64-Bit|wc -l)
if test $ISJAVA64 -gt 0
then
ln -sf swt64.jar ./x10flasher_lib/swtmac/swt.jar
else
ln -sf swt32.jar ./x10flasher_lib/swtmac/swt.jar
fi
if test $ISJAVA6 -gt 0 -o $ISJAVA7 -gt 0
then
java -XstartOnFirstThread -Xms128m -Xmx512m -Duser.country=US -Duser.language=en -jar x10flasher.jar
else
echo "Java version must be 1.6 or 1.7"
fi
fi
let me know how you get on :good:
-- deagon
***EDIT*** I found a downside. The the new script/launcher is going to find and use either the old libusb or libusbx so it may create more problems than it solves for some users if they dont install libusbx before using flashtool.
Another problem will arise if the distro's libusbx package maintainers havent over written the old libusb libs to use libusbx as a drop in replacement like on arch and fedora 19 (i checked inside the fedora libusbx package before) because the changed script/launcher will likely link to libusb before libusbx if they are sitting next to each other.
Click to expand...
Click to collapse
not working for me. same error.
Same error
QkiZMR said:
not working for me. same error.
Click to expand...
Click to collapse
Same error here, need help please!!
nefsation said:
Same error here, need help please!!
Click to expand...
Click to collapse
first go to this http://www.libusbx.org
and download latest source (tarball)
extract that .tar.gz and go to that dir
now run the following commands
Code:
./config
make
sudo make install
assuming your Flashtool folder is in home
run the following commands
Code:
cd
cp /usr/local/lib/libusb-1.0.so.0.1.0 FlashTool/x10flasher_lib/linux/lib64
cp /usr/local/lib/libusb-1.0.so.0.1.0 FlashTool/x10flasher_lib/linux/lib32
replace the FlashTool script in FlashTool folder by this one FlashTool
FlashTool developer decided to bundle full JRE (both 32 and 64 bit) plus all these binaries and libraries with a relatively simple Java application for some strange reason. Lame. I've spent more than an hour downloading the 113 MB 7z archive from some sh*tty file-share service, instead spending just 1/4 of that time, and do something useful for the rest!
An average Linux user should be able to install these deps by herself, all she needs is a decent README specifiying the deps...
At least with the Ubuntu 13.10 (Saucy), libusb, which is at version 1.0.1.16, should work, so one does not need no freakin libusbx... This is for Saucy x86_64;
Code:
# One also needs basic 32-bit support, for running stuff like bin2sin, check libc6:i386 or similar:
sudo apt-get install android-tools-adb android-tools-fastboot libusb-1.0-0 default-jre
sudo ln -s libusb-1.0.so.0.1.0 /lib/x86_64-linux-gnu/libusbx-1.0.so
# Remove 260MB of rubbish:
cd <wherever you unpacked FlashTool>
rm -rf x10flasher_lib/{adb,fastboot}.linux x10flasher_lib/lin*
ln -s /usr/bin/adb x10flasher_lib/adb.linux
ln -s /usr/bin/fastboot x10flasher_lib/fastboot.linux
ln -s swt64.jar x10flasher_lib/swtlin/swt.jar
# Now, start the application
java -Xms128m -Xmx512m -Duser.language=en -jar x10flasher.jar
Zgembo said:
Code:
ln -s swt64.jar x10flasher_lib/swtlin/swt.jar
Click to expand...
Click to collapse
when i execute above command..it gives this error..
Code:
ln: failed to create symbolic link ‘x10flasher_lib/swtlin/swt.jar’: File exists
Edit: aha..finally flashtool successfully started with this method..i just replaced -s with -sf which forcefully does the operation
pivotce.com informs that instructions have been published on gaining root access to a webOS TV. This is much harder than on the old phones and tablets. When this was done on legacy webOS, there was a wave of enhancements and tweaks made available to phone users from webOS Internals and other developers.
The instructions can be found on the Russian webOS forums here: webos-forums.ru/topic4650.html (English Translation via Google).
As the thread itself notes, this creates the possibility of fiddling with your TV in a way that may turn it into a large, thin brick and will almost certainly invalidate your warranty. The general user should stay well clear of this.
pivotCE published this for information only and recommend leaving investigations to those who know what they are doing or who can afford to wreck expensive television sets. We will watch to see if anything interesting emerges from this development.
+
Detailed analysis of the root access method described above:
forums.webosnation.com/lg-webos-tv/331754-pivotce-seems-webos-tv-has-been-rooted.html#post3450911
Hello!
I'm from webos-forums.ru. I've root on TV for a while and can help you with translation or testing on LG webOS 1.4.
rooting
I could use your help rooting my lg 65uf6450-ua if you would. Thank you
Root webOS
Hodizzal said:
I could use your help rooting my lg 65uf6450-ua if you would. Thank you
Click to expand...
Click to collapse
1. You need to install Developer Mode App and export private ssh-key with CLI (webostv.developer.lge.com/develop/app-test)
2. Convert private ssh-key with puttygen [import key <your private ssh-key>, then save private key]
3. Download exploit (zalil.su/6937580), then connect with TV User: prisoner, [<ip-tv>:9922] + private-key with WinSCP (or other SCP-client), upload to /media/developer on TV and rename it to root.
on linux
Code:
ssh -i <your private ssh-key> [email protected]<ip-tv> -p 9922 "/bin/sh -i"
4.
Code:
chmod +x root
Code:
./root
5. After try install any app from market go to LG App Store and try to install any app.
6. if third stage ok. the insert password 1111 as said.
7.
Code:
busybox chroot /proc/1/root
Code:
[email protected]tTV:/# id
Code:
uid=0(root) gid=0(root)........
I personally use Linux Subsystem on Windows 10 for all of this.
To install .ipk app:
Code:
ApplicationInstallerUtility -c install -p /tmp/<any-name>.ipk -u 0 -l /media/developer -d
Info about your linux kernel and TV firmware:
Code:
luna-send -n 1 -f luna://com.palm.systemservice/osInfo/query '{ "subscribe": false }'
Launch app:
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "netflix"}'
All apps ID you can find with
Code:
luna-send -n 1 "palm://com.palm.applicationManager/listLaunchPoints" "{}"
or at a folder /media/cryptofs/apps/usr/palm/applications/<App ID>/appinfo.json
For permanent root access through telnet:
1)
Code:
[email protected]:/# mkdir -p /media/cryptofs/root/etc
2)
Code:
[email protected]:/# cp -r /etc/* /media/cryptofs/root/etc
3)
Code:
[email protected]:/# mount -o bind /media/cryptofs/root/etc /etc
4)
Code:
[email protected]:/# passwd root
Enter any new root password
5)
Code:
cp /media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh /tmp/start-devmode.sh
6) Download with WinSCP start-devmode.sh and edit it locally.
You need to add at the beginning
Code:
mount -o bind /media/cryptofs/root/etc /etc
telnetd -l /sbin/sulogin &
Plus you can add the line to launch any App at start, e.g:
Code:
luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "netflix", "params":{}}'
And comment Dev Mode online check.
Here it's mine start-devmode.sh. It's for webOS 1.4. It can be different for other webOS versions:
Code:
#!/bin/sh
mount -o bind /media/cryptofs/root/etc /etc
telnetd -l /sbin/sulogin &
#luna-send -n 1 -f luna://com.webos.applicationManager/launch '{"id": "netflix", "params":{}}'
# FIXME: disable this to turn off script echo
set -x
# FIXME: disable this to stop script from bailing on error
# set -e
# TODO: Check upstart daemon/process tracking (do we need to change /etc/init/devmode.conf? start sshd as daemon?)
# set devmode ssh port here
SSH_PORT="9922"
# set arch:
ARCH="armv71"
grep -qs "qemux86" /etc/hostname && ARCH="i686"
# set directories
OPT_DEVMODE="/opt/devmode"
OPT_SSH="/opt/openssh"
DEVELOPER_HOME="/media/developer"
DEVMODE_SERVICE_DIR="/media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service"
CRYPTO_SSH="$DEVMODE_SERVICE_DIR/binaries-${ARCH}/opt/openssh"
CRYPTO_OPT="$DEVMODE_SERVICE_DIR/binaries-${ARCH}/opt"
if [ -s ${DEVMODE_SERVICE_DIR}/jail_app.conf ] ; then
mv ${DEVMODE_SERVICE_DIR}/jail_app.conf ${DEVELOPER_HOME}
mv ${DEVMODE_SERVICE_DIR}/jail_app.conf.sig ${DEVELOPER_HOME}
fi
if [ -r ${DEVMODE_SERVICE_DIR}/sessionToken ] ; then
mv -f ${DEVMODE_SERVICE_DIR}/sessionToken /var/luna/preferences/devmode_enabled
fi
# Make sure the ssh binaries are executable (in service directory)
if [ ! -x "${CRYPTO_SSH}/sbin/sshd" ] ; then
chmod ugo+x ${CRYPTO_SSH}/sbin/sshd ${CRYPTO_SSH}/bin/ssh* ${CRYPTO_SSH}/bin/scp* || true
chmod ugo+x ${CRYPTO_SSH}/bin/sftp ${CRYPTO_SSH}/lib/openssh/* || true
chmod ugo+x ${CRYPTO_OPT}/devmode/usr/bin/* || true
fi
# TODO: (later) Look for "re-init" flag to re-generate ssh key if requested by app (via devkey service)
# com.palm.service.devmode could have "resetKey" method to erase /var/lib/devmode/ssh/webos_rsa
# Kind of dangerous though, since new key will need to be fetched on the desktop (after reboot)...
# We could just require a hard-reset of the TV which should blow away /var/lib/devmode/ssh/...
# Initialize the developer (client) SSH key pair, if it doesn't already exist
if [ ! -e /var/lib/devmode/ssh/webos_rsa ] ; then
mkdir -p /var/lib/devmode/ssh
chmod 0700 /var/lib/devmode/ssh
# get FIRST six (UPPER-CASE, hex) characters of 40-char nduid from nyx-cmd
# NOTE: This MUST match passphrase as displayed in devmode app (main.js)!
# PASSPHRASE="`/usr/bin/nyx-cmd DeviceInfo query nduid | head -c 6 | tr 'a-z' 'A-Z'`"
# PASSPHRASE="`/usr/bin/nyx-cmd DeviceInfo query nduid | tail -n1 | head -c 6 | tr 'a-z' 'A-Z'`"
PASSPHRASE="`tail /var/lib/secretagent/nduid -c 40 | head -c 6 | tr 'a-z' 'A-Z'`"
${CRYPTO_SSH}/bin/ssh-keygen -t rsa -C "[email protected]" -N "${PASSPHRASE}" -f /var/lib/devmode/ssh/webos_rsa
# copy ssh key to /var/luna/preferences so the devmode service's KeyServer can read it and serve to ares-webos-cli tools
cp -f /var/lib/devmode/ssh/webos_rsa /var/luna/preferences/webos_rsa
chmod 0644 /var/luna/preferences/webos_rsa
# if we generated a new ssh key, make sure we re-create the authorized_keys file
rm -f ${DEVELOPER_HOME}/.ssh/authorized_keys
fi
# Make sure the /media/developer (and log) directories exists (as sam.conf erases it when devmode is off):
mkdir -p ${DEVELOPER_HOME}/log
chmod 777 ${DEVELOPER_HOME} ${DEVELOPER_HOME}/log
# Install the SSH key into the authorized_keys file (if it doesn't already exist)
if [ ! -e ${DEVELOPER_HOME}/.ssh/authorized_keys ] ; then
mkdir -p ${DEVELOPER_HOME}/.ssh
cp -f /var/lib/devmode/ssh/webos_rsa.pub ${DEVELOPER_HOME}/.ssh/authorized_keys || true
# NOTE: authorized_keys MUST be world-readable else sshd can't read it inside the devmode jail
# To keep sshd from complaining about that, we launch sshd with -o "StrictModes no" (below).
chmod 755 ${DEVELOPER_HOME}/.ssh
chmod 644 ${DEVELOPER_HOME}/.ssh/authorized_keys
chown -R developer:developer ${DEVELOPER_HOME}/.ssh
fi
# FIXME: Can we move this to /var/run/devmode/sshd ?
# Create PrivSep dir
mkdir -p /var/run/sshd
chmod 0755 /var/run/sshd
# Create directory for host keys (rather than /opt/openssh/etc/ssh/)
HOST_KEY_DIR="/var/lib/devmode/sshd"
if [ ! -d "${HOST_KEY_DIR}" ] ; then
mkdir -p ${HOST_KEY_DIR}
chmod 0700 ${HOST_KEY_DIR}
fi
# Create initial keys if necessary
if [ ! -f ${HOST_KEY_DIR}/ssh_host_rsa_key ]; then
echo " generating ssh RSA key..."
${CRYPTO_SSH}/bin/ssh-keygen -q -f ${HOST_KEY_DIR}/ssh_host_rsa_key -N '' -t rsa
fi
if [ ! -f ${HOST_KEY_DIR}/ssh_host_ecdsa_key ]; then
echo " generating ssh ECDSA key..."
${CRYPTO_SSH}/bin/ssh-keygen -q -f ${HOST_KEY_DIR}/ssh_host_ecdsa_key -N '' -t ecdsa
fi
if [ ! -f ${HOST_KEY_DIR}/ssh_host_dsa_key ]; then
echo " generating ssh DSA key..."
${CRYPTO_SSH}/bin/ssh-keygen -q -f ${HOST_KEY_DIR}/ssh_host_dsa_key -N '' -t dsa
fi
# Check config
# NOTE: This should only be enabled for testing
#${CRYPTO_SSH}/sbin/sshd -f ${CRYPTO_SSH}/etc/ssh/sshd_config -h ${HOST_KEY_DIR}/ssh_host_rsa_key -t
# Set jailer command
DEVMODE_JAIL="/usr/bin/jailer -t native_devmode -i com.palm.devmode.openssh -p ${DEVELOPER_HOME}/ -s /bin/sh"
#DEVMODE_JAIL="echo"
# Add for debugging, but this will cause sshd to exit after the first ssh login:
# -ddd -e
# Make environment file for openssh
DEVMODE_JAIL_CONF="/etc/jail_native_devmode.conf"
DEVMODE_OPENSSH_ENV="${DEVELOPER_HOME}/.ssh/environment"
if [ -f ${DEVMODE_JAIL_CONF} ]; then
echo " generating environment file from jail_native_devmode.conf..."
find ${DEVMODE_JAIL_CONF} | xargs awk '/setenv/{printf "%s=%sn", $2,$3}' > ${DEVMODE_OPENSSH_ENV}
${DEVMODE_JAIL} /usr/bin/env >> ${DEVMODE_OPENSSH_ENV}
fi
# Set path for devmode
if [ -f ${DEVMODE_OPENSSH_ENV} ]; then
echo "PATH=${PATH}:${OPT_DEVMODE}/usr/bin" >> ${DEVMODE_OPENSSH_ENV}
fi
sleep 5;
for interface in $(ls /sys/class/net/ | grep -v -e lo -e sit);
do
if [ -r /sys/class/net/$interface/carrier ] ; then
if [[ $(cat /sys/class/net/$interface/carrier) == 1 ]]; then OnLine=1; fi
fi
done
#if [ $OnLine ]; then
# sessionToken=$(cat /var/luna/preferences/devmode_enabled);
# checkSession=$(curl --max-time 3 -s https://developer.lge.com/secure/CheckDevModeSession.dev?sessionToken=$sessionToken);
# if [ "$checkSession" != "" ] ; then
# result=$(node -pe 'JSON.parse(process.argv[1]).result' "$checkSession");
# if [ "$result" == "success" ] ; then
rm -rf /var/luna/preferences/dc*;
# # create devSessionTime file to remain session time in devmode app
# remainTime=$(node -pe 'JSON.parse(process.argv[1]).errorMsg' "$checkSession");
# resultValidTimeCheck=$(echo "${remainTime}" | egrep "^([0-9]{1,4}(:[0-5][0-9]){2})$");
# if [ "$resultValidTimeCheck" != "" ] ; then
echo '900:00:00' > ${DEVMODE_SERVICE_DIR}/devSessionTime;
chgrp 5000 ${DEVMODE_SERVICE_DIR}/devSessionTime;
chmod 664 ${DEVMODE_SERVICE_DIR}/devSessionTime;
# fi
# elif [ "$result" == "fail" ] ; then
# rm -rf /var/luna/preferences/devmode_enabled;
# rm -rf /var/luna/preferences/dc*;
# if [ -e ${DEVMODE_SERVICE_DIR}/devSessionTime ] ; then
# rm ${DEVMODE_SERVICE_DIR}/devSessionTime;
# fi
# fi
# fi
#fi
# Cache clear function added (except Local storage)
if [ -e ${DEVMODE_SERVICE_DIR}/devCacheClear ] ; then
rm -rf `ls | find /var/lib/webappmanager*/* -name "Local Storage" -o -name "localstorage" -prune -o -print`;
rm ${DEVMODE_SERVICE_DIR}/devCacheClear;
fi
# Launch sshd
${DEVMODE_JAIL} ${OPT_SSH}/sbin/sshd
-o StrictModes=no
-f ${OPT_SSH}/etc/ssh/sshd_config
-h ${HOST_KEY_DIR}/ssh_host_rsa_key
-o PasswordAuthentication=no -o PermitRootLogin=no -o PermitUserEnvironment=yes
-D -p ${SSH_PORT}
7) Upload new start-devmode.sh and rewrite the old one
Code:
cp /tmp/start-devmode.sh /media/cryptofs/apps/usr/palm/services/com.palmdts.devmode.service/start-devmode.sh
8) Restart TV.
Connect with telnet and type previously entered password.
Code:
telnet <ip-tv>
Trying <ip-tv>...
Connected to <ip-tv>].
Escape character is '^]'.
webOS TV 1.4.0 LGSmartTV
Give root password for system maintenance
(or type Control-D for normal startup):
Entering System Maintenance Mode
[email protected]:/#
Does it work on WebOS 3.5 devices?
medi01 said:
Does it work on WebOS 3.5 devices?
Click to expand...
Click to collapse
Positive.
is it possible to install webOS 3.0 on an 65EF9500 that currently has WebOS 2.0 via the USB upgrade method?
enkrypt3d said:
is it possible to install webOS 3.0 on an 65EF9500 that currently has WebOS 2.0 via the USB upgrade method?
Click to expand...
Click to collapse
No
Is there any method to get 3.0 installed over 1.4 I have a 49ub8500-ua
syconu said:
Is there any method to get 3.0 installed over 1.4 I have a 49ub8500-ua
Click to expand...
Click to collapse
No
Is there anything hack related that I can do with this to and can is support a new air mouse with a dongle
Ok, so I get run the root app and first ,second , and third stage all are good. then it says try get root password is 1111. But the terminal keeps freezing after that happens. A couple times my tv rebooted too. I cant figure out what i could have messed up. ANyone with any experience using this method have any legit information?
steven817817 said:
Ok, so I get run the root app and first ,second , and third stage all are good. then it says try get root password is 1111. But the terminal keeps freezing after that happens. A couple times my tv rebooted too. I cant figure out what i could have messed up. ANyone with any experience using this method have any legit information?
Click to expand...
Click to collapse
Try to delete all 'cache' files from exploit at /media/developer. It doesn't wotk twice as far as I concerned
Is there anyway I can root my 1.4.0 and if so what r the benefits of the root? Can I install Android or kodi? What's the point
teffd said:
Try to delete all 'cache' files from exploit at /media/developer. It doesn't wotk twice as far as I concerned
Click to expand...
Click to collapse
I tried it stil seems to finish step 3 then says enter 1111. But this is where it freezes up and does not get any further.
Is this still working on 3.6? I'm stuck at try to install any app from market.
Mazda77 said:
Positive.
Click to expand...
Click to collapse
Which TV and firmware version?
Is this possible with UJ63 serie?
Hi, would the root access allow somehow to connect other bluetooth devices different than LG? Thanks!
You can do pretty much anything to the system with root, even include support for unsupported devices in form of additional kernel modules.
For example, I've added Samba support so I can mount use my NAS (see my blog at ddscentral dot org for details).
Hey guys is it possible to install android apps into WebOS? I just bought an Lg oled LG 55EG9A7V i want to use Perfect Player IPTV but i cant install it right now...Other then that i dont need anything else..
Can anyone help me?