proc_create() example for kernel module

This example will create a proc entry which enables reading access. I think you can enable other kinds of access by changing the mode argument passed to the function. I haven’t passed a parent directory because there is no need to. The structure file_operations is where you setup your reading and writing callbacks. struct proc_dir_entry … Read more

module_init() vs. core_initcall() vs. early_initcall()

They determine the initialization order of built-in modules. Drivers will use device_initcall (or module_init; see below) most of the time. Early initialization (early_initcall) is normally used by architecture-specific code to initialize hardware subsystems (power management, DMAs, etc.) before any real driver gets initialized. Technical stuff for understanding below Look at init/main.c. After a few architecture-specific … Read more

Content for Linux Operating Systems Class

My list: What an operating system’s concerns are: Abstraction and extension of the physical machine and resource management. How the build process works ie, how architecture specific/machine code stuff is implanted How system calls work and how modules can link up Memory management / Virtual Memory / Paging and all the rest How processes are … Read more

Linux kernel device driver programming [closed]

Depends on your current skills. If you’re really new to Linux, perhaps you should start with user space system programming with Advanced Linux Programming. You’ll get good knowledge of Unix system calls and other concepts such as signals, processes/threads and so on with this free resource. This is a must (understanding the user space API) … Read more

BSP vs Device-Drivers

I see the relationship between BSPs and devices drivers as “has-a”. Board support packages include device drivers. The differences between BSPs & kernels isn’t easy to distinguish. A kernel translates instructions to the hardware. Kernels are often written to particular families of hardware, so they’re not as portable or generic as they seem. It amounts … Read more

why is u8 u16 u32 u64 used instead of unsigned int in kernel programming

Often when working close to the hardware or when trying to control the size/format of a data structure you need to have precise control of the size of your integers. As for u8 vs uint8_t, this is simply because Linux predated <stdint.h> being available in C, which is technically a C99-ism, but in my experience … Read more

Linux Stack Sizes

The reason that documentation is scarce is that it’s an area that’s quite architecture-dependent. The code is really the best documentation – for example, the THREAD_SIZE macro defines the (architecture-dependent) per-thread kernel stack size. The stacks are allocated in alloc_thread_stack_node(). The stack pointer in the struct task_struct is updated in dup_task_struct(), which is called as … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)