Building and Installing linux kernel

It is always exciting to add something (at least a print message) in kernel and see your own kernel image booting… Well it is not difficult task. Following few steps you can build and install kernel.

  • Find proper defconfig according to your system configuration. For x86-64 bit architecture, x86_64_defconfig is used.
  • Configure kernel
    # make ARCH=x86 x86_64_defconfig
  • Compile kernel
    # make ARCH=x86
  • Install Kernel
    # sudo make modules_install
    # sudo make install

This command automatically updates grub and adds entry for new installed kernel. TO be safer, it is recommanded that you add some delay in grub.cfg so that if newly installed kernel cannot boot due to some reason, you can get a chance to boot using other kernel. If this delay is 0, grub will boot default kernel without prompt to select kernel.

+ set timeout=5
  ### END /etc/grub.d/30_os-prober ###

You can also set timeout in /etc/default/grub

GRUB_TIMEOUT=10                                                                 
Advertisements

My Favorite vimrc

" An example for a gvimrc file.
" The commands in this are executed when the GUI is started.
"
" Maintainer:	Bram Moolenaar <Bram@vim.org>
" Last change:	2001 Sep 02
"
" To use it, copy it to
"     for Unix and OS/2:  ~/.gvimrc
"	      for Amiga:  s:.gvimrc
"  for MS-DOS and Win32:  $VIM\_gvimrc
"	    for OpenVMS:  sys$login:.gvimrc

" Make external commands work through a pipe instead of a pseudo-tty
"set noguipty

" set the X11 font to use
" set guifont=-misc-fixed-medium-r-normal--14-130-75-75-c-70-iso8859-1

set ch=2		" Make command line two lines high

set mousehide		" Hide the mouse when typing text

" Make shift-insert work like in Xterm
map  
map!  

" Only do this for Vim version 5.0 and later.
if version >= 500

set guioptions+=a  
set cpoptions-=W

  " I like highlighting strings inside C comments
  let c_comment_strings=1

  " Switch on syntax highlighting if it wasn't on yet.
  if !exists("syntax_on")
    syntax on
  endif
map f gu
map F gU

  " Switch on search pattern highlighting.
set hlsearch "highlight previous patter
set ai  "For auto indenting"
set sel=inclusive
set slm=key
set cb=autoselect "clipboard
set km=startsel
set ul=100
set hi=100
set mps=(:),{:},[:],
set sm
set bs=2
set incsearch
set ru

" Hide the mouse pointer while typing
set mousehide

" Set nice colors
" background for normal text is light grey
" Text below the last line is darker grey
" Cursor is green
" Constants are not underlined but have a slightly lighter background
" highlight MatchParen
highlight Normal guibg=White
highlight Cursor guibg=Black guifg=NONE
highlight NonText guibg=White
highlight Constant gui=NONE guibg=grey95
highlight Special gui=NONE guibg=grey95
highlight ErrorMsg guibg=White guifg=Red
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
endif
"set guifontset=-b&h-lucidatypewriter-small-r-normal-*-*-100-*-*-s-*-iso10646-1
"set number
set ruler
"set ts=8
"set sw=2
"set tw=150
syntax on
"syntax match <> /\<\l\+\>/
"syntax match () /\(\l\+\)/
"syntax match {} /\{\l\+\}/
let g:plaintex_delimiters = 1
imap \vo  "=strftime("VST%m%d%y :")Pa 
imap \vc  "=strftime("ACTION : c : VST%m%d%y :")Pa 
imap \c  "set ic"
imap \e  "=strftime("// End of")Pa 

runtime macros/matchit.vim

filetype plugin on
set omnifunc=syntaxcomplete#Complete

vmap  "+yy
map  "+gP

"Show Macro REG => "p e.g. "ap .

"Rajan
set tabpagemax=100
set showcmd
set ic
set colorcolumn=80

map <F2> :mksession! ~/vim_session <cr> " Quick write session with F2 
map <F3> :source ~/vim_session <cr> " And load session with F3

Ignore Errors in VIM operations

Sometimes it is required to ignore errors in vim command.
For an example, consider a case where you have macro which includes seach
operaton. While running this macro if seach fails, macro will terminate.

There are ways to ignore errors in vim:

  • Ignore Errors in replace:

use ‘e’ option in replace command:
e.g.

:%s/old/new/e
  • Ignore Errors in search:

use :silent! command with serach to ignore search error.
e.g.

:silent! /text_to_search

Storing Macro in VIM

Storing Macro in VIM

* Start recording macro using q command followed by name of macro. For an
example, if macro name is a then, qa.
* Perform task to be run in macro.
* Stop recording macro using q command.
* At this point macro content is stored in register (in register q in this case).
* Paste register content using “<macro_name>p command (“ap in this case). Note
that ” is part of command.
* Now you have content of macro. You can put it in .vimrc file.
Add below line to store macro with name a.
let @a = ‘<macro content>’

For a example, for simple copy paste macro (content is yyp)
let @a = ‘yyp’

Here ‘ character defines start and end of macro content. So if ‘ character is
part of macro, you need to use ‘ character twice i.e. ”.

For an example, if macro content is yy’p then,
let @a = ‘yy”p’

Enjoy Vimming 🙂