A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic...
Transcript of A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic...
![Page 1: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/1.jpg)
Kompiling the Kernel
A presentation by Tyson A. Tucker B.S.
![Page 2: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/2.jpg)
Who am I?● UN*X Admin● Began using Linux in 98● Primary OS ever since
![Page 3: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/3.jpg)
Agenda● Kernel basics
● Configuring and Compiling
● Installation
![Page 4: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/4.jpg)
Kernel Basics● Kernel (n) : a central or essential part
● Interface between user programs and computer hardware
● Its like the force – it holds the universe together inside your machine
![Page 5: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/5.jpg)
Architecture● monolithic vs. microkernel
– The TanenbaumTorvalds debate– Linus decided on monolithic kernel– It is/was the 'Old' way– Simpler – Less IPC overhead – Just Works(TM)– contrast Mach/HURD, Windows
● POSIX compliant for portability● All bits built at once
![Page 6: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/6.jpg)
Modules● Drivers implemented as removable bits of
code● Can (usually) remove driver, recompile, re
insert● Mix & match between kernels ● Doesn't have to be for hardware
– crypto support– ipv6
![Page 7: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/7.jpg)
Things that aren't modules● Core bits such as processor type, memory
layout (<1gig, 4gig, 64gig), etc
● Configuration bits within modules
![Page 8: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/8.jpg)
To module or not to module?● Pros
– Kernel Size– Memory
● Cons– Modules cause problems– Some drivers work better compiled in (3c509)
● Booting if you don't use initrd's you need fs, block devices (hard drive) compiled in
![Page 9: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/9.jpg)
Configuring and Compiling
make config|menuconfig|xconfig|gconfig|oldconfig
make dep (only for <= 2.4)
make
![Page 10: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/10.jpg)
The Configers● xconfig/gconfig – qt/gtk widgets
● menuconfig – ncurses interface
● config – original text/console interface
● oldconfig – like config but only asks about new kernel options
![Page 11: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/11.jpg)
.config● Example of the Tao of Linux● Contains all configuration of the kernel● Can be edited by hand, options are either included,
not included or selected to be modules:
CONFIG_EFI=y# CONFIG_MATH_EMULATION is not setCONFIG_ACPI_BATTERY=m
● Kernel option exists to make the running kernels' config available via /proc/config.gz
![Page 12: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/12.jpg)
Configure new kernel
tar xjvf linuxnew.tar.bz2cd linuxnew
copy /old/config/file .configmake oldconfig or zcat /proc/config.gz > .configmake oldconfig
![Page 13: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/13.jpg)
Patching● Normally:
cd linux<ver>patch p1 < /path/to/patch
or
zcat /path/to/patch.gz | patch p1
● mm tree– tons of patches not yet accepted into main tree– ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6
![Page 14: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/14.jpg)
Compiling● Since ~2.6make
● <= 2.4make depmake bzImagemake modules
![Page 15: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/15.jpg)
Help and Clean● make help
– Lists lots of useful options.● make clean
– Removes .o files, leaves .config.● make mrproper
– Like some source packages distclean/realclean options. This will delete .config.
● Doing a make clean or mrproper sometimes fixes compile bugs.
![Page 16: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/16.jpg)
Installing● two steps:
make modules_install make install
● Installs to:/lib/modules/<version>/boot/vmlinuzversion/boot/initrdvmlinuzversion
![Page 17: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/17.jpg)
If you love the pain● If make install doesn't work, this covers all
distros:
cp arch/i386/boot/bzImage /boot/vmlinuz<ver>vi /etc/lilo.conf || vi /boot/grub/menu.lstlilo # only if you use lilomkinitramfs || mkinitrd # only if you use initrds
![Page 18: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/18.jpg)
Packages?● make debpkg● make rpmpkg● make targzpkg
● 3rd party:– debian: makekpkg
![Page 19: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/19.jpg)
moduleinittools● Transition from 2.4 to 2.6 (usually) requires
the package moduleinittools:
http://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/
![Page 20: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/20.jpg)
How to be bleeding edge● Patch from the mm tree.
● Or pull from Linus's git tree. http://linux.yyz.us/githowto.html
![Page 21: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/21.jpg)
Review● Kernel basics
● Configuring and Compiling
● Installation
![Page 22: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/22.jpg)
links
ftp://ftp.us.kernel.org/pub/linux/kerne/v2.6http://www.oreilly.com/catalog/opensources/book/appa.htmlftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6http://ftp.kernel.org/pub/linux/kernel/people/rusty/modules/http://linux.yyz.us/githowto.htmlhttp://en.wikipedia.org/wiki/Wildebeest
![Page 23: A presentation byusers.tricity.wsu.edu/~tyson/.../3clug_Presentation... · Architecture monolithic vs. microkernel – The TanenbaumTorvalds debate – Linus decided on monolithic](https://reader035.fdocuments.us/reader035/viewer/2022070719/5eded26cad6a402d666a2cb7/html5/thumbnails/23.jpg)