31. Set Environment
1.Change the root passwd use command :sudo passwd root
2.login root command:su
Find the path jdk you install ex:/usr/lib/jvm/java-7-openjdk-i386
Find the file /root/.bashrc use vim edit and add :
export PATH=/usr/lib/jvm/java-7-openjdk-i386/bin:$PATH
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386"
export CLASSPATH=.:/usr/lib/jvm/java-7-openjdk-i386
32.
33. Example 1
Hello word.c
Use command open the program editor : vim filename.filetype
Write the program hello_word
Leave and save command is “ esc + :wq “
34. Compiler :
Comand :
gcc –c hello_word.c
gcc –o hello_word hello_word.o
Program execution and result : (./filename)
35. Example 2
Hello word.java
Use command open the program editor : vim filename.filetype
Write the program hello_word
Leave and save command is “ esc + :wq “
37. How to build a kernel
103-1 Operating System
黃彥豪
2014/10/28
38. What’s a kernel
“The one program running at all times on the
computer”
The program control hardware!
-
-
39. Why we need to rebuild kernel
Make process working, you need kernel supported.
Kernel is a system file.
There are different module which can drive hardware.
What you want your kernel do
40. Step
1. System checking
2. Setting config
3. Making Kernel / Image / Initial Ram Disk
4. Edit grub
5. Reboot and checking
42. Get start
Open terminal and become root user (#su)
If you using Debian or Ubuntu.
In default those systems may not have root account.
--Using root (#sudo su)
Checking version (#uname -r)
Checking hardware(#lspci)
43.
44. About version
2.5.x VS 2.6.x (2.5.x is development of 2.6)
2.4.x VS 2.6.x (Is two different version)
http://www.kernel.org
45. #cd /(where you want to place this bz2-file)
(view ftp://linux.cis.nctu.edu.tw/kernel/linux/kernel/ before you start )
#wget ftp://linux.cis.nctu.edu.tw/kernel/linux/kernel/vx.x/linux-x.x.xx.xx.tar.bz2
(according to your version)
48. Cont.
#make mrproper (clean residues file ex: *.o)
note: it will clean extra file include old config data
#make clean (target file only)
49. Make XXconfig
make menuconfig
make oldconfig (if you already have ./.config)
make config (one by one)
make xconfig (X window)
make gconfig (Gnome)
50. Make config Cont.
#make menuconfig
before this you may need
#yum /apt-get install gcc (CentOS)
#yum install ncurses-devel (CentOS)
#apt-get install libncurses5-dev (Ubuntu)
According to your operating system
53. Control
Use only ↑ ↓ ← → <Enter> <Space>
y includes
n excludes
m modularizes
----> other option
<*> built-in
<M> module
[ ] / < > excluded /module capable
Note: Don’t use <Esc> to Exit
55. Notice
Processor type and features ---->
Processor family ← This is very important.
MAKE SURE WHAT YOU CHOOSE
Device Drivers ← according your device
“Make your own kernel”
Choose default if you don’t really sure about it.
56. Make sure you view all of them
If you choose something that your hardware doesn’t exist ➔nothing
effect, your kernel can still work
If you choose something that your kernel doesn’t support ➔ rebuild it
63. Initial Ram Disk (initrd)
#mkinitrd –v /boot/initrd-x.x.xx.xx.img x.x.xx.xx
The initial RAM disk (initrd) is an initial root file system that is mounted prior
to when the real root file system is available.