• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Root TWRP - Spectrum

PG, I've already gotten to that part and it properly puts the /dev/block/mmcblk1p1 into the file. The issue is that the source code calls out %d, which for some reason only picks up 0, but when I boot into TWRP, I have a lun of 2. I made a copy with the lun hardcoded, and it works, but now my script to have the phone show up as an SDcard to Windows no longer works. It's a bit aggravating right now.

Also, you won't see that path in CWM because I believe koush used the GB kernel, and the GB kernel didn't contain that path.
koush just forked the repo ;). If irrc I used the 3.x kernel from ics. I found the paths even in GB but just missing or empty file files. Wasn't a big enough deal to me to dig and redo a bunch of shyt for UMS to work. ;)

GL tho, feel free to bounce ideas off me ;)
 
Upvote 0
Can anyone who is currently running TWRP on the Spectrum please provide me with a reading while you're inside of TWRP.

I need to know what you have in directory /sys/devices/platform/msm_hsusb/gadget/ . You can find out by browsing with TWRP's built in file manager, or with ADB shell.

Here is my current status on USB mount, but I need to know if anyone is getting a lun besides lun2, which is what I'm getting. If everyone is getting lun2, then I'm going to hard code the change to lun2, instead of being a variable, which returns 0.

Only lun2 here.
 
Upvote 0
koush just forked the repo ;). If irrc I used the 3.x kernel from ics. I found the paths even in GB but just missing or empty file files. Wasn't a big enough deal to me to dig and redo a bunch of shyt for UMS to work. ;)

GL tho, feel free to bounce ideas off me ;)
Actually, can you take a look at this for me please.

http://androidfiles.massivefilehost.com/twrp/spec_twrp_lun2.img

The mount options writes the info to the correct lun file, but the USB init scripts don't initialize the phone correctly to let Windows see that it is a USB Mass storage device. I'm not really sure why either as it's the exact same settings as every other init that enables mass storage.
 
Upvote 0
I had that happen when I had files in the /sdcard/.android-secure/ directory. For some reason it couldn't unlink them when doing a format, but it could with the RM -rf option on. Did you have this option on when you tried it? If I can figure out what happened, I'll see if I can provide a solution in the next build.

Yeah. I made sure the RM -rf option was on as soon as I flashed twrp. Next time I can get enough free time to play around with it I'll try a few things and see if I can figure out exactly what my issue is
 
Upvote 0
Yeah. I made sure the RM -rf option was on as soon as I flashed twrp. Next time I can get enough free time to play around with it I'll try a few things and see if I can figure out exactly what my issue is
If you run across the error again, please send me a copy of the /tmp/recovery.log file. Their log system for TWRP is surprisingly useful.
 
Upvote 0
Any chance you've made any progress on this?

Also, can you share your boardconfig.mk and recovery.fstab ?

Any other files that were device specific would be nice too... Do you have a github project going for this atm?
Use TDM's default recovery.fstab and BoardConfig.mk file and add this to the end of BoardConfig.

# TRWP
DEVICE_RESOLUTION := 720X1280
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TARGET_RECOVERY_PIXEL_FORMAT := "BGRX_8888"

If you have the full TDM device tree, you'll have many items in the ramdisk that you don't need, but nothing that will cause issues. The mounting as USB device still alludes me. If I find time, I'll see if the never versions have brought better support.
 
  • Like
Reactions: reeseboy and Yoinx
Upvote 0
Ok. So I'm trying to compile TWRP now. I can't for the life of me figure out why I'm getting this error though. I know the path/files exist. I can cd down to the end of the path. But it keeps failing saying the file/path doesnt exist.

Right now I'm running it as a single job, so it's a straight through copy/paste. No threading.

the funny part is that the copy for the common files worked fine.

Any ideas?


[high]
Install: /media/joe/ubuntu_storage/bin/cm/out/host/linux-x86/bin/minigzip
mkdir -p /media/joe/ubuntu_storage/bin/cm/out/target/product/vs920/recovery/root/res/
cp -fr bootable/recovery/gui/devices/common/res/* /media/joe/ubuntu_storage/bin/cm/out/target/product/vs920/recovery/root/res/
cp -fr bootable/recovery/gui/devices/720X1280/res/* /media/joe/ubuntu_storage/bin/cm/out/target/product/vs920/recovery/root/res/
cp: cannot stat `bootable/recovery/gui/devices/720X1280/res/*': No such file or directory
make: *** [/media/joe/ubuntu_storage/bin/cm/out/target/product/vs920/obj/STATIC_LIBRARIES/libgui_intermediates/twrp] Error 1
[/high]


*edit*

heh. nevermind. I copied the bit from above. Didn't realize the 720X1280 had to have a lowercase "x"
 
Upvote 0
Alright...

So I got twrp 2.5.0.0 to build. Looks like it's ok-ish. Mounting the sdcard and such correctly now. The gui though seems REALLY laggy. Not sure why yet.

Looks like it can bootloop like CWM used though when you use the hardware keys to boot into it. I managed to fix that by finding the old cwm bootloop fix zip.


Looks like this one's got this going on to disable usb:
I:Lun file '/sys/devices/platform/usb_mass_storage/lun0/file' does not exist, USB storage mode disabled
 
Upvote 0
Alright...

So I got twrp 2.5.0.0 to build. Looks like it's ok-ish. Mounting the sdcard and such correctly now. The gui though seems REALLY laggy. Not sure why yet.

Looks like it can bootloop like CWM used though when you use the hardware keys to boot into it. I managed to fix that by finding the old cwm bootloop fix zip.


Looks like this one's got this going on to disable usb:
I:Lun file '/sys/devices/platform/usb_mass_storage/lun0/file' does not exist, USB storage mode disabled


If anyone's interested in giving this a try, here's a link: Dev-Host - experimental-twrp.img - The Ultimate Free File Hosting / File Sharing Service

As I said, the interface is a bit laggy on my phone. I'm curious if it's the same way on anyone else's.

I haven't tried installing/wiping anything. But backup seemed to complete correctly. Mount USB is available. I set the lun file to /sys/devices/platform/msm_hsusb/gadget/lun0/file and when I cat that file it gives me /dev/block/mmcblk1p1 this is similar to the behavior in a normal rom, except that in a rom it gives the vold.fstab mountpoint... however, it still doesn't connect as mass storage.


Mostly, I'm just curious about the gui lag though.



If anyone's looking to try compiling this to play with any of it... here's my configs:
BoardConfig.mk:
[high]
# TRWP
DEVICE_RESOLUTION := 720x1280
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TW_INTERNAL_STORAGE_PATH := "/data/media"
TW_INTERNAL_STORAGE_MOUNT_POINT := "data"
TW_EXTERNAL_STORAGE_PATH := "/sdcard"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard"
TW_ALWAYS_RMRF := true
TW_DEFAULT_EXTERNAL_STORAGE := true
TW_NO_REBOOT_BOOTLOADER := true
CUSTOM_LUN_FILE := "/sys/devices/platform/msm_hsusb/gadget/lun0/file"
[/high]

recovery.fstab
[high]
# mount point fstype device [device2] fstype2
/recovery emmc /dev/block/mmcblk0p13
/boot emmc /dev/block/mmcblk0p8
/cache ext4 /dev/block/mmcblk0p27
/data ext4 /dev/block/mmcblk0p28
/sdcard vfat /dev/block/mmcblk1p1
/system ext4 /dev/block/mmcblk0p26
[/high]


*edit*
Got it to successfully mount as mass storage as well. I'll post a copy of that up later... though it kinda got hacked together to make it work.
 
Upvote 0
If anyone's interested in giving this a try, here's a link: Dev-Host - experimental-twrp.img - The Ultimate Free File Hosting / File Sharing Service

As I said, the interface is a bit laggy on my phone. I'm curious if it's the same way on anyone else's.

I haven't tried installing/wiping anything. But backup seemed to complete correctly. Mount USB is available. I set the lun file to /sys/devices/platform/msm_hsusb/gadget/lun0/file and when I cat that file it gives me /dev/block/mmcblk1p1 this is similar to the behavior in a normal rom, except that in a rom it gives the vold.fstab mountpoint... however, it still doesn't connect as mass storage.


Mostly, I'm just curious about the gui lag though.



If anyone's looking to try compiling this to play with any of it... here's my configs:
BoardConfig.mk:
[high]
# TRWP
DEVICE_RESOLUTION := 720x1280
RECOVERY_GRAPHICS_USE_LINELENGTH := true
TARGET_RECOVERY_PIXEL_FORMAT := "RGBX_8888"
TW_INTERNAL_STORAGE_PATH := "/data/media"
TW_INTERNAL_STORAGE_MOUNT_POINT := "data"
TW_EXTERNAL_STORAGE_PATH := "/sdcard"
TW_EXTERNAL_STORAGE_MOUNT_POINT := "sdcard"
TW_ALWAYS_RMRF := true
TW_DEFAULT_EXTERNAL_STORAGE := true
TW_NO_REBOOT_BOOTLOADER := true
CUSTOM_LUN_FILE := "/sys/devices/platform/msm_hsusb/gadget/lun0/file"
[/high]recovery.fstab
[high]
# mount point fstype device [device2] fstype2
/recovery emmc /dev/block/mmcblk0p13
/boot emmc /dev/block/mmcblk0p8
/cache ext4 /dev/block/mmcblk0p27
/data ext4 /dev/block/mmcblk0p28
/sdcard vfat /dev/block/mmcblk1p1
/system ext4 /dev/block/mmcblk0p26
[/high]
*edit*
Got it to successfully mount as mass storage as well. I'll post a copy of that up later... though it kinda got hacked together to make it work.
You need PG's post recovery script added to the device tree to fix the button boot loop. Also, what did you fix to get the mount to work correctly? I found a way to hack it always on, but that was not a good fix.
 
Upvote 0
You need PG's post recovery script added to the device tree to fix the button boot loop. Also, what did you fix to get the mount to work correctly? I found a way to hack it always on, but that was not a good fix.

Like I said, this was hacked together for now, since I'm still learning. The recovery's init.rc needs to perform

[HIGH]write /sys/class/android_usb/android0/functions mass_storage,adb[/HIGH]

instead of

[HIGH]write /sys/class/android_usb/android0/functions adb[/HIGH]

in the on init section. I forced this in the /bootable/recovery/etc/init.rc

Then, I had to modify /bootable/recovery/variables.h

[HIGH]#ifndef CUSTOM_LUN_FILE
//#define CUSTOM_LUN_FILE "/sys/devices/platform/usb_mass_storage/lun%d/file"
#define CUSTOM_LUN_FILE "/sys/devices/platform/msm_hsusb/gadget/lun0/file"
#endif[/HIGH]

I commented out the default lun file and hardcoded my custom lun file. For some reason I couldn't get the "CUSTOM_LUN_FILE" flag in the BoardConfig.mk to set that flag correctly.


Since I'm pretty new to this, I'm still working out how to make things happen from within the device's build tree. I'm *guessing* that if I copy that init.rc out for the recovery folder and just make it recovery.init.rc in the device folder, that it would use it from there. Not sure.

Of course, this depends on it always being lun0 as well. These changes do allow you toggle usb storage on and off though.


Also, I was in #twrp on freenode last night. The guys there helped me out with some of the video lag/touch delay. It's definitely video lag since the recovery log was showing touch releases with debug logging enabled. Tassulur (spelling?) suggested that our device was triple buffering for some reason and had me change
/bootable/recovery/miniuitwrp/graphics.c :

#define NUM_BUFFERS 2

to

#define NUM_BUFFERS 3

I took that out in the builds im doing right now. It did seem to help quite a bit though.

*edit*

Alright, I figured out how to get this all setup so that it doesn't have to hardcode anything in the twrp source and keeps it all in the device tree.

Now, i just need to try and find a graphics.c that works well for our device (hopefully)

https://github.com/yoinx/VS920_TWRP

Built Image : http://d-h.st/hhM
 
Upvote 0
Synced what I have so far to my github repo. Not a whole lot there, but those are the files you need in teh device tree. Then replace /bootable/recovery with the TWRP tree and it should build fine.

I went ahead and made a flashable zip that *should* flash twrp.

Watching the debugging touch info it looks like *maybe* its registering taps as swipes and pausing to wait to see how far the swipe is. Though, thats just a stab in the dark.

DO NOT FLASH THIS IF YOU DON'T KNOW HOW TO REVERT BACK TO CWM. THIS IS AN EXPERIMENTAL RECOVERY AT THIS STAGE.

That said, I could use a couple people who know what they're doing to test thsi out. Sometimes it feels like the UI is responsive enough. Other times it hangs. I still need to know if that's my phone, or an issue.

Other than that though, everything else seems to be working fine.

Dev-Host - Experimental-TWRP.zip - The Ultimate Free File Hosting / File Sharing Service
 
  • Like
Reactions: IMUcarmen
Upvote 0
So, it seems that the P930 has official builds going for TWRP. I would think that should mean the VS920 should be pretty easy to port over.

https://github.com/nexwave-mat/android_device_lge_p930/tree/cm-10.1-twrp

Is the tree for twrp, and I really don't see a whole lot of anything special happening in there. I'm starting to think that maybe my phone's just finnicky... or maybe my build is just not compiling something right for the touchscreen/display.
 
Upvote 0
It's not lag. It really is waiting for a next input as if you're swiping and I didn't get that issue on 2.4 . Case in point. Go into a menu, then press the screen again for it to happen. Press the back out button and you have to press again for it to happen. Also, if you let the screen time out, there is no getting it back on and adb gives you a device not found error. I'm not sure if that's issues with the new 2.5 code or with the kernel you're using, but it could be either. Are you using a prebuilt zImage or compiling your own?
 
Upvote 0
It's not lag. It really is waiting for a next input as if you're swiping and I didn't get that issue on 2.4 . Case in point. Go into a menu, then press the screen again for it to happen. Press the back out button and you have to press again for it to happen. Also, if you let the screen time out, there is no getting it back on and adb gives you a device not found error. I'm not sure if that's issues with the new 2.5 code or with the kernel you're using, but it could be either. Are you using a prebuilt zImage or compiling your own?

I was compiling each time.


Right now, I'm recompiling with different graphics options.

Originally I thought that it was a touch issue. However. I don't think it is. It's registering the touches and not redrawing. Case in point: Tab the bottom right for reboot, if it hangs and doesn't redraw, tap "backup" this will reboot recovery, which is the option that should be drawn there at that point.

Also, I noticed the screen off issue. I disabled the screen off in the options to prevent that.
 
Upvote 0
Nope, just confirmed, it's your kernel. I injected your ramdisk into my twrp image and it works just fine. I don't see a mount usb option though.

http://androidfiles.massivefilehost.com/twrp/yoinx_twrp.img

They removed the mount usb option for awhile in some on the 2.4.x builds.


Hmm. Wonder if it's actually the kernel though, or something that's changed in the 2.5 code.


I may have to pull out your kernel and try to recompile with that as a pre-built.


Sounds like a tomorrow project though.
 
Upvote 0
You could always cross check it. Inject my ramdisk into your twrp image and see if you still get lag. If you do, it's definitely a kernel issue. If it disappears, we're back at square one. I'm in the same boat though as I need to crash as well, but you're definitely on the correct build path.

P.S. if you're not already using it, abootimg is very useful in these situations.
 
Upvote 0
You could always cross check it. Inject my ramdisk into your twrp image and see if you still get lag. If you do, it's definitely a kernel issue. If it disappears, we're back at square one. I'm in the same boat though as I need to crash as well, but you're definitely on the correct build path.

P.S. if you're not already using it, abootimg is very useful in these situations.

Yeah. Good idea.

I tossed your kernel in my image. Graphics issues are gone. USB path is different though. I'll get a build rebuilt and post it up once I have one working without the UI graphical lag and USB mass storage going. Hopefully it doesn't take *too* long to get working right. I'm anticipating it being up in the next couple hours.


On a side note... Any idea if you have the config or defconf that you used to build that kernel? I'm REALLY curious what settings are causing the issues when I build with the defconf from the current CM repo.


Also, if anyone is still tracking this thread that had issues with zips that wouldn't install... Do you have links for any of those zips? I'm curious what parts where making the install fail. I assume that it's something with the edify script either calling functions that it didn't understand, or that weren't cooked into busybox. I'm willing to bet that it was some of the quattrimus builds that I think were calling getprop and such, as that isn't built into the busybox that twrp uses.


Nice.... the kernel you used also allows the screen to timeout and turn back on :D


*edit*

Alright... I can't seem to get setprop to work on these builds, so it's detracting from me using the setprop method. I'm mapping to the right lun file, and when I cat it, I'm getting my sd card path. I can't for the life of me get usb mounting to work right now though.
 
Upvote 0
This kernel is the old GB kernel ripped out of the Koush's CWM. You should be able to pulling the config.gz and see what he was using. Back then, we just used the stock LG GB source code and it worked fine.

P.S. setprop is part of /system/bin which is the same issue I ran into. You have to have a rom flashed and /system mounted in order for that to work.

As for what roms wouldn't flash, that would be TDM's multirom. That had to do with the way his rom called out variables and .diff files.
 
Upvote 0
This kernel is the old GB kernel ripped out of the Koush's CWM. You should be able to pulling the config.gz and see what he was using. Back then, we just used the stock LG GB source code and it worked fine.

I see. I'm building the kernel from LG's V7 sources right now. The one you used didn't have the USB mass storage gadget from what I could tell from the config.gz. Couldn't add it and recompile though from the sources I had.
 
Upvote 0
:(


I'm making no progress on this. I modified the default.prop in the ramdisk with the right setting. Nothing.


Seems like I can either get it running smoothly on a prebuilt kernel without usb mass storage

or

Running with crazy UI lag on a freshly built kernel, with usb mass storage.

I wish I could figure out what's wrong in the kernel that's causing the ui lag.
 
Upvote 0
Well, here is the thing. You can modify init.rc and have mass storage always on, but this is a bad choice because if you're mounted to your PC while doing a backup, you potentially have two separate devices reading/writing to the same memory at the same time. Now, with that being said, if you could get MTP to work, that would potentially be less hazardous, but not all that better. My biggest question is how to you activate mass storage in the new TWRP without the mount as USB button in the GUI?
 
Upvote 0
Well, here is the thing. You can modify init.rc and have mass storage always on, but this is a bad choice because if you're mounted to your PC while doing a backup, you potentially have two separate devices reading/writing to the same memory at the same time. Now, with that being said, if you could get MTP to work, that would potentially be less hazardous, but not all that better. My biggest question is how to you activate mass storage in the new TWRP without the mount as USB button in the GUI?

I'm not sure how you would activate mass storage without it.

On the kernel I was building that had lag, I had the button and it mounted reliably.

On the old prebuilt kernel I don't have the button by defualt, but I get it once I force the persist usb config setting. Though, the button then does nothing for me. Not sure why.


They remove the option to mount as usb on boot-up if it can't find your lun*/file. On the old kernel it's in the location they expect by default

From variabls.h
[HIGH]#ifndef CUSTOM_LUN_FILE
#define CUSTOM_LUN_FILE "/sys/devices/platform/usb_mass_storage/lun%d/file"
#endif[/HIGH]

If you're building from the current iproj kernel repo it's a seperate location so you have to overide it in BoardConfig.mk

I ended up also having to add the line about emmc shares to get it to mount correctly. Not 100% sure what that emmc shares does though, I saw it in another boardconfig with a custom lun path, so I gave it a try.

[HIGH]
# Vold
BOARD_VOLD_EMMC_SHARES_DEV_MAJOR := true
TARGET_USE_CUSTOM_LUN_FILE_PATH := /sys/devices/platform/msm_hsusb/gadget/lun0/file
BOARD_UMS_LUNFILE := /sys/devices/platform/msm_hsusb/gadget/lun0/file
[/HIGH]


I've tried to recompile the current kernel every which way in the video settings. Half the time though the build fails with errors around framebuffer memory definitions. (which is funny since I'm pretty sure it's a framebuffer problem causing the lag)


I'm pretty sure this bit of code here is what's disabling usb storage over here in data.cpp in the twrp source (2.5 branch)

[HIGH]#ifdef TW_NO_USB_STORAGE
printf("TW_NO_USB_STORAGE := true\n");
mConstValues.insert(make_pair(TW_HAS_USB_STORAGE, "0"));
#else
char lun_file[255];
string Lun_File_str = CUSTOM_LUN_FILE;
size_t found = Lun_File_str.find("%");
if (found != string::npos) {
sprintf(lun_file, CUSTOM_LUN_FILE, 0);
Lun_File_str = lun_file;
}
if (!TWFunc::path_Exists(Lun_File_str)) {
LOGINFO("Lun file '%s' does not exist, USB storage mode disabled\n", Lun_File_str.c_str());
mConstValues.insert(make_pair(TW_HAS_USB_STORAGE, "0"));
} else {
LOGINFO("Lun file '%s'\n", Lun_File_str.c_str());
mConstValues.insert(make_pair(TW_HAS_USB_STORAGE, "1"));
}
#endif[/HIGH]

I haven't really dug through much more than that. I've been busy trying to figure out what all has changed between the old kernel and new kernel for video.
 
  • Like
Reactions: Neph81
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones