User Tools

Site Tools


kernel

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
kernel [03/25/2013 12:34] adminkernel [06/09/2026 12:03] (current) – [Compiling the kernel] admin
Line 1: Line 1:
 +https://docs.kernel.org/index.html
  
 Kernel headers should be copied into /usr/include to be used by libraries and compiled programs. These should be the headers glibc has been compiled against, and should be kept independent of the ones in the kernel source tree. New packages are compiled against these headers, otherwise, if packages are compiled against headers that do not match the headers glibc was compiled against, segfaults or other strange problems may appear. /usr/include headers should be what matches the library object files. By copying the headers instead of symlink them to /usr/src/<linux>/include, we make sure that they remain available if we upgrade our kernel. Kernel headers should be copied into /usr/include to be used by libraries and compiled programs. These should be the headers glibc has been compiled against, and should be kept independent of the ones in the kernel source tree. New packages are compiled against these headers, otherwise, if packages are compiled against headers that do not match the headers glibc was compiled against, segfaults or other strange problems may appear. /usr/include headers should be what matches the library object files. By copying the headers instead of symlink them to /usr/src/<linux>/include, we make sure that they remain available if we upgrade our kernel.
  
 +====== Compiling the kernel ======
 +
 +Useful in embedded systems, as only the strongly recommended options are set to Y:
 +
 +  make help          # provides a lot of information about kernel config options
 +
 +  make allnoconfig   # useful in embedded systems, setting the strongly recommended options to Y
 +  make clean         # remove most generated files but keep config
 +  make mrproper      # remove all generated files
 +  make defconfig     # gives us a new config
 +  make LSMOD=... localmodconfig   # uses the list of modules to create a configuration
 +  make distclean     # also remove the editor backup and patch reject files
 +  
 +  make oldcondif     # uses a provided .config as base
 +  
 +  scripts/diffconfig .config.old .config   # shows difference between both kernel configurations
 +  
 +  interesting option: CONFIG_WERROR
 +  
 +  make
 +  make LOADADDR=0x80008000 uImage
 +  make dtbs
 +
 +[[https://github.com/a13xp0p0v/kconfig-hardened-check|Useful tool to check config security]]
 +  
 ====== Process State ====== ====== Process State ======
  
Line 17: Line 43:
  
 The Kernel may also run **kernel threads**, standard processes that exist only in kernel-space, like management threads that maintain the buffer and page caches. These processes are scheduled like normal processes and are allowed to sleep. The Kernel may also run **kernel threads**, standard processes that exist only in kernel-space, like management threads that maintain the buffer and page caches. These processes are scheduled like normal processes and are allowed to sleep.
 +
 +====== Concurrency and shared resources ======
 +  * Interrupts
 +  * Kernel preemption, causing the kernel to switch from the execution of one system call to another
 +  * Multiprocessing
 +
 +We need to keep as much local state as possible and use locking for the shared resources.
 +
 +===== Locks =====
 +  * Mutex, the main kernel locking primitive. Usable in contexts where sleeping is allowed.
 +  * Semaphores.
 +  * Spinlocks, used with code that is not allowed to sleep (interrupt handlers) or that doesn't want to sleep (critical sections). In single-core processors, it is better not to use spinlocks, as they would waist resources slowing down the lock owner (timeslice schedulers) or cause a deadlock (non-timeslice schedulers).
 +  * Alternatives:   Lock-free algorithms like Read Copy Update (RCU) and atomic operations.
  
 ====== Debugging ====== ====== Debugging ======
Line 28: Line 67:
 to restrict bisection to commits that touch [path]. to restrict bisection to commits that touch [path].
  
 +http://www.av8n.com/computer/htm/kernel-lockup.htm
 ====== Porting the kernel to ARM devices ====== ====== Porting the kernel to ARM devices ======
 [[http://www.digipedia.pl/usenet/thread/19011/33747/|ARM11 MPCore example]] [[http://www.digipedia.pl/usenet/thread/19011/33747/|ARM11 MPCore example]]
Line 53: Line 93:
  
 [[http://www.youtube.com/watch?v=LLBrBBImJt4|Write and Submit your first Linux kernel Patch]] [[http://www.youtube.com/watch?v=LLBrBBImJt4|Write and Submit your first Linux kernel Patch]]
 +
 +https://kernelnewbies.org/FirstKernelPatch
 +
 +https://kernelnewbies.org/Outreachyfirstpatch?action=show&redirect=OPWfirstpatch
 +
 +https://tapaswenipathak.wordpress.com/2014/10/11/tools-to-cleanup-linux-kernel/
 +
 +====== Testing ======
 +https://kernelci.org/
  
 ====== Useful links ====== ====== Useful links ======
Line 62: Line 111:
 http://lwn.net/Kernel/LDD3/ http://lwn.net/Kernel/LDD3/
  
 +http://sysplay.in/blog/linux-device-drivers/2013/02/linux-device-drivers-for-your-girl-friend/
kernel.1364214892.txt.gz · Last modified: by admin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki