Sysprogs forums › Forums › VisualKernel › Update kernel in debuggee
- This topic has 13 replies, 3 voices, and was last updated 4 years, 11 months ago by support.
-
AuthorPosts
-
February 20, 2019 at 18:17 #23912furryfuttockParticipant
Hi,
Just starting with VisualKernel and it’s looking quite good, however I have had some problems with the kernel version that was cerated during the sample Hello World kernel module creation.
I have changed the kernel configuration and recompiled the kernel. How do I tell VisualKernel to update?
Regards.
February 20, 2019 at 20:36 #23915supportKeymasterHi,
Please try using the VisualKernel Project Properties -> Module Build Settings -> Kernel Symbols for Debugging setting. It will allow caching the symbols/sources for the new kernel and using them for debugging the module.
February 21, 2019 at 17:54 #23920furryfuttockParticipantThanks for the response.
My setup is as follows: Debugging with Visual Studio 2017 Professional on Windows 10, using a VMware Linux with Debian Stretch AMD64 and a Raspberry Pi CM3.
I am using VisualKernel downloaded from your website, not from any source repository. What I have done.
1.- Delete all VisualKernel
1.1.- Windows files(C:\KernelCache, %LOCALAPPDATA%\VisualDebugger, %USERPROFILE%\source\repos\LinuxKernelModue*)
1.2.- VMware Linux files (/opt/KernelCache)
1.3.- Windows registry (HKCU\Software\Sysprogs)
2.- Open Visual Studio 2017, and create a new Linux Kernel Module project.
2.1.- Use SSH connections to the Linux machine and the Raspberry Pi.
2.2.- The Raspberry Pi kernel and cross compile tools are installed and used to create kernel and modules.
2.3.- The kernel and modules are installed correctly on the Raspberry Pi.
3.- Put a break point in the sample driver init function and start debug
4.- Select debug over Ethernet and VisualKernel tries to create the kdboe module.
4.1.- First problem is that the URL that VisualKernel tries to open to download the kdbgoe tarball is invalid. I managed to download the tarball by hand and can give it to VisualKernel when prompted.
4.2.- The kdbgoe module does not compile because CONFIG_HOTPLUG_CPU is not set in the kernel downloaded in step 3.2.
4.2.1.- I can fix the kdbgoe_io.c compilation by adding a #ifdef CONFIG_HOTPLUG_CPU around the cpu_down(i) call.
4.2.- Compilation now fails in irqsync.c and I can’t find the prototype for the init_timer that it is calling.
I think I have tried all alternatives of trying to add different kernels via the VisualKernel Project Properties -> Module Build Settings -> Kernel Symbols for Debugging setting and when I try to select it I only have the original kernel built in step 2.2. I have added things manualy, copied, rebuilt from scratch, nothing seems to work.
As far as I know your default kernel should be sufficient for me, but I can’t get use it due to the kdbgoe problems.
Any suggestions?
February 22, 2019 at 05:42 #23928supportKeymasterHi,
First of all, thanks for reporting the broken link for the kgdboe download.
Second of all, KGDBoE will likely not work with Raspberry Pi (or may work very unreliably). Please try using a JTAG debugger instead as described in this tutorial.
We have also updated the documentation page for the supported debug methods to reflect the advantages and limitations of various debug methods. Hope this explains. Let us know if you have any further questions.
February 26, 2019 at 18:00 #23995furryfuttockParticipantHi.
I now have the Olimex debugger connectedto the Raspberry Pi and I can debug! Thanks for your suggestion.
Next problem, I need to customize the VisualKernel kernel, enable a few modules. How do I do that? I have tried everything I can and I still can’t get VisualKernel to recognize that it has to update the debug kernel.
Regards.
February 27, 2019 at 05:23 #24004supportKeymasterAre you using VisualKernel to build the kernel itself, or have you already built and installed it manually?
February 27, 2019 at 09:25 #24010furryfuttockParticipantI tried to build it manually but couldn’t find how to tell VisualKernel to use my version, so since I have been using the kerenel automatically built by VisualKernel.
I have tried changing the Project properties…->Module build settings->Kernel version. Adding my own directory, importing symbols, etc. Whatever I do it just says, version incorrect and I eventually have to go back to the VisualKernel version.
February 28, 2019 at 03:10 #24024supportKeymasterPlease try clicking the “Manage cached Linux Kernel Symbols” link in the kernel symbol selector:
This will show all kernel symbols cached by Visual Kernel for that machine. If they are no longer relevant, please delete them and import another kernel by pressing the “Import symbols/sources” button.
Attachments:
You must be logged in to view attached files.February 28, 2019 at 09:05 #24027furryfuttockParticipantI’ve done that. Whatever I add does not appear in the kernel symbols list.
I tried again yesterday and eventually ended up with a non-working system and had to remove all the directories generated bu VisualKernel and start again. Takes a couple of hours. For the moment I’ll try and push what I have as far as possible. Hopefully I can get enough working to go on with.
Is there any way I can debug kernel boot?
February 28, 2019 at 19:49 #24028supportKeymasterSorry for the inconvenience. It’s hard to say why the system would end up being unusable; the only explanation we could think about is that some file transfers were not fully completed.
BTW, we are working on an update to VisualKernel that will use our new highly optimized file transfer engine, so it will considerably speed up file and directory transfers when caching kernel symbols.
You can debug the kernel boot if you are using JTAG or VMWare gdb stub by selecting “attach to a crashed/hanging system”. This will bypass any attempts to connect to the target via SSH and will proceed with a low-level connection, even if the kernel has not started yet. Please ensure that you have address space randomization disabled before trying this though as VisualKernel will not be able to detect the load address of the kernel unless it can connect to it via SSH.
December 6, 2019 at 16:29 #26768Goerge255ParticipantI experienced data loss after a power outage. After the
fsck
several files in the/usr/src/
were missing. I have reinstalled all other damaged files that belonged to my Linux distro, but I do not know how to tell VisualKernel to reinstall itself (with all kernel symbols & sources) on the target machine ?Does anyone know how to force VisualKernel to reinstall itself on the debugee Linux ?
This is what happens after I select “Download and install kernel symbols” from the menu depicted below:
uname -r
4.19.0-6-armmp-lpae
uname -v
#1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11)
Detecting Linux distro…
lsb_release -i
Distributor ID: Debian
Detected Debian Linux
cat “/usr/lib/debug/boot/vmlinux-4.19.0-6-armmp-lpae.DebianKernelVersion”
#1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11)
Found kernel symbols: /usr/lib/debug/boot/vmlinux-4.19.0-6-armmp-lpae
cat /usr/src/linux-source-4.19/LinuxKernelSourceVersion_Debian.txt
cat: /usr/src/linux-source-4.19/LinuxKernelSourceVersion_Debian.txt: No such file or directory
apt-get update
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://deb.debian.org/debian buster-updates InRelease
Hit:3 http://security.debian.org/debian-security buster/updates InRelease
Reading package lists… Done
apt-get install -y –force-yes linux-source-4.19=4.19.67-2+deb10u2
Reading package lists… Done
Building dependency tree
Reading state information… Done
linux-source-4.19 is already the newest version (4.19.67-2+deb10u2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
W: –force-yes is deprecated, use one of the options starting with –allow instead.
apt-get install -y libssl-dev libelf-dev flex bison g++
Reading package lists…
Building dependency tree…
Reading state information…
bison is already the newest version (2:3.3.2.dfsg-1).
libelf-dev is already the newest version (0.176-1.1).
flex is already the newest version (2.6.4-6.2).
g++ is already the newest version (4:8.3.0-1).
libssl-dev is already the newest version (1.1.1d-0+deb10u2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Unpacking kernel sources…
ls -1 linux-source-4.19.tar.*
ls: cannot access ‘linux-source-4.19.tar.*’: No such file or directory
tar xf linux-source-4.19.tar.bz2
tar: linux-source-4.19.tar.bz2: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
ls -1 linux-patch-4.19*.patch*
ls: cannot access ‘linux-patch-4.19*.patch*’: No such file or directory
Warning: cannot find a patch file for your kernel. The installed sources may not match the prebuilt kernel.
echo 4.19-4.19.67-2+deb10u2 > /usr/src/linux-source-4.19/LinuxKernelSourceVersion_Debian.txt
bash: /usr/src/linux-source-4.19/LinuxKernelSourceVersion_Debian.txt: No such file or directory- This reply was modified 4 years, 11 months ago by Goerge255.
- This reply was modified 4 years, 11 months ago by Goerge255.
- This reply was modified 4 years, 11 months ago by Goerge255.
Attachments:
You must be logged in to view attached files.December 6, 2019 at 16:51 #26775supportKeymasterHi,
It looks like the linux-source-4.19 package got corrupt. Please try removing it via apt-get remove, deleting the /usr/src/linux* folders and letting VisualKernel reinstall it.
December 6, 2019 at 21:29 #26780Goerge255ParticipantThis worked, but I had to
get-apt remove
may more packages to get it to work. It was an iterative process involving interpreting VK’s error messages and figuring out which packages were corrupted.Please consider adding a
repair
option to VisualKernel to streamline this process, not only for file system corruption but also for kernel changes / updates.December 6, 2019 at 21:46 #26781supportKeymasterGood to know it works and thanks for the suggestion.
Unfortunately, automatically repairing broken package repositories would not be realistic. File system corruption is very unpredictable, so the exact repair actions would be completely different in each case.
As a workaround, unless you are debugging drivers for hardware that cannot be virtualised, please consider using VM snapshots as a way of recovering from file system corruption.
-
AuthorPosts
- You must be logged in to reply to this topic.