edit the grub.cfg allows to mount partitions for Remix OS - Remix OS for PC

I need the Remix OS to mount other partitions in my computer,such as Disk D(sda5)、Disk E(sda6)and Disk G(sda7),https://www.reddit.com/r/RemixOS/comments/430hpx/question_does_remix_support_ntfs_partitions/
from this thread i know how to edit grub.cfg to mount the Disk D as SDCARD,the grub.cfg like this:
---------------------------------------------------------------------------------------------------------------------------------------------
Code:
menuentry 'Remix OS ' --class android-x86 {
search --file --no-floppy --set=root /kernel
linux /kernel root=/dev/ram0 androidboot.hardware=remix_cn_x86_64 androidboot.selinux=permissive quiet DATA=/data SDCARD=sda5 CREATE_DATA_IMG=1
initrd /initrd.img
}
---------------------------------------------------------------------------------------------------------------------------------------------
now,i want to mount both Disk D E and Disk F on the Remix OS,how to edit the grub.cfg?
please tell me ,thanks in advance!

To mount any partition or file img you must do it in "initrd.img/init" script
I'm not sure if its like this "mount -o loop /dev/sda5 sdcard1"
just google it

imadlatch said:
To mount any partition or file img you must do it in "initrd.img/init" script
I'm not sure if its like this "mount -o loop /dev/sda5 sdcard1"
just google it
Click to expand...
Click to collapse
That's only the case for partitions that need to be mounted before the system is loaded.
Stickmount by chainfire should be what you need.
Alternatively you could run a script like:
Code:
for a in `ls /dev/block/ | grep sda`; do sdcardp=/dev/block/"$a";num=`expr "${num:-0}" + 1`; sdcardf=/mnt/media_rw/sda"$num" ; [ -e $sdcardp ] && mount -o rw,remount / && mkdir -p $sdcardf && fst=`blkid $sdcardp | awk '{print ($NF)}' | cut -d\" -f2` && mount -t $fst $sdcardp $sdcardf && mount -o ro,remount /; done
Would do something similar; with some caveats.

HypoTurtle said:
That's only the case for partitions that need to be mounted before the system is loaded.
Alternatively you could run a script like:
Code:
for a in `ls /dev/block/ | grep sda`; do sdcardp=/dev/block/"$a";num=`expr "${num:-0}" + 1`; sdcardf=/mnt/media_rw/sda"$num" ; [ -e $sdcardp ] && mount -o rw,remount / && mkdir -p $sdcardf && fst=`blkid $sdcardp | awk '{print ($NF)}' | cut -d\" -f2` && mount -t $fst $sdcardp $sdcardf && mount -o ro,remount /; done
Would do something similar; with some caveats.
Click to expand...
Click to collapse
put the code in terminal and run or put them in grun.cfg? i don't how to use the script.

welcometoken said:
put the code in terminal and run or put them in grun.cfg? i don't how to use the script.
Click to expand...
Click to collapse
Put it in terminal; or use a script manager app so it's easy to run every boot.

Related

HD2 SD/MALDR System.ext2 Auto Builder V1.0

1. purpose just speeding up the system.ext2 file making.I'm lazy....
2. use it in Ubuntu O.S. with root account
3. decompress this auto builder and put it in folder /root or else place
4. put the CWM ROM's zip file in the folder "cwm_rom" and put the kernel modules *.ko files in the folder " kernel"
5.open terminal, cd the folder of this scripts, and execute it.
bash systemext2builder.sh then it will auto build the system.ext2 for SD ROM.
here is a demo how to use http://www.mediafire.com/?3lj5iuiv6ddcppi or http://dl.dbank.com/c0xn7ck608
Code:
#!/bin/bash
####################################################
# HD2 Android SD/MAGLDR ROM system.ext2 Auto builder.
# version 1.0
# By 3dak on 2011-04-29
##################################################
# to get current script's path
script_dir=`dirname $(readlink -f $0)`
extract_dir=$script_dir/extract
mount_dir=/mnt/system
#check the $mount_dir folder and ensure it is unmount and it's a fresh empty folder
if [ -d "$mount_dir" ] ; then
umount $mount_dir
rm -rf $mount_dir
mkdir $mount_dir
else
mkdir $mount_dir
fi
#to ensure there is no old extract folder or system.ext2
if [ -d "$extract_dir" ] ; then
rm -rf $extract_dir
fi
if [ -f $script_dir/system.ext2 ]; then
rm -f $script_dir/system.ext2
fi
#to get the main file name of the latest MIUI CWM ROM (*.zip) and decompress it!
# Please put the latest MIUI CWM ROM in the folder $script_dir/cwm_rom
build=`ls $script_dir/cwm_rom/*.zip | tail -1`
unzip $build -d $extract_dir/
#now change the cwm_rom kernel to SD version's kernel
#Please put all kernel modules *.ko files in the folder $script_dir/kernel
rm $extract_dir/system/lib/modules/*.ko
cp $script_dir/kernel/*.ko $extract_dir/system/lib/modules/
# Now create a fresh empty 250MB system.ext2 image file and format it.
dd if=/dev/zero of=$script_dir/system.ext2 bs=1048576 count=250
mke2fs -F $script_dir/system.ext2
#Now mount this fresh system.ext2
mount -o loop $script_dir/system.ext2 $mount_dir
#Now copy the CWM ROM's system folder to the $mount_dir (/mnt/system )
cp -ar $extract_dir/system/* $mount_dir/
############################################################
# Read CWM ROM's updater-script
# Createa Symlinks and set permissions of folders and files
#############################################################
updater_script=$extract_dir/META-INF/com/google/android/updater-script
# create symbolic links
SYMLINKS=`grep "symlink" $updater_script | cut -d'"' -f2`
for SYMLINK in $SYMLINKS; do
echo "Creating symolic links for $SYMLINK..."
if [ "$SYMLINK" = "busybox" -o "$SYMLINK" = "iwmulticall" ]; then
LINK_DIR='/system/xbin/'
elif [ "$SYMLINK" = "toolbox" ]; then
LINK_DIR='/system/bin/'
fi
MATCHES=`awk '/symlink\(\"'"$SYMLINK"'/,/\);/ {print}' $updater_script | \
sed "s/symlink(\"$SYMLINK\",//g" | \
sed 's/);//g' | \
sed 's/"//g' | \
sed 'N;s/\n//g' | \
sed 's/ //g' | \
sed 's/,/ /g' | \
sed "[email protected][email protected]@g"`
cd /mnt/$LINK_DIR
for LINK in $MATCHES; do
echo -n "Linking $SYMLINK to $LINK... "
ln -sf $SYMLINK $LINK && echo "done"
done
done
# set permissions
grep "set_perm_recursive" $updater_script | grep -v "tmp" | grep -v "recovery" | \
while read LINE; do
PERM=`echo $LINE | sed 's/set_perm_recursive(//g' | sed 's/);//g' | sed 's/"//g' | sed 's/ //g'`
USER=`echo $PERM | cut -d',' -f1`;
GROUP=`echo $PERM | cut -d',' -f2`;
DIR_PERM=`echo $PERM | cut -d',' -f3`;
FILE_PERM=`echo $PERM | cut -d',' -f4`;
TARGET=`echo $PERM | cut -d',' -f5`;
echo -n "Setting permissions for $TARGET... "
chown -R $USER:$GROUP /mnt$TARGET
chmod -R $DIR_PERM /mnt$TARGET
find /mnt$TARGET -type f -exec chmod $FILE_PERM {} \; && echo "done"
done
grep "set_perm" $updater_script | grep -v "recursive" | grep -v "tmp" | grep -v "recovery" | \
while read LINE; do
PERM=`echo $LINE | sed 's/set_perm(//g' | sed 's/);//g' | sed 's/"//g' | sed 's/ //g'`
USER=`echo $PERM | cut -d',' -f1`;
GROUP=`echo $PERM | cut -d',' -f2`;
FILE_PERM=`echo $PERM | cut -d',' -f3`;
TARGET=`echo $PERM | cut -d',' -f4`;
echo -n "Setting permissions for $TARGET... "
chown $USER:$GROUP /mnt$TARGET
chmod $FILE_PERM /mnt$TARGET && echo "done"
done
#now unmount system.ext2
umount $mount_dir
#cleanup
rm -rf $extract_dir
echo " All Done!"
# EOF by 3dak :) 2011-04-29
if you wanna a system.img file too for DAF ROM, add the follwoing line before this line #now unmount system.ext2
Code:
mkyaffs2image $mount_dir $script_dir/system.img
tools.zip is some tools for rom making. put them in the foloer
/usr/local/bin
Wonderful !
Would love to see such an application for Windows OS ....
that's very cool! now we can make new sd builds by ourselves
thanks 3dak!
3dak said:
1. purpose just speeding up the system.ext2 file making.I'm lazy....
Click to expand...
Click to collapse
Man this way you take away all the fun!!
Joking... I'm lazy, too!
great tool, work great to build miui 1.4.29
Thanks 3dak
It's so bad that I don't use Ubuntu OS!
I am looking for some tool like this for a long time but running in Windows OS!
kimquypticc said:
It's so bad that I don't use Ubuntu OS!
I am looking for some tool like this for a long time but running in Windows OS!
Click to expand...
Click to collapse
Use ubuntu.
Just make a live cd or live flash drive. It's worth it
Sent from my HD2 using XDA app
kimquypticc said:
It's so bad that I don't use Ubuntu OS!
I am looking for some tool like this for a long time but running in Windows OS!
Click to expand...
Click to collapse
Or use it in a VirtualBox.
It's rather easy
peter
this is just Awesome!
Awesome, I will test this soon!
Problem for build mimu 1.5.20
It's a good application.
I put the miui_HD2_1.5.20_3nhrpwvbo7_2.3.zip into the cwm_rom folder, and copy all *.ko files that extracted from the system.ext2's \lib\modules folder in the miui_HD2_1.5.20_3dak_SD_2.3.4_ACA_r518.7z into the kernel folder, then a system.ext2 file was built with no errors.
I replaced the origin system.ext2 from the miui_HD2_1.5.20_3dak_SD_2.3.4_ACA_r518 by this file, run it from my HD2 SD card, all was fine expect the GPRS. The origin system.ext2 hasn't this bug.
What's the different?
Ty 3dak for this. Are there no way to do this in Windows?
giveup said:
It's a good application.
I put the miui_HD2_1.5.20_3nhrpwvbo7_2.3.zip into the cwm_rom folder, and copy all *.ko files that extracted from the system.ext2's \lib\modules folder in the miui_HD2_1.5.20_3dak_SD_2.3.4_ACA_r518.7z into the kernel folder, then a system.ext2 file was built with no errors.
I replaced the origin system.ext2 from the miui_HD2_1.5.20_3dak_SD_2.3.4_ACA_r518 by this file, run it from my HD2 SD card, all was fine expect the GPRS. The origin system.ext2 hasn't this bug.
What's the different?
Click to expand...
Click to collapse
the different is my system.ext2 opened PPP mode while official MIUI ROM didn't.
giveup said:
It's a good application.
copy all *.ko files that extracted from the system.ext2's \lib\modules folder in the ?
Click to expand...
Click to collapse
in Ubuntu, how do you extract files from system.ext2?
Any comprehensive step by step?
ketzazu said:
in Ubuntu, how do you extract files from system.ext2?
Any comprehensive step by step?
Click to expand...
Click to collapse
Just mount it :
mkdir /mnt/mysystemext2
mount -t ext2 -o loop system.ext2 /mnt/mysystemext2
then go to /mnt/mysystemext2 folder to copy or modify
Sent from my HTC HD2 using xda premium
3dak said:
Just mount it :
mkdir /mnt/mysystemext2
mount -t ext2 -o loop system.ext2 /mnt/mysystemext2
then go to /mnt/mysystemext2 folder to copy or modify
Sent from my HTC HD2 using xda premium
Click to expand...
Click to collapse
Thanks! I'll try those commands instead.
3dak said:
Just mount it :
mkdir /mnt/mysystemext2
then go to /mnt/mysystemext2 folder to copy or modify
Sent from my HTC HD2 using xda premium
Click to expand...
Click to collapse
No matter what I do the system.ext2 is always missing in action, nowhere to be found even after I "sudo chmod 777" the folders. I always get the error "system.ext2: No such file or directory"
I have ubuntu installed in a different drive than windows 7
This is what I did: BTW, I always have to sudo since I don't login as root
I put this zipped NAND "Runnymede_0.82.401.1_v1.3_Tmous" to the folder as you instructed,
I extract all the ".ko" files from this ziped ROM and put them in the "kernel" folder as instructed.
I go to terminal and i sudo the bash command. It spits out the system.ext2 file with a lot of other files.
I copy the system.ext2 file to the Desktop.
then mkdir /mnt/mystemext2
then mount -t ext2 -o loop system.ext2 /mnt/mysystemext2
I sudo chmod 777 the folders to be able access them. I even drag the system.ext2 from the Desktop to the /nmt and mnt/systemext2.
Still, all is empty.
What am i doing wrong?
When I try to copy directly system.ext2 to /mnt or /mnt/system.ext2 I get "not enough space error" but I don't see anything in the "lost+found" folder or anywhere else.
And also what program to use in Ubuntu to be able to open and see and edit the contents of system.ext2 in the folder?
PS. What are the instructions to use tools.zip for ROM making?
Thanks!
ketzazu said:
No matter what I do the system.ext2 is always missing in action, nowhere to be found even after I "sudo chmod 777" the folders. I always get the error "system.ext2: No such file or directory"
I have ubuntu installed in a different drive than windows 7
This is what I did: BTW, I always have to sudo since I don't login as root
I put this zipped NAND "Runnymede_0.82.401.1_v1.3_Tmous" to the folder as you instructed,
I extract all the ".ko" files from this ziped ROM and put them in the "kernel" folder as instructed.
I go to terminal and i sudo the bash command. It spits out the system.ext2 file with a lot of other files.
I copy the system.ext2 file to the Desktop.
then mkdir /mnt/mystemext2
then mount -t ext2 -o loop system.ext2 /mnt/mysystemext2
I sudo chmod 777 the folders to be able access them. I even drag the system.ext2 from the Desktop to the /nmt and mnt/systemext2.
Still, all is empty.
What am i doing wrong?
When I try to copy directly system.ext2 to /mnt or /mnt/system.ext2 I get "not enough space error" but I don't see anything in the "lost+found" folder or anywhere else.
And also what program to use in Ubuntu to be able to open and see and edit the contents of system.ext2 in the folder?
PS. What are the instructions to use tools.zip for ROM making?
Thanks!
Click to expand...
Click to collapse
put system.ext2 in your home folder,
then open terminal,
cd ~ (this will goto your home folder)
ls (check if you can see system.ext2, if no, you put it at wrong place)
mkdir /mnt/mysystemext2
mount -t ext2 -o loop system.ext2 /mnt/mysystemext2
-----------------
or if you want to keep the created system.ext2 is mounted, just open the 3daksystemext2builder.sh,
#now unmount system.ext2
umount $mount_dir
change to
#now unmount system.ext2
#umount $mount_dir
this will keep the system.ext2 is at MOUNT status after the system.ext2 created. check folder /mnt/system and modify or copy
remember to umount it after you finish your work,
umount /mnt/system
3dak said:
put system.ext2 in your home folder,
then open terminal,
cd ~ (this will goto your home folder)
ls (check if you can see system.ext2, if no, you put it at wrong place)
mkdir /mnt/mysystemext2
mount -t ext2 -o loop system.ext2 /mnt/mysystemext2
-----------------
or if you want to keep the created system.ext2 is mounted, just open the 3daksystemext2builder.sh,
#now unmount system.ext2
umount $mount_dir
change to
#now unmount system.ext2
#umount $mount_dir
this will keep the system.ext2 is at MOUNT status after the system.ext2 created. check folder /mnt/system and modify or copy
remember to umount it after you finish your work,
umount /mnt/system
Click to expand...
Click to collapse
thanks again! I'll give it a try. But first, I have to figure out how to get damsel Ubuntu out of that sudden "Read only" blues madness.
Thank you finally found learning to learn!!!

[Q] debian, webtopMOD and post #865

Re: [MOD] Full Linux (Debian) inside WebTop! v0.2.7
I managed to unlock, root and install WebTopMOD on my new2me searet Atrix 4g. Great feeling for an android n00b! I can run iceweasel, gimp and whatever I like just like any linux distro on the webtop as long as I start a new shell to launch linux apps. I had wanted to continue on to using the instructions in post #865 by jissee44 to get the xfce4 window manager running. No luck! I can launch (I think) xfce4 manually and the entire view changes - new wallpaper, new toolbar, but no access to the linux filesystem - everything connects to the android filesystem.
Here is what I think is needed to see what went wrong. There are only two files to edit when following post #865. I am including the entire file as the posting I was following does not include diffs.
/osh/usr/sbin/linux
Code:
#!/bin/bash
CHROOTDIR="/osh/opt/WebTopMOD/root"
LOOPDEVICE="/dev/block/loop50"
function enablex {
xhost +
}
function mountlinuxdisk {
loopdevice
sudo mount -t ext3 -o loop=$LOOPDEVICE $FILENAME $CHROOTDIR
touch /tmp/linuxdiskactive
}
function umountlinuxdisk {
sudo umount $CHROOTDIR
sudo umount $LOOPDEVICE
rm /tmp/linuxdiskactive
}
function startfulllinuxchroot {
mountlinuxdisk
sudo mount -o bind /proc $CHROOTDIR/proc
sudo mount -o bind /dev $CHROOTDIR/dev
sudo mount -o bind /dev/pts $CHROOTDIR/dev/pts
sudo mount -o bind /dev/shm $CHROOTDIR/dev/shm
#sudo mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb
sudo mount -o bind /sys $CHROOTDIR/sys
sudo mount -o bind /tmp $CHROOTDIR/tmp
sudo mount -o bind /var/tmp $CHROOTDIR/var/tmp
sudo mount -o bind /var/run/dbus/ $CHROOTDIR/var/run/dbus
sudo mount -t vfat /dev/block/vold/179:18 $CHROOTDIR/sdcard
sudo mount -t vfat /dev/block/vold/179:33 $CHROOTDIR/sdcard-ext
sudo mount -o bind /etc $CHROOTDIR/mnt/DEVICE/etc
sudo mount -o bind /usr $CHROOTDIR/mnt/DEVICE/usr
touch /tmp/fulllinuxchrootactive
}
function startxterm {
# sudo chroot $CHROOTDIR /usr/bin/xterm pdmenu
sudo chroot $CHROOTDIR /usr/bin/xterm
}
function startxfce {
kill $(ps -ef | grep 5000 | grep webtop-wallpaper | cut -c10-15)
kill $(ps -ef | grep 5000 | grep xscreensaver | cut -c10-15
sudo chroot $CHROOTDIR /usr/bin/xfce4-session
}
function stopfullchroot {
CHECKS=0
until [ "$CHECKS" -eq "15" ]
do
TOUMOUNT=`sudo mount | grep "$CHROOTDIR" | awk '{ print $3 }'`
if [ "$TOUMOUNT" = "" ]; then break; fi
for i in $TOUMOUNT
do
sudo umount $i
done
CHECKS=$(( $CHECKS + 1 ))
done
rm /tmp/fulllinuxchrootactive
mountlinuxdisk
}
function checkwhereislinux {
if [ -e /sdcard/WebTopMOD/linuxdisk ]; then
FILENAME="/sdcard/WebTopMOD/linuxdisk"
if [ "$1" -eq 1 ]; then
/usr/bin/xmessage "Found image in /sdcard/WebTopMOD/linu
xdisk!"
checklinuxdisk
fi
else
if [ -e /sdcard-ext/WebTopMOD/linuxdisk ]; then
FILENAME="/sdcard-ext/WebTopMOD/linuxdisk"
if [ "$1" -eq 1 ]; then
/usr/bin/xmessage "Found image in /sdcard-ext/We
bTopMOD/linuxdisk!"
checklinuxdisk
fi
else
if [ "$1" -eq 1 ]; then
/usr/bin/xmessage "Sorry, no image available...
put linuxdisk in /sdcard/WebTopMOD/ OR /sdcard-ext/WebTopMOD/linuxdisk"
exit 1
fi
fi
fi
}
function checklinuxdisk {
if [ ! -s $FILENAME ]; then
/usr/bin/xmessage "But... Wait... Your disk looks damaged, maybe
you tried to copy an image larger then 4gB? This is a FAT32 limit."
exit 1
fi
if [ -d $FILENAME ]; then
/usr/bin/xmessage "Damn! linuxdisk is a file and it MUST be plac
ed in /sdcard/WebTopMOD/ OR /sdcard-ext/WebTopMOD/ folder. Otherwise this mod CA
N'T work' "
exit 1
fi
}
function loopdevice {
if [ -e $LOOPDEVICE ]; then
echo "Device exist"
else
sudo mknod -m600 $LOOPDEVICE b 7 50
fi
}
enablex
if [ -e /tmp/linuxdiskactive ]; then
if [ -e /tmp/fulllinuxchrootactive ]; then
startxterm
else
checkwhereislinux 0
startfulllinuxchroot
startxterm
fi
else
checkwhereislinux 1
mountlinuxdisk
startfulllinuxchroot
startxfce
# startxterm
fi
#RUNNINGXTERM=`ps -C xterm h | wc -l`
#if [ "$RUNNINGXTERM" -eq 0 ]
#then
# stopfullchroot
# umountlinuxdisk
#fi
exit 0
/osh/usr/local/bin/start-oshwt-2.sh
Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: start_lxde2.sh
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: started by adas user at login
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib
. /lib/lsb/init-functions
log_action_msg "Will now start OSHWT 2 scripts"
# start OSHWT 2 scripts
sfalv -i "lxpanel"
#sfalv -i "awn-autostart"
sfalv -i "webtop-panel"
sfalv -i "webtop-wallpaper"
sfalv -i "evbridge"
sfalv -i "window_switcher"
sr-test avahi_start &
Can someone give me some clues as to what has gone wrong? I'm not sure if something is missing or if I broke something in my edits, and there are no follow up questions on the post. There are 13 thanks.
ruarri
making progress?
Okay, I'm just hearing the crickets.
> startxfce4
provides some of the results I want, but leaves AWN in control. Now that the new ICS ROMs are coming out I'll have to see if I can just make webtopMOD usable until something better comes along. It would be good to see better documentation for n00bs. The forums are a little rambling. There is a lot of good info, its just scattered.
ruarri
ruarri said:
no access to the linux filesystem - everything connects to the android filesystem.
Click to expand...
Click to collapse
Hi,
What do you mean ?
The Debian is a Chroot
Good'nough
jisse44 said:
The Debian is a Chroot
Click to expand...
Click to collapse
Thanks for the terse explanation, jisse44. It took me a while to get around to reading the docs on chroot. It makes sense that webtop isrunning in a sandbox. That is inherently limiting.
I still love webtop and my lapdock. It will be interesting to see what happens with webtop and the ICS ROMs on the Atrix 4G.
ruarri said:
It will be interesting to see what happens with webtop and the ICS ROMs on the Atrix 4G.
Click to expand...
Click to collapse
Or not....
By now you can only run last new "webtop" on ICS Roms, and this is not THE webtop, it's a tablet mode: no Ubuntu or debian, only Android....

[Q] Repurpose Eris?

I have two of these devices sitting around and I was wondering how people were repurposing them. I just picked up a Raspberry Pi with the intention of setting up a home automation system. Isn't the Eris also an ARMv6 processor? Could they be used as smart WiIP video security cameras? Is there a Linux distro somewhere? Anyone have any experience?
Greetings! There's a thread here you might be interested in. http://forum.xda-developers.com/showthread.php?t=823564&highlight=linux
roirraW "edor" ehT said:
Greetings! There's a thread here you might be interested in. http://forum.xda-developers.com/showthread.php?t=823564&highlight=linux
Click to expand...
Click to collapse
http://www.4shared.com/zip/uiPl7NhN/ubuntu.html Link to Ubuntu.img
to mount you can use this:
linuxboot.sh
#option if you wish to load a different file than the rc_enter just replace the rc_enter.sh with the script file you want to run
# i.e init.sh below this script I will post the initl.ls if you wan to replace the rc_enter.sh
Code:
#!/system/bin/sh
(
# If $BINDS does not exist, then done of the others are set iether.
if [ -z "$BINDS" ]; then
export DIST="debian squeeze"
export FILESYSTEM=/sdcard/ubuntu.img
export MOUNTPOINT=/sdcard/linux
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
export LOGNAME=root
export UID=0
export SHELL=bash
export FS=ext3
export busybox="/data/data/com.galoula.LinuxInstall/bin/busybox"
export BINDS="1"
unset TMPDIR
fi
createLinuxBoot() {
if $busybox [ -d "$FILESYSTEM" ]
then
echo "I: Directory chroot !"
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT/proc")" ]; then
# If the loop device is already mounted, we do nothing.
echo "W: $DIST is already mounted. Entering chroot..."
else
echo "I: Mounting device for $DIST..."
# Bind some Android dirs to the linux filesystem
if $busybox [ $BINDS -eq 1 ]
then
# Create mtab
echo > "${MOUNTPOINT}/etc/mtab"
$busybox cat /proc/mounts > "${MOUNTPOINT}/etc/mtab"
# for i in `$busybox cat /proc/mounts | $busybox cut -d " " -f 2`
for i in $( $busybox cat /proc/mounts | $busybox awk '{print $2}' )
do
$busybox mkdir -p "${MOUNTPOINT}/$i" 2> /dev/null
$busybox mount -o bind "${i}" "${MOUNTPOINT}/${i}" 2> /dev/null
#echo "${i}" >> "${MOUNTPOINT}/etc/mtab"
done
fi
fi
else
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT ")" ]; then
# If the loop device is already mounted, we do nothing.
echo "W: $DIST is already mounted. Entering chroot..."
else
echo "I: Mounting device for $DIST..."
if $busybox [ ! -d $MOUNTPOINT ]; then
# Create the mount point if it does not already exist
$busybox mkdir -p $MOUNTPOINT 2> /dev/null
if $busybox [ ! -d $MOUNTPOINT ]; then
echo "F: It was not possible to create the missing mount location ($MOUNTPOINT)"
return 0
fi
fi
if $busybox [ -f "$FILESYSTEM" ]
then
# Android places loop devices in /dev/block/ instead of root /dev/
# If there are none in /dev/ we create links between /dev/loopX and /dev/block/loopX so that losetup will work as it should.
if $busybox [ ! -e /dev/block/loop0 ]; then
i=0
while [ $i -le 8 ]
do
$busybox mknod /dev/block/loop$i b 7 $i
let i=1+$i
done
fi
# Locate the current loop device file
if $busybox [ ! -z "$($busybox losetup | $busybox grep "$FILESYSTEM")" ]; then
# If the filesystem file is already attached to an loop device, we get the path to the device file.
loblk=$($busybox losetup | $busybox grep "$FILESYSTEM" | $busybox cut -d ":" -f 1)
else
# If the filesystem file is not yet attached, we attach it.
loblk=$($busybox losetup -f)
$busybox losetup $loblk $FILESYSTEM 2> /dev/null
# Make sure that the device was successfully attached to a loop device file
if $busybox [ -z "$($busybox losetup | $busybox grep "$FILESYSTEM")" ]; then
echo "F: It was not possible to attach the device to a loop device file"
return 0
fi
fi
fi
if $busybox [ -b "$FILESYSTEM" ]
then
loblk=$FILESYSTEM
fi
# Mount the filesystem
$busybox mount -t $FS $loblk $MOUNTPOINT 2> /dev/null
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT ")" ]; then
# Bind some Android dirs to the linux filesystem
if $busybox [ $BINDS -eq 1 ]
then
# Create mtab
echo > "${MOUNTPOINT}/etc/mtab"
$busybox cat /proc/mounts > "${MOUNTPOINT}/etc/mtab"
# for i in `$busybox cat /proc/mounts | $busybox cut -d " " -f 2`
for i in $( $busybox cat /proc/mounts | $busybox awk '{print $2}' )
do
# /sdcard/Mon mount/Linux
$busybox mkdir -p "${MOUNTPOINT}/$i" 2> /dev/null
$busybox mount -o bind "${i}" "${MOUNTPOINT}/${i}" 2> /dev/null
#echo "${i}" >> "${MOUNTPOINT}/etc/mtab"
done
fi
#for i in $BINDS
#do
# # Bind the dirs if they are not already binded
# if $busybox [ -z "$($busybox mount | $busybox grep "$MOUNTPOINT/$i ")" ]; then
# # Create any missing dirs in the mountpoint
# if $busybox [ ! -d $MOUNTPOINT/$i ]; then
# $busybox mkdir -p $MOUNTPOINT/$i
# fi
# $busybox mount -o bind $i $MOUNTPOINT$i
# fi
#done
else
echo "F: It was not possible to mount $DIST at the specified location ($MOUNTPOINT)"
return 0
fi
fi
fi
# FIX the "stdin: is not a tty" error in direct hadware case.
if $busybox [ -z "$($busybox mount | $busybox grep "$MOUNTPOINT/dev/pts ")" ]; then
$busybox mount -t devpts devpts $MOUNTPOINT/dev/pts
fi
# For the network.
#sysctl -w net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward
# Cleanup tmp folder.
$busybox rm -rf $MOUNTPOINT/tmp/*
if $busybox [ -f $MOUNTPOINT/etc/init.android/rc_mount.sh ]; then
# Execute the mount init file, if it exists
echo "I: Executing /etc/init.android/rc_mount.sh"
$busybox chroot $MOUNTPOINT /etc/init.android/rc_mount.sh
fi
echo "I: Entering chroot..."
return 1
}
removeLinuxBoot() {
if $busybox [ -d "$FILESYSTEM" ]
then
echo "I: Directory chroot !"
# Unmount pts
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT/dev/pts ")" ]; then
$busybox umount $MOUNTPOINT/dev/pts 2> /dev/null
fi
for i in $BINDS
do
# Unmount all binding dirs
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT/$i ")" ]; then
$busybox umount $MOUNTPOINT/$i
fi
done
for i in `$busybox cat /proc/mounts | $busybox tac | $busybox grep -v "$MOUNTPOINT " | $busybox grep "$MOUNTPOINT" | $busybox cut -d " " -f 2`;do umount $i 2> /dev/null;done
else
if $busybox [ -z "$($busybox mount | $busybox grep "$MOUNTPOINT ")" ]; then
# If linux is not mounted, then do nothing.
echo "W: $DIST is already unmounted"
else
echo "I: Unmounting $DIST..."
if $busybox [ -f $MOUNTPOINT/etc/init.android/rc_unmount.sh ]; then
echo "I: Executing /etc/init.android/rc_unmount.sh"
# Execute the unmount init script, if it exist.
$busybox chroot $MOUNTPOINT /etc/init.android/rc_unmount.sh
fi
sync
# Make sure that we have an loop device file to use
if $busybox [ -f "$FILESYSTEM" ]
then
if $busybox [ ! -z "$($busybox losetup | $busybox grep "$FILESYSTEM")" ]; then
# Get the loop device file
loblk=$($busybox losetup | $busybox grep "$FILESYSTEM" | $busybox cut -d ":" -f 1)
else
echo "E: Could not locate the loop device file. $DIST was not unmounted successfully"
fi
fi
if $busybox [ -b "$FILESYSTEM" ]
then
loblk=$FILESYSTEM
fi
# Unmount pts
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT/dev/pts ")" ]; then
$busybox umount $MOUNTPOINT/dev/pts
fi
for i in `$busybox cat /proc/mounts | $busybox tac | $busybox grep -v "$MOUNTPOINT " | $busybox grep "$MOUNTPOINT" | $busybox cut -d " " -f 2`;do umount $i 2> /dev/null;done
for i in $BINDS
do
# Unmount all binding dirs
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT/$i ")" ]; then
$busybox umount $MOUNTPOINT/$i
fi
done
sync && sleep 1
# Unmount the device
$busybox umount $MOUNTPOINT 2> /dev/null && sleep 1
# If the device could not be unmounted
if $busybox [ ! -z "$($busybox mount | $busybox grep "$MOUNTPOINT ")" ]; then
echo "E: $DIST could not be unmounted. Trying to kill attached processes..."
# Try to kill all processes holding the device
for i in `$busybox grep "$MOUNTPOINT" /proc/*/maps 2> /dev/null | $busybox cut -d":" -f 1 | $busybox sort | $busybox uniq | $busybox cut -d "/" -f 3`; do kill $i 2> /dev/null; echo; done
fuser -k -9 $MOUNTPOINT
for i in `$busybox grep "$MOUNTPOINT" /proc/*/maps 2> /dev/null | $busybox cut -d":" -f 1 | $busybox sort | $busybox uniq | $busybox cut -d "/" -f 3`; do kill -9 $i 2> /dev/null; echo; done
# Use umount with the -l option to take care of the rest
$busybox umount -l $MOUNTPOINT 2> /dev/null && sleep 1
fi
# Make sure the device has been successfully unmounted
if $busybox [ -z "$($busybox mount | $busybox grep "$MOUNTPOINT ")" ]; then
if $busybox [ -f "$FILESYSTEM" ]
then
# Try to detach the device from the loop device file
$busybox losetup -d $loblk 2> /dev/null
# Make sure that the device was successfully detached
if $busybox [ -z "$($busybox losetup | $busybox grep "$FILESYSTEM")" ]; then
echo "I: $DIST has been successfully unmounted"
else
echo "E: $DIST has been unmounted, but could not detach the loop device"
fi
fi
if $busybox [ -b "$FILESYSTEM" ]
then
if $busybox [ -z "$($busybox mount | $busybox grep "$MOUNTPOINT ")" ]; then
echo "I: $DIST has been successfully unmounted"
else
echo "E: $DIST has been unmounted, but could not detach the loop device"
fi
fi
else
echo "E: $DIST could not be unmounted successfully"
fi
fi
fi
}
if $busybox [ "$1" = "unmount" ]; then
removeLinuxBoot
else
createLinuxBoot
if $busybox [ $? -eq 1 ]; then
if $busybox [ -f $MOUNTPOINT/etc/init.android/rc_enter.sh ]; then
echo "I: Executing /etc/init.android/rc_enter.sh"
$busybox chroot $MOUNTPOINT /etc/init.android/rc_enter.sh
else
echo "I: To run command when enterring Linux create executable file at /etc/init.android/rc_enter.sh"
fi
$busybox chroot $MOUNTPOINT /bin/bash -i
if $busybox [ -f $MOUNTPOINT/etc/init.android/rc_leave.sh ]; then
echo "I: Executing /etc/init.android/rc_leave.sh ..."
$busybox chroot $MOUNTPOINT /etc/init.android/rc_leave.sh
else
echo "I: To run command when leaving Linux create executable file at /etc/init.android/rc_leave.sh"
fi
echo "Q: Do you want to unmount the $DIST environment, or leave it as is ? Y will kill all process as required; any other key will leave services running."
read REPLY
if $busybox [ "y$REPLY" = "yy" ] || $busybox [ "y$REPLY" = "yY" ]; then
removeLinuxBoot
fi
fi
fi
)
or you can mount it with this linuxboot.sh:
Code:
# Check Permissions
if [ $(whoami) != root ]; then
echo "This script must be run as root."
exit
fi
# Script Variables
NAME=ubuntu
PATH=$(dirname $0)
# Enviroment Variables
export BIN=/system/bin
export HOME=/root
export MOUNT=/data/local/mnt/$NAME
export PATH=$BIN:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export TERM=linux
export USER=root
# Change Directory
cd $PATH
# Create Mount Point
mkdir -p $MOUNT
# Remount System Read/Write
mount -o remount,rw /system
# Check Loop Block Device
if [ ! -b /dev/block/loop_$NAME ]; then
# Create Loop Block Device
mknod /dev/block/loop_$NAME b 7 255
fi
# Setup Loop Block Device
losetup /dev/block/loop_$NAME $NAME.img
# Mount Loop Block Device To Mount Point
mount -t ext3 /dev/block/loop_$NAME $MOUNT
# Add Mount Points
mount -o bind /dev $MOUNT/dev
mount -o bind /dev/pts $MOUNT/dev/pts
mount -o bind /dev/shm $MOUNT/dev/shm
mount -o bind /sdcard $MOUNT/media
mount -t proc none $MOUNT/proc
mount -t sysfs none $MOUNT/sys
# Set Options
echo "127.0.0.1 localhost" > $MOUNT/etc/hosts
echo "nameserver 8.8.4.4" > $MOUNT/etc/resolv.conf
echo "nameserver 8.8.8.8" >> $MOUNT/etc/resolv.conf
rm -rf $MOUNT/lost+found
sysctl -w net.ipv4.ip_forward=1 > /dev/null
sysctl -w net.ipv6.conf.all.forwarding=1 > /dev/null
# Enter Linux
chroot $MOUNT /bin/bash -c "source /etc/profile; bash"
# Remove Mount Points
umount $MOUNT/sys
umount $MOUNT/proc
umount $MOUNT/media
umount $MOUNT/dev/shm
umount $MOUNT/dev/pts
umount $MOUNT/dev
# Clean Up
umount $MOUNT
losetup -d /dev/block/loop_$NAME
rm /dev/block/loop_$NAME
rmdir $MOUNT
this is not the init.sh.
the init.sh is iniside the ubuntu.img so to boot using the init.sh you can edit the rc_enter.sh to start init.sh like so:
./init.sh
you can also start a service like so:
service hostname start

[Q] How to use string array in init.d script?

I want to make app symlinks to sd-ext on booting.
I made a short init.d script, And It correctly worked on JB based rom.
But after I downgraded to GB, It doesn't work anymore.
I founded that pure bone shell doesn't support arrays.
The script uses string array to declare apk list I want to symlink.
So is there a way to use string array or make similar effect?
Here is my script.
Code:
#!/system/bin/sh
if [ -z "$SD_EXT_DIRECTORY" ]; then SD_EXT_DIRECTORY=/sd-ext; fi
SYSBLOCK=`mount | grep system | cut -f 1 -d ' '`
sysapp2sd=("BackupRestoreConfirmation.apk" "BasicDreams.apk" "Bluetooth.apk" "CertInstaller.apk" "Calculator.apk" "CMFileManager.apk" "CMScreenshot.apk" "DSPManager.apk" "DrmProvider.apk" "Email.apk" "Email2.apk" "Exchange.apk" "Exchange2.apk" "Gmail.apk" "GoogleBackupTransport.apk" "InputDevices.apk" "Music.apk" "OneTimeInitializer.apk" "PhotoTable.apk" "PicoTts.apk" "SamsungTTS.apk" "SharedStorageBackup.apk" "SoundRecorder.apk" "Talk.apk" "ThemeChooser.apk" "ThemeManager.apk" "Torch.apk" "VpnDialogs.apk" "WAPPushManager.apk")
app2sd_exception=("com.UCMobile" "com.adobe.flashplayer" "com.android.lmt" "com.fiberthemax.OpQ2keyboard" "com.fiberthemax.OpQ2keyboard.dict.ko" "com.google.android.gms" "com.google.android.googlequicksearchbox" "com.jungsup.thecall" "com.mobint.hololauncher" "com.mobint.hololauncherplus" "com.mobitobi.android.gentlealarm" "com.myhome.mytheme" "com.rs.autorun" "com.teslacoilsw.launcher" "com.vladlee.callconfirm.free" "eu.chainfire.supersu" "kz.mek.DialerOne" "me.dennis.weather.naver" "net.dinglisch.android.taskerm" "net.everythingandroid.smspopup" )
# make sure $SD_EXT_DIRECTORY is actually mounted
if ! awk -vDIR="$SD_EXT_DIRECTORY" '$2 == DIR { exit 1; }' /proc/mounts ; then
mount -rw -o remount SYSBLOCK /system
mkdir -p /sd-ext/symlink/system/app
# /system/app/ -> /sd-ext/symlink/system/app/
FILES=`find /system/app -maxdepth 1 -type f`
for file in $FILES; do
filename=`basename $file`
for pattern in ${sysapp2sd[@]}; do
if [[ $filename == $pattern ]]; then
cp /system/app/$filename /sd-ext/symlink/system/app/
rm -f /system/app/$filename
ln -s /sd-ext/symlink/system/app/$filename /system/app/$filename
fi
done
done
# /data/app/ -> /sd-ext/symlink/data/app/
FILES=`find /data/app -maxdepth 1 -type f`
for file in $FILES; do
filename=`basename $file`
match=false
for pattern in ${app2sd_exception[@]}; do
if [[ $filename == $pattern* ]]; then
match=true
fi
done
if ! $match; then
cp /data/app/$filename /sd-ext/symlink/data/app/
rm -f /data/app/$filename
ln -s /sd-ext/symlink/data/app/$filename /data/app/$filename
fi
done
mount -r -o remount SYSBLOCK /system
fi
You can use echo or cat command to wrap list and grab it with awk.
and add another for loop over for loop for getting the counted numbers to be used on awk...

[GUIDE] Build Linux and Run on Ext Sdcard Without using a Loop Device

Build your own Ubuntu Filesystem and Run (chroot) with Android
NOTE: This is an ongoing project for me so I am not done with this post,
Everything works but obviously room for Improvement. Starting with the Mounts in script, not sure proper mounts i should use.
e.g.
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
or:
mount -t devpts none $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sys $mnt/sys
or:
mount -t dev $mnt/dev/pts
mount -t proc $mnt/proc
mount -t sysfs $mnt/sys
???
Lets get on with it.
I was having trouble with corrupted image file or ubuntu.img that i made so i tried a different method.
I kept getting input/output errors.
Using a partition on my external sdcard and Mounting it back to the external card,
to hold the file system, instead of an image file, Mounted in a Loop device.
I dont have the time to to get into detail of the steps involved, I gotta get back to work.
If you want to do this bad enough,im sure you will figure it out.
My Tools:
Ubuntu 13.10 setup on VirtualBox in Windows8 Envirement
Sdcard is class 10 64G, however i have tried class 4 16G and 16G class 10 and it worked too.
SdcardFormatter: https://www.sdcard.org/downloads/formatter_4/
Galaxy Note3 SM-N900P
First
any sdcard will do.
Now im not going to get into how to figure out the "start sector" (mine is 2048 for the particular card im using) all i can say is,
if its a "stock card", and you haven't partitioned it before, you should be ok. If your not sure use SdcardFormatter to get card back to stock.
In ubuntu find your card:
open Gparted and top right corner select: yor sdcard
Mine is sdb..
(Make sure all partitions are unmounted)
Click on first partition then select: information...It will tell you the start sector, make note.
select: last partition,
Do same for last step: if applicable for end sector.
Make sure all partitions are Unmounted
MAKE SURE WHEN YOU DO THE NEXT STEP, YOUR NOT DELETING YOUR SYSTEM
delete all partitions,
select: unnallocated space,
select: the unnallocated space,
select: new,
select: space before 0, space after, (leave space for whatever your system or image size is mine was 3.94G) so i left 4G.
select: fat32 for file system
select: ok
select: next unallocated space,
select: space before is 0 space after is 0
select: file system ext4
select: ok
MAKE SURE WHEN YOU DO THE NEXT STEP YOUR NOT DELETING YOUR SYSTEM
DONT FORMAT ANYTHING
select: apply
Check information again, check for start and end sector to see if they match the origanal settings you took note of at the begining.
If they are different, use SD Formater ^LINK^ to set sdcart back to stock setting.
Try again after you do some homework on Partitioning and formating sdcards.
Make your Image:
Install Qemu:
sudo apt-get install qemu-user-static qemu-system
sudo apt-get install debootstrap
Make dirctory:
mkdir ~/arm
Or whatever
Then make another directory:
mkdir ~/arm/ubuntu
Or whatever
Go to that directory:
cd ~/arm
Then:
Make an image...........................Pick one or make your own size:
dd if=/dev/zero of=ubuntu.img bs=8k count=524000 >...3.99
dd if=/dev/zero of=ubuntu.img bs=8k count=350000 >...2.9G
dd if=/dev/zero of=ubuntu.img bs=8k count=510000 >...3.6G...........etc.
Example: for a 4G do:
dd if=/dev/zero of=ubuntu.img bs=8k count=524000
Make Filesystem:
sudo mkfs.ext3 -F ubuntu.img
YES THATS EXT3:
Set the Filesystem checking interval:
tune2fs -c 0 ubuntu.img
Mount Filesystem:
sudo mount -o loop ubuntu.img ubuntu
Bring in Base System:
sudo debootstrap --arch armhf --foreign raring ubuntu
You can change raring for other distros, such as stable, or hoary. look in /usr/share/debootstrap/scripts
Make folders for sdcard links:
sudo mkdir ubuntu/media && sudo mkdir ubuntu/media/sdcard && sudo mkdir ubuntu/media/extSdCard
Or you can use your own sdcard settings
Copy Qemu file over to Ubuntu folder:
sudo cp /usr/bin/qemu-arm-static ubuntu/usr/bin
Run first Chroot:
LANG=C sudo chroot ubuntu /usr/bin/qemu-arm-static -cpu cortex-a9 /bin/bash
Finish Installation:
/debootstrap/debootstrap --second-stage
Exit Chroot
exit
Mount some stuff
sudo mount -t proc none ubuntu/proc/ && sudo mount -t devpts devpts ubuntu/dev/pts
Start second Croot:
sudo chroot ubuntu /usr/bin/qemu-arm-static -cpu cortex-a9 /bin/bash
Set some Variables:
export HOME=/root && export USER=root && export LC_ALL=C
Create User:
adduser [PICK A USER NAME]
Set Root Password:
passwd
Add some Groups for permissions:
groupadd -g 3001 aid_net_bt_admin && usermod -G aid_net_bt_admin -a dad && groupadd -g 3002 aid_net_bt && usermod -G aid_net_bt -a dad && groupadd -g 3003 aid_inet && usermod -G aid_inet -a dad && groupadd -g 3004 aid_net_raw && usermod -G aid_net_raw -a dad && groupadd -g 3005 aid_net_admin && usermod -G aid_net_admin -a dad && groupadd -g 3006 aid_net_bw_stats && usermod -G aid_net_bw_stats -a dad && groupadd -g 3007 aid_net_bw_acct && usermod -G aid_net_bw_acct -a dad && groupadd -g 3008 aid_net_bt_stack && usermod -G aid_net_bt_stack -a dad
For Raring...........................
echo "deb http://ports.ubuntu.com saucy main restricted universe multiverse" >> /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 428D7C01
For Quantal.........................
echo "deb http://ports.ubuntu.com quantal main restricted universe multiverse" >> /etc/apt/sources.list
For Wheezy.........................
echo "deb http://ftp.us.debian.org/debian stable main contrib non-free" >> /etc/apt/sources.list
Dont hold me to the last one you may want to double check.
Update Package Manager
apt-get update
Now you can add packages, these are some of the programs i use:
(i dont like to add all packages at once, i break them up because somtimes i notice dpkg error's when i try all at once).
apt-get install git gnupg flex bison gperf build-essential zip curl
apt-get install xfce4 xfce4-goodies
apt-get --reinstall install xfonts-base
apt-get install samba samba-common system-config-samba
Debian: apt-get install openoffice.org
Ubuntu: sudo apt-get install libreoffice
apt-get install tightvncserver streamtuner2
apt-get install xchat-gnome xchat
MAKE SURE YOU INSTALL TIGHTVNCSERVER..................Thats how you will connect to Ubuntu.........,if you want GUI.
Add permissions for sudo:
visudo
Example root ALL=(ALL:ALL) ALL
dad ALL=(ALL:ALL) ALL
(My username is dad)
Dont know if you need this or not i do it:
chmod a+rw /dev/null
chmod 1777 /tmp
To Fix SDCARD
groupadd -g 1015 sdcard-rw && usermod -a -G sdcard-rw dad && groupadd -g 1016 extSdCard-rw && usermod -a -G extSdCard-rw dad
Exit Chroot
exit
Unmount some stuff
sudo umount ubuntu/proc/ && sudo umount ubuntu/dev/pts && sudo umount ubuntu
Transfer your Image to Sdcard
Now Dump the image to Sdcard:
MAKE SURE THE EXT4 PARTITION ON SDCARD IS UNMOUNTED
My sdcard was sdb, so sdb1 would be partition 1 sdb2 would be partition 2
sudo dd if=ubuntu.img of=/dev/sdb2
...........If you notice below, it took 2.8 hrs to dump the image.
[email protected]:/media/dad/Development/arm$ sudo dd if=ubuntu.img of=/dev/sdb2
[sudo] password for dad:
8160000+0 records in
8160000+0 records out
4177920000 bytes (4.2 GB) copied, 10371.3 s, 403 kB/s
[UPDATE]
So far I have not found any problems using the copy command to transfer filesystem over to sdcard.
example:
sudo cp -rp ubuntu/* /media/dad/4920cacb-49aa-4366-8fb7-016b8e502406 (only takes 15-20min)
(Make sure your ubuntu.img is mounted in the ubuntu folder) using:
sudo mount -o loop ubuntu.img ubuntu
To Chroot it.............
With sdcard in Phone,
Connect to windows usb:
IN WINDOWS:
Open File Explorer:
Create directory "ubuntu" on root of sdcard
Copy ext4ubuntu.sh to root of sdcard (not in the ubuntu folder)
ON PHONE:
Open Terminal:
su
cd /storage/extSdCard
chmod 777 ext4ubuntu.sh
sh ./ext4ubuntu.sh
Ready to go.
Connect to Ubuntu:
Get bVNC Free from Market
In Terminal type:
login dad
vncserver :0 -geometry 960x540
Open VNC Viewer and enter:
localhost:0 for ip address
and password if you want.
Connect
Notes:
I was able to sudo cp -rp ubuntu/* /media/dad/912c45f4-b0bd-4e14-a55d-d8d9bcd4bd6a (which is the path to my sdcard), worked the second time i tried it.
( I mounted the ubuntu.img then copied all files to sdcard)
The first time i tried it i got dpkg errors.
That took only 20min to copy vrs. almost 3 hrs using dd if=
Here are some after thought I made note of, I havent tried them yet but u can, just let us know your experiances with them.
Some things you can put in a script to run after ubuntu started.
df doesn't work, there is no mtab file containing the currently mounted filesystems:
grep -Ev "rootfs|tmpfs|cgroup|mmcblk|usbfs|asec|storage" /proc/mounts | sort -r | uniq > /etc/mtab
if you can only run vncserver/Xvnc as root Try
chmod 01777 /tmp/.X11-unix
or
Fix Upstart
dpkg-divert --local --rename --add /sbin/initctl > /dev/null 2>&1
ln -s /bin/true /sbin/initctl > /dev/null 2>&1
Sources:
http://the.taoofmac.com/space/blog/2013/04/28/2330
http://whiteboard.ping.se/Android/Debian
http://linux-expert.net/?Trucs_et_astuces___Android___Tutoriel_:_Chroot_Debian
http://forum.xda-developers.com/showthread.php?t=2598481
http://gautampk.tumblr.com/post/23032189096/ubuntuonandroid-linuxshell#
BELOW IS:.....ext4ubuntu.sh
Just copy and paste into txt editor and name it ext4ubuntu.sh
Dont make too much fun of it. Im still learnen.
###################################################################Cut
echo "This will Install Ununtu ...................."
sleep .8
c=5 # seconds to wait
REWRITE="\e[25D\e[1A\e[K"
echo "Starting..."
while [ $c -gt 0 ]; do
c=$((c-1))
sleep 1
echo -e "${REWRITE}$c"
done
echo -e "${REWRITE}Done."
mount -o remount,rw /dev/block/mmcblk0p23 /system
export bin=/system/bin
export mnt=/storage/extSdCard/ubuntu
export TMPDIR=/tmp
export PATH=$bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$PATH
export HOME=/root
export PWD=/root
export SHELL=/bin/bash
export TERM=linux
export EDITOR=/usr/bin/nano
export VISUAL=/usr/bin/vi
echo "Mounting File System..........................."
sleep .5
mount -t ext4 -o rw,noatime /dev/block/mmcblk1p2 $mnt
sleep .5
echo "Mounting and Binding Neccesary Devices..............."
sleep .5
echo ".................................DONE!.................."
sleep .5
mount -o bind /dev $mnt/dev
echo "dev"
sleep .5
mount -t devpts devpts $mnt/dev/pts
echo "devpts......................................................"
sleep .5
mount -o bind /proc $mnt/proc
echo "proc..................................................."
sleep .5
mount -o bind /sys $mnt/sys
echo "sys..............................................."
sleep .5
sysctl -w net.ipv4.ip_forward=1
echo "inet................................."
sleep .5
echo "MOUNTING SD CARDS................"
sleep .5
mount -o bind /data/media/0 $mnt/media/sdcard
echo "Card: sdcard............"
sleep .5
mount -o bind /storage/extSdCard $mnt/media/extSdCard
echo "Card: extSdCard....."
sleep .5
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "Ubuntu Has Started "
echo "Enjoy "
echo "..."
chroot $mnt /bin/bash
echo " "
echo "Shutting down Ubuntu"
busybox umount $mnt/dev/pts
busybox umount $mnt/proc
busybox umount $mnt/sys
busybox umount $mnt
echo "...It might have Worked... "
#####################################################################END
holy crap. ok. Thanks dude
femmyade2001 said:
holy crap. ok. Thanks dude
Click to expand...
Click to collapse
Thanks
Might be a good idea to post commands between
Code:
tags
Man o man. This looks very interesting.
Any screenshots?
Sent from my SM-N900P using XDA Premium 4 mobile app
yotaking said:
Man o man. This looks very interesting.
Any screenshots?
Sent from my SM-N900P using XDA Premium 4 mobile app
Click to expand...
Click to collapse
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Homefix said:
View attachment 2637812
Click to expand...
Click to collapse
Best post of the day.
Sent from my SM-N900P using Xparent BlueTapatalk 2

Categories

Resources