I'm trying to port pmOS to an LG-K330 (AT&T LG-K7), which I believe is codenamed m1 (I think it has the same kernel as the MetroPCS variant MS330).
I found kernel source here, removed the default patches added by pmbootstrap and added 00_fix_return_address.patch which I got from other aports I was able to menuconfig and kconfig, but I'm unable to successfully build. I keep getting these errors:
drivers/soc/qcom/lge/lge_boot_mode.c:197:9: error: 'LGEUSB_FACTORY_56K' undeclared (first use in this function) res = LGEUSB_FACTORY_56K;...drivers/soc/qcom/lge/lge_boot_mode.c:218:8: error: variable 'lge_android_usb_pdata' has initializer but incomplete type struct lge_android_usb_platform_data lge_android_usb_pdata = {
I'm getting the same issue with LGEUSB_FACTORY_130K / 910K. I looked and LGEUSB_FACTORY_56K and lge_android_usb_platform_data are both defined in include/linux/platform_data/lge_android_usb.h, is the header just not being included or something?
drivers/soc/qcom/lge/lge_boot_mode.c:228:8: error: variable 'lge_android_usb_device' has initializer but incomplete type struct platform_device lge_android_usb_device = {
There are more errors that I think are related to the ones I've listed above. I've attached a more complete error log and my APKBUILD.
I found in lge_boot_mode.c that include/linux/platform_data/lge_android_usb.h is included under an ifdef here referring to CONFIG_LGE_USB_G_ANDROID.
I looked for this option with pmbootstrap menuconfig; the search result said it was listed under
Device Drivers -> USB Support -> USB Gadget Support, and that it also relied on
CONFIG_USB_G_ANDROID under
Device Drivers -> USB Support -> USB Gadget Support -> USB Gadget Drivers.
At first I was unable to find either option actually listed so I added them both manually, but looking again it looks like it's only available when USB Gadget Drivers is set to *; it was listed as M so I changed it to Y and selected CONFIG_USB_G_ANDROID, which let me set CONFIG_LGE_USB_G_ANDROID too. There are more errors that I'll get to soon, I will update as I find out more.
UPDATE
now I have this issue:
drivers/char/diag/mts_tty.o: In function `mts_tty_init':/home/pmos/build/src/android_kernel_lge_msm8909-017ab2a9067360f82d660dab7b08ce7e277c1cdb/drivers/char/diag/mts_tty.c:207: multiple definition of `init_module'drivers/char/diag/diagchar_core.o:/home/pmos/build/src/android_kernel_lge_msm8909-017ab2a9067360f82d660dab7b08ce7e277c1cdb/drivers/char/diag/diagchar_core.c:2294: first defined heredrivers/char/diag/mts_tty.o: In function `mts_tty_unthrottle':/home/pmos/build/src/android_kernel_lge_msm8909-017ab2a9067360f82d660dab7b08ce7e277c1cdb/drivers/char/diag/mts_tty.c:155: multiple definition of `cleanup_module'drivers/char/diag/diagchar_core.o:/home/pmos/build/src/android_kernel_lge_msm8909-017ab2a9067360f82d660dab7b08ce7e277c1cdb/drivers/char/diag/diagchar_core.c:2413: first defined heremake[3]: *** [scripts/Makefile.build:444: drivers/char/diag/diagchar.o] Error 1make[2]: *** [scripts/Makefile.build:455: drivers/char/diag] Error 2make[1]: *** [scripts/Makefile.build:455: drivers/char] Error 2
I read here that it could be an issue with the Makefile or Kconfig but I'm not really sure where to start looking. I'll keep looking around to see what i can find, it'd be great if someone could point me in the right direction too.
UPDATE-2
I found some more errors from when I tried building with multiple threads, more "multiple definition" errors from lib/mpi/mpi.o:
Welcome to postmarketOS and thanks for starting a port to your device!
I found some more errors from when I tried building with multiple threads, more "multiple definition" errors from lib/mpi/mpi.o:
In my experience that's not very helpful, we need to fix the errors from top to bottom, and sometimes upper errors cause further errors down the road.
CONFIG_DIAG_CHAR was set to M so I changed it to * and that fixed the drivers/char/diag/mts_tty.o error. I'm starting to see a pattern here lol
Good that you just got further again
If you should get stuck at some point without any idea how to proceed, please fork pmbootstrap and add your WIP progress in a new branch, so we can try the build ourselves and try to fix it. (also let us know here with a comment afterwards )
will do. It looks like the mpi error was patched in the linux-lg-bullhead port with static-inline.patch. I also applied driver-fix.patchfrom the same port to address another error, and it finished building! I won't be able to actually try and flash it for a bit but I'll update when I am. I added a wiki page here.
I think I got the screen to work! Now I'm trying to get pmos to recognize touch events and I'm hitting some snags. I'm not totally sure what touchscreen drivers I should be including in the kernel; initially CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_v21 was enabled, but I don't know why since the config I based mine off didn't include that at all. I poked around a bit and my current best guess is the melfas mit200 firmware. I thought I set the right flags in the config to build out the firmware but I'm getting this:
MK_FW firmware/melfas/mit200/lgps22/L0M45P1_00_07.fw.gen.S COPY firmware/melfas/mit200/lgps22/L0M45P1_00_07.fwcp: can't stat '/home/pmos/build/src/android_kernel_lge_msm8909-017ab2a9067360f82d660dab7b08ce7e277c1cdb/firmware/melfas/mit200/lgps22/L0M45P1_00_07.fw': No such file or directorymake[1]: *** [/home/pmos/build/src/android_kernel_lge_msm8909-017ab2a9067360f82d660dab7b08ce7e277c1cdb/firmware/Makefile:287: firmware/melfas/mit200/lgps22/L0M45P1_00_07.fw] Error 1make: *** [Makefile:815: firmware] Error 2
Looking at the makefile reveals why it's dipping into mit200/lgps22 even though my phone model is m1, though I diffed the two folders and they're identical anyway. Also the ifdefs above are all identical to each other and refer to $(wildcard $(srctree)/firmware/melfas/m1_spr_us/*) which isn't actually a folder??
But otherwise I don't know why it's failing. I'm assuming there's some sort of conversion process from .fw.ihex -> .fw.gen.S -> .fw but I haven't found any documentation on it yet. Any ideas? I finally make forked pmbootstrap with my wip device-lg-m1 branch here.
For all devices we have ported postmarketOS to so far, we did not require any kernel config adjustments to make the touchscreen work. The drivers already get built if you use the kernel config for your device (modified to pass pmbootstrap's kernel config checking of course).
but I don't know why since the config I based mine off didn't include that at all.
My guess is that the kernel config you've started with was generated with older kernel sources. As the kernel source changed, new options appeared, and when you generate a new config with pmbootstrap menuconfig, these new options get filled out with the defaults.
That's interesting about the kernel defaults. I did try to cat /dev/input/eventX but i was only able to trigger any events with the power and volume keys (event4/5). Looking at logread output it also says
Dec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.198] event5 - gpio-keys: is tagged by udev as: KeyboardDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.198] event5 - gpio-keys: device is a keyboardDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.199] event4 - qpnp_pon: is tagged by udev as: KeyboardDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.199] event4 - qpnp_pon: device is a keyboardDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.201] event2 - accelerometer: is tagged by udev as: AccelerometerDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.201] event2 - accelerometer: device is an accelerometer, ignoringDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.201] event2 - not using input device '/dev/input/event2'Dec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.202] event1 - light: not tagged as supported input deviceDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.203] event1 - not using input device '/dev/input/event1'Dec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.204] event3 - magnetic_field: is tagged by udev as: AccelerometerDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.204] event3 - magnetic_field: device is an accelerometer, ignoringDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.204] event3 - not using input device '/dev/input/event3'Dec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.205] event0 - proximity: not tagged as supported input deviceDec 31 13:59:59 lg-m1 user.notice user:weston: [19:02:27.205] event0 - not using input device '/dev/input/event0'
so event0-3 are not being used by weston and are all non-touch devices.
I compared my pmos/twrp sysfs as recommended on the wiki: devices.diff. twrp seems to list input0 as being the touch device (cat /sys/devices/virtual/input/input0/name returns touch_dev) and cat /dev/input/event0 does print outputs when in twrp. /sys/devices/virtual/input/lge_touch/firmware returns
======== IC Firmware Info ========FW Version: 1.01====== Binary Firmware Info ======Bin Version: 1.01
on the other hand, lge_touch is entirely absent from /sys/devices/virtual/input in pmos. I tried to set deviceinfo_dev_touchscreen="/dev/input/event0" anyway but that did nothing (not that it should have since event0 is apparently the proximity sensor)
I also looked in the sysfs folder of another LG device (lg-k428) and confirmed it's using the mit-300 touchscreen driver, hence my current suspicions that I ought to be using the mit200 driver.
update
after some finagling I patched firmware/Makefile with a modified version of this and got it to compile through with the mit200 driver, but unfortunately i'm not seeing any new input devices show up.
I managed to compile and flash the EdwinMoq kernel but I haven't been able to get the screen to work nor does the touchscreen seem to get detected lol. gonna keep fiddling with kernel config
For some reason dmesg on 3.10.49-pmos is totally empty?? but it does have a /var/log/firmwareload.log that just says a bunch of times
cannot find firmware file 'venus.mdt'
According to twrp's dmesg I think I was right that I need the MIT200 firmware/driver so I wonder why it wasn't selected in my original config and doesn't even compile without a shoddy self-made patch -_- but it looks like in 3.18.71 it gets stuck in some sort of infinite boot loop, the touch logs seem comparable until here:
[ 3.951585] [TOUCH][L][MIT200] ESD Detected![ 3.951602] [TOUCH][L][COMMON] WqTouchIrqHandler : goto error !!![ 3.951614] [TOUCH][E][COMMON] WqTouchIrqHandler() line=702 : Abnormal IC status. Touch IC will be reset[ 3.951642] [TOUCH][L][PLATFORM] Interrupt Disabled[ 3.951654] [TOUCH][L][PLATFORM] Reset Pin was set to LOW[ 3.970144] [TOUCH][L][PLATFORM] Reset Pin was set to HIGH[ 4.080274] [TOUCH][L][MIT200] Device was reset[ 4.080538] [TOUCH][L][COMMON] STATE = NORMAL[ 4.080557] [TOUCH][L][PLATFORM] Interrupt Enabled
according to google though, apparently ESD just means "electrostatic discharge"?? so I guess my main inquiries:
why is the touchscreen reporting ESDs? some sort of pin misconfiguration or something?
why isn't dmesg working in 3.10.49 and what is venus.mdt? I saw some other references to it in this repository, i'll look into it
i'm wondering which kernel I should focus on as well since at least 3.10.49 has a working display. right now i'm thinking it may benefit me to keep looking at both of them at least for comparison.
For some reason dmesg on 3.10.49-pmos is totally empty??
That is probably caused by a weird value for kernel config option CONSOLE_LOGLEVEL_DEFAULT, so you could compare what both kernels have there. You can also override the log level without recompiling the kernel by specifying "loglevel=" in the kernel command line.
According to twrp's dmesg I think I was right that I need the MIT200 firmware/driver so I wonder why it wasn't selected in my original config and doesn't even compile without a shoddy self-made patch -_-
The other day I have read in #postmarketOS, that with Android's build system, sometimes multiple kernel configs get merged into one, and that such a second kernel config may specify the details for the touch screen. So maybe you could check the Android repositories for a touch screen specific config that you need to merge with yours.
@scintill wrote that the usb networking related configurations were in an extra config file for the samsung-i9195 in #1260 (closed), maybe he could tell you how to find such a second config.
why is the touchscreen reporting ESDs? some sort of pin misconfiguration or something?
I think this is a bug in the touchscreen driver: it reports ESD problems, when the firmware file is missing (I also think that you really need this file now, and it probably gets generated in the kernel compilation process?).
i'm wondering which kernel I should focus on as well since at least 3.10.49 has a working display. right now i'm thinking it may benefit me to keep looking at both of them at least for comparison.
This line shows the second config file for my own device (TARGET_KERNEL_VARIANT_CONFIG seems to get combined with TARGET_KERNEL_CONFIG for the full kernel config). I didn't see the VARIANT line in TheOddTaco's repos, so it's probably not the exact same issue. Anyway, I think I tracked mine down by diffing zcat /proc/config.gz between my working Android kernel and the one pmOS was building. There might be easier ways to do that; but if you haven't tried that, I would start there. Maybe look at your Android init scripts to see if they poke something to initialize the screen.
I found CONFIG_DEFAULT_MESSAGE_LOGLEVEL=4 already set in the oddtaco kernel but still nothing in dmesg.
@scintill I'm not seeing any /proc/config.gz or /boot/config* in twrp recovery, did you have to reflash the android rootfs? I guess i can restore my twrp backup
update
i've looked a bunch of places and haven't been able to find the running kernel config. Gonna keep looking at the sources then
Unfortunatelly this feature is not enabled in all kernels (CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC must be enabled in the kernel at compile time). If it is not enabled, the kernel configuration (as text) does not get compiled into the kernel, so you can't read it out.
Idea
This is a shot in the dark, but when searching for "FIRMWARE" in your kernel config, I found this option enabled:
Say yes to avoid building firmware. Firmware is usually shipped with the driver and only when updating the firmware should a rebuild be made. If unsure, say Y here.
I've grepped for this in the other kernel configs we have, and whenever the option is specified, it is set to =y, so I would not put too much hope into it. But maybe if you disable that option, it compiles the touch screen firmware and it starts working.
hm yeah, searching for PREVENT_FIRMWARE_BUILD in the git repo doesn't seem to return anything promising so I'm not too sure about this. I really want to figure out what's blocking up dmesg, I feel like it'll be pretty useful later on too (thinking optimistically lol).
I'm gonna try to compare more closely the differences between the edmoq+oddtaco melfas mit200 drivers, I already patched the oddtaco makefile with some of the edmoq one since it was refusing to build for a while.
also, after rebasing my oddtaco repo to pmbootstrap@002993b3 I'm getting the same error as in the edmoq repo, and my screen is stuck at the pmos loading screen:
Dec 31 13:59:59 lg-m1 user.notice user:weston: [19:25:05.224] Failed to open frame buffer device ‘/dev/fb0’: Permission denied
but I don't see anything in the build logs that indicates this rule even being hit.
In the oddtaco kernel tree there is indeed a file at firmware/melfas/m1_spr_us/fw.bin though it isn't present in the fenomenalMOD one. I tried sftping this file to the rootfs at /lib/firmware/melfas/m1_spr_us/fw.bin but I'm still getting the same error. I did a find / -name fw.bin in TWRP but didn't find anything either so I'm guessing it's been bundled in the binary or something. Gonna keep poking around.
I looked into the error message a little bit.. I think error message -12 refers to ENOMEMNot enough space/cannot allocate memory (POSIX.1-2001), which isn't incredibly helpful since a lot of the function calls in request_firmware() can return ENOMEM. Is there a better way to debug than like...patching request_firmware to do a bunch of printks or something? Apparently I have CONFIG_DYNAMIC_DEBUG=y enabled though I'm not quite sure what to do with that information.
I'm currently stumped by this issue which is preventing me from rebuilding any packages, once i figure that out I can get back into it.
ok so I flashed again but now I'm getting this error "initramfs-extra not found". I tried manually extracting it like it says here but I get the same error.
I needed to pass /boot to mount_boot_partition, which isn't present on the wiki
the only initramfs-extra i found is called '/boot/initramfs-lg-m1-extra_0da0e49d89aee6b475d9235e0617a8e8' and the wiki doesn't indicate that I should expect that hash suffix.
I also tried netcatting it from ~/.local/var/pmbootstrap/chroot_rootfs_lg-m1/boot/initramfs-lg-m1-extra but that made no difference either.
I searched through the matrix rooms, one guy said zapping everything fixed it for him but that didn't fix it for me.