{"id":484,"date":"2022-07-27T12:21:19","date_gmt":"2022-07-27T19:21:19","guid":{"rendered":"https:\/\/sysprogs.com\/tutorials\/?p=484"},"modified":"2022-09-09T13:44:03","modified_gmt":"2022-09-09T20:44:03","slug":"building-kernels-when-symbols-are-missing","status":"publish","type":"post","link":"https:\/\/sysprogs.com\/VisualKernel\/documentation\/buildkernel\/","title":{"rendered":"Building Kernels when Symbols Are Missing"},"content":{"rendered":"<p>Kernel symbol files are special files that allow mapping code and data inside the kernel into meaningful variable names and source file locations. Without having those files VisualKernel will not be able to debug your kernel.<\/p>\n<p>Some versions of Ubuntu do not ship the kernel symbols, or ship them with a delay. This makes it impossible to debug the stock kernels without rebuilding them. A typical &#8220;missing package&#8221; error looks this way:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/inst.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-486\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/inst.png\" alt=\"\" width=\"750\" height=\"553\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>This page provides instructions on building a kernel from source in order to get a new kernel image with the debugging symbols:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/01-newkernel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-485\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/01-newkernel.png\" alt=\"\" width=\"700\" height=\"394\" \/><\/a><\/p>\n<ol>\n<li>Cancel the kernel module wizard and open the Custom Linux Kernel wizard:<\/li>\n<li>Select &#8220;Automatically download sources for the current kernel&#8221;, then select &#8220;do not import files to Solution Explorer&#8221; and &#8220;Install the kernel automatically&#8221;:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/02-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-487\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/02-build.png\" alt=\"\" width=\"696\" height=\"556\" \/><\/a><\/li>\n<li>Proceed with the default file transfer settings:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/03-filetr.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-488\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/03-filetr.png\" alt=\"\" width=\"696\" height=\"556\" \/><\/a><\/li>\n<li>If you are planning to debug kernel modules and not the kernel itself, you can simply press &#8220;finish&#8221; without filling the last page of the wizard:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/04-dbg.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-489\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/04-dbg.png\" alt=\"\" width=\"696\" height=\"556\" \/><\/a><\/li>\n<li>When your project is created, right-click on it in Solution Explorer, select VisualKernel Project Properties and enable parallel building according to the amount of CPU cores on your Linux machine:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/05-parallel.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-490\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/05-parallel.png\" alt=\"\" width=\"700\" height=\"553\" \/><\/a><\/li>\n<li>Close the project properties window and press Ctrl-Shift-B to build your project. The build typically takes around 25 minutes on a 6-core machine and can be slower if you have fewer cores:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/06-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-491\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/06-build.png\" alt=\"\" width=\"643\" height=\"195\" \/><\/a><\/li>\n<li>Restart your Linux machine to boot into the new kernel. Once the system starts up, open the Linux Kernel Module wizard:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/07a-newmod.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-492\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/07a-newmod.png\" alt=\"\" width=\"700\" height=\"394\" \/><\/a><\/li>\n<li>On the second page disable the &#8220;detect and install headers and symbols&#8221; checkbox:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/07-noauto.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-493\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/07-noauto.png\" alt=\"\" width=\"696\" height=\"628\" \/><\/a><\/li>\n<li>On the next page select &#8220;Debug a kernel built in VisualKernel project&#8221; and specify the path to the previously created kernel project:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/08-refprj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-494\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/08-refprj.png\" alt=\"\" width=\"696\" height=\"628\" \/><\/a><\/li>\n<li>Proceed with the default source code access settings:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/09-srcpaths.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-495\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/09-srcpaths.png\" alt=\"\" width=\"696\" height=\"628\" \/><\/a><\/li>\n<li>Specify the debug settings that match your setup:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/10-debug.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-496\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/10-debug.png\" alt=\"\" width=\"696\" height=\"628\" \/><\/a><\/li>\n<li>When the module project is created, set a breakpoint on the initialization function and hit F5 to begin debugging. The debugging will now work normally:<a href=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/11-breakpoint.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-497\" src=\"https:\/\/sysprogs.com\/tutorials\/wp-content\/uploads\/2022\/07\/11-breakpoint.png\" alt=\"\" width=\"701\" height=\"564\" \/><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Kernel symbol files are special files that allow mapping code and data inside the kernel into meaningful variable names and<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[58],"tags":[],"_links":{"self":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/484"}],"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=484"}],"version-history":[{"count":1,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/484\/revisions"}],"predecessor-version":[{"id":498,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/posts\/484\/revisions\/498"}],"wp:attachment":[{"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/media?parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/categories?post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sysprogs.com\/tutorials\/wp-json\/wp\/v2\/tags?post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}