Debugging Android Kernel over phone - debugging

I am new to Android and to Kernel development, but I would like to test some things. I just finished compiling the first version of my modified kernel, and put it in a phone. Obviously, it doesn't work. How can I debug the kernel on the mobile phone?
I'm working over a Nexus 5 (MSM architecture, Linux 3.4.0 based). The .config used is the one by default (hammerhead_defconfig). When the kernel is booted, it only shows the Google screen, and stops there, forever.
I tried (with a working boot image) changing the 'console' parameter when generating the image with mkbootimg (tty, tty0, ttyHSL0), and I tried with different .config options as MSM_SERIAL_DEBUGGER (compilation error), FIQ_DEBUGGER (compilation error) and SERIAL_MSM (compiled, but no difference, no new devices in /dev on my computer). I tried with kgdb, following this, but I could not make the patches work for my architecture. Any idea?

I finally found a way to debug direcly over hardware:
http://blog.accuvant.com/jduckandryan/building-a-nexus-4-uart-debug-cable/ [Link down! Mirror at archive.org]
In Nexus 5 you need 3.3V instead of 3V of input, but it works like a charm.

Related

SyCL ComputeCpp: issues with the matrix_multiply SDK example

I just managed to install successfully the SyCL ComputeCpp + OpenCL (from CUDA) and running cmake to generate the samples VS2019 sln, successfully.
I've tried to run the matrix_multiply example ONLY, for now.
It ran successfully using the Intel FPGA emulator as a default device.
Changing the devices to the Device CPU worked well as well.
Choosing the host device, took ages without exiting.
When I tried to change the device to the nVidia, the GeForce GTX 1650 Ti.
I got this expection error from there ComputeCpp:RT0100, etc etc.
Googling a bit, I found I'd probably have to output the PTX instead of the SPIR.
So I regenerated the sln using -DCOMPUTECPP_BITCODE=ptx64
After doing that, the kernel ran successfully on the nVidia GPU.
My first question is: is that needed since nVidia does NOT support spir yet at the time of this writing, but only PTX?
However this broke the other devices, which are now reporting:
[ComputeCpp:RT0107] Failed to create program from binary
This happens now for all devices: Intel GPU, Device CPU, Device FPGA (While were formerly working)
Inspecting the .sycl I found now SYCL_matrix_multiply_cpp_bin_nvptx64[].
My question is: how to support nVidia with ptx and "normal" devices with spir altogether in the same exe? I did a menĂ¹ from which the user can choose to play with, but now it's working only for nVidia.
What am I doing wrong, please?
I would expect to be able to run the same .sycl code for all the devices despite it contains ptx or spir. How to manage for that?
EDIT: I just tried to retarget the bitcode to spirv64, since the computecpp_info told me all my devices are supposed to support it.
However, now no device is anymore working with that setting :-(

Vulkan cannot find physical devices on linux

I have been wanting to work with Vulkan, the new graphics API and have gotten it up and running with no problems on Windows 7. However I can't get Vulkan to work on linux. When I try running any of the LunarG samples, or even my own code, vkEnumeratePhysicalDevices always says that there are no physical devices. Here is my setup:
OS: Ubuntu 16.04 (LTS) [x64]
GPU: Nvidia Geforce GT 730 2GB GDDR5
Driver: NVIDIA Binary driver - version 364.19 from nvidia-364 (open source)
Vulkan SDK: LunarG v1.0.17.0 [ latest version]
I was wondering if maybe there's a file for my GPU that I need to set an environment variable for, but I really don't know. As I said before, this worked on Windows 7 perfectly, but I can't seem to get this to work this the above configuration. I am able to create an instance with the LunarG standard validation layer and the correct extensions, but vkEnumeratePhysicalDevices doesn't find any physical devices. It doesn't give an error, just says it can't find any physical devices. This has really got me stumped and I would really appreciate the help. Thanks!
Depending on your distribution you may have to install the nvidia-utils package. See this issue on my Vulkan repo for details.
If this isn't the case for you check the directories Karl mentioned and check if there is no other ICD (maybe one from Intel) that may cause troubles. If you're on an optimus system with dual GPU you may need to explicitly activate the NVIDIA GPU.
The 730 should work fine on Linux, at least judging from the Linux hardware reports I got on my database like this one.
You shouldn't have to set an environment variable if the driver installed properly.
One way to check for a proper installation is to look for the JSON file that identifies the driver. For example, an nvidia driver will place a file called nvidia_icd.json in /etc/vulkan/icd.d/. /usr/share/vulkan/icd.d/ is another standard, but less common location.
It may also be the case that your GPU does not support Vulkan. Be sure to check your GPU vendor's web pages to confirm support. You may want to download the driver straight from the vendor's site in order to get one that they say has Vulkan support.
And are you sure that using the "Additional Drivers" page is supposed to give you a Vulkan driver?
You can refer to the loader documentation in the docs section at https://vulkan.lunarg.com for more info.

Windows 7 Default Audio Device Problems, PJLIB VOIP SDK

I have been able to build PJSUA. The softphone runs perfectly on Windows XP, but on Windows 7 but it gives me the following error
It seems to be an issue with PJSUA on Windows 7. Has anyone been able to resolve this?
If you look into the code you will see that PJSUA is looking for a default device that has both input and output (mic and speakers) - such as headset. Just output or just input will not work...So if you plug in a headset you may eliminate your error. It works great on Win7.
The audio part of PJSIP is quite complicated IMO. Although I have it working now I am myself researching how to implement giving user a choice. That is, the user will have a choice of using headset or mic/speakers built-in combo.
Seems it is incompatible with windows7, and so is Sipek, because of some library which is no longer present in Windows7 (libwavemixer, ...).
I went on to use the Java-based Peers SIP Phone.

Upgrading driver from XP to W7

I've got a driver for a custom PCI card, which builds and runs fine on XP. I'm trying to use this custom hardware on W7, and am trying to build and run my driver.
I've got the latest DDK from Microsoft, and build my driver for XP using Windows XP "x86 Free Build Environment". Everything installs & works fine. (Build using a DDK "build" command)
If I use the Windows 7 "x86 Free Build Environment" build environment, everything builds fine. I run it through the PREfast and staticdv code checkers, no errors from either. ( I get a couple of warnings about "The dispatch function 'FooFnc' does not have any __drv_dispatchType annotations" - are these likely to be the issue? )
When I install, the install starts OK (standard error about drivers not being signed), but gets to a certain point and then hangs, then fails with a timeout error. The device then shows up in device manager as installed. At this point the PC won't shutdown or boot, but hangs indefinitely. I'm forced to boot into Safe Mode and uninstall the driver from there.
So my question(s) are:
If there has been a change in the driver model between XP and W7, what's the best way to find it? I can't see anything on MSDN.
How would I go about debugging the driver? The box doesn't start, so it's not like I can run up WinDBG.
Any specific W7 driver gotchas that are hidden away?
I've tried to keep this as generic as possible, but if more detail would be helpful I'll provide more
AFAIK, the biggest changes have been made in video and network drivers. Other drivers retain backward compatibility and can be run on W7 even with no recompiling.
Run your driver under driver verifier and turn on generating crash dumps with a keyboard (very helpful in case of system hangs, you can manually generate crashdump, analyze it and find what was wrong).
Hope this helps!

How to compile Linux kernel for real Android phone?

I successfully compiled and loaded custom Linux kernel into Android emulator (Eclair). Now I want to compile kernel for real Android device (Samsung Galaxy 5, Android 2.1 (Eclair)).
It seems that the same kernel image that was compiled for emulator, can't be used with real device. There is no much clear information given on how to do this.
Can someone tell what steps need to be changed to get kernel image for real android phone.
You are probably using the MSM kernel tree (for Qualcomm MSM processors), but the Samsung Galaxy S has a Samsung Hummingbird processor and thus needs the Samsung kernel tree, found here.
I don't know if the kernel tree includes a defconfig for the Galaxy S specifically, but you could probably use the "herring_defconfig" (make herring_defconfig). Herring is the code name for the Nexus S, but the Galaxy S is quite similar.
If you are building the Android framework as well (not just the kernel), you'll likely need to extract binary drivers (for the camera, bluetooth, WiFi, radio, etc.) from the existing phone images and add them to your system build.

Resources