[DEV's] 2.2 Legend - G1 Android Development

Hey guys,
as i know so far there are 4 people in this G1 section that wants to port a 2.2 Legend ROM right now, or already ported it.
Maybe we can discuss the problems we got in this thread so the other DEV's can see it and MAYBE give us solutions.
My progress so far is getting the logcat to until the point that busybox just terminates itself, i'm using a SWAP partition and MTD recovery stuff, mtdpartmap.txt @ 160MB or smth:
Code:
logcat
# --------- beginning of /dev/log/main
pthread ( 61): ## thread 61 is creating thread @system/core/adb/sysdeps.h:411
pthread ( 61): ## thread 62 is created success
pthread ( 61): ## thread 61 is creating thread @system/core/adb/sysdeps.h:411
pthread ( 61): ## thread 63 is created success
pthread ( 61): ## thread 61 is creating thread @system/core/adb/sysdeps.h:411
pthread ( 61): ## thread 64 is created success
pthread ( 61): ## thread 61 is creating thread @system/core/adb/sysdeps.h:411
pthread ( 61): ## thread 66 is created success
pthread ( 61): ## thread 61 is creating thread @system/core/adb/sysdeps.h:411
pthread ( 61): ## thread 67 is created success
/system/xbin/busybox( 60): Welcome to Android 2.2 /
/system/xbin/busybox( 60): Powered by _____ _______
/system/xbin/busybox( 60): | \ |
/system/xbin/busybox( 60): | | |
/system/xbin/busybox( 60): | | |
/system/xbin/busybox( 60): | | |
/system/xbin/busybox( 60): |____/ |
/system/xbin/busybox( 60): Darktremor Apps2SD
/system/xbin/busybox( 60): sysctl: /etc/sysctl.conf: No such file or directory
/system/xbin/busybox( 60): [ ] Apps2SD is launching...
/system/xbin/busybox( 60): __ _____
/system/xbin/busybox( 60): | \ |
/system/xbin/busybox( 60): | | |
/system/xbin/busybox( 60): |__/ | Darktremor Apps2SD 2.7.5.2 (2010-09-30)
/system/xbin/busybox( 60): [ ] Startup Boot Sequence
/system/xbin/busybox( 60): [ ] GetProp Command = /system/bin/toolbox getprop
/system/xbin/busybox( 60): [ ] SetProp Command = /system/bin/toolbox setprop
/system/xbin/busybox( 60): [ ] Mount Point = /system/sd
/system/xbin/busybox( 60): [ ] Checking for existence of Dalvik Heap Change Program.
/system/xbin/busybox( 60): [!] Dalvik Heap Change Program Not Found.
/system/xbin/busybox( 60): [ ] Starting Darktremor Apps2SD Version 2.7.5.2
/system/xbin/busybox( 60): [ ] Attempting to mount SD card to /system/sd
/system/xbin/busybox( 60): [ ] Waiting 3s seconds to see if /dev/block/mmcblk0p2 shows up.
/system/xbin/busybox( 60): [ ] Checking for ext partition
/system/xbin/busybox( 60): [!] Creating /dev/block/mmcblk0p2.
/system/xbin/busybox( 60): [ ] Mounting ext partitions
/system/xbin/busybox( 60): mount: mounting /dev/block/mmcblk0p2 on /system/sd failed: No such file or directory
/system/xbin/busybox( 60): [X] Mounting ext partition failed.
/system/xbin/busybox( 60): [X] Swap block device not found
/system/xbin/busybox( 60): [X] Swap not active.
/system/xbin/busybox( 60): [ ] Setting swap variables to 0
/system/xbin/busybox( 60): [ ] Heap Size set to:
/system/xbin/busybox( 60): [ ] Checking for previous version flag files...
/system/xbin/busybox( 60): [ ] Applications are stored
/system/xbin/busybox( 60): in /data/app
/system/xbin/busybox( 60): [ ] Private Applications are
/system/xbin/busybox( 60): stored in /data/app-private
/system/xbin/busybox( 60): [ ] Dalvik-Cache is located in /data/dalvik-cache
/system/xbin/busybox( 60): [X] No Start flag detected.
/system/xbin/busybox( 60): [X] Apps2SD will not start.
DEBUG ( 184): debuggerd: Jan 24 2011 14:45:23
vold ( 183): Android Volume Daemon version 2.0
vold ( 183): New MMC card 'SU08G' (serial 1883055730) added @ /devices/platform/msm_sdcc.2/mmc_host/mmc1/mmc1:aaaa
vold ( 183): Disk (blkdev 179:0), 15523840 secs (7580 MB) 1 partitions
vold ( 183): New blkdev 179.0 on media SU08G, media path /devices/platform/msm_sdcc.2/mmc_host/mmc1/mmc1:aaaa, Dpp 1
vold ( 183): Partition (blkdev 179:1), 15523839 secs (7579 MB) type 0xb
vold ( 183): New blkdev 179.1 on media SU08G, media path /devices/platform/msm_sdcc.2/mmc_host/mmc1/mmc1:aaaa, Dpp 0
vold ( 183): Bootstrapping complete
AKMD ( 194): akmd 1.6.4 START
AKMD ( 194): library version: 1.2.1.1129
/system/xbin/busybox( 60): mount: no /etc/mtab
/system/xbin/busybox( 60): mount: no /etc/mtab
logwrapper( 60): /system/xbin/busybox terminated by exit(0)

From looking at the logcat, below codes are some of the thing that I noticed. Don't know if that is/are the cause of some of the problem you are having.
Code:
/system/xbin/busybox(60): sysctl: /etc/sysctl.conf: No such file or directory
/system/xbin/busybox(60): [!] Dalvik Heap Change Program Not Found.
/system/xbin/busybox(60): mount: mounting /dev/block/mmcblk0p2 on /system/sd failed: No such file or directory
/system/xbin/busybox(60): [X] Mounting ext partition failed.
/system/xbin/busybox(60): [X] Swap block device not found
/system/xbin/busybox(60): [X] Swap not active.
/system/xbin/busybox(60): [X] No Start flag detected.
/system/xbin/busybox(60): [X] Apps2SD will not start.
Looks like some of the files are missing or not reconized for some reason. See if you ADB server is up to date.
BTW! I am not a DEV, I don't have much experience. I sometime look at codes with others thing. Just trying to help out.

You mean the ADB file in the kernel?

What did you change so far?

Very much... Lib's, etc, modules, kernel, updater-script.
But got something else working, which is BY FAR the fastest 2.1 Sense that you've ever seen on the G1... Everything is working like WiFi/Data/Cam/GPS. And it's so freakin' stable but there is still much a mate of me and i can fix about that, so it should be running like a normal Sense on a Wildfire or Desire HD.
56MB internal space which is with MUCH app's installed.
OH MY GOAD!!! It's truely so fast.. *___*

Don't replace any lib files yet.

I was working with a tutorial on how to port Sense roms to any devices.

Rushness said:
You mean the ADB file in the kernel?
Click to expand...
Click to collapse
Yes, that what I mean. Anyway, I believed that Namit1994 have a handle on this.

Rushness said:
I was working with a tutorial on how to port Sense roms to any devices.
Click to expand...
Click to collapse
where did you see this tutorial? lol im at the point where my logcat is having lib file issues..

Then you should propably replace some of em
Watch my 2.1 Legend Port that i've just released. It's stable as hell man, never thought sense could be that fast on this device. No offence but i think it's actually faster than SenseLX cause it's just a Legend base <3

Okay cool.

Related

Debian install error?

If this is in wrong place pleas move as needed.
When I try to boot debian on my g1 I get some errors.
Here is what I get:
/sdcard/debian # su bootdeb
su bootdeb
←[H←[JAndroid Filesytem remounted as read/write
insmod: can't read 'ext2': No such file or directory
mknod: /dev/loop2: File exists
←[H←[J
a888a
d888888b
8P YP Y88
8|o||o|88
8. .88
8 ._. Y8.
d/ 8b.
.dP . Y8b.
d8: ::88b.
d8 Y88b
:8P :888
8a. : _a88P
._/ Yaa_ : .| 88P|
\ YP | 8P \.
/ \._____.d| .|
--..__)888888P ._.|
mount: mounting /dev/block/loop2 on /data/local/mnt failed: Invalid argument
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or direct
ory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
Custom Linux Pseudo Bootstrapper V1.0 - by Mark Walker
WEB: http://www.androidfanatic.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: cannot execute /bin/bash: No such file or directory
umount: can't forcibly umount /data/local/mnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/mnt/proc: No such file or directory
umount: can't forcibly umount /data/local/mnt/sys: No such file or directory
umount: can't forcibly umount /data/local/mnt: Invalid argument
Filesystems have unmounted
losetup: /dev/block/loop2: No such device or address
Loopback device shutdown - success
Debian down
Coded by Mark Walker
http://www.androidfanatic.com
admin.androidfanatic.com
Reverted back to Android console
/sdcard/debian #
Click to expand...
Click to collapse
Can anyone help me out there?
Thanks...but is there a faster mirror for debian? I'm trying to get a new build of Win7 (still using pre beta 1,going to RC) and I cant spare any bandwidth

[PATCH][A2SD]MT3G Friendly a2sd Patch - Firerat

EDIT: 2010-05-13
a note on this modded a2sd and CM5
This mod is *not* required , cm5 has a newer/better way of implementing a2sd
but it will do no harm, it just simply won't do anything
Firerat Patch - a2sd for MT3G users
NOTE My Modified a2sd is intended for both G1s and MT3Gs, one a2sd suits both MT3G's and G1s
Ok, I thought it was about time I gave a full explanation on my mt3g-a2sd patch
why MT3G users should not use an ext partition
why MT3G users who have just 2 Parttions ( FAT / SWAP ) get failed boots
How my modifications reslove this situation
Why should MT3G users not use an ext partition?
the answer is quite simple really, they don't need it.
a2sd was designed with G1s in mind, the G1's /data partition has a limited amount of space available, just over 74mb or 89mb with 'DangerSPL' whereas the MT3G has just over 295mb around 3 or 4 times the G1's.
Although I have not 'benchmarked' the 'speeds' of internal vs sdcard , I belive it is widely accepted that the internal memory is significantly faster than sdcards, and therefore if an MT3G can use it, it should.
So I hope we are all now agree that the MT3G's internal memory should be used for apps/dalvik-cache
Why do MT3G users who have just 2 Parttions ( FAT / SWAP ) get failed boots?
the problem is within the a2sd script, here is a section of the code, with my annotations in blue
Code:
[COLOR="Blue"]Here the script checks for second partition[/COLOR]
if [ -e /dev/block/mmcblk0p2 ];
then
[COLOR="Blue"]it exists so it does a fsck on it [/COLOR]
# fsck the sdcard filesystem first
e2fsck -fy /dev/block/mmcblk0p2;
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;
[COLOR="Blue"] an error is returned ( it is swap not an extfs ) error no. is just stored, no action [/COLOR]
# mount and set permsd
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd;
[COLOR="Blue"] The above mount command fails, it is swap
<snip some link clean ups>[/COLOR]
# move apps and dalvik cache from internal memory to sdcard
for i in app app_s app-private dalvik-cache;
do
[COLOR="Blue"] here directories are normally created on sdcard
but as sdcard isn't mounted it tries to put them on the /system partition,
since /system is mounted read only , it fails[/COLOR]
if [ ! -d /system/sd/$i ];
then
mkdir /system/sd/$i;
fi
busybox chown 1000:1000 /system/sd/$i;
busybox chmod 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
[COLOR="Blue"] the next line tries to copy files from internal memory to /system/sd,
which is read only, it fails[/COLOR]
busybox cp -a /data/$i/* /system/sd/$i/;
busybox rm -f /data/$i/*;
[COLOR="Blue"] BANG , that line above just deleted all your apps,
your system will not boot[/COLOR]
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app app_s app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
[COLOR="Blue"] its just removing empty directories,
and creating a link to none existent directories in /system/sd/[/COLOR]
busybox ln -s /system/sd/$i /data/$i;
fi;
done;
How my modifications reslove this situation
Quite simply by skipping the above code, with this.
Code:
# check if not a G1 ( assuming mt3g ) - Firerat 2010-03-23
rohardware=`getprop ro.hardware`
if [ "$rohardware" != "trout" ];
then
FindSwap
ReturnAppsToData
$SETPROP_CMD cm.filesystem.ready 1;
exit 0;
the != is not equal to, getprop ro.hardware will return sapphire, not trout,
so this code will run my findswap, and ReturnAppsToData Functions
you can find the ReturnAppsToData Function in my next post
Code:
FindSwap ()
{
if [ "`sed -n '$=' /proc/swaps`" -gt "1" ];
then
echo "Swap appears to be already setup, skipping checks"
return
else
for isitswap in `ls /dev/block/mmcblk0p*` ; do
swapon $isitswap 2>/dev/null
if [ "$?" = "0" ];
then
busybox mount -o rw,remount /system
sed s~/dev/block/mmcblk0p.~$isitswap~ /system/bin/user.conf -i
busybox mount -o ro,remount /system
break
else
echo "$isitswap is not swap"
fi
done
fi
return
}
next post contains my full modified a2sd
New Version 2.1
FireratModified-a2sd-2-1_S.zip
This one has the functions in the right place, so they *will* do something
################
Older versions
################
are a bit broken
Full Firerat Modified a2sd Code
It actually does a little more that just be friendly to MT3G, it will attempt to keep Dalvik-cache on /data
Code:
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# [email protected] (cyanogen) Thanks Cy! & ccyrowski
# modified by Firerat 2010-03-24
# Skip a2sd functions if not a G1 ( mt3g in mind )
# Conditional added to location of Dalvik-cache, keep in internal memory where possible
# Firerat 2010-03-30 - added moving apps back to data for mt3g's
# Firerat-TODO - echo for when ran on terminal
#############################################################
RM_CMD="busybox rm"
MV_CMD="busybox mv"
CP_CMD="busybox cp"
LS_CMD="busybox ls"
LN_CMD="busybox ln"
MKDIR_CMD="busybox mkdir"
MOUNT_CMD="busybox mount"
UMOUNT_CMD="busybox umount"
SWAPON_CMD="busybox swapon"
# nb the df sticks out, toolbox df output is easier to cut up
DF_CMD="toolbox df"
DU_CMD="busybox du"
SED_CMD="busybox sed"
GREP_CMD="busybox grep"
CUT_CMD="busybox cut"
GETPROP_CMD="getprop"
SETPROP_CMD="setprop"
E2FSCK_CMD="e2fsck"
CHMOD_CMD="busybox chmod"
CHOWN_CMD="busybox chown"
SYNC_CMD="sync"
rohardware=`$GETPROP_CMD ro.hardware`
#############################################################
echo "+++ Welcome to Android `$GETPROP_CMD ro.build.version.release` / `getprop ro.modversion`";
sysctl -p
# check if not a G1 ( assuming mt3g ) - Firerat 2010-03-23
if [ "$rohardware" != "trout" ];
then
FindSwap
ReturnAppsToData
$SETPROP_CMD cm.filesystem.ready 1;
exit 0;
elif [ -e /dev/block/mmcblk0p2 ];
then
MountExt
# clean up any old symlinks, create data directories
for i in dalvik-cache data;
do
if [ -h /data/$i ];
then
$RM_CMD /data/$i;
fi
if [ ! -d /data/$i ];
then
$MKDIR_CMD /data/$i;
$CHOWN_CMD 1000:1000 /data/$i;
$CHMOD_CMD 771 /data/$i;
fi
done;
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
$CP_CMD -a /system/sd/data/* /data/data/;
$RM_CMD -rf /system/sd/data;
fi
# move apps and dalvik cache from internal memory to sdcard
# when possible keep dalvik-cache on internal memory Firerat 2010-03-23
# for i in app app_s app-private dalvik-cache;
# Firerat-TODO in the same way I try to keep Dalvik-Cache on internal, do same for apps
# therefore keeping things as fast as possible
# and if I get my head round aufs then can maybe do some moving based on priority list
# hell, could even build list based on useage if it's recorded in the dbs
for i in app app_s app-private ;
do
if [ ! -d /system/sd/$i ];
then
$MKDIR_CMD /system/sd/$i;
fi
$CHOWN_CMD 1000:1000 /system/sd/$i;
$CHMOD_CMD 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
$CP_CMD -a /data/$i/* /system/sd/$i/;
$RM_CMD -f /data/$i/*;
fi
done;
# symlink app dirs - they must be on the same filesystem
for i in app app_s app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
$RM_CMD -rf /data/$i;
$LN_CMD -s /system/sd/$i /data/$i;
fi
done;
# bind mount dalvik-cache so we can still boot without the sdcard
# when possible keep dalvik-cache on internal memory Firerat 2010-02-24
# $MOUNT_CMD -o bind /system/sd/dalvik-cache /data/dalvik-cache;
# $CHOWN_CMD 1000:1000 /data/dalvik-cache;
# $CHMOD_CMD 771 /data/dalvik-cache;
DalvikCache
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /system/sd/$i ]; then $RM_CMD -f /system/sd/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
$RM_CMD -f /system/sd/app/*.odex
# Firerat 2010-03-30 , not looked at this , but wrapper dexopt to ignore *.odex ?
else
# replace symlinks with directories so we can boot without sd
for i in app app-private;
do
if [ -h /data/$i ];
then
$RM_CMD -f /data/$i;
$MKDIR_CMD /data/$i;
$CHOWN_CMD 1000:1000 /data/$i;
$CHMOD_CMD 771 /data/$i;
fi
done;
fi
$SYNC_CMD;
FindSwap
#Set Fifo - King Klick - thanks Wes Garner!
for i in ` $LS_CMD -1 /sys/block/mtdblock*` /sys/block/mmcblk0
do
echo 1 > $i/queue/iosched/fifo_batch
done
# Firerat 2010-03-30 ^ should be in init.rc , or some other post boot script
$SETPROP_CMD cm.filesystem.ready 1;
# for now this can stay
if [ -e /data/fix_permissions.sh ];
then
sh /data/fix_permissions.sh
$RM_CMD /data/fix_permissions.sh
fi
### Firerat - Begin functions
MountExt ()
{
# Firerat Check /dev/block/mmcblk0p2 is mounted , so script can be run in terminal
if [ `$MOUNT_CMD |$GREP_CMD -q "/dev/block/mmcblk0p2";echo $?` != "0" ];
then
# fsck the sdcard filesystem first
$E2FSCK_CMD -fy /dev/block/mmcblk0p2;
# set property with exit code in case an error occurs
$SETPROP_CMD cm.e2fsck.errors $?;
# mount and set perms
$MOUNT_CMD -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd;
$CHOWN_CMD 1000:1000 /system/sd;
$CHMOD_CMD 771 /system/sd;
$SYNC_CMD
fi
return
}
FindSwap ()
{
if [ "`$SED_CMD -n '$=' /proc/swaps`" -gt "1" ];
then
echo "Swap appears to be already setup, skipping checks"
return
else
for isitswap in ` $LS_CMD /dev/block/mmcblk0p*` ; do
$SWAPON_CMD $isitswap 2>/dev/null
if [ "$?" = "0" ];
then
$MOUNT_CMD -o rw,remount /system
# Firerat 2010-03-30 - check for cache hack
if [ -d /system/csys ]; then
$MOUNT_CMD -o rw,remount /system/csys
fi
$SED_CMD s~/dev/block/mmcblk0p.~$isitswap~ /system/bin/user.conf -i
$MOUNT_CMD -o ro,remount /system
# Firerat 2010-03-30 - check for cache hack
if [ -d /system/csys ]; then
$MOUNT_CMD -o ro,remount /system/csys
fi
break
else
echo "$isitswap is not swap"
fi
done
fi
return
}
DalvikCache ()
{
# doubt they are going to change, but shoud set the 'paths' as variables
DataTotal_K=`$DF_CMD|$GREP_CMD \/data\:|$CUT_CMD -d " " -f2|$SED_CMD s/K//`
DataFree_K=`$DF_CMD|$GREP_CMD \/data\:|$CUT_CMD -d " " -f6|$SED_CMD s/K//`
DataDalvik_K=`$DU_CMD /data/dalvik-cache/|$CUT_CMD -f1`
# Pickup min free on data from config in future
Min_Data_Free_MB=10
Buffer_K=`expr $Min_Data_Free_MB \* 1024`
DataApp_K=`$DU_CMD /system/app/|$CUT_CMD -f1`
System_App_K=`$DU_CMD /data/app/|$CUT_CMD -f1`
if [ -d /system/sd/dalvik-cache ];
then
SD_Dalvik_K=`busybox $DU_CMD /system/sd/dalvik-cache|$CUT_CMD -f1`
else
SD_Dalvik_K="0"
fi
# Firerat-TODO - I'll finish these some other time
#echo "Data Partition size : ${DataTotal_K}K"
#echo "Free on Data Partition : ${DataFree_K}K"
#echo $DataDalvik_K
#echo $Min_Data_Free_MB
#echo $Buffer_K
#echo $DataApp_K
#echo $System_App_K
#echo $SD_Dalvik_K
if [ ! -d /system/sd/dalvik-cache ] && [ "$DataDalvik_K" -lt "1024" ] && [ "`expr \( $DataApp_K + $System_App_K \) \/2`" -lt "$DataFree_K" ];
then
DalvikToIntMem
else
# if DalvikCache + a bit is too big, move to SD card
if [ "`expr $DataDalvik_K + $Buffer_K`" -gt "`expr $DataFree_K + $DataDalvik_K`" ];
then
DalvikToSdCard
else
if [ "`expr "$SD_Dalvik_K" + "$Buffer_K"`" -lt "$DataFree_K" ];
then
DalvikToIntMem
fi
fi
fi
DalvikComplete
return
}
DalvikToIntMem ()
{
if [ -d /system/sd/dalvik-cache ];
then
# hmm, I should be not lazy look before I leap
$MKDIR_CMD /data/dalvik-cache-temp
$CHOWN_CMD 1000:1000 /data/dalvik-cache-temp
$CHMOD_CMD 771 /data/dalvik-cache-temp
$CP_CMD -a /system/sd/dalvik-cache/* /data/dalvik-cache-temp/
$UMOUNT_CMD /data/dalvik-cache
$RM_CMD -rf /data/dalvik-cache
$MV_CMD /data/dalvik-cache-temp /data/dalvik-cache
$RM_CMD -rf /system/sd/dalvik-cache
else
if [ ! -d /data/dalvik-cache ];
then
$MKDIR_CMD /data/dalvik-cache
fi
$CHOWN_CMD 1000:1000 /data/dalvik-cache
$CHMOD_CMD 771 /data/dalvik-cache
fi
return
}
DalvikToSdCard ()
{
$MKDIR_CMD /system/sd/dalvik-cache/
$CP_CMD -a /data/dalvik-cache/* /system/sd/dalvik-cache/
$RM_CMD /data/dalvik-cache/*
return
}
DalvikComplete ()
{
if [ -d /system/sd/dalvik-cache ] && [ "`$MOUNT_CMD |$GREP_CMD -q "/data/dalvik-cache";echo $?`" != "0" ];
then
$MOUNT_CMD -o bind /system/sd/dalvik-cache /data/dalvik-cache;
fi
$CHOWN_CMD 1000:1000 /data/dalvik-cache;
$CHMOD_CMD 771 /data/dalvik-cache;
return
}
ReturnAppsToData ()
{
# Firerat 2010-03-30
# only running this for none G1s, like mt3g
# allows this patched a2sd to be used on existing install that emulates G1 with broken keyboard
# will only move apps / dalvik i\f there is enough space on /data
# I can probably use this to move apps an a G1, but for now only calling if not g1
if [ -e /dev/block/mmcblk0p2 ] && [ "$isitswap" != "/dev/block/mmcblk0p2" ];
then
Min_Data_Free_MB=10
Buffer_K=`expr $Min_Data_Free_MB \* 1024`
DataFree_K=`$DF_CMD|$GREP_CMD \/data\:|$CUT_CMD -d " " -f6|$SED_CMD s/K//`
TotalAppsOnSD="0"
MountExt
# check to make sure apps on sd are not too large
for i in app app_s app-private dalvik-cache; do
if [ ! -d /system/sd/$i ];
then
SizeOnSD$i=`busybox $DU_CMD /system/sd/$i|$CUT_CMD -f1`
else
SizeOnSD$i="0"
fi
TotalAppsOnSD=`expr "$TotalAppsOnSD" + "SizeOnSD$i"`
done
if [ "$TotalAppsOnSD" -lt "`expr "$DataFree_K" - "$Buffer_K"`" ];
then
# Firerat 2010-03-30 NB, I'm not moving Dalvik-c here , as I already have a function for that
for i in app app_s app-private; do
if [ -d /system/sd/$i ] && [ -L /data/$i ];
then
# Firerat 2020-03-31 - Copy to temp, then remove link and move temp in place
$CP_CMD -a /system/sd/$i /data/$i-temp
$RM_CMD /data/$i
$MV_CMD /data/$i-temp /data/$i
if [ "$?" = "0" ];
then
$RM_CMD -rf /system/sd/$i
fi
fi
done
DalvikToIntMem
$UMOUNT_CMD /dev/block/mmcblk0p2
return
else
DalvikComplete
return
fi
else
return
fi
}
Original Code
Code:
#!/system/bin/sh
#
# Apps2SD using symlinks and bind mounts
# [email protected] (cyanogen) Thanks Cy! & ccyrowski
#
echo "+++ Welcome to Android `getprop ro.build.version.release` / `getprop ro.modversion`";
sysctl -p
if [ -e /dev/block/mmcblk0p2 ];
then
# fsck the sdcard filesystem first
e2fsck -fy /dev/block/mmcblk0p2;
# set property with exit code in case an error occurs
setprop cm.e2fsck.errors $?;
# mount and set perms
busybox mount -o noatime,nodiratime -t auto /dev/block/mmcblk0p2 /system/sd;
busybox chown 1000:1000 /system/sd;
busybox chmod 771 /system/sd;
#busybox mount /sdcard;
# clean up any old symlinks, create data directories
for i in dalvik-cache data;
do
if [ -h /data/$i ];
then
rm /data/$i;
fi;
if [ ! -d /data/$i ];
then
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
# don't allow /data/data on sd because of upgrade issues - move it if possible
if [ -d /system/sd/data ];
then
busybox cp -a /system/sd/data/* /data/data/;
busybox rm -rf /system/sd/data;
fi;
# move apps and dalvik cache from internal memory to sdcard
for i in app app_s app-private dalvik-cache;
do
if [ ! -d /system/sd/$i ];
then
mkdir /system/sd/$i;
fi
busybox chown 1000:1000 /system/sd/$i;
busybox chmod 771 /system/sd/$i
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox cp -a /data/$i/* /system/sd/$i/;
busybox rm -f /data/$i/*;
fi;
done;
# symlink app dirs - they must be on the same filesystem
for i in app app_s app-private;
do
if [ -d /data/$i ] && [ ! -h /data/$i ];
then
busybox rm -rf /data/$i;
busybox ln -s /system/sd/$i /data/$i;
fi;
done;
# bind mount dalvik-cache so we can still boot without the sdcard
busybox mount -o bind /system/sd/dalvik-cache /data/dalvik-cache;
busybox chown 1000:1000 /data/dalvik-cache;
busybox chmod 771 /data/dalvik-cache;
# clean up old whiteouts
for i in local misc property system tombstones data;
do
if [ -h /system/sd/$i ]; then rm -f /system/sd/$i; fi
done;
# please don't put odex files in the app directory people!
# it causes dexopt to crash when switching builds!
busybox rm -f /system/sd/app/*.odex
else
# replace symlinks with directories so we can boot without sd
for i in app app-private;
do
if [ -h /data/$i ];
then
rm -f /data/$i;
mkdir /data/$i;
busybox chown 1000:1000 /data/$i;
busybox chmod 771 /data/$i;
fi;
done;
fi;
sync;
setprop cm.filesystem.ready 1;
this is for if I need some more space
great job again firerat.... alot of us appreciate your hard work and thoroughness!!!!!!!!!!!!!!!!!!!!!!! looking forward to add to my mt3g.... ive been experiencing many boot failures.....
dangambino said:
great job again firerat.... alot of us appreciate your hard work and thoroughness!!!!!!!!!!!!!!!!!!!!!!! looking forward to add to my mt3g.... ive been experiencing many boot failures.....
Click to expand...
Click to collapse
the Flash update in the OP should convert an MT3G emulating a G1 with broken keyboard back into an MT3G with a spare ext partition, for a chroot linux or something, or just fix it up before messing about re-partitioning
but I have to say, I have not tested the apps back to data part, it should check if there is room, it did cross my mind that some may have hundreds of apps and it they would be too big to fit, so I try to check
Lovely, thanks! I'm going to try this now, as I'm just re-flashing King's Legend2g1
Would this be able to run properly once a ROM is already established? Like a ROM I've had for a couple days? Or would this need to be flashed on a ROM that's recently installed. For instance:
Code:
Flash ROM
Flash a2sd
reboot
nolimit78 said:
Would this be able to run properly once a ROM is already established? Like a ROM I've had for a couple days? Or would this need to be flashed on a ROM that's recently installed. For instance:
Code:
Flash ROM
Flash a2sd
reboot
Click to expand...
Click to collapse
yes, my latest will copy app, app_s, app-private and dalvik-cache from the ext partition to /data
( unless it finds that they are all too big, in which case you are still g1 with broken keyboard but your gota have *a lot* of apps before that happens )
But as I only have a G1 I have not been able to test it properly, but the logic is straight forward so fingers crossed I have not missed a typo...
Hmm. I'm having a problem with it. Well, maybe with it. So the first time I wiped, repartitioned with just a swap (190mb) and the rest as fat32. I flashed Rom, then flashed your patch, then flashed the vega kernal patch. Booted up, it all worked, past the HTC quietly brilliant screen, but then sat there on the black HTC bit. If I let the screen sleep, it looked like Sense had loaded, but when I unlocked it it was still sitting there on the black HTC screen with Clock repeatedly FC'ing. So I wiped, reflashed this time just the Rom and the Patch and this time it's getting to the setup screen. It was working fine. I connected to wifi, then signed into my google account (still on the setup) and then onto the next screen about google using my location, and then Settings FC'd. Since then I've been in a loop of going back to the start of the Setup menu, never getting further than the language screen again. I will reboot and see if that helps. Failing that, I'll re-flash with JUST the rom, and see if it sets up ok. If so, I suppose I won't need the patch afterall!
I'll keep you updated.
Firerat said:
yes, my latest will copy app, app_s, app-private and dalvik-cache from the ext partition to /data
( unless it finds that they are all too big, in which case you are still g1 with broken keyboard but your gota have *a lot* of apps before that happens )
But as I only have a G1 I have not been able to test it properly, but the logic is straight forward so fingers crossed I have not missed a typo...
Click to expand...
Click to collapse
I flashed it as I was typing, just outta curiosity, and its seeming to work properly. Good work sir!
Thanks!! I'll try it out on superD and tell you how it goes
DanGrover said:
Hmm. I'm having a problem with it. Well, maybe with it. So the first time I wiped, repartitioned with just a swap (190mb) and the rest as fat32. I flashed Rom, then flashed your patch, then flashed the vega kernal patch. Booted up, it all worked, past the HTC quietly brilliant screen, but then sat there on the black HTC bit. If I let the screen sleep, it looked like Sense had loaded, but when I unlocked it it was still sitting there on the black HTC screen with Clock repeatedly FC'ing. So I wiped, reflashed this time just the Rom and the Patch and this time it's getting to the setup screen. It was working fine. I connected to wifi, then signed into my google account (still on the setup) and then onto the next screen about google using my location, and then Settings FC'd. Since then I've been in a loop of going back to the start of the Setup menu, never getting further than the language screen again. I will reboot and see if that helps. Failing that, I'll re-flash with JUST the rom, and see if it sets up ok. If so, I suppose I won't need the patch afterall!
I'll keep you updated.
Click to expand...
Click to collapse
Further to this, I rebooted and let it sit for a while, then tried again. I got as far as the Facebook sync bit on the Setup but no dice, FC settings and back to the start. So I wiped and re-flashed just the rom, which has now been sitting on the HTC Quietly Brilliant screen for about 15 minutes. The only option I haven't tried yet is installing Legend2g1 + the Vega patch, booting and seeing if it works.
DanGrover said:
Further to this, I rebooted and let it sit for a while, then tried again. I got as far as the Facebook sync bit on the Setup but no dice, FC settings and back to the start. So I wiped and re-flashed just the rom, which has now been sitting on the HTC Quietly Brilliant screen for about 15 minutes. The only option I haven't tried yet is installing Legend2g1 + the Vega patch, booting and seeing if it works.
Click to expand...
Click to collapse
try one of my Legend for NoneDangerSPLs
link in my sig
they are using an MT3G friendly a2sd out of the box, but without the apps back to data part
Firerat! This is AWESOME!!!!! I've needed this for a while, but my experience of bash scripting is less than mediocre.
I have 3 questions:
1) To make this usable on g1, I can just remove the ro.getprop section, correct? or do I need to change it instead of removing it?
2) To guess whether or not my /data folder will even fit on the g1, can I simply extract the zip and look at the file size of "data" folder inside, or is there something more? and if that barely fits, will dalvik-cache still go on sd?
3) If I am installing a bunch of apps and it fills up /data (assuming I am using this script), then will the "move apps and dalvik-cache to sd" option in amon_ra work?
Thanks man!
jcarrz1 said:
Firerat! This is AWESOME!!!!! I've needed this for a while, but my experience of bash scripting is less than mediocre.
I have two questions:
1) To make this usable on g1, I can just remove the ro.getprop section, correct? or do I need to change it instead of removing it?
Click to expand...
Click to collapse
Out of the box it will work with G1s and MT3Gs, that's the idea One Script two phones.
jcarrz1 said:
2) To guess whether or not my /data folder will even fit on the g1, can I simply extract the zip and look at the file size of "data" folder inside, or is there something more? and if that barely fits, will dalvik-cache still go on sd?
Thanks man!
Click to expand...
Click to collapse
with a G1 I let everything go to sd,
but if I work out that dalvik-cache will fit on data , leaving 10mb free I keep it on data
I do need to tweak it a little, the Legend Cache Hacks I have done need a reboot to push dalvik-cache to sd
And , in future ( providing DEVs adopt it ) all system apps can go to system
check my Eris / Legend on NoneDangerSPL in sig for more info
I can recommend the ErisCacheHack, and Legend for NoneDanger
( DangerLegend is still wip, but I'm hoping my latest works )
jcarrz1 said:
3) If I am installing a bunch of apps and it fills up /data (assuming I am using this script), then will the "move apps and dalvik-cache to sd" option in amon_ra work?
Thanks man!
Click to expand...
Click to collapse
yeah, it should do, the a2sd will move the dalvik-cache back if it thinks there is enough space, but at the moment it won't touch the apps
I am going to develop the a2sd a little more, and get it to auto move apps between data/sd depending on size
I kind of hint at that in the comments in the last function
but one of my goals is to get unionfs going, having some apps on internal and some on SD
it will also make the cache hack much easier
I'd just flash a linux base, the android being a tarball, and extract the android on first boot into a unionfs, if I'm right, the files will automagicaly go to where space is available
failing that, I have other ideas
Firerat said:
but one of my goals is to get unionfs going, having some apps on internal and some on SD
Click to expand...
Click to collapse
If working unionfs for a2sd search XDA (in particular, this forum) first. It's been done but was found wanting from a performance standpoint--you may as well build on that experience. You might also see if you get better results from aufs.
Firerat said:
yeah, it should do, the a2sd will move the dalvik-cache back if it thinks there is enough space, but at the moment it won't touch the apps
I am going to develop the a2sd a little more, and get it to auto move apps between data/sd depending on size
I kind of hint at that in the comments in the last function
but one of my goals is to get unionfs going, having some apps on internal and some on SD
it will also make the cache hack much easier
I'd just flash a linux base, the android being a tarball, and extract the android on first boot into a unionfs, if I'm right, the files will automagicaly go to where space is available
failing that, I have other ideas
Click to expand...
Click to collapse
Thanks for the quick response. In regard to #1, if I wanted to make the script do what it usually does on mt3g happen on my g1, can I simply remove those lines?
Also, I'm testing the legend patch right now ON DANGER, but fyi the 4shared links for the prepatched rom don't work... that's why I did it myself. flashing.
hmm.. Ill flash this over the current rom im using i guess and ill see how it goes. using that SuperEclair 2.3. should i wipe before flashing or its unnecessary?
Shaquiel Harris said:
hmm.. Ill flash this over the current rom im using i guess and ill see how it goes. using that SuperEclair 2.3. should i wipe before flashing or its unnecessary?
Click to expand...
Click to collapse
this isn't something you flash, it's something you stick into /system/bin when you're cooking a rom... as far as I know...

Cannot install Debian... Need Help. Please.

Hey, looking at the Debian installation guides they are all OUTDATED.
I have Android 2.1 with SuperBad ROM... I got the debian installer... but I have had speed bumps like problems while chmod'ing and i had to like run the installer
press exit and then shbootdeb and I get this:
Code:
a888a
d888888b
8P YP Y88
8|o||o|88
8. .88
8 ._. Y8.
d/ 8b.
.dP . Y8b.
d8: ::88b.
d8 Y88b
:8P :888
8a. : _a88P
._/ Yaa_ : .| 88P|
\ YP | 8P \.
/ \._____.d| .|
--..__)888888P ._.|
mount: can't setup loop device: No such file or directory
mount: mounting devpts on /data/local/mnt/dev/pts failed: No such file or directory
mount: mounting proc on /data/local/mnt/proc failed: No such file or directory
mount: mounting sysfs on /data/local/mnt/sys failed: No such file or directory
Custom Linux Pseudo Bootstrapper V1.0 - by Mark Walker
WEB: http://www.androidfanatic.com
EML: [email protected]
Starting init process
INIT: Debian booting.....
Running Linux Kernel
net.ipv4.ip_forward = 1
AutoMounter started
Type EXIT to end session
Make sure you do a proper EXIT for a clean kill of Debian!
chroot: can't execute '/bin/bash': No such file or directory
umount: can't forcibly umount /data/local/mnt/dev/pts: No such file or directory
umount: can't forcibly umount /data/local/mnt/proc: No such file or directory
umount: can't forcibly umount /data/local/mnt/sys: No such file or directory
umount: can't forcibly umount /data/local/mnt: Invalid argument
Filesystems have unmounted
losetup: /dev/block/loop2: No such device or address
Loopback device shutdown - success
Debian down
Coded by Mark Walker
http://www.androidfanatic.com
admin.androidfanatic.com
Reverted back to Android console
#
Anyone.. i saw something about mod ext2 and it doesnt work. Anyone wanna help? I have a 32B Tmobile G1...
losetup /dev/block/loop7 /sdcard/debian/debian.img
mount -t ext4 /dev/block/loop7 /data/local/mnt
chroot /data/local/mnt /bin/bash
xulihang said:
losetup /dev/block/loop7 /sdcard/debian/debian.img
mount -t ext4 /dev/block/loop7 /data/local/mnt
chroot /data/local/mnt /bin/bash
Click to expand...
Click to collapse
wanna explain that?

[Script] Chroot Control Script

One of the fun things you can do on your Android device, is to play around with different ways of getting a real distro (Debian, Ubuntu etc.) working along side the Android system. There are several (A lot) of tutorials in here on how to do this, so this part will not be covered here. This thread only contains some scripts that will help make it easier working with the chroot.
Most of the scripts that comes with the endless pool of chroot tutorials, is only made to mount and unmount the distro image in the most simple way. But nothing that helps walking in and out of the chroot without mount/unmount, and nothing that takes different services, busy devices etc. into consideration.
The debian.sh script in this thread has many tasks. It will on execution check to see if the image is mounted or not. If the image is mounted, it will just enter the chroot. If not, it will mount the image and then enter the chroot. On exit it will provide you with the option of exiting the chroot or exit and unmount.
Also it provides 4 custom scripts that is placed and executed inside the chroot. One for mount, unmount, enter chroot, leave chroot. This makes it possible to control chroot services much easier.
The script debian.sh is executed using the command "debian". You can also unmount the chroot from within the android shell by executing "debian unmount" instead of entering the chroot and then exit choosing to unmount.
The unmount process has several and different unmount attempts in case of busy devices, running services etc. which will make sure that the chroot is successfully unmounted.
File: /system/bin/debian
Code:
#!/system/bin/sh
su -c "/system/bin/debian.sh [email protected]"
File: /system/bin/debian.sh
Code:
#!/system/bin/sh
createLinuxBoot() {
if [ ! -f $FILESYSTEM ]; then
echo "Missing the $DIST filesystem image!"
return 0
elif [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# If the loop device is already mounted, we do nothing.
echo " - $DIST is already mounted. Entering chroot..."
else
echo " - Executing mount proccess of $DIST..."
if [ ! -d $MOUNTPOINT ]; then
# Create the mount point if it does not already exist
busybox mkdir -p $MOUNTPOINT 2> /dev/null
if [ ! -d $MOUNTPOINT ]; then
echo "It was not possible to create the missing mount location ($MOUNTPOINT)!"
return 0
fi
fi
# 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 [ ! -e /dev/loop0 ]; then
for i in 0 1 2 3 4 5 6 7
do
# Create each block device
mknod /dev/loop$i b 7 $i
done
fi
# Android also placed the frame buffer in /dev/grapichs instead of /dev
if [ ! -e /dev/fb0 ]; then
mknod /dev/fb0 b 29 0
fi
# Locate the current loop device file
if [ ! -z "$(losetup | grep "$FILESYSTEM")" ]; then
# If the filesystem file is already attached to an loop device, we get the path to the device file.
loblk=$(losetup | grep "$FILESYSTEM" | cut -d ":" -f 1)
else
# If the filesystem file is not yet attached, we attach it.
loblk=$(losetup -f)
losetup $loblk $FILESYSTEM 2> /dev/null
# Make sure that the device was successfully attached to a loop device file
if [ -z "$(losetup | grep "$FILESYSTEM")" ]; then
echo "It was not possible to attach the $DIST filesystem to a loop device!"
return 0
fi
fi
# Mount the filesystem
mount $loblk $MOUNTPOINT 2> /dev/null
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# Bind some Android dirs to the linux filesystem
for i in $MOUNT_BIND
do
# Bind the dirs if they are not already binded
if [ -z "$(mount | grep "$MOUNTPOINT/$i ")" ]; then
# Create any missing dirs in the mountpoint
if [ ! -d $MOUNTPOINT/$i ]; then
busybox mkdir -p $MOUNTPOINT/$i 2> /dev/zero
fi
mount --bind /$i $MOUNTPOINT/$i
fi
done
# FIX the "stdin: is not a tty" error in direct hadware case.
if [ -z "$(mount | grep "$MOUNTPOINT/dev/pts ")" ]; then
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.
rm -rf $MOUNTPOINT/tmp/*
else
echo "It was not possible to mount $DIST at the specified location ($MOUNTPOINT)!"
return 0
fi
if [ -f $MOUNTPOINT/etc/init.chroot/rc_mount.sh ]; then
# Execute the mount init file, if it exists
chroot $MOUNTPOINT /etc/init.chroot/rc_mount.sh
fi
echo " - $DIST was successsfully mounted. Entering chroot..."
fi
return 1
}
removeLinuxBoot() {
if [ -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# If linux is not mounted, then do nothing.
echo " - $DIST is already unmounted. Exiting..."
else
echo " - Executing unmount process of $DIST..."
if [ -f $MOUNTPOINT/etc/init.chroot/rc_unmount.sh ]; then
# Execute the unmount init script, if it exist.
chroot $MOUNTPOINT /etc/init.chroot/rc_unmount.sh
fi
sync
# The sleep part is very important. It may take some time before /dev is no longer busy
# after executing some services in the rc_unmount.sh script.
sleep 1
# Make sure that we have an loop device file to use
if [ ! -z "$(losetup | grep "$FILESYSTEM")" ]; then
# Get the loop device file
loblk=$(losetup | grep "$FILESYSTEM" | cut -d ":" -f 1)
for i in $UMOUNT_BIND
do
# Unmount all binding dirs
if [ ! -z "$(mount | grep "$MOUNTPOINT/$i ")" ]; then
umount $MOUNTPOINT/$i 2> /dev/zero
fi
done
sync
# Unmount the device
# In most cases one umount attempt will be enough.
# However it may take up to 3 tries in order to make it work.
# It depends on the types of services running or has been running before unmounting.
umount $MOUNTPOINT 2> /dev/null && sleep 1 2> /dev/zero
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
sync
umount $MOUNTPOINT 2> /dev/null && sleep 1 2> /dev/zero
fi
# If the device could not be unmounted
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
echo " - Unable to unmount $DIST. Will attempt to kill attached processes..."
# Try to kill all processes holding the device
fuser -k -9 $loblk
sync
# Use umount with the -l option to take care of the rest
umount -l $MOUNTPOINT 2> /dev/null && sleep 1
fi
# Make sure the device has been successfully unmounted
if [ -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# Try to detach the device from the loop device file
losetup -d $loblk 2> /dev/null
# Make sure that the device was successfully detached
if [ -z "$(losetup | grep "$FILESYSTEM")" ]; then
echo "$DIST has been successfully unmounted!"
else
echo "$DIST has been successfully unmounted, but was not able not detach the loop device!"
fi
else
echo "$DIST could not be successfully unmounted!"
fi
else
echo "Could not locate the loop device. $DIST was not unmounted!"
fi
fi
}
if [ -z "$EXPORTED" ]; then
export EXPORTED="TRUE"
# Basic needed variables
export TERM=linux
export HOME=/root
export USER=root
export LOGNAME=root
export UID=0
export SHELL=bash
# Here you can add all of the paths that should be binded. One list for mount and one reversed list for unmount.
export MOUNT_BIND="dev dev/pts dev/cpuctl proc sys sys/kernel/debug system d vendor acct sdcard cache sd-ext data"
export UMOUNT_BIND="dev/cpuctl dev/pts dev proc sys/kernel/debug d sys vendor acct sdcard cache sd-ext system data"
# Here you can change mount and image paths
export DIST="Debian" # The name of the distro. Is used for the messages.
export FILESYSTEM=/mnt/sdcard/debian.img # Path to the distro image file
export MOUNTPOINT=/data/debian # Path where the distro is to be mounted
fi
export OLDPATH=$PATH
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/root/bin:$PATH
if [ "$1" = "unmount" ]; then
removeLinuxBoot
else
createLinuxBoot
if [ $? -eq 1 ]; then
if [ -f $MOUNTPOINT/etc/init.chroot/rc_enter.sh ]; then
chroot $MOUNTPOINT /etc/init.chroot/rc_enter.sh
fi
chroot $MOUNTPOINT /bin/bash -i
if [ -f $MOUNTPOINT/etc/init.chroot/rc_leave.sh ]; then
chroot $MOUNTPOINT /etc/init.chroot/rc_leave.sh
fi
echo -n " - Type [Y] to unmount $DIST or random key to exit chroot ]# "
read ACTION
if [ "$ACTION" = "y" ] || [ "$ACTION" = "Y" ]; then
removeLinuxBoot
fi
fi
fi
# Restore the PATH variable when executing chroot
export PATH=$OLDPATH
By default debian.sh will look for /mnt/sdcard/debian.img and mount it at /data/debian
The script has build-in first-time-install functionality that will create missing directories etc. Just change the variable "FILESYSTEM" in debian.sh to the correct path and filename of your distro image, and it will handle the rest.
Chroot Init Scripts
Inside your chroot, you can create the directory /etc/init.chroot and create the fallowing files.
rc_mount.sh - Executed after mount
rc_unmount.sh - Executed before unmount
rc_enter.sh - Executed when entering chroot
rc_leave.sh - Executed when leaving chroot
Here are an example of a mount and unmount script used to control tightvncserver.
File: (chroot) /etc/init.chroot/rc_mount.sh
Code:
#!/bin/sh
# Make sure that the vncserver is completly stopped before starting.
if [ ! -f /tmp/.X11-unix/X1 ] && [ ! -f /tmp/.X1-lock ]; then
# Start vncserver
vncserver -geometry 800x480 :1
else
# This is in case something went wrong the last time
# it was shut down. Perhaps an uncomplete unmount.
vncserver -kill :1 2> /dev/zero
unset /tmp/.X11-unix/X1 2> /dev/zero 2> /dev/zero
unset /tmp/.X1-lock 2> /dev/zero 2> /dev/zero
vncserver -geometry 800x480 :1
fi
File: (chroot) /etc/init.chroot/rc_unmount.sh
Code:
#!/bin/sh
# Only stop this if it is started
if [ -f /tmp/.X11-unix/X1 ] || [ -f /tmp/.X1-lock ]; then
vncserver -kill :1
# Make sure that these are removed
unset /tmp/.X11-unix/X1 2> /dev/zero
unset /tmp/.X1-lock 2> /dev/zero
fi
Using these scripts, the VNC Server is started on chroot mount and stopped on chroot unmount. You can still leave and enter the chroot keeping the VNC Server running.

Android 10_Q system-as-root

As the thread starter state's...
Android 10 'System-As-Root' was never supposed to be released. Google it.
It never was. Nothing wrong with my fone. boot-debug.img IS the system-as-root, it just isnt a root app.
User-debug will be tied to your account, so dont expect to see them ever again...
So many naysayers saying my fone company got it wrong, that my fone is fecked up...
Na.. System-As-Root = root, as good as it's ever gonna be in the open, provided by boot-debug.
You have root but cant flash a dynamic /system. Magisk KILL's Developer/Feature Flags. With stock boot, feature flags is seen, but shows 'experimental' nothing else. With boot-debug, all feature flags are shown. First thing you'll do is flash magisk. Why does magisk remove this access? In particular for YOU is 'settings-dynamic-system' (used to overlay your gsi - needed to flash gsi). Without these feature flags to set, how will your magisk'd fone boot gsi on system-as-root a-only? It cant. Uninstall magisk... but magisk leaves traces on the fone that prevent earlier versions of magisk being installed, so how can we test earlier versions? That we know worked before?
Magisk'd boot removes the feature flags section from developer menu in Android 10_Q. Why?
This is needed to mount any gsi on an 'a-only' 'system-as-root', by mounting to 'upper' partition, which wipes when re-flashing stock boot.img. Do the work in the upper (like we do in twrp) reflash to the lower after 'sync' will retain your work before reflashing stock boot.img, so no root app needed, but we need one to cut down on how tedious it all is now.. at least they keep you at home... safe lol...
Magisk is only using overlay because it works in pie... in fact, all using magisk are using PIE exploits that dont work in android 10 system as root!! (just a noticed warning )
SystemRW works in PIE, even works in my system-as-root but useless, cause the point, being able to write system while in fone gui, is negated by the fact that system is ro, in about 20 different locations, in about a billion different mount points and well... right down to file sizes for each file in each partition contained within the super.img, but what I dont get is why it works in twrp, yet not in the gui.. (i'm in the directory so cant mount it when using fone, duh...)
As for the other tool to create rw in the super partition, I'll say this:
Pie is dying. Re-write your apps to work with the android 10 super, which is NOT the same as PIE super.img... (this is not a super.img ring any bell's?)
Both rw tool authors stuck on them damn pie's.. I'd swap parted to get the auto resize of space on the fly, I'd give my 10 cents worth, but you know better... if they kill all fones previous to android 10... google win.
They gave us root.
Overlay your own tools!
In a system-as-root booted fone. Feck safety net, I use my nokia 8310 to this day..
And for the naysayers...
D:\0\AdbStation>adb reboot download
D:\0\AdbStation>fastboot flashing unlock_critical
(bootloader) Start unlock flow
OKAY [ 4.196s]
Finished. Total time: 4.196s
D:\0\AdbStation>fastboot --disable-verity --disable-verification flash boot boot
-debug.img
Sending 'boot' (32768 KB) OKAY [ 0.764s]
Writing 'boot' OKAY [ 0.515s]
Finished. Total time: 1.420s
D:\0\AdbStation>fastboot -w
Erasing 'userdata' OKAY [ 0.452s]
mke2fs 1.46.2 (28-Feb-2021)
Creating filesystem with 6311931 4k blocks and 1581056 inodes
Filesystem UUID: aa3b871c-2496-11ec-9dd6-d71d0c30be37
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
Sending 'userdata' (180 KB) OKAY [ 0.016s]
Writing 'userdata' OKAY [ 0.047s]
Erasing 'cache' OKAY [ 0.016s]
mke2fs 1.46.2 (28-Feb-2021)
Creating filesystem with 110592 4k blocks and 110592 inodes
Filesystem UUID: aa63fe86-2496-11ec-99f6-f719dec4c630
Superblock backups stored on blocks:
32768, 98304
Allocating group tables: done
Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done
Sending 'cache' (68 KB) OKAY [ 0.016s]
Writing 'cache' OKAY [ 0.031s]
Erasing 'metadata' OKAY [ 0.016s]
Erase successful, but not automatically formatting.
File system type raw data not supported.
Finished. Total time: 0.889s
D:\0\AdbStation>fastboot reboot
Rebooting OKAY [ 0.000s]
Finished. Total time: 0.000s
D:\0\AdbStation>adb disable-verity
Error getting verity state. Try adb root first?
D:\0\AdbStation>adb root
restarting adbd as root
D:\0\AdbStation>adb shell
Armor_X5_Q:/ # whoami
root
Armor_X5_Q:/ # mount -o rw,remount /
'/dev/block/dm-3' is read-only
Armor_X5_Q:/ # mount -o rw,remount /sys
Armor_X5_Q:/ # cd sys
Armor_X5_Q:/sys # ls
block bus dev firmware kernel mtk_rgu
bootinfo class devices fs module power
Armor_X5_Q:/sys # bootinfo
/system/bin/sh: bootinfo: inaccessible or not found
127|Armor_X5_Q:/sys # bootinfo --help
/system/bin/sh: bootinfo: inaccessible or not found
127|Armor_X5_Q:/sys # devices
/system/bin/sh: devices: inaccessible or not found
127|Armor_X5_Q:/sys # cd dev
Armor_X5_Q:/sys/dev # ls
block char
Armor_X5_Q:/sys/dev # cd /
Armor_X5_Q:/ # cd /
Armor_X5_Q:/ # ls
acct d init.environ.rc metadata sbin
apex data init.rc mnt sdcard
bin debug_ramdisk init.usb.configfs.rc odm storage
bugreports default.prop init.usb.rc oem sys
cache dev init.zygote32.rc proc system
charger etc init.zygote64_32.rc product ueventd.rc
config init lost+found product_services vendor
Armor_X5_Q:/ # cd system
Armor_X5_Q:/system # cd bin
Armor_X5_Q:/system/bin # ls
AudioSetParam hwclock printenv
abb hwservicemanager printf
acpi i2cdetect procrank
adbd i2cdump profman
aee i2cget ps
aee_aed i2cset pwd
aee_aed64 iconv racoon
aee_archive id readlink
aee_core_forwarder idmap realpath
aee_dumpstate idmap2 reboot
am idmap2d recovery-persist
apexd ifconfig renice
app_process ime requestsync
app_process32 incident resize.f2fs
app_process64 incident_helper resize2fs
applypatch incidentd restorecon
appops init rm
appwidget inotifyd rmdir
art_apex_boot_integrity input rmmod
ashmemd insmod rss_hwm_reset
atrace install rtt
audioserver install-recovery.sh run-as
auditctl installd runcon
awk ionice schedtest
badblocks iorapd screencap
base64 iorenice screenrecord
basename ip sdcard
batterywarning ip-wrapper-1.0 secdiscard
bc ip6tables secilc
bcc ip6tables-restore sed
blank_screen ip6tables-save sendevent
blkid ip6tables-wrapper-1.0 sensorservice
blockdev iptables seq
bmgr iptables-restore service
boot_logo_updater iptables-save servicemanager
bootstat iptables-wrapper-1.0 setenforce
bootstrap keystore setprop
bpfloader keystore_cli_v2 setsid
bu kill settings
bugreport killall sgdisk
bugreportz kpoc_charger sh
bunzip2 lbs_dbg sha1sum
bzcat lcdc_screen_cap sha224sum
bzip2 ld.mc sha256sum
cal librank sha384sum
cameraserver linker sha512sum
cat linker64 showmap
charger linker_asan simpleperf
chcon linker_asan64 simpleperf_app_runner
chgrp lmkd sleep
chmod ln sload_f2fs
chown load_policy sm
chroot locksettings sort
chrt log split
cksum logcat ss
clatd logd sspm_log_writer
clear loghidlsysservice st_factorytests
cmd logname start
cmp logwrapper stat
comm losetup statsd
connsyslogger lpdump stop
content lpdumpd storaged
cp ls strings
cpio lshal stty
crash_dump32 lsmod surfaceflinger
crash_dump64 lsof svc
cut lspci swapoff
dalvikvm lsusb swapon
dalvikvm32 make_f2fs sync
dalvikvm64 md5sum sysctl
date mdlogger tac
dd mdnsd tail
debuggerd media tar
defrag.f2fs mediadrmserver taskset
device_config mediaextractor tc
devmem mediametrics tc-wrapper-1.0
dex2oat mediaserver tcpdump
dexdiag met-cmd tee
dexdump met_log_d telecom
dexlist microcom terservice
dexoptanalyzer migrate_legacy_obb_data.sh thermald
df mini-keyctl time
diff mkdir timeout
dirname mke2fs tombstoned
dmctl mkfifo toolbox
dmesg mkfs.ext2 top
dnsmasq mkfs.ext3 touch
dos2unix mkfs.ext4 toybox
dpm mknod tr
drmserver mkswap traced
du mktemp traced_probes
dumpstate mobile_log_d trigger_perfetto
dumpsys modemdbfilter_client true
e2fsck modinfo truncate
e2fsdroid modprobe tty
echo monkey tune2fs
egrep more tzdatacheck
emdlogger1 mount ueventd
emdlogger2 mountpoint uiautomator
emdlogger3 move_widevine_data.sh ulimit
emdlogger5 mtkbootanimation umount
env mtpd uname
expand mv uncrypt
expr nc uniq
fallocate ndc unix2dos
false ndc-wrapper-1.0 unlink
fgrep netcat unshare
file netd unzip
find netdiag uptime
flags_health_check netstat usbd
flock netutils-wrapper-1.0 usleep
fmt newfs_msdos uudecode
free nfcstackp uuencode
fsck.f2fs nice uuidgen
fsck_msdos nl vdc
fsverity_init nohup viewcompiler
fsync notify_traceur.override.sh vintf
gatekeeperd notify_traceur.sh vmstat
getconf nproc vold
getenforce nsenter vold_prepare_subdirs
getevent oatdump vr
getprop od vtservice
gpuservice oem-iptables-init.sh wait_for_keymaster
grep paste watch
groups patch watchdogd
gsi_tool perfetto wc
gsid pgrep which
gunzip pidof whoami
gzip ping wificond
head ping6 wm
heapprofd pkill xargs
hid pm xxd
hostname pmap yes
hw pppd zcat
Armor_X5_Q:/system/bin # getenforce
Enforcing
Armor_X5_Q:/system/bin # setenforce 0
Armor_X5_Q:/system/bin # get enforce
/system/bin/sh: get: inaccessible or not found
127|Armor_X5_Q:/system/bin # getenforce
Permissive
Armor_X5_Q:/system/bin # root mofo's, System-As-Root! boot-debug rocks!
> ^C
130|Armor_X5_Q:/system/bin # Who needs su
/system/bin/sh: Who: inaccessible or not found
127|Armor_X5_Q:/system/bin # whoami
root
Armor_X5_Q:/system/bin #

Categories

Resources