Defy [MB525] - Enabling FM Transmitter - Defy General

Hi all,
I have enabled the FM transmitter on Motorola DEFY using the sample FM test application from omap3 git. Please note its not an apk that you can install and its NOT for users (its only test code).
I have not yet successfully transmitted any audio but there seems to be some hope that it can be done. (provided all the required internal circuitry is present)
After a few modifications (and some ugly hacks) to the FM app, I was able to switch to TX mode, power on and set a frequency (tune) for FM transmission. Logs show promising results but I have to confirm if it is enabled for real. I have attached the log to this post.
Currently I am stuck with audio routing to FM transmitter. The FM test app seems to use ALSA to setup and get the routing done for some dev board. For Defy I am not sure how to get it working. I have to dig a bit more into audio API's and libraries. Any ideas? Sample apps/code or API's to get this done?
Just did this over the weekend and I am planning to mess around with it a bit more.
-- WiZarD [Winny Mathew]

the way things are going for motorola defy, it looks set to become the n900 of maemo or htc hd2, i.e. a legendary smartphone - and thanks a ton you all modders!
Seems like motorola has released a pandora's box without they knowing it themselves (speaks volumes about motorola's miscalculations about market positioning of the phone - even eldar murtazin was impressed by moto defy!)
Also, it is sometimes funny how on some other forums, users seem to know more than official moto folks - let's take the example of defy possessing a graphics chip - users knew it long before moto forum representatives could confirm it. And now if the above post is true, defy might soon have FM transmitting capabilities! What a great day!

One more hurdle of unlocking the bootloader and defy would become a legend..

Looking forward to more positive news about this! Unfortunly I can't contribute with anything though
Sent from my MOTO Defy

Sowhat you are saying is, defy has all the needed hardware for a FM transmitter?
now if its possible, man its huge!
So please keep uptodate with whats happening! love to hear them!
All XDA developers should look into it, together we can make this happen!

snath83 said:
One more hurdle of unlocking the bootloader and defy would become a legend..
Click to expand...
Click to collapse
That is not just one hurdle, that is THE hurdle. No unlocked bootloader no legend. This phone, however promising it seemed, just isn't becoming the new HD2. I am still not entirely sure if I rather should have bought the HD2 in the first place. But for the moment the waterproof case still makes the Defy the better one for me.

AgentSmith said:
That is not just one hurdle, that is THE hurdle. No unlocked bootloader no legend. This phone, however promising it seemed, just isn't becoming the new HD2. I am still not entirely sure if I rather should have bought the HD2 in the first place. But for the moment the waterproof case still makes the Defy the better one for me.
Click to expand...
Click to collapse
Have both.
HD2 is the better computer, Defy the better phone. (Smaller screen yet more batterylife and outdoor capabilities

nice but it was my understanding that the defy had the hardware but no way of transmitting due to the fact theirs no internal antenna.
what sort of range did you get?

The headphones are the antena. Here in Brazil, the stock rom comes with FM.

antony.ps said:
The headphones are the antena. Here in Brazil, the stock rom comes with FM.
Click to expand...
Click to collapse
All defy's have FM radio to receive but this tread is about being able to transmit via FM

I only see a log file in the zip you attached. Do you have some code or a link to the omap git code you mentioned?

Source OMAP3 GIT: hxxp://git.omapzoom.org/?p=platform/hardware/ti/omap3.git;a=tree;f=fmradio;hb=HEAD

Hi. I really dont get how to compile this. As far as I see, there are .cpp and .c files, so I think that they can be compiled with a simple gcc-armel. The thing is, I have to clone the entire GIT of omapzoom?
What I need to compile those? I have the SDK(working, aside the Java exception) and the NDK of android and nothing else.

Hi all,
I was a bit busy, out of focus and travelling. I did search DEFY's source code (kernel and framework) to find how data could be routed to the transmitter. I did not find anything interesting yet.
Steps pending:
1. Find how FM Radio Rx (stock FM Radio app) gets its data routed to external and 3.5 mm speakers.
2. Find out if there is code to send data via Tx path, if not, is it possible to add the same. (which may involve recompiling the driver/kernel)
There are many output devices listed in kernel source code for audio. (in kernel/sound/oss/omap34xx_audio_driver.c and kernel/sound/oss/cpcap_audio_driver.h). I am not sure if any of the output devices could be used for sending data to FM Tx.
@cocus:
a. You can use NDK and some modifications to the Makefile and source to get it compiled.
b. No you don't have to clone the entire git.
I can post a patch of changes I have done but currently it is ugly

Let's share your source and brain storm to find a solution
I made some tests this WE with a FMAPP found on the web but I can't get it stable.

Initial patch and dependencies for enabling Tx (Native test app only)
Hi all,
I have attached 'FM_TX.zip' which contains the source code patch, dependencies and a README.txt (attached outside as well). Using this you can build 'fmapp' for enabling and testing FM Tx on DEFY.
'README.txt' has more information on steps, setup and more TODOs
Let me try to figure out audio...
-- Winny Mathew
-- [WiZarD]

Hi, thanks for your great post.
I've cloned the omap3 hardware path, and now I have the fm radio dir. Now, how do I apply the patch?
I've tryied this, but I get a lot of errors:
[email protected]:~/devfm/omap3/fmradio$ patch -p1 < ./fmradio.patch
(Stripping trailing CRs from patch.)
patching file Makefile
(Stripping trailing CRs from patch.)
patching file fm_app/fm_app.c
Hunk #1 FAILED at 49.
Hunk #2 FAILED at 1718.
Hunk #3 FAILED at 3510.
Hunk #4 FAILED at 3529.
Hunk #5 FAILED at 3578.
Hunk #6 FAILED at 3621.
Hunk #7 FAILED at 3635.
Hunk #8 FAILED at 3644.
Hunk #9 FAILED at 3657.
Hunk #10 FAILED at 3773.
Hunk #11 FAILED at 3781.
Hunk #12 FAILED at 3795.
Hunk #13 FAILED at 3805.
Hunk #14 FAILED at 3817.
Hunk #15 FAILED at 3931.
15 out of 15 hunks FAILED -- saving rejects to file fm_app/fm_app.c.rej
(Stripping trailing CRs from patch.)
patching file fm_app/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_app/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/FM_Trace/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/FM_Trace/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c
Hunk #1 FAILED at 2290.
Hunk #2 FAILED at 2648.
2 out of 2 hunks FAILED -- saving rejects to file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h
Hunk #1 FAILED at 76.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h.rej
Click to expand...
Click to collapse
(im a noob in this stuff).
Thanks!

Copy 'fmradio.patch' into 'fmradio' directory.
Then execute the following:
$ patch -p1 < fmradio.patch
Hint: Run 'dos2unix fmradio.patch' if required.

Hey, thanks for your answer. Yes, that is what I did. Take a look here, I've listed the fmradio directory and there is the fmradio.patch with the other files from the GIT.
[email protected]:~/devfm/omap3/fmradio$ ls
Android.mk fm_app fmradio.patch fm_stack LICENSE.TXT Makefile
[email protected]:~/devfm/omap3/fmradio$ patch -p1 < fmradio.patch
(Stripping trailing CRs from patch.)
patching file Makefile
(Stripping trailing CRs from patch.)
patching file fm_app/fm_app.c
Hunk #1 FAILED at 49.
Hunk #2 FAILED at 1718.
Hunk #3 FAILED at 3510.
Hunk #4 FAILED at 3529.
Hunk #5 FAILED at 3578.
Hunk #6 FAILED at 3621.
Hunk #7 FAILED at 3635.
Hunk #8 FAILED at 3644.
Hunk #9 FAILED at 3657.
Hunk #10 FAILED at 3773.
Hunk #11 FAILED at 3781.
Hunk #12 FAILED at 3795.
Hunk #13 FAILED at 3805.
Hunk #14 FAILED at 3817.
Hunk #15 FAILED at 3931.
15 out of 15 hunks FAILED -- saving rejects to file fm_app/fm_app.c.rej
(Stripping trailing CRs from patch.)
patching file fm_app/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_app/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/FM_Trace/fm_trace.h
Hunk #1 FAILED at 184.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/FM_Trace/fm_trace.h.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c
Hunk #1 FAILED at 2290.
Hunk #2 FAILED at 2648.
2 out of 2 hunks FAILED -- saving rejects to file fm_stack/HSW_FMStack/stack/tx/fm_tx_sm.c.rej
(Stripping trailing CRs from patch.)
patching file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h
Hunk #1 FAILED at 76.
1 out of 1 hunk FAILED -- saving rejects to file fm_stack/MCP_Common/Platform/inc/mcp_hal_config.h.rej
Click to expand...
Click to collapse
I've tryied your pre-compiled binary, but Im getting a very strange error. Ive pushed the binary to /sdcard, then with the console Ive copyied it to /system/data and when I wanted to chmod it:
chmod +x fmapp
Bad mode
Click to expand...
Click to collapse
With chmod 0755 it didnt say anything, but when I try to run it:
./fmapp
-sh: ./fmapp: No such file or directory
Click to expand...
Click to collapse
And the file is there!!!!!

cocus said:
Hey, thanks for your answer. Yes, that is what I did. Take a look here, I've listed the fmradio directory and there is the fmradio.patch with the other files from the GIT.
I've tryied your pre-compiled binary, but Im getting a very strange error. Ive pushed the binary to /sdcard, then with the console Ive copyied it to /system/data and when I wanted to chmod it:
With chmod 0755 it didnt say anything, but when I try to run it:
And the file is there!!!!!
Click to expand...
Click to collapse
Try this:
[Host ] $ adb shell
[Device] $ su
[Device] # mkdir /data/tmp
[Device] # chmod 777 /data/tmp
[Device] # exit
[Device] $ exit
---- Up to here, needed only once ----
[Host ] $ adb push fmapp /data/tmp
Connect to phone over WiFi using 'putty' (install QuickSSHd or similar)
[Device] $ su
[Device] # cd /data/tmp
[Device] # chmod 777 fmapp
[Device] # ./fmapp

Related

Help Needed: Need a file from the Incredible dumped!

Basically, i'm looking for the file 'dev/tpa2018d1' or something along those lines, it might be called something slightly different. I'm not in a position where i can build the source so if anyone could do this for me, i would be incredibly grateful!!
Thanks!
may we ask what is it for =)
I am sure I can look around for you
Getting a volume hack working on the Nexus/Desire/Incredible. As they are running very similar firmware on very similar hardware it should be compatible across all 3 phones
tpa2018d1 controls speaker amplification on the Nexus/Desire but isn't present. I'm just hoping that the Incredible has it
I looked on my incredible and can't find such a file in /dev, or indeed any files beginning with the letters tpa.
i dont think we can get this file for you untill we have root..... but i will take a look and see what i can find.
here is what we have in /dev/
Code:
C:\AndroidSDK\tools>adb shell
$ ls /dev/
ls /dev/
cpuctl
msm_camera
mtd
ppp
input
vdec
oncrpc
network_throughput
network_latency
cpu_dma_latency
htc-portlist
btdiag
log
binder
device-mapper
akm8973_aot
akm8973_daemon
alarm
lightsensor
keychord
uinput
android_mtp_event
android_mtp_control
android_mtp_enable
android_mtp_tunnel
qct_diag_enable
diag_arm9
diag
android_adb_enable
android_adb
bma150
pmem_camera
pmem_adsp
pmem
kgsl
ashmem
cm3602
htc-acoustic
msm_qcelp_in
msm_aac_in
q6venc
msm_audio_ctl
msm_audio_route
msm_mp3
msm_pcm_in
msm_pcm_out
smem_log
qmi2
qmi1
qmi0
ttySA1
ttySA0
ttyHSUSB2
ttyHSUSB1
ttyHSUSB0
ptmx
console
tty
smd19
smd27
smd9
smd1
smd0
kmsg
urandom
random
full
zero
null
graphics
block
ttyHS0
ttyMSM0
socket
pts
$
Ah, that's a shame
It was worth a try though, thank you very much guys
I shall continue hunting and i'll let you know if i find anything!
Thanks again!!
Yea cant find them for you... yet
FWIW, I took a look at the output from dmesg and I think the first part of the file may be named tpa6130. I really have no idea. If this is irrelevant or unhelpful, please ignore this post. :]
Ok. I ran a full ls -R on the filesystem and found the following files containing the string tpa
/system/etc/TPA2018.csv
/sys/bus/i2c/drivers/tpa2018d1 (is a directory, contains uevent, unbind, bind)
/sys/bus/i2c/drivers/tpa6130 (is a directory, contains 0-0060, uevent, unbind, bind)
the CSV file contains the text
IncredibleC_20100104,,,,,,,,
TPA2018_MODE_OFF,1,a2,0,0,0,0,0,0
TPA2018_MODE_PLAYBACK,1,c2,20,1,0,0c,1e,c0
TPA2018_MODE_RINGTONE,1,c2,20,1,0,0c,1e,c0
TPA2018_MODE_VOICE_CALL,1,c2,20,1,0,0c,1e,c0
Let me know if any of the files in the i2c/drivers directories may be of use to you. I tried to pull one but got permission denied - the files themselves are chmoded to writable by owner (which is root) and readable by noone.

Building AOSP 8.0.0_r30 for Xperia XZ2 Compact (h8314)

Well, new user but old lurker here, no points to post in dev threads and I'm not going to wait 3 months to get them so jumping right into things...
This is a record of my attempts to build AOSP 8.0 Orea for the nex Xperia XZ2 Compact. I'm running into problems and figured I'd document them here, for the betterment of others and to get help if needed.
Main guide: https://developer.sony.com/develop/open-devices/guides/aosp-build-instructions/build-aosp-oreo-8-0-kernel-4-4/#tutorial-step-3
Some modification required, as the phone and code are both pretty new, as mentioned by BeNeDeLuX on May 22 the repo was only just uploaded. More to follow.
github links not permitted?!??!?
well according to XDA, outside links are not allowed to be posted until you've replied 10 times... Even if the posts are OBVIOUSLY code-related (e.g. GitHub *cough*cough*)...
Please excuse me while I go spam another thread, or create an intro or something... brb
Step 2
OK, jumping right back into it:
Now we need to add the git repos for tama (platform) and apollo (xz2).
First follow the steps in the main guide up to step 4.3: https://developer.sony.com/develop/.../build-aosp-oreo-8-0-kernel-4-4/
Then clone the following two repositories into the ~/android/devices/sony directory:
Code:
git clone https://github.com/sonyxperiadev/device-sony-tama.git tama
Code:
git clone https://github.com/sonyxperiadev/device-sony-apollo.git apollo
now continue on with the steps in the main guide
There may be errors yet to come...
First error
First error:
Code:
build/core/base_rules.mk:374: warning: ignoring old commands for target
`out/target/product/apollo/vendor/etc/gps.conf'
ninja: error: 'kernel/sony/msm/arch/arm64/configs/aosp_tama_apollo_defconfig',
needed by '/home/anna/android_8-0-0/out/target/product/apollo/obj/KERNEL_OBJ/.config',
missing and no known rule to make it
16:32:12 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1
#### make failed to build some targets (01:40 (mm:ss)) ####
System Info:
Code:
Linux hostname 4.8.0-53-generic #56~16.04.1-Ubuntu SMP Tue May 16 01:18:56 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Will post any progress as I make it, suggestions are welcome. You can find the full log here
any progress??
I'm back!
[email protected] said:
any progress??
Click to expand...
Click to collapse
Hey yes sorry my real-life job doesn't always allow for much personal time...
So right now the Sony dev repos don't have a pre-built kernel or kernel configuration for the XZ2 Compact.
I've grabbed the current config from /proc/config.gz on my XZ2 Compact running Android 8.0.0, Linux kernel 4.9.65-perf+, posted to gist here: https://gist.github.com/Ifiht/9d0eff34d1f47ecd955b49acd34a14fb
The closest config (based on software/hardware from https://en.wikipedia.org/wiki/Sony_Xperia) in sony repos is the aosp_yoshino_lilac default config, I've started compiling all these resources in a single git repo at https://github.com/Ifiht/sony-xperia-xz2.build.
Will update here with progress once I've got some with the kernel build.
2nd Error
Code:
ninja: error: 'out/target/product/apollo/obj_arm/SHARED_LIBRARIES/libqdutils_intermediates/export_includes', needed by 'out/target/product/apollo/obj_arm/SHARED_LIBRARIES/libOmxVdec_intermediates/import_includes', missing and no known rule to make it
12:58:20 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1
#### make failed to build some targets (03:37 (mm:ss)) ####
So the build failed again using the defconfig listed in my git repo for this project. This time it doesn't even look like a kernel issue, more like a repo conflict given that all the errors are in "out" directory.
Appreciate any guidance from those that have seen this before. Full error copied here: https://gist.github.com/Ifiht/bb4e1dd43b6598ffcf02b83d960cd959
3rd error
Code:
[ 90% 10/11] glob system/core/*/Android.bp
ninja: error: 'device/sony/common-kernel/kernel-dtb-apollo', needed by 'out/target/product/apollo/kernel', missing and no known rule to make it
14:07:36 ninja failed with: exit status 1
build/core/main.mk:21: recipe for target 'run_soong_ui' failed
make: *** [run_soong_ui] Error 1
After upgrading my kernel and local repos to 4.9.6 and re-syncing everything for good measure I'm now getting the above. At least this one seems straightforward, even if it may mean I have to frankenstein together a custom kernel from the flagship source repos currently available from Sony...
Oh well onward and upward!
Build attempt on Mac OSX
Hey,
thank you for documenting your progress, I am playing along trying to get the build to work on my Mac OS 10.13 machine,
nice to see I am not the only one trying
Stuck with the exact same error now btw
Code:
[ 99% 141/142] glob prebuilts/abi-dumps/vndk/current/arm64/source-based/[email protected]
ninja: error: 'device/sony/common-kernel/kernel-dtb-apollo', needed by 'out/target/product/apollo/kernel', missing and no known rule to make it
20:16:48 ninja failed with: exit status 1
best wishes
https://github.com/sonyxperiadev/bug_tracker/issues/169#issuecomment-424278920
PLEASE DON'T FLASH TAMA WITH THE CURRENT KERNEL
My Akari's display got permanently damaged.
I repeat, DO NOT FLASH.
Click to expand...
Click to collapse

Linageos 17.1 Build faild Python Error - Use prebuilts python for ninja?

Hello,
my Linux OS have a strange Python Version or setting, so the Build failed with:
Code:
FAILED: //art/build/apex:art-check-release-apex-gen generate art-check-release-apex-gen.dummy
Outputs: out/soong/.intermediates/art/build/apex/art-check-release-apex-gen/gen/art-check-release-apex-gen.dummy
Error: exited with code: 1
Command: rm -rf out/soong/.intermediates/art/build/apex/art-check-release-apex-gen/gen && out/soong/host/linux-x86/bin/sbox --sandbox-path out/soong/.temp --output-root out/soong/.intermediates/art/build/apex/art-check-release-apex-gen/gen -c 'out/soong/host/linux-x86/bin/art-apex-tester --debugfs out/soong/host/linux-x86/bin/debugfs --tmpdir __SBOX_OUT_DIR__ out/soong/.intermediates/art/build/apex/com.android.runtime.release/android_common_com.android.runtime.release/com.android.runtime.release.apex && touch __SBOX_OUT_FILES__' __SBOX_OUT_DIR__/art-check-release-apex-gen.dummy
Output:
.path_interposer: no python-exec wrapped executable found in /usr/lib/python-exec.
sbox command (out/soong/host/linux-x86/bin/art-apex-tester --debugfs out/soong/host/linux-x86/bin/debugfs --tmpdir out/soong/.temp/sbox333717900 out/soong/.intermediates/art/build/apex/com.android.runtime.release/android_common_com.android.runtime.release/com.android.runtime.release.apex && touch out/soong/.temp/sbox333717900/art-check-release-apex-gen.dummy) failed with err "exit status 127"
Its on the Finish-Line of the building Process. ( [ 99% 11533/11603] )
I try to use
Code:
virtualenv --version
virtualenv 20.0.18 from /usr/lib64/python3.6/site-packages/virtualenv/__init__.py
With the Python in:
prebuilts/python/linux-x86/2.7.5/bin/python2.7
Some hints for me?
Building Lineage 16, works fine, sure the build process is different.
Can i just use the Command from lineageos16, which create the zip file if all parts are finnished?
I've been having the same issue on Gentoo since LineageOS 17.1.
I have Python 2.7, 3.6, 3.7 and 3.8 installed.
If nobody has a solution and you find it, please comment with the solution, I'm sure we are not the only two people affected by this issue.
Thank you Yurienu,
easy would be to juse another live-Distro with a build Tree on a mounted file System.
However i think the error is in the tools of google, like apex or how the script use and call this function. Not sure if i like to debug this.
I think it because the path.interposer try to present a list of tools to art-check-release-apex-gen, from where the program to do its job. And a wrapper might failed and put its path there. When art-check do its job, try it and failed, because its not design to handle the error message (and so because of that bug).
For this speaks the error message:
But take a look on my error code: "Error: exited with code: 1" from the command: //art/build/apex:art-check-release-apex-gen generate art-check-release-apex-gen.dummy".
I think there is the bug. Whatever art-check-release-apex-gen do, it fail here. Then check, see the wrapper and say that there is no python.
I try to use python 2.7.18 (Gentoos Python 2.7), and it did not work.
I try to use virtuelenvwrapper*** and it failed but the error was like: "no Module with python 2.7.5, named virtuelenvwrapper". However i got this misconfigured. But it sound compelling. Because a Module for python 2.7.18, is maybe not byte compatible with python 2.7.5.
Think i try to use another distro for building this.
Bye the way, there is a Google Summer of code 2020 project, that's sound very interesting. So there is hope for a proper lineage and gentoo support in the future.
However, if i find a solution i share it here!
I stay a little bit longer with lineageos 16.0, because self build security updates are more important for me, as Android 10 is.
*** I just linked the prebuild binary an path as environment to /usr/local/bin/
Hello everyone,
I too met the same issue, the exact same content in the "out/error.log" than the first post; I am sharing the research I got around this issue, because I don't have the same conclusion.
First I tried to discard the error about ".path_interposer", and seek the error from the "sbox" software output.
I dig around "out/soong/host/linux-x86/bin/art-apex-tester", and got those information:
Code:
% file out/soong/host/linux-x86/bin/art-apex-tester
out/soong/host/linux-x86/bin/art-apex-tester: Zip archive data, made by v?[0x314], extract using at least v2.0, last modified Thu Nov
4 03:39:44 1999, uncompressed size 2619, method=store
% unzip -l out/soong/host/linux-x86/bin/art-apex-tester
Archive: out/soong/host/linux-x86/bin/art-apex-tester
Length Date Time Name
--------- ---------- ----- ----
2619 01-01-2008 00:00 __main__.py
28376 01-01-2008 00:00 art_apex_test.py
--------- -------
30995 2 files
It looks like it’s a Zip archive which can execute the Python script "__main__.py".
The "__main__.py" is a wrapper, which its goal is to call the other python file, "art_apex_test.py" with the correct parameters.
By reading its content, I noticed it searchs Python 3 executable, and calls the following command:
Code:
/usr/bin/python3 -S relative_path/to/art_apex_test.py […]
When I execute this command under a temporary directory, I have this output (still under the current directory as parent of the "out" directory):
Code:
python3 -S /tmp/art_apex_test.py --debugfs out/soong/host/linux-x86/bin/debugfs --tmpdir out/soong/.temp out/soong/.intermediates/art/build/apex/com.android.runtime.release/android_common_com.android.runtime.release/com.android.runtime.release.apex
--bitness=auto, trying to autodetect. This may be incorrect!
Detected multilib
I have the same ouput by either executing the Zip archive with the same arguments.
Unfortunately, the "tmpdir" "out/soong/.temp" remains empty.
What about "path_interposer" then? No idea, I found no match in either the two Python scripts.
And then I don't think it's related to the Python 2.7 embedded program.
Oddly enough, the full command with sbox has the same output, but not error. I start to think this error is in a build system file.
Hope to have help (a little).
Best regards,
thican said:
I too met the same issue, the exact same content in the "out/error.log" than the first post; I am sharing the research I got around this issue, because I don't have the same conclusion.
Click to expand...
Click to collapse
I've been having this issue a while also, turns out it's fixable (not that Gentoo won't override it every time you upgrade python) I linked /usr/bin/python3.7 to /usr/bin/python3 instead of /usr/bin/python-exec2c.
Now the apex tester thinger works fine, I'm guessing that inside the sandbox can't find /usr/lib/python-exec.
Hope this works for you guys as well.
SOLVED LineageOS 17.1: .path_interposer: no python-exec wrapped executable found
superfes said:
I've been having this issue a while also, turns out it's fixable (not that Gentoo won't override it every time you upgrade python) I linked /usr/bin/python3.7 to /usr/bin/python3 instead of /usr/bin/python-exec2c.
Now the apex tester thinger works fine, I'm guessing that inside the sandbox can't find /usr/lib/python-exec.
Hope this works for you guys as well.
Click to expand...
Click to collapse
OH! That's the trick, it finally works!
For an easy fix without needing to touch files hold by system, I just create a bin directory at the root of the home directory of the user, put its path inside the PATH environment variable, at its beginning (PATH="${HOME}/bin:${PATH}"), and then creating the symbolic links.
It was so easy it's so frustrating, having this issue for months, even during 16.0 branch IIRC.
Just to be sure, I create those links (I picked Python 3.8 for my example):
Code:
ln -s /usr/bin/python3.8 ~/bin/python3
ln -s python3 ~/bin/python
Now let's try this new build. Thank you very much for you help! :good:
PS: in your message, the links are backward, it's currently python3 which is linked to python-exec2c, and /usr/bin/python3.7{,m} are there own executable. I advice you to avoid editing your system files
@superfes and @thican you guys deserve three internets!
I was struggling with this error as well (not for 16.0, only for 17.1 -- Gentoo here as well). This fixed it!
So again: Thanks!
thican said:
OH! That's the trick, it finally works!
For an easy fix without needing to touch files hold by system, I just create a bin directory at the root of the home directory of the user, put its path inside the PATH environment variable, at its beginning (PATH="${HOME}/bin:${PATH}"), and then creating the symbolic links.
It was so easy it's so frustrating, having this issue for months, even during 16.0 branch IIRC.
Just to be sure, I create those links (I picked Python 3.8 for my example):
Code:
ln -s /usr/bin/python3.8 ~/bin/python3
ln -s python3 ~/bin/python
Click to expand...
Click to collapse
This is the way that worked fully for me. Thanks all! Running Gentoo latest hardened with python 3.7 as default.
Thank you superfes and thican!
I had not the time do investigate since covid19 blow up my personal workingdesk. Nice to go on with Lineage 17.1!
Tnx! Worked for me too!
With dev-lang/python-exec-2.4.6-r2
/usr/bin/python3 is a symlink to python-exec2c which cause this error.
Workaround is use vanilla python version of python-exec2c
before brunch command you can use like
Code:
[[ -d ~/bin/ ]] || mkdir ~/bin
[[ -e ~/bin/python3 ]] || ln -s /usr/lib/python-exec/python-exec2 ~/bin/python3
export PATH=~/bin:$PATH
Hence, in future shebang support of python or python3 will removed also.
762406 – [TRACKER] Packages that have failures with dev-lang/python-exec[-native-symlinks]
bugs.gentoo.org

Get camera working on custom rom without selinux permissive

I very recently decided to mod my wonderful, but neglected, LG V30. H933. By following the various guides, I unlocked the bootloader, installed twrp, rooted with magisk. Then using this thread https://forum.xda-developers.com/lg-v30/how-to/canadian-h933-compatibility-h930-roms-t3897586 prepared it for a Pie custom ROM (a tedious process, but it works just fine). I then installed LOS16 H930, no gapps. Using opencamera instead of gcam. All went well, but the camera/flashlight and a few of my user apps wouldn't work.
As many of you know, you can get the camera/flashlight working by setting selinux permissive. However, you need the permissions enabled at the boot/startup level. Executing setenforce 0 as root won't get the camera working in this situation. However, patching the kernel command line, which is what Kernel-Sepolicy-Patcher.zip does will do the trick. Unfortunately, this situation presents us with a dilemma. Running your device in selinux permissive full-time is a security risk one should not take. But having to boot into recovery, run a patcher, then reboot when you want to take a photo...and then repeating the process to go back to enforcing mode, is too tedious.
After spending days deep diving into the seemingly bottomless pit of android camera (a terrific learning experience), running through all the init scripts, services, selinux stuff, etc., etc. For a number of reasons, I never really found the exact solution I was looking for. Finally, I decided upon the following method to deal with the issue. Keep in mind that this still opens up security a little bit, but it's a helluva lot better than running SELinux *permissive* (i.e. no SElinux security at all). I performed most of the work on my arch linux system, but alternatively you can do this using an adb shell or a terminal app on the device.
WARNING / DISCLAIMER: If you mess up or brick your phone, it's on you. It's YOUR responsibility - not mine.
Directions:
1) Obtain a copy of your current boot partition:
Code:
dd if=/dev/block/bootdevice/by-name/boot of=/sdcard/boot.img
2) Copy boot.img to the PC's current directory:
Code:
adb pull /sdcard/boot.img
3) Use magisk's magiskboot utility to unpack boot.img (kernel, ramdisk, kernel dtb, etc):
Code:
./magiskboot unpack boot.img
4) Extract the sepolicy file from ramdisk.cpio:
Code:
./magiskboot cpio ramdisk.cpio "extract sepolicy sepolicy"
The quotes are necessary. You can also just use xarchiver or anything that can handle cpio. Don't copy from /sepolicy or /sys/fs/selinux/policy from the live device because they contain a large number of magisk rules (assuming you're rooted). Copy it from the current boot partition.
5) Add/modify selinux rules in the sepolicy file. I used setools-android https://github.com/xmikos/setools-android It built fine on arch linux, I believe dependencies are built in, but YMMV. The sepolicy-inject command is used to add/modify rules. Use logcat and dmesg (save the output to examine it more easily with an editor). See what caused your avc denied entries. Correct some or all of them by adding permissions to existing entries or adding new entries to the policy file.
Update: The only rule change you need to get the camera working is:
Code:
sepolicy-inject -s sensors -t sensors -c capability -p dac_override -P sepolicy
However, you might want to change other rules that are generating avc denieds (audio, battery health, ...). You can also use magiskpolicy or other tools for this. You can either add permissions to an existing rule, or add a new rule.
6) Replace the original sepolicy file in ramdisk.cpio with the modified one:
Code:
./magiskboot cpio ramdisk.cpio "add 644 sepolicy sepolicy"
7) Repack the boot image:
Code:
./magiskboot repack boot.img
magiskboot reads the original unpacked boot.img to get certain info for the repack, and then creates by default a new-boot.img image file.
8) Copy new-boot.img from to your device if it's not already there:
Code:
adb push new-boot.img /sdcard
9) Write the new boot image to the device:
Code:
dd if=/sdcard/new-boot.img of=/dev/block/bootdevice/by-name/boot
10) Boot. Voila!
I should add that there are other ways to get this accomplished as well. Mostly courtesy of magisk. However, the method above will work even without being rooted.
A few people have said flashing nougat kdz, then updating to oreo allows you to use aosp Pie roms with working camera on enforcing
tech_infinity said:
A few people have said flashing nougat kdz, then updating to oreo allows you to use aosp Pie roms with working camera on enforcing
Click to expand...
Click to collapse
Thank you. Yes, I had read that.
In my case, because I followed the Canadian guide linked in my original post, that's exactly what had been done. Nougat 10d -> Oreo 20i -> LOS16 Pie. It could very well be an issue specific to that LOS rom.
When looking over the logs and watching the processes in realtime, in addition to doing a lot of other investigation (with my limited tools/resources), it seems that "something" that is normally there on startup is absent, and then an alternative route and configuration is taken for camera setup. Without those permissions, it pukes around the part where it is trying to configure the three different camera sensors. Why else would there be a need for additional permissions (assuming relevant sepolicy rules are the same versus stock), and why else would those additional permissions make the difference? There's no system camera app in this rom (unlike other LOS roms). You can see what looks like orphaned "camera code" in /system.
You get this over and over without permissive or adding specific rules (see OP).
Code:
03-06 08:21:27.668 0 0 I init : Service 'vendor.camera-provider-2-4' (pid 2462) exited with status 1
03-06 08:21:27.668 0 0 I init : Sending signal 9 to service 'vendor.camera-provider-2-4' (pid 2462) process group...
03-06 08:21:27.668 0 0 I libprocessgroup: Successfully killed process cgroup uid 1047 pid 2462 in 0ms
03-06 08:21:27.669 0 0 I init : starting service 'vendor.camera-provider-2-4'...
An interesting page on android camera framework:
https://programmer.ink/think/camera-android-camera2-hal3-framework-analysis.html
Given the idiosyncracies of this phone (versus my OP6 or other phones), I'm somewhat hesitant to test a bunch of different ROMs (stock and custom) to gain more insight. But perhaps when I have adequate time I'll do more digging. I'd like to compare the sepolicy files as well as a number of other things (e.g. "blobs"). If I find anything interesting, I will post it.
BTW, it's not just the camera issue that needed to be taken care of. There are other services that (most likely unbeknownst to the users of the rom) are caught in a kill/restart loop (battery, audio,...). Adding specific permissions resolved those issues as well.
Upon inspection of sepolicy of a few of the ROMs in question.
Stock Nougat 998 10d:
Code:
allow sensors sensors : capability { chown [B]dac_override[/B] dac_read_search fowner setgid setuid net_bind_service net_raw } ;
Stock Oreo 933 20i:
Code:
allow sensors sensors : capability { chown [B]dac_override[/B] dac_read_search fowner setgid setuid net_bind_service net_raw } ;
Stock Pie 933 20k:
Code:
allow sensors sensors : capability { chown fowner setgid setuid net_bind_service net_raw } ;
Interesting.
This is brilliant work, congrats
You mentioned other services that need permissions. Care to share those as well?
Thanks.
*Edit*
I did manage to return to the state it was before flashing stock pie.
I did a full backup in twrp (especially efs), then I used chip erase on lgup and flashed "H93022j_00_OPEN_EU_OP_0403.kdz" and then I restored efs (chip erase deletes ALL partitions including efs where imei and serial number are stored, that's why an efs backup is essential).
Now I'm using enforcing and everything seems to work.
Be careful though, chip erase is VERY dangerous.
Hi thanks for this awesome tutorial
I'm not very familiar with sepolicy-inject
Could you please tell me how to translate these avc errors into an ALLOW rule for bypassing that annoying "permission denied" message as shell user? Thanks!
Code:
mount : type=1400 audit(0.0:645): avc: denied { dac_override } for capability=1 scontext=u:r:shell:s0 tcontext=u:r:shell:s0 tclass=capability permissive=0
mount : type=1400 audit(0.0:646): avc: denied { dac_read_search } for capability=2 scontext=u:r:shell:s0 tcontext=u:r:shell:s0 tclass=capability permissive=0
mount : type=1400 audit(0.0:647): avc: denied { mounton } for path="/system" dev="dm-0" ino=2 scontext=u:r:shell:s0 tcontext=u:object_r:system_file:s0 tclass=dir permissive=0
mount : type=1400 audit(0.0:648): avc: denied { read } for name="dm-0" dev="tmpfs" ino=20822 scontext=u:r:shell:s0 tcontext=u:object_r:dm_device:s0 tclass=blk_file permissive=0
cat : type=1400 audit(0.0:755): avc: denied { syslog } for capability=34 scontext=u:r:shell:s0 tcontext=u:r:shell:s0 tclass=capability2 permissive=0
cat : type=1400 audit(0.0:756): avc: denied { sys_admin } for capability=21 scontext=u:r:shell:s0 tcontext=u:r:shell:s0 tclass=capability permissive=0

Trying to build lineageos 18.1 for one plus one

Hi guys!
So I was following this https://wiki.lineageos.org/devices/bacon/build wiki to build a lineageos 18.1 ROM for my one plus one.
Unfortunately, when I get to the step for "breakfast bacon", I get the following errors.
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
build/make/target/product/product_launched_with_k.mk:2: error: _nic.PRODUCTS.[[device/oneplus/bacon/lineage_bacon.mk]]: "device/oppo/msm8974-common/msm8974.mk" does not exist.
22:35:04 dumpvars failed with: exit status 1
Device bacon not found. Attempting to retrieve device repository from LineageOS Github (http://github.com/LineageOS).
Found repository: android_device_oneplus_bacon
Default revision: lineage-18.1
Checking branch info
Checking if device/oneplus/bacon is fetched from android_device_oneplus_bacon
LineageOS/android_device_oneplus_bacon already fetched to device/oneplus/bacon
Syncing repository to retrieve project.
sh: 1: repo: not found
Repository synced!
Looking for dependencies in device/oneplus/bacon
Looking for dependencies in device/oppo/msm8974-common
device/oppo/msm8974-common has no additional dependencies.
Looking for dependencies in kernel/oppo/msm8974
kernel/oppo/msm8974 has no additional dependencies.
Done
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
build/make/target/product/product_launched_with_k.mk:2: error: _nic.PRODUCTS.[[device/oneplus/bacon/lineage_bacon.mk]]: "device/oppo/msm8974-common/msm8974.mk" does not exist.
22:35:05 dumpvars failed with: exit status 1
In file included from build/make/core/config.mk:291:
In file included from build/make/core/envsetup.mk:266:
build/make/target/product/product_launched_with_k.mk:2: error: _nic.PRODUCTS.[[device/oneplus/bacon/lineage_bacon.mk]]: "device/oppo/msm8974-common/msm8974.mk" does not exist.
22:35:06 dumpvars failed with: exit status 1
** Don't have a product spec for: 'lineage_bacon'
** Do you have the right repo manifest?
Click to expand...
Click to collapse
What am I doing wrong?
p.s. if I do a "breakfast d855", then I get no error.
My utter apologies for being so blind.
It is of course clearly written on that wiki that some devices would fail upon "breakfast" command being called due to the missing vendor files.
Hence one should first run "extract-files.sh" in the device specific folder. And indeed afterwards the breakfast command succeeds for "bacon".
I could be given a little margin for being a noob and also that my other device "d855" does not need extract-files.sh before breakfast.
Also what confused me yesterday was, that the paths contained oppo when infact I was building for bacon. I was sure something is wrong upstream.
My sincere apologies again for starting on xda with such a useless post.

Categories

Resources