Posts

Showing posts from January, 2021

Linux Host Environment Setup

Image
Install supporting packags   Before you start any development, you need to set an environment up. The environment dedicated to Linux development is quite simple, at least on Debian-based systems: $ sudo apt-get update $ sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev  xterm ncurses-dev lzop ARM CROSS compilation: sudo apt-get install gcc-arm-linux-gnueabihf Own built Kernel Kernel Configuration, Compilation and Install --------------------------------------------- 1. Download Kernel Source from Kernel masters server: $ cd ~/KernelSouceCode $ git clone https://github.com/torvalds/linux.git 2. Kernel Configuration $ cd linux $ make menuconfig  3. Kernel Compilaton $ make -j4  (Static Compilation) out put is vmlinux (kernel raw image) $ du -sh vmlinux (with out compressing) $ make modules  (Dynamic Compilation) out put is .ko  $ du -sh .  4. Kernel Install...

Git commnets

Image
 git commands: ---------------------------- >git status . To know diff old patch and new  >git diff nv_memory_driver/ftl/src/ftl_test_interface.c To create the branch with UTP >bee startsms . <UTP Name> >bee startsms . ADD: ===== git add -A --> stages All git add .  --> stages new and modified, without deleteds git add -u --> stages modified and deleted, without new diff: ===== git diff <file> git diff --staged  git diff --check --> for checking the white space error search ====== > grep -rnsi  git diff at_router/src/at_router.c grep -rnis "PCL_PAD_I2C1_SCL" board_fih* | grep 125  clean: untracked files ====== git clean -f -d or git clean -fd  ------------------------->  To remove directories git clean -f -X or git clean -fX  ------------------------->  To remove ignored files log: git log --author=="kponnojx...

Virtual Memory

Image
Memory Problems: Not enough RAM. As per Address line, a program can access any bye in their 32-bit address space. in case of the 1GB physical memory. what if the program is trying the access more than 1GB memory area access?  the progress will crash.   Holes in our Address space. Programs writing over each other on the same address space. How we do we solve this: key to problem "same Memory space". can we give each its own virtual memory space? if so we can: separately map each programs memory space to the RAM memory space. and even move it to disk if we run out of Memory. Virtual Memory:           In computing, virtual memory, or virtual storage is a memory management technique that provides an "idealized abstraction of the storage resources that are actually available on a given machine" which "creates the illusion to users of a very large (main) memory". Address Translation and MMU : The mechanism to convert the virtual Address to Physical...

RegMap in linux

Image
Why RegMap  Linux is divided into many sub-systems in order to factor out common code in different parts and to simplify driver development, which helps in code maintenance. Linux has sub-systems such as I2C and SPI, which are used to connect to devices that reside on these buses. Both these buses have the common function of reading and writing registers from the devices connected to them. So the code to read and write these registers, cache the value of the registers, etc, will have to be present in both these sub-systems. This causes redundant code to be present in all sub-systems that have this register read and write functionality. To avoid this and to factor out common code , as well as for easy driver maintenance and development, Linux developers introduced a new kernel API from version 3.1, which is called regmap. This infrastructure was previously present in the Linux AsoC (ALSA) sub-system but has now been made available to entire Linux through the regmap API. Earlier, i...

Linux Device Driver Q&A

Image
 Linux Device Driver Q&A who calls the Probe function for Driver?  The starting trigger function for the  driver->probe()  callback is the  module_init()  macro called while loading the driver; this  macro  is defined in  include/linux/module.h . module_init(my_driver_init)  has the callback to  my_driver_init()  function.  my_driver_init()  function should have a call to  platform_driver_register(my_driver) platform_driver_register(my_driver)  assigns  my_driver -> probe()  handle to generic  drv -> probe()  and calls the  driver_register(my_driver)  function. driver_register(my_driver)  function adds  my_driver  to the platform bus and calls  driver_attach()  function. In the same way, even the  platform_device  needs to attach to the platform bus. Finally, only if the  driver_match_device()  returns success based on th...