Can't fstrim on /sdcard - LG Optimus 4X HD

Hello all,
As some of you you may know, some Android manufactures gift their mobile devices with slow memory chips, and I assume the 4X contain one of these, sometimes the lag gets me extremely frustrated.
Now, the application LagFix may be a solution, but as I didn't feel a noticeable difference, and I doubt that it may be because it does not work on /sdcard, only trims /cache, /data and /system.
So I am trying to do it myself from terminal, yet doing 'fstrim -v /sdcard' returns 1, which according to fstrim manuals indicates a failure.
So my question is, does the hope that additionally trimming /sdcard would enhance the situation, seem like a logical one ? If so, can you help me investigate the reason for failure ? trimming /data, for example, successes.

The /sdcard 'partition' is virtual and emulated by the FUSE daemon. It can be found under /data/media so if you trim /data, you're fine.
Sent from my OmniROM-powered LG Optimus 4X HD

Related

[Q] What's the downside of having /system partition always writable?

I have run into a situation where several scripts and/or applications all presume /system partition being writeable while one of them remounts it read-only and others start complaining about it. Not a big deal to remount it again, but made me think why does it need to be read-only in the first place? Is it only for protection? Protection against who? Me? In case I accidentally do something irreversible there? I don't think so. Against malicious applications I might have downloaded from the Market? Probably so. Does anyone know a better reason for needing it to be definitely read-only?
Bump.
I guess it's security protection, because files written to it may cause problems.
It's just my opinion, without proper knowledge about it..
Yeah, it's security.
It's like having Windows without UAC and anti-virus and every application runs as administrator.
knzo said:
It's like having Windows without UAC and anti-virus and every application runs as administrator.
Click to expand...
Click to collapse
Me, me and me These annoying UAC prompts are first thing to be turned off after install, anti-virus is not set to real-time scanning although I run it when I feel anything suspicious happening, and administrator account is the only account I use However, in firewalls I believe. A friend of mine once said that a computer that attracts all these viral, fungal and such sort of things is a *****. Call me stupid if you wish but I have never gotten into any trouble so far.
But I promise to be careful, at least until Android/Linux world is not an uncharted territory for me any more. Thank you all for your inputs!
I second that.
I've never used AV or UAC.
I believe the best anti-virus is: common sense.

[Q] Does leaked update fix apps dissapearing from "Media"?

So after moving apps to the media area, the internal storage on my phone, most of the apps dissapeared. Other websites have talked about this, but I see nothing on XDA. Is this fixed by the leaked OTA?
Sent from my DROID3 using Tapatalk
Its the way the OS works...you dismount a drive and anything on that drive will no longer be available (disappear). This occurs when you plug into the PC and the phone unmounts storage so the PC can mount it. Force close your launcher or if possible, restart it (launcher pro gives this option) once the storage is unmounted from the PC and remounted to the phone.
Sent from my Viewsonic 10" GTab...GTabComb
tcrews said:
Its the way the OS works...you dismount a drive and anything on that drive will no longer be available (disappear). This occurs when you plug into the PC and the phone unmounts storage so the PC can mount it. Force close your launcher or if possible, restart it (launcher pro gives this option) once the storage is unmounted from the PC and remounted to the phone.
Sent from my Viewsonic 10" GTab...GTabComb
Click to expand...
Click to collapse
Actually...I'm having the same problem. Even when the media area isn't mounted on the PC (I make sure it's mounted in Android). Doesn't bother me too much, because my apps don't take up much space. The strange part is that not all of the apps in the media area are disappearing, only some.
Javier78 said:
Actually...I'm having the same problem. Even when the media area isn't mounted on the PC (I make sure it's mounted in Android). Doesn't bother me too much, because my apps don't take up much space. The strange part is that not all of the apps in the media area are disappearing, only some.
Click to expand...
Click to collapse
Same. Things will dissapear even though I never plug it into the computer. Other forums have said this is a common problem, I'll post a link when I'm experienced enough to
Has anyone installed the update, and can give a status report on this issue?
Sent from my DROID3 using Tapatalk
Haven't experienced this as an issue on any droid phone, but it's probably common because alot of ppl are plugging in their phones to their computers and thus losing access to apps on SD.
As with what tcrews advised, it's the way the Os works - If this persists simply restart your phone/launcher, could be a faulty SD card swapping out the card would help.
We have so much space to use on the apps partition as it is tho so i'd recommend moving any apps that install to sd/media back to the phone to reduce issues.
-smc
I appreciate the advice, but I'm afraid no one is getting at the real issue. Since the OP, I moved a dozen apps over to test and half have dissappeared. No computer, no mounting or remounting, just one restart.
Please, this post is about the update. From other forums I believe this is droid 3 specific, and I would like to know if this was fixed. I have a lot of apps.
Sent from my DROID3 using Tapatalk
After some research, I see the issue everyone else is getting at. My problem is not the launcher shortcuts or the app drawer. In settings > applications > manage applications, the app disappears, and all that is left is the namespace, which I assume is just a link to the data on the internal storage. But I need to redownload the app before it works.
Has anyone who flashed the update experienced this, not experienced?
Sent from my DROID3 using Tapatalk

[Q] secure erase

Hello, I am aware of the reset my phone function on windows phone. I understand that it's mounted as an MTP when connecting to a PC. I would like to know if there is a complete, secure, total wiping method for the ultra-paranoid, suitable for WP 8 that will be given away, on the level of how dBan does it. In light of the recent news about how easy it is to recover data on Android, and the fact that it's not impossible on iPhone, I would like to know this.
I am also curious if there is any way to mount the WP 8 as a fully accessible drive, similar to a USB, in order to view all files and perform sanitization. I am curious if this exists for not just Windows, but any of the other OSes out there.
It's probably not technically a full shred of the data, especially since doing so is bloody hard on flash storage. It might even be just a quick format, leaving nearly all the data intact. However, this isn't *very* concerning, because (in answer to your second question) no, there isn't any way to mount the storage directly. Apps don't have the privileges, USB only exposes MTP unless you have a non-retail engineering phone, and there's no way (at this time) to get the required access to the OS. A sufficiently determined attacker *could* pull the data off the physical storage, though this would probably require effectively destroying the phone.
On the other hand, there's an even better option (if you can manage it): BitLocker. If you encrypt the data, then the encryption key (and all material needed to recover it) will be wiped even in a quick format, and your data will be permanently unrecoverable. The problem is, WP8 supports BL but doesn't expose a user-reachable way to enable it. The usual method is to connect to an Exchange server that mandates device encryption, which will turn on BL on the phone. Stupid, I know...
secure erase
GoodDayToDie said:
It's probably not technically a full shred of the data, especially since doing so is bloody hard on flash storage. It might even be just a quick format, leaving nearly all the data intact. However, this isn't *very* concerning, because (in answer to your second question) no, there isn't any way to mount the storage directly. Apps don't have the privileges, USB only exposes MTP unless you have a non-retail engineering phone, and there's no way (at this time) to get the required access to the OS. A sufficiently determined attacker *could* pull the data off the physical storage, though this would probably require effectively destroying the phone.
On the other hand, there's an even better option (if you can manage it): BitLocker. If you encrypt the data, then the encryption key (and all material needed to recover it) will be wiped even in a quick format, and your data will be permanently unrecoverable. The problem is, WP8 supports BL but doesn't expose a user-reachable way to enable it. The usual method is to connect to an Exchange server that mandates device encryption, which will turn on BL on the phone. Stupid, I know...
Click to expand...
Click to collapse
Thank you for that information. Am I correct in assuming that encryption also encrypts user data that may still remain from before a flash, even if that data is no longer accessible? Also, does a full firmware and software flash using Nokia care suit product support tool found on this forum overwrite all data?
BitLocker is capable of encrypting free space as well, though I don't know whether the phone's implementation does so. In general, I would expect it to, though.
No idea w.r.t. firmware flashing, but generally speaking those don't touch the user data at all (you have to hard reset as part of the process, though).

Whats with the USB OTG on this phone.

Coming from a long line of LG's, I do have to say I loved that LG's UI automatically recognized the USB and didnt need any apps to run it, and all other apps recognized it as well. So why doesnt the Nexus 6 do this? I am using stick mount but there are apps that dont recognize this, like with my G2 since it didnt have an SD card, so to save space i would setup titanium backup to store directly to the USB, but now it doesnt recognize it.
anyone have any ideas on how to work around this?
Custom ROMs can build automount in. I don't know of any off the top of my head, but have a read of the threads
Sorry if this seems like a flame, but stop posting the same junk all over....you posted in the two other threads, and now you went and created a third for what is probably your issue.
I have Stickmount working as expected on Stock, MeanPop and BlissPop. Its seen in Root Explorer and I can get it seen by TiBu (even though TiBu says its not writeable, it actually is).
cmh714 said:
Sorry if this seems like a flame, but stop posting the same junk all over....you posted in the two other threads, and now you went and created a third for what is probably your issue.
I have Stickmount working as expected on Stock, MeanPop and BlissPop. Its seen in Root Explorer and I can get it seen by TiBu (even though TiBu says its not writeable, it actually is).
Click to expand...
Click to collapse
stickmount may mount it but it doesnt automatically allow third party apps to see it. I have several apps that I use to use withmy OTG and they can no longer recognize it. and my first question was about doing it period, so dont be an ass. its a simple questions as to why the Nexus doesnt automatically do it. and so far I havent had any of the custom roms I have tried automatically mount it.
harvickgm said:
its a simple questions as to why the Nexus doesnt automatically do it
Click to expand...
Click to collapse
That is not a simple question. At least not to us, since none of us were present at any google meetings where this was either decided against or not discussed.
harvickgm said:
and so far I havent had any of the custom roms I have tried automatically mount it.
Click to expand...
Click to collapse
I can't tell you any that have it. I assume Slim will have it in the future when their 5.1 ROM progresses as they had it previously on KK devices. Actually it's really only the kernel that needs to mount it in the fstab, but it is always nice to have ROM support too, where it is shown in the storage menu.
What apps do you have that cannot recognise OTG? All stick mount does is put it in a folder on your sdcard. I expect all apps can browse to folders on sdcard?
rootSU said:
That is not a simple question. At least not to us, since none of us were present at any google meetings where this was either decided against or not discussed.
I can't tell you any that have it. I assume Slim will have it in the future when their 5.1 ROM progresses as they had it previously on KK devices. Actually it's really only the kernel that needs to mount it in the fstab, but it is always nice to have ROM support too, where it is shown in the storage menu.
What apps do you have that cannot recognise OTG? All stick mount does is put it in a folder on your sdcard. I expect all apps can browse to folders on sdcard?
Click to expand...
Click to collapse
thanks for your input. the original post should have asked about the transfer speeds as well, but thats not my biggest concern. quickpic use to automatically load everything up on as soon as the usb was mounted, but I havent tried it lately with any of the AOSP roms. I always liked the LG UI and never liked AOSP but since I see that stock google looks similar to AOSP that I have taken an interest to learn about them and play with their features and Euphoria 1.1 has it under storage settings but it doesnt do anything when I insert my usb. so it may still be being worked on or I could try a kernel that has it supported to see if that would do it.
but on older phones that never had SD cards I would use by USB for my Titanium Backup storage, but even with stickmount the app still wont notice it. I am going to try a few things that someone told me earlier and see if that works. my backups can become quite large and that valuable space when you only have 32gb.
so if yall have any ideas to try, let me know and I will be happy to give them a shot
Ah figured it out.. I realized I was still running my USB in exfat and once I reformatted it back to fat32 titanium now see's it.. Will have to play more to see if all is working right now
harvickgm said:
Ah figured it out.. I realized I was still running my USB in exfat and once I reformatted it back to fat32 titanium now see's it.. Will have to play more to see if all is working right now
Click to expand...
Click to collapse
Ah cool. Yeah ExFat isn't going to help unless you're on a Samsung - if they still indeed support that.
rootSU said:
Ah cool. Yeah ExFat isn't going to help unless you're on a Samsung - if they still indeed support that.
Click to expand...
Click to collapse
My LG's supported it, but I hate the limitation on Fat32 when you need to transfer files larger than 4gb
harvickgm said:
My LG's supported it, but I hate the limitation on Fat32 when you need to transfer files larger than 4gb
Click to expand...
Click to collapse
Yep it's a pain. ExFAT is microsoft proprietary. I'm surprised some vendors even use it. Some custom Kernels may allow use of NTFS or something. FAT32 is my only option because I have to plug into Windows and Linux systems.
rootSU said:
Yep it's a pain. ExFAT is microsoft proprietary. I'm surprised some vendors even use it. Some custom Kernels may allow use of NTFS or something. FAT32 is my only option because I have to plug into Windows and Linux systems.
Click to expand...
Click to collapse
I'm honestly surprised some new format hasn't been adapted, file sizes are getting to be so big now something will have to change soon.. I hope at least
harvickgm said:
I'm honestly surprised some new format hasn't been adapted, file sizes are getting to be so big now something will have to change soon.. I hope at least
Click to expand...
Click to collapse
I always think the same thing.
rootSU said:
I always think the same thing.
Click to expand...
Click to collapse
OK, so now I have a new problem, maybe you have a work around. Since stickmount shows up under the SD card, the system counts its storage space with the space on the phone. So even tho its a 64gb USB, it won't transfer thinking there is is not enough space on the disk. Any ideas?
harvickgm said:
OK, so now I have a new problem, maybe you have a work around. Since stickmount shows up under the SD card, the system counts its storage space with the space on the phone. So even tho its a 64gb USB, it won't transfer thinking there is is not enough space on the disk. Any ideas?
Click to expand...
Click to collapse
I think you're stuck on that one. The best way would be to mount it independently using the fstab of a custom kernel.
rootSU said:
I think you're stuck on that one. The best way would be to mount it independently using the fstab of a custom kernel.
Click to expand...
Click to collapse
Yes, I have been meaning to try out a kernel with support but just keep forgetting. Will definitely have to do it today. Thanks man

[kernel][RnD][rom] Running Arch Linux Arm with mainline linux on Jemlte

Hi, everyone.
Some time ago I've been working on getting mainline linux to work on our device.
I was mostly interested in running desktop GNU/Linux, not Android, not in chroot.
I used it in Uni for occasional coding, in order not to carry laptop with me.
I'm not sure if I'll continue to actively develop and maintain it, so I decided to share my work with whoever might be interested in it.
However if there would be community interest, I might continue to improve support.
Or maybe someone would like to help me with this undertaking.
The code is not based on amazon kernel, and don't use legacy board files, but is Device Tree based.
Most of the basic hardware works, however, some don't, and would be nice if someone smarter or more stubborn than me helps to troubleshoot it.
What works:
It boots)
Serial console - needs device disassembly, convenient for debugging
eMMC
Display panel with backlight - 18bit mode, without dithering.
HDMI display (hotplug, modeswitching)
USB device - works as usb cdc, handy for SSH access and configuration.
Charging - uses driver from stock kernel
Battery monitoring - doesn't strictly match android measurements, but works.
WiFi - uses brcmfmac driver, needs firmware, haven't tested it outside of regular client mode, not shure if either hotspot or p2p works.
Bluetooth - needs firmware uploaded from userspace, however may be rewriten with serdev interface.
Touchscreen - uses driver from stock kernel.
Vvolume gpio keys
Power button - connected to power management chip
Vivante gc320 - gives a nice speedup for X11 and Xv scaling.
Hall sensor (protective cover (lid) sensor)
Case thermal sensor
Audio codec - headphones, speakers, microphones not tested
LTE modem - can be used for data and SMS but not calling (unless you figure out how to ). Not sure about positioning (if it is available on this modem)
What doesn't work:
Sound - codec works, but I failed to make it properly communicate with omap, am I missing something obvious? works now: mclk pinmux was misconfigured
Camera - not really interested in it anyway.
RPROC - see notes below
[*] DSP - seems to be not used on stock andoid at all;
[*] IPU - required for camera and video encoding/decoding acceleration
[*] IVA-HD - part of VPU.​
GNSS - provided by the same chip as Bluetooth, but communicates via some obscure protocol from userspace.
PoverVR gpu.
What could be brought up with small effort (supposedly):
Various sensors:
IMU: accelerometer, gyroscope, compass.
Hall sensor - protective cover lid
ambient light sensor
various thermal sensors.
LTE (might actually have GPS in it, or call functionality, who knows...)
Bugs:
Bluetooth needs to be enabled in android prior to (hot) reboot to linux, I'm obviously missing some port configuraion.
USB host technically works, but is disabled since it needs some work. (And it makes high pitched noise while 5v booster is on though)
Suspend/resume mighth not work Should work :silly: (proper power management needs newer u-boot).
Charging sometimes get's limited to 500mA -- smb347 driver needs some debugging.
CPU Idle is disabled, not really shure what's wrong with it.
Frequency scaling is not perfect (since omap4470 is not really supported in mainline kernel).
HDMI DDC - EDID reading corrupted, looks like some issues with ddc pullup/esd protection chip, sometimes it might even work. If someone with osciloscope is interested in debugging, you are welcome. And one more thing: after you reboot back to android hdmi wouldn't work here for some time, untill it gets back to normal. Resolved.
Remoteproc functionality (DSP, IPU) for omap chips is not really present in mainline. It IS in TI kernel, I was able to build firmware for ducati, and run it.
But was unable to make it properly communicate with userspace.
Someone experienced with it might help.
What is unlikely to EVER work:
SGX544sc has no userspace drivers, so unless you have some contacts at TI who would bother to compile it, this gpu won't work.
Camera requires some code running on IPU, which, AFAIK, was never opensourced.
Boot process:
The kernel is booted directly via second bootloader.
For now without initramfs, so it needs a separate partition on eMMC for rootfs.
With initramfs, on the other hand, one may put rootfs on the regular `data` partition, either as file or in directory.
Works nicely along with regular Android: with a small tweak to bootloader you can boot either via volume key combination.
The bootloader is configured to boot from `dkernel` partition if both volume buttons are pressed.
Dkernel partition initially contains kernel for factory device check and is not used in regular device operation. Still, you may wish to back it up if you feel like you may need it at some point.
You may choose whichever linux distribution you like, I'm using archlinuxarm for now.
I'll provide a more detailed manual, and flashable binaries, alongside with rootfs later,
But for now, if you know what you are doing, here are some sources:
kernel (current working branch is `integration-4.18`, use omap4jem_defconfig)
u-boot (will upload source code later, for binary build see attachment)
Basic outline of required steps are:
replace secondary bootloader in your main boot partition
rebuild dkernel, with zImage build from sources and flash it.
shrink your 'data' partition
add new partition on your eMMC for your rootfs and format it to ext4 or f2fs
unpack your rootfs onto it
mount and chroot into it to make basic configuration
boot.
A video demo:
https://www.youtube.com/watch?v=mpjwL4VRS-E
Have a nice day!
ipipipipip said:
...
Click to expand...
Click to collapse
Sorry for jumping on the bandwagon a little late here. Seems like a promising project. If you managed to get mainline 4.18 to at least boot (which sounds hard in and of itself), how would it work out if it booted nicely on Android? that wouldn't be too bad of a prospect. Complicated, yes, but maybe remotely possible. I'd be willing to test drive it on my non-lte jem - after I give this project a spin, of course.
A quick update:
Bluetooth now neither require to be powered on prior reboot (there was a clock that I forgot to enable that prevented bcm module from starting), nor a user-space firmware upload.
It now uses serdev bus and kernel-space driver to upload firmware, that removes the hassle of adding system daemon that will properly initiate bluetooth with the correct tty.
There is no proper way for now to check what version of jem/jemlte device you are using so you have to rebuild the kernel with the correct firmware in "firmware/brcm/BCM2076B1_26MHZ.hcd". The default firmware is for lte version, so if you use non-LTE version please replace the file "firmware/brcm/BCM2076B1_26MHZ.hcd" with the 20MHZ one from the same directory (just remove the 26MHZ one, and change 20MHZ to 26MHZ in file name).
WiFi no longer causes issues on resume, and device suspends and resumes properly (more or less), I haven't measured battery drain)
Bad news:
I've bricked my device and not sure if I still can revive it, looks like eMMC is almost dead. Or another case of crappy samsung moviNand firmware.
It is detected over USB as OMAP4470 device and it looks like cpu does not detect emmc.
After about 5 minutes (some kind of watchdog??) it manages to boot u-boot aka fastboot. Any other action that tries to modify content on emmc causes the flash controller lockup and communication with it is no longer possible.
Soldering wires directly to pcb pads doesn't help much, the card is not detected by card-reader.
The main idea for now is to use vendor command 62, as mentioned in one of #Hashcode's posts to wipe all the content of the chip. The problem is that I have wiped linux partition and can't boot into any kind of working linux system on the device. (Recovery tries to mount some partitions rw and thus makes flash chip inaccessible). Guess it's time to make an NFS rootfs and boot the device over USB network.... Or maybe someone knows how to prevent TWRP from accessing partitions on device?
In the worst case scenario I'll have to replace emmc chip (if it's not glued too hard in place), curious if some 128GB will work
Or maybe someone has a spare PCB, or a broken device that they no longer need and may donate?
monster1612 said:
Sorry for jumping on the bandwagon a little late here. Seems like a promising project. If you managed to get mainline 4.18 to at least boot (which sounds hard in and of itself), how would it work out if it booted nicely on Android? that wouldn't be too bad of a prospect. Complicated, yes, but maybe remotely possible. I'd be willing to test drive it on my non-lte jem - after I give this project a spin, of course.
Click to expand...
Click to collapse
There will be no GPU or video decoding acceleration, which might be a problem with modern apps, if you wish, go on and try, might be interesting to have a look, I don't have much experience in building android ROM's.
Sup, have some news on the progress of the project
An eMMC on my tablet died completely, thus I had to replace it with another one. My initial intent was to place some 64gig SanDisk emmc 5.1 from ebay, but I was not sure if it'll work with omap4 and that I won't fry it in the process of replacement. So I've bought some similar scrapped 16gig variant from a local reseller for a couple of pennies. After recovering partition layout and bootloaders the tablet came back to life, thus it's pretty safe to put whatever eMMC chip you have on your hands in your tablet) (it's time to order a larger capacity flash now, 16 gig is rather scarce for both android, arch and some content). The trusty old stock kernel, on the other hand, needed a tiny patch to let kernel understand a flash from the future. The driver checks for known emmc protocol version and unloads flash driver if the revision is too high.
Now feeling more confident in unbrickability of my tablet, I've gone an extra mile of porting mainline U-Boot bootloader to the tablet.
The port is pretty minimal, just support for serial port, usb/fastboot, and framebuffer console. Since pinmuxing and HW initialization is done via stock bl, nothing much to do. But it adds ability to freely manipulate boot sources, kernels, ramdisks, supports dtbs and overlays, environment save/restore, and external boot scrips on a FAT boot partition ). For some reason bootloader font is corrupted and hard to read, bit it should be easy to fix.
The good parts:
kernel version is bumped up to the latest 5.0.0
enabled mpu6050 IMU sensor
enabled tmp103 temperature sensor, supposedly case temperature...
enabled hall sensor that is triggered by a case lid magnet, It's mapped as a SW_LID key
some cleanups for display panel code
resolved HDMI edid issue: two part problem of wrong DDC pin mux sequence and wrong HDMI vdda supply regulator match string
Regressions:
Somewhere in the process it lost the ability to resume from suspend, have to find what caused that.
New bootloader does not handle IDME tags, therefore for the stock os I had to hardcode serial and MAC addresses in stock kernel idme driver. But since there is plenty of place to put different bootloaders on our tablets you may use one for stock rom, and another for development.
A second part of the update is coming soon...
Hi there,
This is very exciting work - how is the tablet doing a year on? I'm wondering how much of your work is applicable to the 7 inch equivalent, seeing as the board is common, just with a few minor hardware differences.
Thanks,
Jack
Jack_Kekzoz said:
Hi there,
This is very exciting work - how is the tablet doing a year on? I'm wondering how much of your work is applicable to the 7 inch equivalent, seeing as the board is common, just with a few minor hardware differences.
Thanks,
Jack
Click to expand...
Click to collapse
Hi Jack, since last update I got some additional pieces working. Specifically: sound (and that was a brain-teaser for a long time) and LTE modem are working now. UEFI boot with u-boot implementation is functional.
Indeed 7-inch tablet may be brought-up with quite a low effort: lcd panel is slightly different, but there is a driver for it already in kernel, touch screen is also different. Apart from that rest of the stuff should work quite the same, that is usb, uart, wifi, bt, audio, backlight, keys, emmc, hdmi, with minor DeviceTree adjustments.
Same for u-boot: for basic functionality only a few pin-assignment changes are needed.
Hi,
For a relative arch Linux beginner, what resources would you point one to to be able to implement this on an OG kindle fire HD 8.9?
I'm decently comfortable on the command line, but once it starts getting deep in the kernel, I am a little more cautious..
Many thanks,
Jeff
Joonatnoon said:
Hi,
For a relative arch Linux beginner, what resources would you point one to to be able to implement this on an OG kindle fire HD 8.9?
I'm decently comfortable on the command line, but once it starts getting deep in the kernel, I am a little more cautious..
Many thanks,
Jeff
Click to expand...
Click to collapse
It depends on what you want to achieve. This kernel will happily work on any kindle fire 8.9 2012. LTE version just has an additional board with a modem on it, (and needs another Bluetooth firmware).
At some point, I created a bit more user-friendly image of Manjaro with LXQt suitable for dual-boot, but without hardware acceleration, it was too sluggish for any real use.
If you want to have some fun and do something useful at the same time, I'd suggest adding support for this device in postmarket os project.
The starting point is here https://wiki.postmarketos.org/wiki/Porting_to_a_new_device
If you encounter any difficulties, feel free to ask
ipipipipip said:
Hi Jack, since last update I got some additional pieces working. Specifically: sound (and that was a brain-teaser for a long time) and LTE modem are working now. UEFI boot with u-boot implementation is functional.
Indeed 7-inch tablet may be brought-up with quite a low effort: lcd panel is slightly different, but there is a driver for it already in kernel, touch screen is also different. Apart from that rest of the stuff should work quite the same, that is usb, uart, wifi, bt, audio, backlight, keys, emmc, hdmi, with minor DeviceTree adjustments.
Same for u-boot: for basic functionality only a few pin-assignment changes are needed.
Click to expand...
Click to collapse
Thanks for all this. I hope to port the 7 inch version (soho) to postmarketOS (am surprised you didn't want to get jem running it so you can have a nice touch interface).
Have you seen the attempts to get mainline drivers that interface with PowerVR SGX 5xx graphics firmware? Seems like one day there might be 3D working...
https://github.com/openpvrsgx-devgroup/linux_openpvrsgx
One more question - have all the changes you described been pulled upstream, so I can just fork from mainline, or are some important ones still not yet in, so I should fork your repo?
Thanks again for all your efforts - I am very excited as to how this will benefit soho development.
Jack_Kekzoz said:
Thanks for all this. I hope to port the 7 inch version (soho) to postmarketOS (am surprised you didn't want to get jem running it so you can have a nice touch interface).
Click to expand...
Click to collapse
I did get it run postmarket, but it was somewhat clumsy and not properly integrated into a build tree. Also, it seemed a bit clumsy to update-rebuild-flash-reboot firmware image after a change contrary to rebuilding some users-pace parts just on the device.
Have you seen the attempts to get mainline drivers that interface with PowerVR SGX 5xx graphics firmware? Seems like one day there might be 3D working...
https://github.com/openpvrsgx-devgroup/linux_openpvrsgx
Click to expand...
Click to collapse
If only there was a non-android userspace driver for sgx544sc that is in 4470, inb4: ti still uses sgx544 in their new chips, but it is different.
Would be nice to have 3d, but I'm afraid that without major testing and bug fixing (on source code driver level, which is closed) It will be buggy as hell.
One more question - have all the changes you described been pulled upstream, so I can just fork from mainline, or are some important ones still not yet in, so I should fork your repo?
Click to expand...
Click to collapse
Nope :angel: . Clone my repo.
Hello again,
I've been trying to get a downstream kernel postmarketOS running on soho, and had noted the bootloader refused to load my kernel (just went to fastboot) unless I hexedited some zeroes (and some other data) at the beginning of my boot image (a technique required for the one custom rom available for it), after which it bootlooped. I see jem too requires some boot image manipulation to get cm11 on it (https://github.com/LineageOS/android_device_amazon_jem/blob/cm-11.0/boot.mk) - how did you get your kernel booting? I don't know much about the boot process, but I imagine there is some sort of signature verification Amazon cooked in that the hex data added at the beginning confuses.
Can I pm you?
Thanks,
Jack
Hi, yes boot image is signed and verified, but at least on Jem there is a vulnerability in stock u-boot that allows to bypass the signature check and execute arbitrary code.
Not sure how it is done on soho, but, at a first glance, the exploit looks kinda the same (even addresses are the same).
https://github.com/TeamWin/android_device_amazon_soho/blob/cm-12.0/exploit.mk
On jem there is an image size check missing when loading boot image into ram. The boot.img header contains image size to be loaded, and thus if you load a large enough chunk you will overwrite current stack frame (and what's important - return address), thus after data is loaded bootloader will jump to user-specified address. The trick is to load your executable code (second bootloader in my case) into ram (put it somewhere at a known place in boot partition) and use that address to overwrite the stack.
One problem was that main boot partition is too small (8MiB) to contain a patch to overwrite the stack, thus initially it was placed somewhere at the beginning of system partition (with hopes and prayers that it will not corrupt ext4). But then I resized those partitions to 16MiB which is enough to fit everything.
If you don't want to bother with modifying bootloader, just retrofit those boot image creation makefiles.
Thanks - so how did you modify your boot image when you were tinkering with pmOS? Did you just replace the stock u-boot so no exploit was necessary? I thought x-loader would refuse to load any u-boot not signed with Amazon's keys? Sorry, you stated you put your second bootloader at an address in the boot partition. I'm just curious as to how exactly one does that when building pmOS.
Thanks,
Jack
Who knows, there is actually no sane way to create simply flashable boot.img without resizing boot partition first, that I highly suggest you to do. Make a backup of all partitions and gpt table, practice a bit on a spare sdcard, boot twrp, remove boot partition, and what's after it, then recreate those with sizes as need (and don't forget to restore partition names, that's important). Also would be handy to increase system partition size on the way, by sacrificing userdata size.
But, if you have working third party ROM, and don't expect to fiddle with bootloader, chances are you may get away with just dd-ing a few values and 2nd loader over boot.img postmarket builds (there is a package stage in linux-xxx target in postmarket's APKBUILD where you can put this code), and hope that magic value (stack smashing value) will not be overwritten while installing firmware
Thanks for this info. I've managed, through your help and others, to get a boot pmOS (on a downstream kernel). I'm in the process of merging my work, and the question is being asked of the boot hack, which I am hoping to get merged into postmarketos-mkinitfs package (not in an APKBUILD for soho) - are there any other devices that use a similar hack? If the answer is yes, I think it makes sense to include them in the same portion of code for future pmOS jem attempts - I know you didn't want to merge all your code, and that's ok, but could I make a request for one part of it? Please may I ask what exact shell commands you needed to run to amend jem's boot.img so that tricking the signature check takes place? For what it is worth, for soho I adapted the boot hack in the rom makefile to the below:
SOHO_HEADER_DATA='\x50\x03\x00\x00\x00\x25\xe4\x00'
SOHO_HEADER_SIZE=848
SOHO_HEADER_OFFSET=52
tempfile=$(mktemp)
dd if=/dev/zero of="${tempfile}" bs=$SOHO_HEADER_SIZE count=1
printf "%b" $SOHO_HEADER_DATA | dd of="${tempfile}" bs=$SOHO_HEADER_OFFSET seek=1 conv=notrunc
cat "${outfile/initramfs-/boot.img-}" >> "${tempfile}"
mv "${tempfile}" "${outfile/initramfs-/boot.img-}"
(I didn't need to resize my boot partition as I believe the hidden bootloader is stored in the recovery partition.) Anyway, thanks for all the help. I'm going to work a bit more on polishing my downstream port before turning my attention upstream, and copying most of your dts and relevant commits
Nice , as for other devices: fire hd 2012 7" (IIRC it is called tate) is likely using the same hack, and that's it, it was an amazons bug so no other devices affected. You may assume that the commands for jem are exactly the same.
BTW, may I have a look at a merge request for postmarketos-mkinitfs, when you create it? I dug a bit, trying to find a nice clean method of wrapping boot.img after mkinitfs creates it, but didn't found any. The closest thing that exists are a few device-specific "sign" steps, which are almost exactly what we need, except that, I don't want to add more ugly device-specific checks in build scripts. Some generic field that names the tool for signing and a separate package that does that device-specific signature would've been the best IMO.
I guess It's time to rebase jem to a latest kernel, with a cleanup, coz a few things are broken now and need additional rework.
The Kindle Fire 2 (otter2) also appears to require a similar exploit. Merge request is here: https://gitlab.com/postmarketOS/pmaports/-/merge_requests/1995
Rebasing jem sounds exciting!
I don't know if you've read the MR comments, but lead dev Ollie has just said what you said re device specific code. Time to rewrite then...

Categories

Resources