{"id":425,"date":"2020-03-27T16:39:06","date_gmt":"2020-03-27T23:39:06","guid":{"rendered":"https:\/\/sysprogs.com\/tutorials\/?p=425"},"modified":"2020-03-27T16:39:06","modified_gmt":"2020-03-27T23:39:06","slug":"manually-importing-kernel-symbols-into-visualkernel","status":"publish","type":"post","link":"https:\/\/sysprogs.com\/VisualKernel\/tutorials\/setup\/symbols\/","title":{"rendered":"Manually Importing Kernel Symbols into VisualKernel"},"content":{"rendered":"<p>This tutorial shows how to import kernel symbols for unsupported Linux distributions into VisualKernel.<\/p>\n<p>Normally, VisualKernel will automatically download and install the symbols for <a href=\"https:\/\/sysprogs.com\/VisualKernel\/?features=os_support\">supported Linux distributions<\/a>, however if you are using a distribution that is not directly supported, or cannot obtain the symbols automatically, follow this tutorial to install the symbols and import them into VisualKernel automatically.<\/p>\n<ol>\n<li>Before you begin importing the symbols into VisualKernel, determine your currently running kernel version by running &#8220;<strong>uname -a<\/strong>&#8221; and follow your distribution&#8217;s instructions to install the symbol and source packages for this <strong>exact<\/strong> kernel version. In most of the cases, you will need to install 2 packages:\n<ol>\n<li>Debugging symbols. They typically consist of one huge kernel file containing the debug information. Debug symbols help map symbolic names, such as <strong>printk(), <\/strong>to specific addresses in the kernel space.<\/li>\n<li>Kernel sources. The source package contains a snapshot of the kernel source tree with files like <strong>printk.c<\/strong>, that were used to build the currently running image. VisualKernel will use them to display meaningful source code when stepping through the kernel functions.<\/li>\n<\/ol>\n<p>We have detailed tutorials showing how to download symbols for <a href=\"https:\/\/sysprogs.com\/VisualKernel\/tutorials\/setup\/ubuntu\/\">Ubuntu<\/a> and <a href=\"https:\/\/sysprogs.com\/VisualKernel\/tutorials\/setup\/fedora\/\">Fedora<\/a>. For other Linux distros, see the distro-specific documentation.<\/li>\n<li>Once you have downloaded the symbols and the sources, go to the source directory on the Linux machine and make <strong>vmlinux<\/strong> a symbolic link to the symbol file:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/00-import.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-426\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/00-import.png\" alt=\"\" width=\"1140\" height=\"356\" \/><\/a><br \/>\nNow the source directory will have the same structure as if the kernel was built directly in it.<\/li>\n<li>Start Visual Studio and open the <strong>Tools-&gt;VisualKernel-&gt;Manage Linux Kernel Symbols<\/strong> window:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/01-manage.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-427\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/01-manage.png\" alt=\"\" width=\"1181\" height=\"864\" \/><\/a><\/li>\n<li>VisualKernel will open the Kernel Symbol Manager window, listing the kernel symbols\/sources that can already be used for debugging. In order to add the symbols you have just installed to the list, click &#8220;Import symbols and sources for another kernel&#8221;:<br \/>\n<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/02-import.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-428\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/02-import.png\" alt=\"\" width=\"812\" height=\"597\" \/><\/a><\/li>\n<li>VisualKernel will start the symbol importing wizard. On the first page select &#8220;Import manually built kernel&#8221;: <a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/03-importk.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-429\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/03-importk.png\" alt=\"\" width=\"786\" height=\"593\" \/><\/a><\/li>\n<li>On the next page select the computer where you have downloaded the symbols and pick the source directory: <a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/04-inplace.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-430\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/04-inplace.png\" alt=\"\" width=\"786\" height=\"593\" \/><\/a><br \/>\nThe source directory should contain the kernel sources and the &#8220;vmlinux&#8221; symlink pointing to the symbol file.<\/li>\n<li>Click &#8220;Finish&#8221; to complete the wizard. VisualKernel will import the sources and symbols to your Windows machine and will index them, making debugging possible:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/05-index.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-431\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/05-index.png\" alt=\"\" width=\"812\" height=\"596\" \/><\/a><\/li>\n<li>Once the import is completed, the symbols will appear in the Linux Kernel Symbol Manager window: <a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/06-imported.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-432\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/06-imported.png\" alt=\"\" width=\"812\" height=\"597\" \/><\/a><\/li>\n<li>Now you can use the imported symbols for debugging your kernel. The easiest way to try it out is via the Debug-&gt;Quick Debug Linux Kernel command: <a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/07-qd.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-433\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/07-qd.png\" alt=\"\" width=\"1181\" height=\"864\" \/><\/a><\/li>\n<li>Select your Linux machine, pick the previously imported symbols, and configure a debugging method that will work with your setup: <a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/08-qdsettings.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-434\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/08-qdsettings.png\" alt=\"\" width=\"786\" height=\"588\" \/><\/a><br \/>\nYou can read more about various debug methods supported by VisualKernel on <a href=\"https:\/\/sysprogs.com\/VisualKernel\/documentation\/overview\">this page<\/a>.<\/li>\n<li>Once you click &#8220;Debug&#8221;, VisualKernel will automatically use the previously imported symbols to debug your kernel, so you will be able to set breakpoints and step through the source code:<br \/>\n<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/09-bkpt.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-435\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2020\/03\/09-bkpt.png\" alt=\"\" width=\"1182\" height=\"759\" \/><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to import kernel symbols for unsupported Linux distributions into VisualKernel. Normally, VisualKernel will automatically download and<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[41],"tags":[53],"_links":{"self":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/425"}],"collection":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/comments?post=425"}],"version-history":[{"count":2,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/425\/revisions"}],"predecessor-version":[{"id":437,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/425\/revisions\/437"}],"wp:attachment":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/media?parent=425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/categories?post=425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/tags?post=425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}