[DEV] Porting Photon kernel 2.6.32 here

Search This thread


Senior Member
Nov 15, 2010
may be problem in haret ? haret load only image ext2?

no it's not haret, it's android & kernel config.
editing the vold.conf does not affect the sdcard mount, as we saw with cardsharing.
we need to find where the mount command is performed first to understand how we can tweak it.
today the sdcard partition is mounted in /sdcard, which seems to be the path to system partition (internal SD?)
we need to mount it in /media/sd (external SD?) if my understanding is correct


Senior Member
Dec 21, 2010
so you right , for test we can change mount path
ps: vold.conf from donut bild

## vold configuration file for Dream

volume_sdcard {
## This is the direct uevent device path to the SD slot on the device
media_path /devices/platform/msm_sdcc.1/mmc_host/mmc0
emu_media_path /devices/platform/goldfish_mmc.0/mmc_host/mmc0

media_type mmc
mount_point /sdcard
ums_path /devices/platform/usb_mass_storage/lun0
may be change
in our vold.conf
dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0 /devices/platform/msm_sdcc.2/mmc_host/mmc1
dev_mount sdcard /mnt/sdcard auto /devices/platform/goldfish_mmc.0 /devices/platform/msm_sdcc.1/mmc_host/mmc0
if that don't work we can install old vold , may be with it will be work fine sd read
Last edited:


Senior Member
Nov 15, 2010
maybe, but I was more refering to this line:
mount_point /sdcard
mount_point /media

normally it should mount in /media and be recognized as external SD card by android.


Senior Member
Aug 17, 2010
Sry, to go off topic. Wifi works greate. Any way. does any one have same problem as i. That if i click on phone - > menu -> people android gives me error that application People as stopped and then it does not start. And seemes the problem is with many applications.Dont know if it is kernel problem or system.ext problem or which problem. But keep up the good work.


Oct 7, 2008

i use android 2.1 ROM IS ok,may be problem in 2.2china ver ,,,i dont find any other problem

now ,use android2.1 IS ok, TRY 2.2 TOMORROW ,NOW IS 0:33, SLEEPING

AND I ASK some question,
that kernel.rar file out and run , it is del old bcm4329.ko and copy bcm4329.ko to /system/lib/modules,then set access authority?

so i copy and del use some access root soft is ok?
Last edited:


Oct 7, 2008
hi ,I have a question, use Cotulla system.ex2(android 2.1), wifi is ok ,use your system.ex2(android 2.2 language china) wifi is not ok, dont open it, the same setting


Senior Member
Dec 21, 2010
from initrd some information abount sd
# mount sd card

echo "Partition for Andoroid: " $partition  > /proc/printk

echo "Prepare SD card"   > /proc/printk
mkdir -m 0777 /mnt/sdcard
dosfsck -y /dev/block/$partition
echo "Mount SD card"   > /proc/printk
/bin/mount -t vfat -o fmask=0000,dmask=0000,rw,flush,noatime,nodiratime /dev/block/$partition /mnt/sdcard
[ $? -eq 0 ] || fail "Failed to mount the SD card. Cannot continue."
echo "Mount done!"   > /proc/printk

mkdir -m 0777 /sdcard
mount /mnt/sdcard /sdcard

#echo "thisistesttext" > /sdcard/my.txt
so compare init from our init.rd and hd2 init
in hd2 sd android init more lines with more info about mount sd
Last edited:


Senior Member
Dec 21, 2010
problem not in directory..
i think problem in mount blocks
ps: hd2 init
# author: cedesmith
# license: GPL
# if you use my work please clearly and visibly mention it  
echo "Init started"

export PATH

fail() {
	echo "$1"
	exit 1

/bin/mount -o remount,rw / /
mount -t proc proc /proc

mount -t sysfs sys /sys

[COLOR="Red"]mkdir -m 0777 /dev/block
mknod -m 0666 /dev/block/mmcblk0 b 179 0
mknod -m 0666 /dev/block/mmcblk0p1 b 179 1
mknod -m 0666 /dev/block/mmcblk0p2 b 179 2
mknod -m 0666 /dev/block/mmcblk0p3 b 179 3
mknod -m 0666 /dev/block/mmcblk0p4 b 179 4

mkdir -m 0777 /dev/input
mknod -m 0644 /dev/input/event0 c 13 64
mknod -m 0644 /dev/input/event1 c 13 65
mknod -m 0644 /dev/input/event2 c 13 66
mknod -m 0644 /dev/input/event3 c 13 67

mknod -m 0666 /dev/null c 1 3
mknod -m 0444 /dev/zero c 1 5
mknod -m 0644 /dev/ppp0 c 108 0
mknod -m 0644 /dev/smd0 c 253 0
mknod -m 0644 /dev/smd1 c 253 1
# wait for sdcard 
while [ ! -b /dev/block/mmcblk0 ] ; do
	echo "Waiting for SD Card"
	sleep 1
sleep 1

[COLOR="red"]find /sys/block/mmcblk0/ -type d > /dev/null[/COLOR]

# mount /sdcard for install/update and in case system and data are image files not partitions 
# use loop_partition for backward compatibility
sdcard_partition=`grep -o '\bloop_partition=\w*' /proc/cmdline | sed 's/loop_partition=//'`
if [ "$sdcard_partition" = "" ];then
	# assume single partition, if found partition 1 use that	
	#[ -b /dev/block/mmcblk0p1 ] && sdcard_partition=mmcblk0p1
	[ -d /sys/block/mmcblk0/mmcblk0p1 ] && sdcard_partition=mmcblk0p1

mkdir -m 0755 /mnt
chown 0:1000 /mnt
mkdir -m 0700 /mnt/sdcard_boot
mount -t vfat -o rw,utf8,fmask=0111,dmask=0000,noatime,nodiratime /dev/block/$sdcard_partition /mnt/sdcard_boot
[ $? -eq 0 ] || echo "Failed to mount the SD card."

# set ANDROID_PATH for install/update and in case system and data are image files not partitions  
ANDROID_PATH=`grep -o '\brel_path=\w*' /proc/cmdline | sed 's/rel_path=//'`
[ "$ANDROID_PATH" = "" ] && ANDROID_PATH="/mnt/sdcard_boot/Android" || ANDROID_PATH="/mnt/sdcard_boot/$ANDROID_PATH"

cp -a $ANDROID_PATH/system.ext2 /system.ext2

# check for system_partition and data_partition
# if partitions are specified use that else use files on $ANDROID_PATH
system_partition=`grep -o '\bsystem_partition=\w*' /proc/cmdline | sed 's/system_partition=//'`
data_partition=`grep -o '\bdata_partition=\w*' /proc/cmdline | sed 's/data_partition=//'`
if [ "$system_partition" != "" -o "$data_partition" != "" ]; then
	#should have both system_partition and data_partition set
	[ "$system_partition" = "" ] && fail "system_partition empty while data_partition set"
	[ "$data_partition" = "" ] && fail "data_partition empty while system_partition set"

	mknod -m 0666 /dev/block/loop0 b 7 0
	mknod -m 0666 /dev/block/loop1 b 7 1
	if [ -f /system.ext2 ]; then 
		losetup /dev/block/loop0 /system.ext2
	elif [ -f /system.ext2 ]; then
		losetup /dev/block/loop0 /system.ext2
		fail "system image not found on $ANDROID_PATH "
	if [ -f $ANDROID_PATH/data.img ]; then 
		losetup /dev/block/loop1 $ANDROID_PATH/data.img
	elif [ -f $ANDROID_PATH/data.ext2 ]; then
		losetup /dev/block/loop1 $ANDROID_PATH/data.ext2
		fail "data image not found on $ANDROID_PATH "	

mount -t ext2 -o noatime,nodiratime /dev/block/$system_partition /system
[ $? -eq 0 ] || fail "Failed to mount /system"
mount -t ext2 -o noatime,nodiratime /dev/block/$data_partition /data 
[ $? -eq 0 ] || fail "Failed to mount /data"

# move adbd to xbin to free ram for
[ ! -f /system/xbin/adbd ] && cp -a /sbin/adbd /system/xbin/
rm -f /sbin/adbd
[ -f /system/xbin/adbd ] && ln -s /system/xbin/adbd /sbin/adbd
# move config files to /system to allow edit persist and save ram
[ ! -f /system/init.rc ] && cp -a /init.rc /system/init.rc
[ ! -f /system/init.htcleo.rc ] && cp -a /init.htcleo.rc /system/init.htcleo.rc
[ ! -f /system/bootcomplete.htcleo.rc ] && cp -a /bootcomplete.htcleo.rc /system/bootcomplete.htcleo.rc
[ ! -f /system/shutdown.htcleo.rc ] && cp -a /shutdown.htcleo.rc /system/shutdown.htcleo.rc
[ ! -f /system/default.prop ] && cp -a /default.prop /system/default.prop
rm -f /init.rc /init.htcleo.rc /bootcomplete.htcleo.rc /shutdown.htcleo.rc /default.prop
[ -f /system/init.rc ] && ln -s /system/init.rc /init.rc
[ -f /system/init.htcleo.rc ] && ln -s /system/init.htcleo.rc /init.htcleo.rc
[ -f /system/bootcomplete.htcleo.rc ] && ln -s /system/bootcomplete.htcleo.rc /bootcomplete.htcleo.rc
[ -f /system/shutdown.htcleo.rc ] && ln -s /system/shutdown.htcleo.rc /shutdown.htcleo.rc
[ -f /system/default.prop ] && ln -s /system/default.prop /default.prop

if [ -d "$ANDROID_PATH/update" ] ; then

	find "$ANDROID_PATH/update/" -maxdepth 1 -name "uninstall*.sh" -exec sh '{}' \;

	find "$ANDROID_PATH/update/" -maxdepth 1 -name "install*.sh" -exec sh '{}' \;

if [ -d $ANDROID_PATH/AndroidApps ] ; then
        echo Copying Applications
        if [ ! -d /data/app ] ; then
                mkdir -m 0771 /data/app

	[ ! -d /data/app/tmp_copy_dir ] && mkdir /data/app/tmp_copy_dir
        cp $ANDROID_PATH/AndroidApps/* /data/app/tmp_copy_dir/
        chown -R 1000:1000 /data/app/tmp_copy_dir/

	find /data/app/tmp_copy_dir/ -type f -exec chmod 0644 '{}' \;
	find /data/app/tmp_copy_dir/ -type d -exec chmod 0755 '{}' \;
	mv /data/app/tmp_copy_dir/* /data/app/
	rm -rf /data/app/tmp_copy_dir

	rm -rf $ANDROID_PATH/AndroidApps

if [ -d "$ANDROID_PATH/root" ] ; then
	echo Updating files
	cp -ar $ANDROID_PATH/root/* /


if [ -d "$ANDROID_PATH/update" ] ; then
	echo "Executing update scripts"
	find "$ANDROID_PATH/update/" -maxdepth 1 -name "update*.sh" -exec sh '{}' \;


find /system -maxdepth 1 -name "init*.sh" -exec sh '{}' \;

if [ ! -d /data/.cache ];then
	mkdir -m 0770 /data/.cache
	chown 1000:2001 /data/.cache
ln -s /data/.cache /cache

if [ -f /data/data/customized ];then
rm /init.rc
mv /initorig.rc /init.rc

umount /mnt/sdcard_boot
#rm -rf /bin
export PATH

exec /init.android
the first idea
change loop1 to loop0 in system.ext2
# mount system.ext2
if      [ -f $card/system.ext2 ] ; then
	echo "Using uncompressed system"
        losetup /dev/block/[COLOR="red"]loop1[/COLOR] $card/system.ext2
        [ $? -eq 0 ] || fail "Failed to reach system.ext2 on SD Card"
	echo "Checking system EXT2" > /proc/printk
        /bin/e2fsck -y /dev/block/[COLOR="red"]loop1[/COLOR]
	echo "Mount system EXT2" > /proc/printk
        /bin/mount -t ext2 -o noatime,nodiratime /dev/block/loop1 /system
	[ $? -eq 0 ] || fail "Failed to mount /system"
no.. isn't! problem in init.rc
in external memory line
export EXTERNAL_STORAGE /sdcard to export EXTERNAL_STORAGE /mnt/sdcard
compiling new initrd....
i 'll upload to test when all be done
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    guys, good news: 3G is almost working
    finally we dropped rmnet, and used PPP from HTC Leo.
    it is not 100% stable at the moment (disconnect/reconnect), but you can get google and other internet pages to load on photon
    (special thanks to Letama for his help)
    will post the changes in photon website later, and I'll work with Schlund to build a release (thanks to Schlund kitchen 2.0 ^^)
    ok, i got the mic fix working perfectly.
    at the end, it's only a stupid RPC call to enable mic and nothing more :rolleyes:
    Special thanks to schlund that showed me the winmo dll where to get RPC values

    Here is the func:
    static struct msm_rpc_endpoint *endpoint = NULL;
    void photon_pm_mic_en()
    	int ret;
    	int mprog=0x30000061;
    	int mvers=0x10001;
    	struct {
    		struct rpc_request_hdr hdr;
    		uint32_t data;
    	} req;
    	if (!endpoint)
    		endpoint = msm_rpc_connect(mprog, mvers, 0);
    	if (!endpoint) {
    		printk("Couldn't open rpc endpoint 0x%x vers 0x%x\n",mprog,mvers);
    		endpoint = msm_rpc_connect(mprog, mvers, 0);
    		if (!endpoint) {
    			printk("Couldn't open rpc endpoint 0x%x vers 0x%x\n",mprog,mvers);
    	ret = msm_rpc_call(endpoint, 0x1c, &req, sizeof(req), 5 * HZ);
    	if (ret < 0)
    		printk(KERN_ERR "%s: rpc call failed! (%d)\n", __func__, ret);

    You must call it here:
    		pr_info("snd_set_device %d %d %d\n", dev.device,
    						 dev.ear_mute, dev.mic_mute);
    +              //r0bin: enable mic for photon
    +              photon_pm_mic_en();
    		msm_rpc_setup_req(&dmsg.hdr, RPC_SND_PROG, RPC_SND_VERS,
    		rc = msm_rpc_write(snd->ept, &dmsg, sizeof(dmsg));
    You can add the photon_pm_mic_en() function in the same file (snd.c)

    Cardsharing, tell me if it's ok for you or if you need a patch or whatever else ;)

    Guys, enjoy and please tell me if mic is working for you, and if there is no other bugs regarding audio :)

    I will check now the 3G, and if you can explain to me the G-sensor issue, how to trigger it and how to test it because i dont know about this. thanks ;)
    i got the wifi working!!!
    :p oh my god it's sooo goood to make some progress, finally!

    well, the issue was in /proc/calibration, created in htc_wifi_nvs.c
    i removed the offset that was messing up the static nvs string, hardcoded by Cotula.
    now the wifi driver load automatically, i was able to connect to my wifi hotspot, put the WPA key, and browse on the internet.

    attached the zImage compiled, plus the htc_wifi_nvs.c with my changes (sorry it is really bad documented and not clean code, but it is working :)))
    edit: just replace zImage on your sdcard and boot android. kernel version is 2.6.29 from Cotula, it should work for both android 2.1 and 2.2 (tested on 2.1)
    hurray, i got DEX working!
    I can command the ARM9 to update the battery values in SMEM
    Battery algorithm seems to work too, but it needs a little fine tuning, there are so many parameters.
    + i still need GPIO number triggered to enable FAST charge, if you have it...

    i will post the kernel in a separate post, for those who wants to test.
    edit: see here:
    guys, great news: i got incall mic working :)
    seems we must send DEX + RPC pm_en_mic
    only issue is, now speaker dont work, but wait a little more...
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone