Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts
pthread
A very good one-shot tutorial to the POSIX thread libraries (pthread). Talks all about threading, synchronization and scheduling with example code.
Linux performance analysis for embedded system
Nice series of articles found on www.embedded.com
Part 1: Available tools
Part 2: Profiling/analysis methods and techniques
Part 1: Available tools
Part 2: Profiling/analysis methods and techniques
Script to install a new kernel
#!/bin/sh
#
# (c) Hunterwala
if [ $(/usr/bin/id -u) -ne 0 ]; then
echo "run this script with sudo"
exit 2
fi
if [ -z $1 ]; then
echo "kernel version not found"
echo "usage: ./install_kernel [kernel_version]"
exit 2
else
VERSION=$1
echo "using $VERSION"
fi
if [ ! -d /lib/modules/$VERSION ]; then
echo "kernel modules not installed"
echo "run make install_modules from the kernel directory"
exit 2
fi
BOOTDIR=/boot
echo "Installing kernel ........................"
cp $PWD/.config $BOOTDIR/config-$VERSION
cp $PWD/System.map $BOOTDIR/System.map-$VERSION
cp $PWD/arch/i386/boot/bzImage $BOOTDIR/vmlinuz-$VERSION
echo "done"
echo "Creating initrd image ...................."
update-initramfs -c -k $VERSION
echo "done"
echo "Updating grub ............................"
update-grub
echo "done"
echo "Linux kernel $VERSION successfully installed"
echo "Please restart and select $VERSION in grub menu"Battery monitoring from console
If you prefer to work on a console based machine (without gdm\kdm), the following script is useful if you are running your laptop on battery. It shows the current battery charge and can be used for monitoring the battery discharge.
Save this script as
Change the permissions
Run it on a separate tty
#!/bin/sh
# While working in console mode (without gdm) this script
# tells you the remaining charge of your laptop battery
#
# Run it along with watch on a separate tty
# $ watch -n 10 ./batmon
#
# (c) Hunterwala, 2009
#
# TODO: check for error levels and buzz using pcspkr mod
# when the charge level decreases beyond that level.
PROC_PATH="/proc/acpi/battery/BAT0"
org_cap=`cat $PROC_PATH/info | grep "last full capacity" | sed "s/ //g" | awk -F: '{print($2)}' | sed "s/mAh//g"`
rem_cap=`cat $PROC_PATH/state | grep "remaining capacity" | sed "s/ //g" | awk -F: '{print($2)}'| sed "s/mAh//g"`
message=`cat $PROC_PATH/state | grep "charging state" | sed "s/ //g" | awk -F: '{print($2)}'| sed "s/mAh//g"`
diff=$(echo "($org_cap-$rem_cap)" | bc)
total_per=$(echo "100-($diff*100/$org_cap)" | bc)
echo "Battery is" $message ":" $total_per"%"Save this script as
batmon.shChange the permissions
chmod a+x batmon.shRun it on a separate tty
watch -n 10 ./batmon.shnew system
Just installed a new system with a fresh Ubuntu install? Install all the packages in one shot,
Apart from that, install the individual
1. Google Chrome (dev channel)
2. Skype for 32 bit (64-bit still shaky)
3. Picasa for Linux
Before installing new packages, do
~$ sudo aptitude install build-essential ddd insight kdbg kdevelop eclipse eclipse-cdt eclipse-jdt kompare kate bless kile lyx cscope global octave kmplot vim emacs virtualbox-ose pdfedit scribus inkscape checkgmail kompozer manpages manpages-posix easytag gtkpod vlc libncurses5 libncurses5-dev dialog curl sun-java6-jre sun-java6-jdk wireshark qt4-dev-tools qt4-assistant qt4-designer qdevelop monodevelop umbrello git git-core gitk git-gui graphviz doxygen doxygen-guiApart from that, install the individual
.deb for1. Google Chrome (dev channel)
2. Skype for 32 bit (64-bit still shaky)
3. Picasa for Linux
Before installing new packages, do
~$ sudo apt-get update; sudo apt-get upgrade
oprofile
oprofile is very helpful in getting a trace out of the kernel especially to know the %age usage of methods from the kernel and the application. Helps in debugging some weird problems.First, enable
oprofile in the kernel, it is good to build it part of the kernel rather than a kernel module, so make sure in the menuconfig option it is a [*] rather than [m].You can install the oprofile client once you boot back into your file system.
sudo apt-get install oprofile oprofile-guiBefore starting your application, initialize
$ sudo opcontrol --init The following two options can be done once in the beginning
Tell oprofile the path to your compiled and unstripped
vmlinux file so that it can pick the symbols from there$ sudo opcontrol --vmlinux=/path/to/kernel/imageSet the call stack depth
# sudo opcontrol --callgraph=#depthNow check the status,
$ sudo opcontrol --statusReset the earlier dump,
$ sudo opcontrol --resetStart the profiler
$ sudo opcontrol --startRun your application
$ ./mystupidapp All done, stop the profiler
$ sudo opcontrol --stopGet the dump
$ sudo opcontrol --dumpNow, get the report
$ sudo opreport -l (and various options if you want) Clear it,
$ sudo opcontrol --resetDeinit,
$ sudo opcontrol --deinitand start again if you want to.
I use alias(es) in the
.bashrc file. Really helps!alias opc='sudo opcontrol'
alias opcdeinit='opc --deinit'
alias opcdump='opc --dump'
alias opcinit='opc --init'
alias opcreset='opc --reset'
alias opcstart='opc --start'
alias opcstatus='opc --status'
alias opcstop='opc --stop'
alias opr='sudo opreport -l'
alias oprcall='opr -c'Linux embedded Systems
Nice tutorial that concludes a series of tutorials on embedded Linux system development by noted ARM Linux kernel hackers Vincent Sanders and Daniel Silverstone, here
ping sweep
You have a machine on the subnet for which you know the MAC address but you don't know what IP address it got after a restart, use
nmap and do a ping sweep: sudo nmap -n -sP 192.168.1.0/24 | grep "00:11:22:33:44"-n tells nmap not to never do reverse DNS resolution on the active IP address it finds. Makes scanning faster-sP Only perform a ping scan (host discovery) and prints the results, go no further.HTML editor
I am working on creating the website for my lab and I had to find a good open source alternative to Dreamweaver.
Bluefish Editor
It is a nice editor but it is not a WYSIWYG. One needs to go back to learning HTML and family and it becomes irritating after sometime.
Quanta Plus
Like Bluefish but more crappy and archaic. I would suggest installing software using
KompoZer
This is best editor. Powered by Mozilla (even looks like Firefox) and is a WYSIWYG with powerful features like tag view, source view and preview. It provides easy layering (div) and properties. It took me 10 minutes to create the same page that took 1 hour in Bluefish. Winner!!!
It is a nice editor but it is not a WYSIWYG. One needs to go back to learning HTML and family and it becomes irritating after sometime.
Like Bluefish but more crappy and archaic. I would suggest installing software using
aptitude rather than apt-get because it is easy to purge and clean the dependency chain that it creates.This is best editor. Powered by Mozilla (even looks like Firefox) and is a WYSIWYG with powerful features like tag view, source view and preview. It provides easy layering (div) and properties. It took me 10 minutes to create the same page that took 1 hour in Bluefish. Winner!!!
[Book] Linux in a nutshell
This O'Reilly book is a good starter for people new to Linux. Here are the list of useful commands from the book.
[Image courtsey http://www.oreillynet.com]
Using cut and uniq
For some weird reason I had to do this,
So, instead of this
I get this
OK, another approach is to use
cut and uniq turned out to be quite handy and can be used along with sedcat /proc/cpuinfo | grep "model name" | uniq | cut -d: -f2So, instead of this
model name : Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz
model name : Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHzI get this
Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHzOK, another approach is to use
awkcat /proc/cpuinfo | grep "model name" | uniq | awk -F: '{print($2)}'Emacs command list
Sometimes I tend to forget some of these :D :P
Basics
Basic movement
Editing
Important
Online-Help
Search/Replace
Search/Replace with regular expressions
Characters to use in regular expressions:
Window-Commands
Bookmark commands
Shell
DIRectory EDitor (dired)
Telnet
Text
Works only in text mode
Macro-commands
Programming
C, C++ and Java Modes
In order to achive some of the feats coming up now you have to run etags *.c *.h *.cpp (or what ever ending you source files have) in the source directory
GDB (Debugger)
Version Control
(Reference: http://lpn.rnbhq.org/tools/xemacs/emacs_ref.html)
C = Control
M = Meta = Alt|EscBasics
C-x C-f "find" file i.e. open/create a file in buffer
C-x C-s save the file
C-x C-w write the text to an alternate name
C-x C-v find alternate file
C-x i insert file at cursor position
C-x b create/switch buffers
C-x C-b show buffer list
C-x k kill buffer
C-z suspend emacs
C-X C-c close down emacsBasic movement
C-f forward char
C-b backward char
C-p previous line
C-n next line
M-f forward one word
M-b backward one word
C-a beginning of line
C-e end of line
C-v one page up
M-v scroll down one page
M-< beginning of text
M-> end of text Editing
M-n repeat the following command n times
C-u repeat the following command 4 times
C-u n repeat n times
C-d delete a char
M-d delete word
M-Del delete word backwards
C-k kill line
C-Space Set beginning mark (for region marking for example)
C-W "kill" (delete) the marked region region
M-W copy the marked region
C-y "yank" (paste) the copied/killed region/line
M-y yank earlier text (cycle through kill buffer)
C-x C-x exchange cursor and mark
C-t transpose two chars
M-t transpose two words
C-x C-t transpose lines
M-u make letters uppercase in word from cursor position to end
M-c simply make first letter in word uppercase
M-l opposite to M-uImportant
C-g quit the running/entered command
C-x u undo previous action
M-x revert-buffer RETURN (insert like this) undo all changes since last save
M-x recover-file RETURN Recover text from an autosave-file
M-x recover-session RETURN if you edited several filesOnline-Help
C-h c which command does this keystroke invoke
C-h k which command does this keystroke invoke and what does it do?
C-h l what were my last 100 typed keys
C-h w what key-combo does this command have?
C-h f what does this function do
C-h v what's this variable and what is it's value
C-h b show all keycommands for this buffer
C-h t start the emacs tutorial
C-h i start the info reader
C-h C-k start up info reader and go to a certain key-combo point
C-h F show the emacs FAQ
C-h p show infos about the Elisp package on this machineSearch/Replace
C-s Search forward
C-r search backward
C-g return to where search started (if you are still in search mode)
M-% query replace
Space or y replace this occurrence
Del or n don't replace
. only replace this and exit (replace)
, replace and pause (resume with Space or y)
! replace all following occurrences
^ back to previous match
RETURN or q quit replace Search/Replace with regular expressions
Characters to use in regular expressions:
^ beginning of line
$ end of line
. single char
.* group or null of chars
\< beginning of a word
\> end of a word
[] every char inside the backets (for example [a-z] means every small letter)
M C-s RETURN search for regular expression forward
M C-r RETURN search for regular expression backward
M C-s incremental search
C-s repeat incremental search
M C-r incremental search backwards
C-r repeat backwards
M-x query-replace-regexp search and replaceWindow-Commands
C-x 2 split window vertically
C-x o change to other window
C-x 0 delete window
C-x 1 close all windows except the one the cursors in
C-x ^ enlarge window
M-x shrink-window command says it ;-)
M C-v scroll other window
C-x 4 f find file in other window
C-x 4 o change to other window
C-x 4 0 kill buffer and window
C-x 5 2 make new frame
C-x 5 f find file in other frame
C-x 5 o change to other frame
C-x 5 0 close this frameBookmark commands
C-x r m set a bookmark at current cursor pos
C-x r b jump to bookmark
M-x bookmark-rename says it
M-x bookmark-delete "
M-x bookmark-save "
C-x r l list bookmarks
d mark bookmark for deletion
r rename bookmark
s save all listed bookmarks
f show bookmark the cursor is over
m mark bookmarks to be shown in multiple window
v show marked bookmarks (or the one the cursor is over)
t toggle listing of the corresponding paths
w " path to this file
x delete marked bookmarks
Del ?
q quit bookmark list
M-x bookmark-write write all bookmarks in given file
M-x bookmark-load load bookmark from given fileShell
M-x shell starts shell modus
C-c C-c same as C-c under unix (stop running job)
C-d delete char forward
C-c C-d Send EOF
C-c C-z suspend job (C-z under unix)
M-p show previous commandsDIRectory EDitor (dired)
C-x d start up dired
C (large C) copy
d mark for erase
D delete right away
e or f open file or directory
g reread directory structure from file
G change group permissions (chgrp)
k delete line from listing on screen (don't actually delete)
m mark with *
n move to next line
o open file in other window and go there
C-o open file in other window but don't change there
P print file
q quit dired
Q do query-replace in marked files
R rename file
u remove mark
v view file content
x delete files marked with D
z compress file
M-Del remove all marks (whatever kind)
~ mark backup files (name~ files) for deletion
# mark auto-save files (#name#) for deletion
*/ mark directory with * (C-u * removes that mark again)
= compare this file with marked file
M-= compare this file with it's backup file
! apply shell command to this file
M-} change to the next file marked with * od D
M-{ " previous "
% d mark files described through regular expression for deletion
% m " (with *)
+ create directory
> changed to next dir
< change to previous dir
s toggle between sorting by name or date
M-x speedbar starts up a separate window with a directory viewTelnet
M-x telnet starts up telnet-modus
C-d either delete char or send EOF
C-c C-c stop running job (similar to C-c under unix)
C-c C-d send EOF
C-c C-o clear output of last command
C-c C-z suspend execution of command
C-c C-u kill line backwards
M-p recall previous commandText
Works only in text mode
M-s center line
M-S center paragraph
M-x center-region name saysMacro-commands
C-x ( start macro definition
C-x ) end of macro definition
C-x e execute last definied macro
M-n C-x e execute last defined macro n times
M-x name-last-kbd-macro give name to macro (for saving)
M-x insert-keyboard-macro save named macro into file
M-x load-file load macro
M-x macroname execute macronameProgramming
M C-\ indent region between cursor and mark
M-m move to first (non-space) char in this line
M-^ attach this line to previous
M-; formatize and indent commentC, C++ and Java Modes
M-a beginning of statement
M-e end of statement
M C-a beginning of function
M C-e end of function
C-c RETURN Set cursor to beginning of function and mark at the end
C-c C-q indent the whole function according to indention style
C-c C-a toggle modus in which after electric signs (like {}:';./*) emacs does the indention
C-c C-d toggle auto hungry mode in which emacs deletes groups of spaces with one del-press
C-c C-u go to beginning of this preprocessor statement
C-c C-c comment out marked area
M-x outline-minor-mode collapses function definitions in a file to a mere {...}
M-x show-subtree If you are in one of the collapsed functions, this un-collapses it In order to achive some of the feats coming up now you have to run etags *.c *.h *.cpp (or what ever ending you source files have) in the source directory
M-. (Thats Meta dot) If you are in a function call, this will take you to it's definition
M-x tags-search ENTER Searches through all you etaged
M-, (Meta comma) jumps to the next occurence for tags-search
M-x tags-query-replace yum. This lets you replace some text in all the tagged filesGDB (Debugger)
M-x gdb starts up gdm in an extra windowVersion Control
C-x v d show all registered files in this dir
C-x v = show diff between versions
C-x v u remove all changes since last checkin
C-x v ~ show certain version in different window
C-x v l print log
C-x v i mark file for version control add
C-x v h insert version control header into file
C-x v r check out named snapshot
C-x v s create named snapshot
C-x v a create changelog file in gnu-style(Reference: http://lpn.rnbhq.org/tools/xemacs/emacs_ref.html)
Mounting an ISO
sudo mount -t iso9660 -o loop /path/to/the/iso /folder/to/mount/into In case you are getting errors like
ISOFS: Unable to identify CD-ROM format., do a file /path/to/the/iso and confirm that the file that you think is an ISO, actually is.
Using ssh, scp, sftp
SSH
The server node should be running the SSH server
Connect to the server
Connect to the server with X enabled
Note: specify port only if the default 22 is not being used.
SCP
scp can be used to transfer the files between the nodes (works on top of SSH)
From remote node to local node
From local node to remote node
SFTP
If you have a luxury of a GUI, you can copy using sftp.
Open nautilus (if using Gnome) and type in the location bar the address to the server.
Although you can go to the
The server node should be running the SSH server
sudo aptitude install openssh-serverConnect to the server
ssh username@ipaddress:portConnect to the server with X enabled
ssh username@ipaddress:portNote: specify port only if the default 22 is not being used.
SCP
scp can be used to transfer the files between the nodes (works on top of SSH)
From remote node to local node
cd local_folder
scp username@ipaddress:port:/home/username/path/to/folder_file . From local node to remote node
scp /path/to/local/folder_file username@ipaddress:port:/home/username/path SFTP
If you have a luxury of a GUI, you can copy using sftp.
Open nautilus (if using Gnome) and type in the location bar the address to the server.
nautilus --no-dektop --browser
Location Bar: sftp://username@ipaddress:port/home/usernameAlthough you can go to the
root folder as well, but is not a good practice to screw around in that area
Using VNC over SSH
Okay, now I need to connect to this Linux box in the department which is running Matlab and access it on the wire.
Options:
1. SSH + X11 forwarding [slow]
In order to have SSH forward X11 by default change the following in
With this you can now use
2. VNC without SSH. [fast]
3. VNC tunneling over SSH [faster]
Ensure that
NOTE:
If you are running compiz\beryl (any composite window manager), Matlab's pre-bundled java does not support it and hence it would not render it properly with option (1). You would have to point to the latest version of the JVM before starting matlab
Update:
Got a local copy of Matlab and realized that it has the same problem and is solved by pointing to the latest JVM. Create a launcher that takes care of setting up the environment before the launch.
Options:
1. SSH + X11 forwarding [slow]
% ssh -X username@hostname
% matlab &In order to have SSH forward X11 by default change the following in
/etc/ssh/ssh_config and also remove the #ForwardAgent yes (default no)
ForwardX11 yes (default is no)
StrictHostKeyChecking no (default is ask)With this you can now use
ssh username@hostname2. VNC without SSH. [fast]
% vncviewer hostname:display3. VNC tunneling over SSH [faster]
% ssh -C -L 5901/localhost/5901 username@hostname
% vncviewer localhost:5901Ensure that
vncserver is running on the remote node and also that you have set your vncpasswd. The "display" is the number that you get after starting the vncserverNOTE:
If you are running compiz\beryl (any composite window manager), Matlab's pre-bundled java does not support it and hence it would not render it properly with option (1). You would have to point to the latest version of the JVM before starting matlab
% export MATLAB_JAVA=/usr/lib/java/blah-blah/jre
% matlab & Update:
Got a local copy of Matlab and realized that it has the same problem and is solved by pointing to the latest JVM. Create a launcher that takes care of setting up the environment before the launch.
env MATLAB_JAVA="/usr/lib/jvm/java-6-sun/jre" xterm "/home/piyush/matlab-2007b/bin/matlab"
your own system call in 5 easy steps
You *might* want to write your system call for various reasons
Assuming the path to your kernel source is "L". Create a new folder L/mysyscall. Inside the folder create the source file mysyscall.c and a Makefile
Step 1. Changing the System Table
Add your system call at the end of the file.
Step 2. Changing the unistd.h
Add your system call at the end of the existing list and append the next number
Where XXX is the existing system call number plus 1. Also update the total system calls (as you just added another)
Where XXY is XXX+1
Step 3: Changing syscalls.h
Add the declaration of your system call at the end.
Step 4: Changing the kernel Makefile
Add the new folder to the kernel compile
Step 5: Write your system call
Write whatever crap you want to write inside the mysyscall.c file
Change the makefile as well and add the following line
Compile your kernel and test the system call from a user level program. You can create a header file that the user space program can use.
*/
Last thing to do is to test the code:
NOTE
Starting around kernel 2.6.18, the
or, make the following changes in the header.h
Assuming the path to your kernel source is "L". Create a new folder L/mysyscall. Inside the folder create the source file mysyscall.c and a Makefile
Step 1. Changing the System Table
L/arch/x86/kernel/syscall_table_32.SAdd your system call at the end of the file.
.long sys_new_system_call Step 2. Changing the unistd.h
L/linux/include/asm-x86/unistd_32.hAdd your system call at the end of the existing list and append the next number
#define __NR_new_system_call XXX Where XXX is the existing system call number plus 1. Also update the total system calls (as you just added another)
#define __NR_syscalls XXYWhere XXY is XXX+1
Step 3: Changing syscalls.h
L/include/linux/syscalls.hAdd the declaration of your system call at the end.
asmlinkage long new_system_call (whatever params you want to pass) Step 4: Changing the kernel Makefile
Add the new folder to the kernel compile
core-y += /kernel /blah /blah /blah /mysyscallStep 5: Write your system call
Write whatever crap you want to write inside the mysyscall.c file
asmlinkage long new_system_call (whatever params you want to pass)
{
// whatever you want to do
} Change the makefile as well and add the following line
obj-y := mysyscall.o Compile your kernel and test the system call from a user level program. You can create a header file that the user space program can use.
/* header.h */
#include < linux/unistd.h >
#define __NR_new_system_call XXX
/* if you system call returns int and takes no parameter
* use this macro
*/
_syscall0(int,new_system_call)
/* Otherwise, depending on the number of parameters
* being passed use the _syscallN macro, N being the no
* of params, like
_syscall1(int, new_system_call, int) */
Last thing to do is to test the code:
/* test client */
#include "header.h"
int main (void)
{
printf ("System call returned %d \n", new_system_call());
return 1;
}NOTE
Starting around kernel 2.6.18, the
_syscallXX macros were removed from header files supplied to user space. Instead we need to use syscall() function. printf ("System call returned %d \n", syscall (__NR_new_system_call, params_if_any));or, make the following changes in the header.h
/* header.h */
#include < linux/unistd.h >
#include < sys/syscall.h >
#define __NR_new_system_call XXX
long new_system_call (params_if_any)
{
return syscall (__NR_new_system_call, params_if_any);
}
Kernel compile notes
NOTE: The upstream (git) kernel *sometimes* does not compile with gcc-4.x. Install gcc-3.4 and change /usr/bin/gcc (which links to gcc-4.x) to point to gcc-3.4 instead.
Compile using make-kpkg on Debian. Kernel compiles as a .deb (initrd image + modules) and can be directly installed using
The old fashioned way
1. Go to the kernel directory (say, kernel_dir) and edit the Makefile to specify the
2. Configure the kernel
If you do not know where to start for, use
This creates a default configuration for i386. You can then confirm the configuration with
[OLD]It might be useful to run (not required)
3. Compile the kernel and modules
In the 2.6+ kernel, you can just do the following instead
TIP: If you have already compiled and installed the kernel once and later made changes ONLY to the kernel, doing a
TIP: To reduce the compilation noise you can forward the output of make to
4. Install the modules in
Confirm that
5. Copy the kernel image binaries to
Lets say that the kernel version (along with the EXTRAVERSION) is 2.6.24-custom.010209
6. Create the RAM Disk image (initrd).
In Ubuntu the
Note that update-initramfs looks at
The initrd file
NOTE: Usually the following are selected by default at the time of kernel configuration. If these are not set, you might get a kernel panic while booting.
7. Last step is to update grub
Check in
8. Reboot, and select your kernel
Compile using make-kpkg on Debian. Kernel compiles as a .deb (initrd image + modules) and can be directly installed using
dpkg -i. (Steps, UbuntuWiki). The problem with make-kpkg is that every time you make a change to the kernel code it recompiles everything from scratch, which is a pain in the neck! To avoid that, it is better to compile the kernel from scratch and not use jazzy distro scriptsThe old fashioned way
1. Go to the kernel directory (say, kernel_dir) and edit the Makefile to specify the
EXTRAVERSION. (This is what --append-to-version does in make-kpkg). It is good to do this as it helps to identify your kernel from the rest.2. Configure the kernel
make menuconfigIf you do not know where to start for, use
make defconfigThis creates a default configuration for i386. You can then confirm the configuration with
make menuconfig[OLD]It might be useful to run (not required)
make oldconfig3. Compile the kernel and modules
make bzImage
make modules In the 2.6+ kernel, you can just do the following instead
make -j N, where N is the number of parallel compilation tasks you want to kick in for a faster compile. (N = 2,4,...)TIP: If you have already compiled and installed the kernel once and later made changes ONLY to the kernel, doing a
make would build the modules too. To avoid that do make bzImageTIP: To reduce the compilation noise you can forward the output of make to
/dev/null.4. Install the modules in
/lib/modules sudo make modules_install Confirm that
/lib/modules/ has the modules corresponding to your kernel version.5. Copy the kernel image binaries to
/bootLets say that the kernel version (along with the EXTRAVERSION) is 2.6.24-custom.010209
cd kernel_dir
sudo mv arch/i386/boot/bzImage /boot/vmlinuz-2.6.24-custom.010209
sudo mv .config /boot/config-2.6.24-custom.010209
sudo mv System.map /boot/System.map-2.6.24-custom.0102096. Create the RAM Disk image (initrd).
In Ubuntu the
mkinitrd is no longer supported. Instead mkinitramfs is used.update-initramfs -c -k 2.6.24-custom.010209 # your kernel version Note that update-initramfs looks at
/lib/module for the kernel version. Make sure that you have installed the modules in step 4.The initrd file
initrd-2.6.24-custom.010209 would be created in /bootNOTE: Usually the following are selected by default at the time of kernel configuration. If these are not set, you might get a kernel panic while booting.
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_CRAMFS=y 7. Last step is to update grub
sudo update-grub Check in
/boot/grub/menu.lst and confirm.8. Reboot, and select your kernel
Subscribe to:
Posts (Atom)