Is is possible to use ftrace without debugfs? - linux

I was going through a Linux KERNEL configuration file wherein function_trace is enabled but debugfs is disabled. If i load this kernel onto the target is there any way, I can make use of the function_tracer ? if debugfs is disabled is it that the function tracer is not enabled by default ?

Technically it's not possible to select function_trace without debugfs enabled. As per tracing configuration file (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/trace/Kconfig#n140), it suggest that - if you select FUNCTION_TRACER, it'll automatically select GENERIC_TRACER and when GENERIC_TRACER is selected this will automatically select TRACING (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/trace/Kconfig#n112) and when TRACING is selected it'll select DEBUG_FS (https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/kernel/trace/Kconfig#n101).
So, it's a linked list of selection procedure and you do not need to select each option every time. Until unless you've modified config file by hand and it's not recommended.

Related

How to create a consistent .config file to compile Linux kernel?

To compile Linux kernel, I created a default .config file using make defconfig. Since I didn't want to browse thousands of options through a menu-driven interface (make menuconfig), I set CONFIG_KALLSYMS=n manually, and then triggered the build (make -j8). I noticed the build system overwrote my changes and set CONFIG_KALLSYMS=y again. I suspect there might be other options present in the configuration which rely on CONFIG_KALLSYMS. How can I create a consistent .config file without using any menu-driven interface?
It might be burdensome to browse thousands of options through a menu-driven interface (make menuconfig). When you only want to change a couple of options and don't remember where they are in the menu hierarchy, you can use search to find any specific option. Just press / (slash) and type the full or partial name of the option. The result of the search will show where the options are located in the menu hierarchy, and what are the dependencies. Save and exit after you are done with the changes, and you should have a consistent .config file.
After you create a .config using make defconfig, to change just a few config options after that "make menuconfig" is the best way to do this. It also tells you about the dependencies and doesn't allow you to make a change unless the dependencies are met.

Is it possible to share SublimeText preferences *and* override one specific pref?

I share Sublime prefs between two machines (home, work) using Git.
My monitor at work has a higher DPI than my monitor at home, so in one of the two machines I'd like to override font_size.
I was hoping for:
The possibility to override using a command-line flag (to do something like subl --override-pref font_size=15), like kitty --override does.
Another level of prefs cascading below User.
, but I don't think any of this exists in Sublime. Language-specific config is not what I'm looking for, I want something global, but only in one of the two machines.
Ideas? Workarounds? Thanks.
The general mechanism at play for settings files is that when Sublime loads a sublime-settings file by name, it pulls all of the similarly named files across all of the known packages and combines them together (the same also happens for many other resource files) with content from later files overriding anything that appears in an earlier file.
The order that's imposed here is lexically by package, with Default always being first and User always being last. That's why the default settings are in the Default package and your custom settings are in the User package. Additionally syntax specific settings also apply (as do settings specific to projects).
Apart from this mechanism there's no direct way to override settings without some sort of manual intervention on your part. Potential solutions for this sort of problem include the following examples:
Don't sync the Preferences.sublime-settings file
If the file isn't synced across multiple machines, then this problem becomes moot because each machine can easily have it's own unique settings. The downside to that is that each machine then has it's own unique settings, which is a pain in the butt if you often move from machine to machine and things don't quite work the same way.
Use separate git branches
An alternative here if you're using git such as you are is to try and keep separate branches per host or per host type (like hi_dpi and reg_dpi or some such). Then on each machine check out the appropriate branch.
The obvious downsides here are having to try and cross-sync desired settings changes (for both User as well as any packages you might install) between branches, which is less than ideal unless you really love git.
Use extra Preferences.sublime-settings files
Here the idea is that you don't include the font_size setting in your User/Preferences.sublime-settings file at all. Instead, you use Browse Packages from the command palette to open the Packages folder, then create a new folder there with some arbitrary name. Inside of that folder include a Preferences.sublime-settings file that contains only the font_size setting.
Doing this on multiple machines, you can sync the settings in your User folder across machines without also syncing the preference that contains the font_size. As a note, if you create the file while Sublime is already running, you may need to quit and restart to get it to notice that the settings file exists; this only applies the one time, though.
Use a plugin
Looking at the link provided above, the ultimate trump card for any setting is a setting that's been applied directly to a view. Given that, you can use a plugin that selectively always applies a specific font size to any newly created or opened file:
import sublime
import sublime_plugin
import socket
class CustomFontListener(sublime_plugin.EventListener):
hostname = socket.gethostname()
def on_new(self, view):
if self.hostname in ("host1", "host1.example.com", "host2"):
view.settings().set("font_size", 20)
on_load = on_new
Now any time you open a file or create a new buffer, if the current hostname is in the list you've configured the view will immediately get an appropriate font_size applied; otherwise the one from the preferences would be used instead.
You could also extend this to be configurable via it's own settings file, apply a different font size depending on the host name, etc.
Settings in views are persisted in the sublime-session file and also in the workspace files associated with sublime-project files, so these settings will remain in place even across restarts.
Something to keep in mind is that the internal commands for changing the font size (via Preferences > Font or via the mouse wheel keyboard shortcuts) work by writing a new font_size to your user preferences.
If you're using separate preference files, then doing this will add font_size to your User settings and you will need to manually remove it and modify the other settings file.
If you're using the plugin, then these shortcuts won't seem to do anything because it applies a font_size that overrides the User preference, but in fact as outlined above your preferences file end up being changed and you may not notice right away.
So whichever way you go, if you tend to use those you may need to make manual adjustments to settings files in the aftermath. It's also possible to create smarter versions of those commands as well, if this is the sort of thing that happens often.

How to disable certain keyboard keys in yocto

I want to disable certain keys while creating image in yocto. I know in users pace we can achieve this with xmodmap utility but I want to achieve this kernel itself.
I checked drivers/try/vt/defkeymap.map file and modified as per my requirement but loadkeys not able to generate defkeymap.c file. It throws this error:
/bin/sh: 1: loadkeys: not found.
Am I going in the right direction? Or is there any other option to change default keycode map?
The raw keyboard data is scan codes that the keyboard driver converts into key codes cf https://unix.stackexchange.com/questions/319787/how-does-the-linux-kernel-handle-keyboards-inputs-outputs. A way to generate a custom keyoard layout for console is in https://wiki.archlinux.org/index.php/Linux_console/Keyboard_configuration#Creating_a_custom_keymap, so you do not edit a driver file, loadkeys requires changes in specific directory / file :
As a side note, it is worth noting that such a personal keymap is
useful also to redefine the behaviour of keys already treated by the
default keymap: when loaded with loadkeys, the directives in the
default keymap will be replaced when they conflict with the new
directives and conserved otherwise. This way, only changes to the
keymap must be specified in the personal keymap.
source : https://wiki.archlinux.org/index.php/Linux_console/Keyboard_configuration#Creating_a_custom_keymap
If you want to do this on kernel module level you have to rewrite or patch the entire keyboard module.
In https://unix.stackexchange.com/questions/319787/how-does-the-linux-kernel-handle-keyboards-inputs-outputs is many essential information ( links to source code, ... ) for all levels, including solving this issue on kernel module level ( writing / patching kernel module )

Enable DRM_KMS_CMA_HELPER in linux kernel

I'm trying to recompile my Linux Kernel 3.18 with DRM_KMS_CMA_HELPER enabled, but editing the .config file is not working.
I have the dependencies enabled, but it still shows and not enabled.
Is there a way i can do this without editing the Kconfig file? Do i need to enable any special module for it to work?
Some symbols are not allowed to be explicitly selected by the user, but instead they are meant to be selected by other symbols.
You can identify such symbols because they don't have a "prompt" next to the symbol type (bool, tristate). This is the case of CONFIG_KMS_DMA_HELPER:
config DRM_KMS_CMA_HELPER
bool
select DRM_GEM_CMA_HELPER
select DRM_KMS_FB_HELPER
select FB_SYS_FILLRECT
select FB_SYS_COPYAREA
select FB_SYS_IMAGEBLIT
help
Choose this if you need the KMS CMA helper functions
In contrast, here's a symbol with a "prompt" text:
config KERNEL_GZIP
bool "Gzip"
depends on HAVE_KERNEL_GZIP
help
The old and tried gzip compression. It provides a good balance
between compression ratio and decompression speed.
In other words, it's not possible to explicitly enable CONFIG_DRM_KMS_CMA_HELPER. It's meant to be selected by other symbols (DRM drivers such as rcar-du, shmobile, tilcdc, and others).
Thus, if you are writing a driver that needs the functions provided when such option is enabled, you can simply select the option as the mentioned DRM drivers do.

Centos option deletion possible

In my boot options of my installed CentOS on VBox, I have the followings that really mess me up to figure out how to eliminate those that doesn't work anymore, e.g the first one which is reported as unavailability of kernel root to boot. I can only choose the last one to boot the system.
> CentOS(2.6.32-200.17.1.e16.x86_64)
> CentOS(2.6.32-200.17.1.e16.x86_64.debug)
> CentOS(2.6.32-200.4.2.e16.x86_64.debug)
> CentOS(2.6.32-200.4.2.e16.x86_64)
> CentOS(2.6.32-200.4.1.e16.x86_64)
> CentOS(2.6.32-200.e16.x86_64)
Where are these stored once I boot the system with the last option ? What if I would like to delete (completely) one of them ? I don't know what the xxx.debug's are there for ?
Thank you for any help
On most distros today the boot manager is GRUB. The configuration of boot menu is usually stored in /boot/grub in a file called menu.lst or grub.cfg depending on GRUB version and distro. In that file, you can comment out sets of lines corresponding to the OS you don't want in the menu - syntax should be pretty intuitive.
On some distros the file is generated by a set of scripts, in this case a comment at the top say you shouldn't edit that file directly. For example in Debian, the scripts which generate the configuration reside in /etc/grub.d/ and they do all sorts of auto-probing for available OS's. In this case one needs to either modify the script or to remove the OS images which are automatically appended to the menu. The exact way to do this cleanly may vary depending on your setup - perhaps some of these boot images can be removed using a package manager which would be more elegant than just removing files manually.
Either way, be careful, since removing the wrong file related to booting may make it impossible to boot your OS or even to start GRUB at all if you're extremely unlucky.

Resources