Experiments with GB Kernel - Milestone 2 Android Development

I'm opening this thread to share information about experiments with the new GB kernel with other devs/contributors of M2 community.
Based on the idea of dual-booting I managed today to get my phone running using system directly from an image on /data.
The base system installed is boot/devtree/recovery from signed GB Leak with Mostly Blurless ROM. I created an image from this same system with dd if=/dev/block/system of=/data/blurless.img.
I then edited bootmenu 2nd-int init.rc to:
- comment lines that mount /data and /system
- added the following lines:
Code:
mount ext3 [email protected] /data nosuid nodev noatime nodiratime barrier=0
mount ext3 [email protected]/data/blurless.img /system noatime nodiratime barrier=1
In init.mapphone_umts.rc:
- commented lines that remounts /system
- added following line:
Code:
mount ext3 [email protected]/data/blurless-system.img /system ro noatime nodiratime remount
In /system/bootmenu/scripts/2nd-init.sh:
Code:
#!/sbin/sh
######## BootMenu Script v0.8.6
######## Execute [2nd-init] Menu
export PATH=/sbin:/system/xbin:/system/bin
######## Main Script
rm /*.rc
cp -r -f /system/bootmenu/2nd-init/* /
cp -fp /system/bootmenu/binary/2nd-init /sbin/
chmod 755 /*.rc
#chmod 755 /system/bootmenu/binary/2nd-init
chmod 755 /sbin/2nd-init
umount /acct
umount /mnt/asec
umount /dev/cpuctl
umount /dev/pts
umount /mnt/obb
## sbin cleanup
## move post_bootmenu.sh
#/system/bootmenu/binary/2nd-init
umount -l /system
/sbin/2nd-init
exit
Works fine and system is really mounted on loopback device after boot. Now I want to mount on init.rc /data as a bind fs. Does anyone know how to do that as a init.rc script command?
As a test I tried
mount ext3 [email protected]/data/system /mnt/data
but it didn't work

Ok. I found a way to do that mounting data first as /mnt/data then mounting loopback system. with system ready I can mount bind /data with the following command:
exec /system/xbin/busybox mount -obind /mnt/data/rom/blurless-data /data
I'd like better to mount this with a native init command if anybody knows how to, but for the moment this will do.

It doesn't work because bind is not supported by the original mount command ?
Anyway, may be you can do symlink with the data directory .
But good job allowing us to test img system without breaking existing one !

Trying now to boot MIUI on a second system image I get the following error:
08-26 21:06:40.773 2971 2979 E FramebufferNativeWindow: couldn't open framebuffer HAL (No such device)
I'm not sure if this error was caused by kernel incompatibility or by some special file libsurfaceflinger could not find. Doing strings | grep on libsurfaceflinger.so from miui I could find this references:
/dev/tty0
/sys/android_power/wait_for_fb_sleep
/sys/android_power/wait_for_fb_wake
/sys/class/graphics/fbcon
/sys/power/wait_for_fb_sleep
/sys/power/wait_for_fb_wake
Maybe we can map old devices to new devices (ln -s) at run time and make it work but I don't know exactly how to map them.
Edit: I am unable to create anything in /sys, even mounting it as RW. Does n1 know what I should do?

Yeah! You rule!

r2beta0 said:
Trying now to boot MIUI on a second system image I get the following error:
08-26 21:06:40.773 2971 2979 E FramebufferNativeWindow: couldn't open framebuffer HAL (No such device)
I'm not sure if this error was caused by kernel incompatibility or by some special file libsurfaceflinger could not find. Doing strings | grep on libsurfaceflinger.so from miui I could find this references:
/dev/tty0
/sys/android_power/wait_for_fb_sleep
/sys/android_power/wait_for_fb_wake
/sys/class/graphics/fbcon
/sys/power/wait_for_fb_sleep
/sys/power/wait_for_fb_wake
Maybe we can map old devices to new devices (ln -s) at run time and make it work but I don't know exactly how to map them.
Edit: I am unable to create anything in /sys, even mounting it as RW. Does n1 know what I should do?
Click to expand...
Click to collapse
Ok. for your system find all it needs, you have to "bind" (by anyway i think) /proc and /sys . Like a normal linux when you do a chroot. I don't know the exact order of execution of your script, but before anything else, you must have proper /proc , /sys ,/dev . For example, here it what we need in to do in linux,
#!/bin/bash
mount --bind /dev /répertoire-vers-votre-chroot/dev
mount --bind /dev/pts /répertoire-vers-votre-chroot/dev/pts
mount --bind /dev/shm /répertoire-vers-votre-chroot/dev/shm
mount -t proc none /répertoire-vers-votre-chroot/proc
mount -t sysfs none /répertoire-vers-votre-chroot/sys
As you can't bind them with mount, try the symlink , it might work (i dont see why not) . These directories are created by the kernel , maybe there are other in android , i don't know.
Try that and let me know , it should do the trick !
Edit: i read too fast! It couldnt be that, as you dont change / .

r2beta0 said:
Trying now to boot MIUI on a second system image I get the following error:
08-26 21:06:40.773 2971 2979 E FramebufferNativeWindow: couldn't open framebuffer HAL (No such device)
I'm not sure if this error was caused by kernel incompatibility or by some special file libsurfaceflinger could not find. Doing strings | grep on libsurfaceflinger.so from miui I could find this references:
/dev/tty0
/sys/android_power/wait_for_fb_sleep
/sys/android_power/wait_for_fb_wake
/sys/class/graphics/fbcon
/sys/power/wait_for_fb_sleep
/sys/power/wait_for_fb_wake
Maybe we can map old devices to new devices (ln -s) at run time and make it work but I don't know exactly how to map them.
Edit: I am unable to create anything in /sys, even mounting it as RW. Does n1 know what I should do?
Click to expand...
Click to collapse
Isn't MIUI and CM7 running on top of froyo kernel/dev tree?
I remember I got the same HAL issue when I tried to run unsigned GB on froyo kernel. I assume trying to run froyo based rom's on 2.3.4 kernel will show the same issues.

n3ptun3 said:
Isn't MIUI and CM7 running on top of froyo kernel/dev tree?
I remember I got the same HAL issue when I tried to run unsigned GB on froyo kernel. I assume trying to run froyo based rom's on 2.3.4 kernel will show the same issues.
Click to expand...
Click to collapse
Hm... maybe you're right. The new nightly CM from Defy should work with GB kernel I think.
Sent from my Milestone 2 XDA App

dangpzanco said:
Hm... maybe you're right. The new nightly CM from Defy should work with GB kernel I think.
Sent from my Milestone 2 XDA App
Click to expand...
Click to collapse
I wouldn't bet on it. 2nd-init might be GB ready, but Defy's CM7 is still built over a froyo base. If I have time this weekend I'll experiment on D2G CM7 with GB base.

Just let GB kernel boot CM7. ch-2.2 kernel suck in touch screen.

n3ptun3 said:
I wouldn't bet on it. 2nd-init might be GB ready, but Defy's CM7 is still built over a froyo base. If I have time this weekend I'll experiment on D2G CM7 with GB base.
Click to expand...
Click to collapse
I can't boot CM7 0826 nightly bulid with both ch-2.2.2/GB kernels. Anyone know why? The author has changed the 2nd-init?
Edit: I think I know why. The author delete 2nd-init in /binary. So we need to change the boot method to 2nd-boot. GB kernel isn't suported yet.

Endless7 said:
Edit: I think I know why. The author delete 2nd-init in /binary. So we need to change the boot method to 2nd-boot. GB kernel isn't suported yet.
Click to expand...
Click to collapse
That seems to be a mistake and was fixed in 3e3c820adecf812e3dfea872a184f5f428fd4fbc (Allow 2nd-init support with bootmenu, which is stored in system image). It was caused by heavy restructuring of the motorola common boot-code in the CM7 repository. Just copy my 2nd-init into the binary directory, and you should be fine.

pat972 said:
Ok. for your system find all it needs, you have to "bind" (by anyway i think) /proc and /sys . Like a normal linux when you do a chroot. I don't know the exact order of execution of your script, but before anything else, you must have proper /proc , /sys ,/dev . For example, here it what we need in to do in linux,
#!/bin/bash
mount --bind /dev /répertoire-vers-votre-chroot/dev
mount --bind /dev/pts /répertoire-vers-votre-chroot/dev/pts
mount --bind /dev/shm /répertoire-vers-votre-chroot/dev/shm
mount -t proc none /répertoire-vers-votre-chroot/proc
mount -t sysfs none /répertoire-vers-votre-chroot/sys
As you can't bind them with mount, try the symlink , it might work (i dont see why not) . These directories are created by the kernel , maybe there are other in android , i don't know.
Try that and let me know , it should do the trick !
Edit: i read too fast! It couldnt be that, as you dont change / .
Click to expand...
Click to collapse
It's a good idea, as I can bind filesystems using busybox mount. It needs just some engineering into 2nd-init script like copying busybox to /sbin and forcing umount of /dev /proc and /sys, but it can be done.
How do I clone /sys to some other folder like /data/sys? I tried with 'cp -a' but it doesn't work fine. As I see I have to clone /sys and make some symlinks on this clone. Then I bind it with original /sys on init.rc. Is that right?

r2beta0 said:
It's a good idea, as I can bind filesystems using busybox mount. It needs just some engineering into 2nd-init script like copying busybox to /sbin and forcing umount of /dev /proc and /sys, but it can be done.
How do I clone /sys to some other folder like /data/sys? I tried with 'cp -a' but it doesn't work fine. As I see I have to clone /sys and make some symlinks on this clone. Then I bind it with original /sys on init.rc. Is that right?
Click to expand...
Click to collapse
I would not unmount /dev /proc and /sys, they are closely related to kernel init, in linux desktop it the first thing rc.sysinit does.
I was thinking more to something like "ln -s /sys/ /data/sys" , and one other solution i've just tested, is to do a "mount -n -t sysfs sys /data/sys -o nosuid,noexec,nodev" ! The difference for me is that with the mount command you'll not be able to umount /data/sys until reboot ! With the symlink you can just rm it when you finish.
The bind option is usefull cause when you do a chroot, you don't have access the other part of the system , so i'm not sure the symlink method work in that case. i'll ask and tell you.
Edit : I confirm It's that well about bind and chroot. and it seems to me , you can't create file in /sys , the kernel create them and you can read/change values. If you create one, it will not be taken in account by the kernel.
Also can you light up my lantern, which script in /system is called after the 2nd-init to launch the MIUI ?

pat972 said:
I would not unmount /dev /proc and /sys, they are closely related to kernel init, in linux desktop it the first thing rc.sysinit does.
I was thinking more to something like "ln -s /sys/ /data/sys" , and one other solution i've just tested, is to do a "mount -n -t sysfs sys /data/sys -o nosuid,noexec,nodev" ! The difference for me is that with the mount command you'll not be able to umount /data/sys until reboot ! With the symlink you can just rm it when you finish.
The bind option is usefull cause when you do a chroot, you don't have access the other part of the system , so i'm not sure the symlink method work in that case. i'll ask and tell you.
Edit : I confirm It's that well about bind and chroot. and it seems to me , you can't create file in /sys , the kernel create them and you can read/change values. If you create one, it will not be taken in account by the kernel.
Also can you light up my lantern, which script in /system is called after the 2nd-init to launch the MIUI ?
Click to expand...
Click to collapse
When you use bootmenu to start 2nd-init it will run a script called /system/bootmenu/script/2nd-init.sh. The last line of this script is 2nd-init binary itself. When you call 2nd-init binary it forks init on top of itself causing something like a hot restart. So, what 2nd-init script does is remount / as RW and copy new init.rc, init.mpaphone_umts.rc and init binary to /. Then it calls 2nd-init binary in order to use your custom files instead of stock ones. You can do anything you like on init.rc, as I did to boot MIUI from a loopback device. Unfortunately MIUI was compiled for froyo kernel and can't find some devices it needs to work. Thats why I need to create symlinks inside /sys and I think I already found a way to do that. Will test and explain that later.

Ok thanks !

Even with the new symlinks the system is unable to boot. As I suspected it is far more complicated then just adding links to /sys, too bad. I think the only way we have to boot multi-systems with multi-kernels (like miui on froyo and stock on gb) will be using kexec hack. n1 know if some group already found a way to run kexec on milestone or milestone2?

You can't rebuilt miui over a generic 2.6.32 kernel ? Well i'm a total newb in rom dev, i assume the officiel ginger from google won't work, you must have some specific hardware stuff ! For kexec it seems they have some driver problem, but since you want to boot the moto kernel may be it'll be easier !

pat972 said:
You can't rebuilt miui over a generic 2.6.32 kernel ? Well i'm a total newb in rom dev, i assume the officiel ginger from google won't work, you must have some specific hardware stuff ! For kexec it seems they have some driver problem, but since you want to boot the moto kernel may be it'll be easier !
Click to expand...
Click to collapse
MIUI is closed source, so only team members are able to rebuilt it
Do you know how can I use kexec to boot moto kernel?

r2beta0 said:
MIUI is closed source, so only team members are able to rebuilt it
Click to expand...
Click to collapse
This is illegal - violation of GPL license. If they modified Linux kernel they should give users source code to those modifications.

Related

Android init.rc Language

Hi XDA,
I havent found much on this topic on the forum. I wonder if anyone can elaborate or link me in the right direction regarding this issue.
Im working with Amon_Ra's latest 1.6.2 ROM. I unzipped it, took the boot.img, unpacked it, add a line in /etc/fstab and init.rc, repacked it, zipped the ROM, signed it, flashed it. But my changes dont seem to do the trick.
the following was added to init.rc
Code:
mount ext2 /dev/block/mmcblk0p2 /system/sd rw noatime nodiratime
and this was added to /etc/fstab
Code:
/dev/block/mmcblk0p2 /system/sd ext2 rw
Yes /system/sd exists, and Yes my microSD is partitioned correctly. I presume my line might be in wrong syntax? Or? Wiped before I flashed, didnt help.
If I've missed a thread on init.rc syntax I pardon that
Any help is appreciated!
altso tried,
Code:
mount ext2 [email protected] /system/sd
any suggestions at all?
bump, bump!
im running a motorola cliq, but i do know that the init.rc has the ability to start services.
You may want to try adding your lines into a script (shell script), and put that script into /system/bin
THEN add a command to open console and start that particular script, in init.rc
works for me with apps2sd for cliq.

[FIXED] full r/w access via overlay filesystem

Hey guys!
Together with some others at android-hilfe.de I'm working on an overlay filesystem for the Desire.
We've chosen aufs (Another Unionfs) to implement our idea.
Basically, two filesystems are combined to a single one.
The first filesystem contains the initial data. The second one is used to overlap it.
Aufs first searches the second for files, then the first. We plan to use a fully writeable filesystem for the second and a secured filesystem for the first.
If you want to modify a file on the first partition, you can put it on the second filesystem and change it there.
So we can get indirect write access to the secured filesystem by mounting the aufs partition to the right path so that the system sees it as the original, secured filesystem.
In theory, a full r/w acces to the all partions on the phone could be possible.
Visit the project site for files and instructions.
that is actually a pretty good idea... and would be awesome if it could be implemented i have no experience in android development and would therefore not be at much help there, but i could help you with testing, as i don't use my phone for any important stuff
antweb said:
Hey guys!
Together with some guys at android-hilfe.de I'm working on an overlay filesystem for the Desire.
We've chosen aufs (Another Unionfs) to implement our idea.
.......
We still could use some help, as for now we are only 2 active developers.
Click to expand...
Click to collapse
Nice thought. Wish i could help
Great idea, and it seems it should work and will obviate the need for a eng-SPL.
Have you tried it ? You seem to have all the necessary bits (you don't really need the utils) so i'm not sure what else you need at this point. This should work with adb in normal mode (ie not recovery) as you should be able to remount the system ontop of itself like so:
adb shell
first to get to your desire root shell. Then do
insmod aufs2
Then create some persistent storage on your sdcard
mkdir /sdcard/sysrw
Then mount the dir
mount -t aufs -o br=/sdcard/sysrw=rw:/system=ro none /system
you should now be able to write to /system, so try doing a
touch /system/foo
If that works, you should be away.
Clearly your modules you provide above will be specific to a certain kernel and with so many ROMS out there i can't say it will work with the one i have so you can try and report back.
Putting the persistent storage on the sdcard means that when it is mounted via usb you will loose access to it and bad things will happen.
Also remember if this works you need to add this to your init scripts
daveba said:
mount -t aufs -o br=/sdcard/sysrw=rw:/system=ro none /system
Click to expand...
Click to collapse
This step fails. All I get is
Code:
mount: No such Device
daveba said:
Clearly your modules you provide above will be specific to a certain kernel and with so many ROMS out there i can't say it will work with the one i have so you can try and report back.
Click to expand...
Click to collapse
Every ROM (with a custom kernel) will need some kernel patches anyways as otherwise many simbols are missing (and sure some other stuff, no clue what the aufs kernel patches do in detail). The attachements include a patched stock kernel. To try it out, you'll have to install the included kernel.
daveba said:
Also remember if this works you need to add this to your init scripts
Click to expand...
Click to collapse
Yep, thats the next step after I get a successful mount.
antweb said:
This step fails. All I get is
Code:
mount: No such Device
Click to expand...
Click to collapse
So it looks like the mount command doesn't accept 'none' as a non-device argument perhaps which i find strange since /proc is one of those also. Are you getting any messages from 'dmesg' or 'logcat' ?
My basic question:
If we use more and more the SD card, i believe we will drain more and more battery.
Apps2sd, system2sd etc
Or it is not draining more battery the extended sd usage?
billias said:
My basic question:
If we use more and more the SD card, i believe we will drain more and more battery.
Apps2sd, system2sd etc
Or it is not draining more battery the extended sd usage?
Click to expand...
Click to collapse
Not much stuff gets written to /system constantly. Just a few changes so you shouldn't see much of a drain.
Ok, so it looks like this actually works. You can't put the rw partition on a VFAT sdcard partiton only. SO in theory if you make a ext{123} partition on your sdcard it should work. For now i tried with the writeable mtd /data partition on my CM nightly and all works. Look:
Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo
-rw-rw-rw- 1 root root 0 Aug 8 20:30 /system/foo
A writeable /system !!!
And here is the real data on /data/rw
Code:
ls -l /data/rw/
-rw-rw-rw- 1 root root 0 Aug 8 20:30 foo
In theory Metamorph, adblock and all the rest that require /system should now work as expected.
daveba said:
Ok, so it looks like this actually works. You can't put the rw partition on a VFAT sdcard partiton only. SO in theory if you make a ext{123} partition on your sdcard it should work. For now i tried with the writeable mtd /data partition on my CM nightly and all works. Look:
Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo
-rw-rw-rw- 1 root root 0 Aug 8 20:30 /system/foo
A writeable /system !!!
And here is the real data on /data/rw
Code:
ls -l /data/rw/
-rw-rw-rw- 1 root root 0 Aug 8 20:30 foo
In theory Metamorph, adblock and all the rest that require /system should now work as expected.
Click to expand...
Click to collapse
could you try metamorph?
finally....
Nice work!! :O
Edit: Ok I tried this but metamorph still gives me an error when trying to set it up.
daveba said:
Code:
adb shell
modprobe aufs
lsmod (to check aufs worked)
mkdir /data/rw
mount -t aufs -o br=/data/rw=rw:/system=ro none /system
(no errors here)
touch /system/foo (YES IT WORKED)
ls -l /system/foo
-rw-rw-rw- 1 root root 0 Aug 8 20:30 /system/foo
Click to expand...
Click to collapse
cTrox said:
Nice work!! :O
Edit: Ok I tried this but metamorph still gives me an error when trying to set it up.
Click to expand...
Click to collapse
Really ? I just tried it and it worked fine for me...
Could anyone give a step by step guide on doing this?
daveba said:
Really ? I just tried it and it worked fine for me...
Click to expand...
Click to collapse
Oh I just saw, that metamorph is giving me an error because I havn't got enough free space in /system. How much do I need? I have 20MB free.
Ireas said:
Could anyone give a step by step guide on doing this?
Click to expand...
Click to collapse
+1 I'm very interested on this
cTrox said:
Oh I just saw, that metamorph is giving me an error because I havn't got enough free space in /system. How much do I need? I have 20MB free.
Click to expand...
Click to collapse
Where did you put the writeable partition on ? Ensure it has enough space. I'm not sure exactly what checks metamorph does when it runs but it definetly succeeded for me.
shawe_ewahs said:
+1 I'm very interested on this
Click to expand...
Click to collapse
It's exactly as i wrote in the previous page.
You'll need to ROM to have the aufs overlay 'filesystem' built in or as a module. If you're on CM6 you're lucky as it has it builtin (i was suprised it loaded when i did the modprobe myself as i didn't think it was included).
You should see a aufs.ko if it's built in as a module. Try running a jar/grep on your ROM of choice to see if it's included
Code:
jar tvf RoufianosV6.zip |grep aufs
gives no output, but
Code:
jar tvf cm_bravo-08082010-104323.zip |grep aufs
169400 Fri Feb 29 02:33:46 GST 2008 system/lib/modules/2.6.34.2-cyanogenmod/kernel/fs/aufs/aufs.ko
does.
You can do the steps described earlier (via adb) when your desire is fully booted as it doesn't require it at recovery only.
This needs to be pushed out to rom creators as it needs to be included in the startup scripts or else the next time you reboot your desire you'll lose all changes you made while the overlay was active.
daveba said:
This needs to be pushed out to rom creators as it needs to be included in the startup scripts or else the next time you reboot your desire you'll lose all changes you made while the overlay was active.
Click to expand...
Click to collapse
Oh that's why it didn't work I thought I might have to reboot the device to get access
Thanx guys ! Someone tested on 2.2
Sent from my HTC Desire using XDA App

Working aircrack-ng with monitor mode and packet injection !

Hi,
so after few days of playing with drivers patches kernel sources i finally got aircrack-ng working on g1 ! ( If you dont know whats aircrack-ng http://www.aircrack-ng.org/) I tested airodump for 1h, had it dumping packets to the sdcard to a cap file with channel switching and aireplay with deauth attack. I monitored this from my laptop to see if the packets are being sent ok and the client was disconnected from the network as expected.
I used patches for the n900 form the "download here" link at the bottom of this page http://david.gnedt.eu/blog/wl1251/. I also followed this tutorial http://bobcopeland.com/android_wifi.html and used his excellent kernel patch to get the msm_wifi.ko module. I then used the kernel and the zip file herehttp://forum.xda-developers.com/showpost.php?p=14768272&postcount=2427
You will want to make a backup of your system before you do anything. With that kernel you won't be able to use wifi in the Android UI.
Requirements to use attached files:
2.2 Rom
Debian installed in chroot on g1 with aircrack-ng installed ( you can use this img http://www.mediafire.com/?0ab95ia8xbale0i , just extract in on /sdcard/ so debian.img path is /sdcard/debian/debian.img )
How to make it work ?
steps 1-5 are one time only
First boot your android ROM and type
adb shell
$ su
# mount -o remount,rw /
# cd /system/etc/firmware
# ln -s ../wifi/Fw1251r1c.bin wl1251-fw.bin
# cat /proc/calibration > wl1251-nvs.bin
# mount -o remount,ro /
Click to expand...
Click to collapse
Extract attached files ( g1_wl1251.zip ) to sdcard
Apply ez_1.5.1_wl1251.signed.zip from recovery ( it got 2708 and ebi0 kernel for now will add ebi1 later)
Boot the phone
adb shell
su
cd /sdcard/wl1251_modules
sh ../insmod.sh
Click to expand...
Click to collapse
Now chroot into you debian installation ( if you used mine debian.tar.bz2 there is script startdeb just write: sh /sdcard/debian/startdeb and you should be chrooted correctly )
screen ( dont know why airodump doesnt give any output without screen on adb shell ?! )
bash
airmon-ng start wlan0
airodump-ng -i mon0
and DONE
How com compile it
First you need to get sources:
kernel sources i used https://github.com/ezterry/kernel-biff-testing tag ezgb-2636-v1.5.1-20110820
prepatched compat-wireless-2010-12-22 ( attached in sources.zip. I did some small build fixes and applied every patch from wl1251-maemo/patches/wireless-testing/ EXCEPT 0003-wl1251-fix-scan-behaviour-while-not-associated.patch as i got build errors with it )
rest of the files in patches.zip
Kernel:
You can just apply all patches in the kernel dir
If you want to make your config by yourself you have to compile as module cfg80211 and mac80211, compile in CONFIG_RFKILL_PM, CONFIG_CRC7 and UNSET CONFIG_TIWLAN1251. Its important as there as some ifdefs for CONFIG_TIWLAN1251 in drivers/mmc/core/core.c which is compiled in and with CONFIG_TIWLAN1251 WL1251 drivers doesnt work !
Compat wireless:
there is make.sh script edit it and change the patchs for your crosscompile toolchain and kernel location
./make.sh
and copy all *.ko modules
I hope everything is clear and more ppl can use it in custom roms If something is unclear plz write about it
too bad i sold my g1!
Thank you for the great tutorial! I think many people are using Gingerbread right now with several different incompatible ROMs. I think it would be useful if you list your ROM version as well as SPL & Radio info. Also if you could PLEASE make an image of your G1 with the debian install, it would help a lot. If you don't want your personal data in the image then I can remove it for you and will host the image. At the very least people need to know how exactly you installed debian before attempting this.
Please PM me if you can supply the image, thanks again!
Debian location can by anywhere, nothing depends on it and i got it on sdcard so g1 dump wont do anything. But i can send u ready debian.img to mount it with wireless tools installed just want to add new kismet and as i cant find ready deb for debian i would need to compile it probably. As for the radio u can use that new 2708 radio and old one for kernel i provided. I used cm6 for it but i think you can use any 2.2 rom as its froyo kernel. I need to clean up everything and redo it to write good tutorial how to compile it for any kernel and how to patch drivers.
zewelor said:
Debian location can by anywhere, nothing depends on it and i got it on sdcard so g1 dump wont do anything. But i can send u ready debian.img to mount it with wireless tools installed just want to add new kismet and as i cant find ready deb for debian i would need to compile it probably. As for the radio u can use that new 2708 radio and old one for kernel i provided. I used cm6 for it but i think you can use any 2.2 rom as its froyo kernel. I need to clean up everything and redo it to write good tutorial how to compile it for any kernel and how to patch drivers.
Click to expand...
Click to collapse
Thanks for the response. I just upgraded my hboot to a version that CM6 doesn't support, but I can use a different Froyo ROM that is still working.
On Gingerbread I am having a very hard time getting ext2.ko loaded. I already have an EXT(4) partition mounted, but since I am not on Froyo none of the kernel modules can be loaded correctly. I also think that ext2 support is already there but I don't know how to make use of it. There are filesystem modules under /system/lib/modules/2.6.36.4-s3-cos/.
My goal is to create a clockwork image of a Froyo/Debian install (with working injection driver) and use it as needed while keeping a 2.3.4/2.3.5 Android image for testing newer Apps that don't work on 2.2.
For anyone that just needs the Debian image, you can download it from the original G1 Debian tut site here: http://www.saurik.com/id/10
Please PM me if you are willing to upload a copy of your .img container file & I will host it for everyone to use. Thanks!
If u want u can still flash cm6 and after flashing it, flash kernel.zip from attached zip in 1st post ( it got also kernel for newer radio, but i havent tested it as i got older radio). As i saw in ezterry's kernel config ext2 partitions are mounted using ext4 so u dont have to load ext2 ( it works at least in froyo version of ezterry's kernel ). I can send now debian.img without working kismet but i think its better to get also kismet running so ppl wont have to redownload it. My debian.img its normal debian only with aircrack-ng installed nothing special in it. Only magic is kernel config and modules with patches compiled for that kernel thats it nothing more.
zewelor said:
If u want u can still flash cm6 and after flashing it, flash kernel.zip from attached zip in 1st post ( it got also kernel for newer radio, but i havent tested it as i got older radio). As i saw in ezterry's kernel config ext2 partitions are mounted using ext4 so u dont have to load ext2 ( it works at least in froyo version of ezterry's kernel ). I can send now debian.img without working kismet but i think its better to get also kismet running so ppl wont have to redownload it. My debian.img its normal debian only with aircrack-ng installed nothing special in it. Only magic is kernel config and modules with patches compiled for that kernel thats it nothing more.
Click to expand...
Click to collapse
Yes, let's wait until Kismet is working and then you can upload the image. I will try your suggestion and use EXT4. If I still have trouble I will create a flashable ZIP that has Froyo optimized for Debian with your Kernel patch included and a startup app to launch Debian via UI. Thanks again for your great contribution!
But when you mount debian img just write mount -o loop -t ext2 not ext4 it should work
Updated first post with some instructions how to compile drivers and kernel
Constantly getting "mount: can't setup loop device: No such file or directory"
I tried "mknod /dev/loop0 b 7 0" but neither "mount -o loop,noatime /mnt/sdcard/debian.img /data/local/mnt" nor other variations using ext2 work. I did mount / as rw and created the /data/local/mnt directory. I also tried 2 versions of busybox and so far no luck; I guess you are using the version that comes with CM6? Thanks
Yes i used busybox from cyanogenmod
Copy debian.img to /sdcard/debian/debian.img ( or change location in startdeb script )
First do mkdir -p /data/local/debian/mnt
then sh /sdcard/debian/startdeb ( or where u got it )
startdeb script i used:
#!/system/bin/sh
if [ ! -e /dev/block/loop99 ]
then
mknod -m 660 /dev/block/loop99 b 7 99
fi
if [ ! -e /dev/loop1 ]
then
ln /dev/block/loop99 /dev/loop0
fi
mount -o loop -t ext2 /sdcard/debian/debian.img /data/local/debian/mnt
busybox mount -o bind /sdcard /data/local/debian/mnt/sdcard
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
busybox mount -t proc none /data/local/debian/mnt/proc
busybox mount -t sysfs sysfs /data/local/debian/mnt/sys
busybox mount -t devpts devpts /data/local/debian/mnt/dev/pts
busybox chroot /data/local/debian/mnt/ /bin/bash
Click to expand...
Click to collapse
can u do it for lg optimus black ?
That depends on wifi chipset there, if its wl1251 it should be doable.
nice work, a year ago I did the same work (I think I posted it in the modaco android forum), however there was no injection patch at that time, so only packet capturing worked. The HTC Hero has the same TI wifi chip (wl1251). By the way you don't need an entire linux environment it is sufficient to compile static binaries (aircrack, kismet..). If i remember correctly compiling aircrack was very straight forward, however for kismet I had to make a dirty hack because it complained for a missing environment variable, but int he end Kismet worked fine too, even the gps . Unfortunately I lost my dev environment due to a harddisk failure, otherwise I would share the patches and binaries.
[EDIT]
HA! I found the aircrack binaries on an old backup disc
If you want to copy the files on your sdcard remember to remount it with (mount -o,exec,remount /mnt/scard), because by default the noexec flat is set or you copy the files to internal memory.
Thx for that aircrack I have chosen debian to avoid recompiling everything i will like to use and to have normal command line enviroment. Except aircrack and kismet u can also like to have iw / wireless tools / ping / nmap /tcpdump etc so you will have to search for it or recompiling staticly everything. I just prefer to find .deb file and install it, as using apt-get on g1 takes forever Also htc magic got wl1251 as afaik its the same as g1 (?).
yeah thats true, I decided to compile everything statically because I had very poor performance using debian (apt-get, compiling stuff etc), another advantage is you can start the programs very easily from the homescreen using gscript, sl4a..., in the end its just a question of preference
Sorry for asking in wrong topic, but:
Is there any airdump app that works well on HD2 ? (Broadcom chip: bmc 4329).
Or maybe the right question is : If it is even possible to create such app for hd2/nexus ?
misieq666 said:
Sorry for asking in wrong topic, but:
Is there any airdump app that works well on HD2 ? (Broadcom chip: bmc 4329).
Or maybe the right question is : If it is even possible to create such app for hd2/nexus ?
Click to expand...
Click to collapse
The problem is not the app, the problem is having wireless driver that support packet injection/Promiscuous-mode for the specific wireless chip, which in this case are afaik not available.
And even not a driver but firmware for specific chipset that allow to do that. As i read the main problem in bmc4329 is the firmware as driver can only do what firmware will allow. Well u can rewrite driver to workaround some limitations in firmware etc. Anyway here is a page u can follow http://linuxwireless.org/en/users/Drivers/brcm80211 they even got monitor mode in todo so maybe it can be done
Hi guy, final step, I got this:
airmon-ng start wlan0
Interface Chipset Driver
wlan0 wl1251_sdio - [phy0]SIOCSIFFLAGS: No such file or directory
(monitor mode enabled on mon0)
Click to expand...
Click to collapse
and this:
airodump-ng mon0
ioctl(SIOCSIFFLAGS) failed: No such file or directory
Click to expand...
Click to collapse
how should i fix this? plz.
Thank you.

[Q&A] Mounts2SD - Storage & Memory Management

Mounts2SD - Storage & Memory Management
The Opening Post (OP) has been moved to a new DevDB Section
This Thread has been assigned as an Q&A.
You should see a new pane above where you can navigate this project.
About dalvik-cache? It remains in phone memory?
Hi I cant understand How to use it ! any guide ?!
denzel09 said:
About dalvik-cache? It remains in phone memory?
Click to expand...
Click to collapse
dalvik-cache remains, so does all of the app related data. Only the APK's is moved.
Taki2011 said:
Hi I cant understand How to use it ! any guide ?!
Click to expand...
Click to collapse
First of all you need a custom rom. If you have a stock rom it will not work since you need a rom that will allow custom scripts during boot.
You will also need to know how to use ADB (An android tool for communicating with your phone. It is used to enter the android shell and also to transfer files to and from the phone, among other things).
And last, you will need at least 2 or 3 partitions on your sdcard (Otherwise it's a waste of time, although the script is build to adapt for these scenarios). One as a regular fat32 sdcard partition, one for the sd-ext and one for the cache. (Use ext2 for the last two. ext3 will eat your card to fast)
Here is the steps (You need to have ADB working on your computer).
Copy/Paste the script content into a file editor and safe the file with the name "99mounts2sd"
Plug your phone to your computer using a usb cable (Select charge only on your phone))
Open a terminal on your computer (In windows use "run" and type "cmd")
Type in shell: "adb shell mount -o remount,rw /system"
Type in shell: "adb push <path to script> /system/etc/init.d/"
Type in shell: "adb shell chmod a+x /system/etc/init.d/99mounts2sd"
Reboot your phone
The first time you boot your phone using the script it will take some time, because the script needs to copy all of your APK's from internal storage to the sd-ext partition.
The script has been rewritten. Better checks and more options has been added.
Great script
Sent from my GT-S5570 using Tapatalk
It didn't work for me, I made the files made sure they were in the right place and rebooted but booted normally. No delay on first boot and still seems to not be using the other two partitions on my sd card. i used cwm4 to partiton my SD card and it is partitioned correctly (3 partitons). I see the script says "log" I don't know where the log is stored or how to view it. Thanks.
To see the log, type in the terminal: "logcat | grep mounts2sd". Download a terminal or use ADB.
Also run the command "df -h" to see what is mounted where.
Sent from my HTC Desire using xda premium
thanks for the share.
#7 @dyehya
It seams that logcat has a very limited lifetime. In order to get the log info, you would have to get it during boot.
Instead I have updated the script to do this itself. Update your script and config file content with the new above code.
In the config file set VAR_DEBUG="yes" and reboot your phone. Now enter a terminal and type "cat /var/mounts2sd.log | grep mounts2sd" which will show you all the messages from the script, and possible errors, if any.
I am not sure what is going on in boot. I just saw your replies and haven't had a chance to update the script and mess with the phone. I do know that when I was playing with it before it kept using the busybox minimal that was in the kernel loaded in sbin I tried copying your version of busybox into bin and xbin (and now reverted back) but it would still use the one in sbin. What I would really like to do and would recommend is you design the script where you can put busybox in a certain location and the script will use that version over any other versions. I am still learning with all this and despite being able to create the files throw them in the correct places I don't know the code well enough to do this myself. Thanks again for all your help.
Ok i have changed the script so that it now forces the usage of /system/xbin/busybox or /system/bin/busybox and ignores /sbin/busybox
Place a full busybox version in one of the system bin folders, update the script and see what happends.
Otherwise paste a copy of "df -h" and "cat /data/mounts2sd.log | grep mounts2sd" here so that I can see what it does during boot.
Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !
virus2013 said:
Thanks for this. Just flashed the ICS beta 0.1 with your a2sd embedded. Just a suggestion, I added $CMD_CHMOD 777 $CMD_BUSYBOX at line 260, just after the affectation of CMD_BUSYBOX.
For now, it seems to work very well !
Click to expand...
Click to collapse
That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?
dk_zero-cool said:
That I don't get? $CMD_CHMOD is undefined at line 260 and why use busybox to change permissions on itself?
Click to expand...
Click to collapse
Sorry, I'm tired... :-\
In fact, I just wanna be sure that the busybox in /system/bin was executable as I pushed it into the rom zip. And as chmod was already used upper, I was thinking it could be a good idea. However, I'm not a script writer! ;-)
Sent from my Desire running ICS
Hello Cool,
trying ICS with your script. Here is the output of logcat an df -h command:
Code:
# cat /data/mounts2sd.log | grep mounts2sd
cat /data/mounts2sd.log | grep mounts2sd
12-14 13:05:12.905 V/mounts2sd( 96): Initiating Mounts2SD (v:1.1.1)...
12-14 13:05:12.985 V/mounts2sd( 101): Including configuration file...
12-14 13:05:14.897 V/mounts2sd( 212): Searching for sdcard...
12-14 13:05:15.277 V/mounts2sd( 231): Searching for sd-ext partition (/dev/block/mmcblk0p2)...
12-14 13:05:16.198 V/mounts2sd( 254): sd-ext partition was mounted successfully...
12-14 13:05:16.728 V/mounts2sd( 278): Moving /data/app to /sd-ext/app...
12-14 13:05:17.049 V/mounts2sd( 297): Moving /data/app-private to /sd-ext/app-private...
12-14 13:05:17.209 V/mounts2sd( 305): Searching for the sd-cache partition (/dev/block/mmcblk0p3)...
12-14 13:05:18.050 V/mounts2sd( 326): sd-cache was mounted successfully...
12-14 13:05:18.280 V/mounts2sd( 335): A device is already mounted at /cache. Umounting it...
12-14 13:05:18.420 V/mounts2sd( 341): Moving /cache to /sd-cache...
12-14 13:05:18.440 V/mounts2sd( 342): Done!
df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 202.9M 32.0K 202.9M 0% /dev
tmpfs 202.9M 0 202.9M 0% /mnt/asec
tmpfs 202.9M 0 202.9M 0% /mnt/obb
/dev/block/mtdblock3 250.0M 165.0M 85.0M 66% /system
/dev/block/mtdblock5 147.6M 62.4M 85.2M 42% /data
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /sd-ext
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /data/app
/dev/block/mmcblk0p2 960.7M 1.2M 959.4M 0% /data/app-private
/dev/block/mmcblk0p3 295.9M 168.0K 295.8M 0% /sd-cache
/dev/block/mmcblk0p3 295.9M 168.0K 295.8M 0% /cache
/dev/block/vold/179:1
6.2G 4.6G 1.6G 75% /mnt/sdcard
/dev/block/vold/179:1
6.2G 4.6G 1.6G 75% /mnt/secure/asec
This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?
Thanks for the script though!
Cheers, keep up the good work.
jukyO said:
This looks good, can you please confirm?
Also, why is /data not on ext partition but on phone memory?
Thanks for the script though!
Cheers, keep up the good work.
Click to expand...
Click to collapse
That looks as it should.
The whole /data is not moved to the /sd-ext for that simple reason that there are no hboot out there with 0mb /data.
I have options in my script to move both the .apk files (The applications) and the dalvik-cache which are the biggest things in the /data partition. If I moved everything to sd-ext, there would be nothing using the remaining space available on the internal data which is a waste of good space. It's like having an extra room in your house that is not used for anything at all. If we have to have it, we might as well use it
BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf
dk_zero-cool said:
BTW:
You don't have dalvik-cache aktivated. So if you ever need more space on /data, activate it in /system/etc/mounts2sd.conf
Click to expand...
Click to collapse
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
uzi2 said:
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
Click to expand...
Click to collapse
You don't need a .conf file now - it's not used. You simply install the zip and then use the m2sd commands in terminal to make changes (see instructions in OP - type m2sd help for more info)
uzi2 said:
Could you provide an example mounts2sd.conf file, so that all settings could be established at first boot. This would make it much easier when updating ROMS.
Click to expand...
Click to collapse
The config files is deprecated and replaced with the "m2sd" command, as said above. Settings is saved to /data/.m2sd which means that it keeps your settings when you flash new ROM's as long as you don't wipe data.

Mediatek YAFFS2 EXT4 mount, building kernel

I built already kernel, forced printk.c never stop, added busybox to ramfs.
But Android doesnot come up. See attached log.
Question is that init.rc mounts to /system first mtd as yaffs2, then mounts [email protected] again as ext4 to /system. I do not understand this. I checked original kernel and there seems to be no yaffs support.
How it can mount it??
Look into log and search for busybox...
Why android doesnot start? Is the android_main not found a problem? Attached is also my init.rc modified with busybox calls

Categories

Resources