Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ass:cursuri:04:theory:00 [2024/08/09 16:16]
radu.mantu
ass:cursuri:04:theory:00 [2024/08/15 19:20] (current)
radu.mantu [QEMU setup for kernel development]
Line 48: Line 48:
 $ chroot rootfs /bin/bash $ chroot rootfs /bin/bash
 </​code>​ </​code>​
- 
  
 === The Linux kernel === === The Linux kernel ===
Line 85: Line 84:
 Unfortunately,​ the server does not have any foolproof method of inferring the structure of the project. For example, it has no idea whether you are using the //arm64// or the //x86// definition of a function. Luckily for us, the Linux build system contains a script that's able to generate a file names ''​compile_commands.json''​. This file contains all compiler invocations used during the boot and can deduce include paths, compiled source, macro definitions,​ etc. The language server will automatically load it and generate indices for the compiled source code. Unfortunately,​ the server does not have any foolproof method of inferring the structure of the project. For example, it has no idea whether you are using the //arm64// or the //x86// definition of a function. Luckily for us, the Linux build system contains a script that's able to generate a file names ''​compile_commands.json''​. This file contains all compiler invocations used during the boot and can deduce include paths, compiled source, macro definitions,​ etc. The language server will automatically load it and generate indices for the compiled source code.
  
-Note that this script only forks for the Linux kernel. If you want to generate ''​compile_commands.json''​ for other projects, consider using [[https://​github.com/​rizsotto/​Bear|Bear]]. This is a tool that hooks the ''​exec()''​ family of library calls via LD_PRELOAD hooking in order to extract the command arguments.+<code bash> 
 +linux$ ./​scripts/​clang-tools/​gen_compile_commands.py 
 +</​code>​ 
 + 
 +Note that this script only works for the Linux kernel. If you want to generate ''​compile_commands.json''​ for other projects, consider using [[https://​github.com/​rizsotto/​Bear|Bear]]. This is a tool that hooks the ''​exec()''​ family of library calls via LD_PRELOAD hooking in order to extract the command arguments
 + 
 +Also, for such a large codebase, expect the language server to take up //a lot// of your CPU when you first open your editor, while doing the indexing (usually in a ''​.cache/''​ directory).
 </​note>​ </​note>​
  
Line 133: Line 138:
 Some terminal emulators such as [[https://​github.com/​kovidgoyal/​kitty|kitty]] support custom ''​TERM''​ values such as **xterm-kitty** but most shells won't have any idea how to particularize the output for it. Stick to **xterm** :p Some terminal emulators such as [[https://​github.com/​kovidgoyal/​kitty|kitty]] support custom ''​TERM''​ values such as **xterm-kitty** but most shells won't have any idea how to particularize the output for it. Stick to **xterm** :p
 ---- ----
-If the VM doesn'​t accept your root login password even after specifically setting it from **chroot** via **passwd**, make sure you're running the script with **sudo**. When debootstrapping the rootfs, the file owner was set to //root//, meaning that your unprivileged user won't have read access to ''/​etc/​shadow''​ that has ''​rw----''​ permissions. As a result, ''​systemd-login''​ won't be able to validate your password against its stored cryptographic hash. Though I agree, it could be a bit more verbose about that fact :/+If the VM doesn'​t accept your root login password even after specifically setting it from **chroot** via **passwd**, make sure you're running the script with **sudo**. When debootstrapping the rootfs, the file owner was set to //root//, meaning that your unprivileged user won't have read access to ''/​etc/​shadow''​ that has ''​rw%%----%%''​ permissions. As a result, ''​systemd-login''​ won't be able to validate your password against its stored cryptographic hash. Though I agree, it could be a bit more verbose about that fact :/
 </​note>​ </​note>​
ass/cursuri/04/theory/00.1723209368.txt.gz · Last modified: 2024/08/09 16:16 by radu.mantu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0