[Android Software/Hacking General [Developers Only]] astronfestmon:
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.

#!/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