Linux-grub, kernel and module relationships, CHROOT,LDD

Source: Internet
Author: User

Linux system startup process


Pc:os (Linux)


Post-->bios (Boot Sequence)-->mbr (bootloader,446)-->kernel-->initrd--> (ROOTFS)/sbin/init (/etc/ Inittab


The service started differently:
Operating level: 0-6
0:halt
1:single user mode, directly as an administrator, S,s,single
2:multi user mode, no NFS
3:multi user mode, text mode
4:reserved
5:multi user mode, graphic mode
6:reboot


Detailed start-up process
Bootloader (MBR): only 446 bytes, too small
Lilo:linux LOader
Grub:grand Unified Bootloader (can extend larger memory space)
Stage1:mbr
Stage1_5: (Identify different file systems)
Stage2:/boot/grub/


[Email protected] ~]# ll-h/boot/grub/
Total 276K
-rw-r--r--. 1 root root The June Device.map
-rw-r--r--. 1 root root 14K June e2fs_stage1_5
-rw-r--r--. 1 root root 13K June fat_stage1_5
-rw-r--r--. 1 root root 12K June ffs_stage1_5
-RW-------. 1 root root 784 June grub.conf
-RW-------. 1 root root 789 June Grub.conf.bak
-rw-r--r--. 1 root root 12K June iso9660_stage1_5
-rw-r--r--. 1 root root 13K June jfs_stage1_5
lrwxrwxrwx. 1 root root all June menu.lst./grub.conf
-rw-r--r--. 1 root root 12K June minix_stage1_5
-rw-r--r--. 1 root root 15K June reiserfs_stage1_5
-rw-r--r--. 1 root root 1.4K May 6 2010splash.xpm.gz Landing Background map
-rw-r--r--. 1 root root for June Stage1
-rw-r--r--. 1 root root124K June stage2 size is much larger than 446 bytes
-rw-r--r--. 1 root root 12K June ufs2_stage1_5
-rw-r--r--. 1 root root 12K June vstafs_stage1_5
-rw-r--r--. 1 root root 14K June xfs_stage1_5
[Email protected] ~]#

[[email protected] ~]# rpm-q Grub (Query grub version)
Grub-0.97-93.el6.x86_64
[Email protected] ~]#


[Email protected] ~]# cat/boot/grub/grub.conf
# grub.conf generated by Anaconda
#
# Note that you don't have the to rerun grub after making changes to the This file
# notice:you has a/boot partition. This means
# all kernel and INITRD paths is relative to/boot/, eg.
# root (hd0,0)
# kernel/vmlinuz-version RO root=/dev/sda2
# initrd/initrd-[generic-]version.img
#boot =/DEV/SDA
Default=0 (Start the first kernel by default, starting from 0)
Timeout=5 (s) waiting for the user to select the time-out period
Splashimage= (hd0,0)/grub/splash.xpm.gz (Specify GRUB background image)
Hiddenmenu (Hide Selection menu)
Title Red Hat Enterprise Linux 6 (2.6.32-504.el6.x86_64) (different kernel version, name; kernel title, or operating system name, string, can be modified freely)
Root (hd0,0) (the device on which the kernel file resides; For grub, all types of hard drives are HD, in the format (hd#,n); hd#, #表示第几个磁盘; the last N indicates the partition of the corresponding disk)
kernel/vmlinuz-2.6.32-504.el6.x86_64 ro root=uuid=57d85756-7680-4c7c-9125-6ad67dae2c45 Rd_NO_LUKS rd_NO_LVM LANG=en _us. UTF-8 rd_no_md sysfont=latarcyrheb-sun16 crashkernel=auto keyboardtype=pc keytable=us rd_NO_DM Quiet (kernel file path, and passed to the kernel Parameters
Initrd/initramfs-2.6.32-504.el6.x86_64.img (ramdisk file path)

[Email protected] ~]#



Redhat5:ramdisk-->initrd
Redhat6:ramfs-->initramfs


Download GIMP, encountered when compiling files in Linux: Your Intltool is too old. You need Intltool 0.35.0 or later

#wget http://ftp.gnome.org/pub/gnome/sources/intltool/0.40/intltool-0.40.6.tar.gz ()
#tar-ZXVF intltool-0.40.6.tar.gz
#cd intltool-0.40.6
#./configure Here you can also specify the installation directory, and the man directory
#make && make Install


Unable to install GIMP, login interface cannot be modified





Kernel design style:


RedHat, SUSE
Core: Dynamic load kernel module
Kernel:/lib/modules/"kernel version number command directory"/
vmlinuz-2.6.32
/lib/modules/2.6.32/


[Email protected] 2.6.32-504.el6.x86_64]# du-sh/boot/vmlinuz-2.6.32-504.el6.x86_64
4.0M/BOOT/VMLINUZ-2.6.32-504.EL6.X86_64 (core size is 4M)

[Email protected] 2.6.32-504.el6.x86_64]# du-sh/lib/modules/
107m/lib/modules/(module size 107M, greatly reduce the memory of the kernel)


[[email protected] ~]# ll/lib/modules/(the directory where the module is located)
Total 4
Drwxr-xr-x. 7 root root 4096 June 2.6.32-504.el6.x86_64
[Email protected] ~]#

[email protected] 2.6.32-504.el6.x86_64]# LL
Total 3608
lrwxrwxrwx. 1 root root, June, build. /.. /.. /usr/src/kernels/2.6.32-504.el6.x86_64
Drwxr-xr-x. 2 root root 4096 Sep extra
Drwxr-xr-x. Root root 4096 June kernel
-rw-r--r--. 1 root root 604652 June Modules.alias
-rw-r--r--. 1 root root 579321 June Modules.alias.bin
-rw-r--r--. 1 root root 1413 Sep Modules.block
-rw-r--r--. 1 root root (June) Modules.ccwmap
-rw-r--r--. 1 root root 204307 June 21 2015MODULES.DEP (mapping relationships between modules)
-rw-r--r--. 1 root root 296406 June Modules.dep.bin
-rw-r--r--. 1 root root modules.drm Sep
-rw-r--r--. 1 root root 665 June Modules.ieee1394map
-rw-r--r--. 1 root root 141 June Modules.inputmap
-rw-r--r--. 1 root root 1313 June Modules.isapnpmap
-rw-r--r--. 1 root root Sep modules.modesetting
-rw-r--r--. 1 root root 1974 Sep modules.networking
-rw-r--r--. 1 root root (June) Modules.ofmap
-rw-r--r--. 1 root root 76447 Sep Modules.order
-rw-r--r--. 1 root root 452824 June Modules.pcimap
-rw-r--r--. 1 root root 6259 June Modules.seriomap
-rw-r--r--. 1 root root 165 June MODULES.SOFTDEP
-rw-r--r--. 1 root root 239283 June Modules.symbols
-rw-r--r--. 1 root root 301921 June Modules.symbols.bin
-rw-r--r--. 1 root root 852337 June Modules.usbmap
lrwxrwxrwx. 1 root root 5 June by Source-build
Drwxr-xr-x. 2 root root 4096 Sep updates
Drwxr-xr-x. 2 root root 4096 June Vdso
Drwxr-xr-x. 2 root root 4096 Sep weak-updates
[Email protected] 2.6.32-504.el6.x86_64]# CD kernel/
[email protected] kernel]# LL
Total 36
Drwxr-xr-x. 3 root root 4096 June 21 2015Arch (platform)
Drwxr-xr-x. 3 root root 4096 June 21 2015Crypto Encryption
Drwxr-xr-x. Root root 4096 June 21 2015Drivers Drive
Drwxr-xr-x. Root root 4096 June 21 2015FS File System
Drwxr-xr-x. 3 root root 4096 June 21 2015Kernel kernel
Drwxr-xr-x. 6 root root 4096 June 21 2015Lib Library
Drwxr-xr-x. 2 root root 4096 June 21 2015mm Memory Management
Drwxr-xr-x. Root root 4096 June 21 2015NET Network
Drwxr-xr-x. 9 root root 4096 June 21 2015Sound Audio
[Email protected] kernel]#

[Email protected] kernel]#ls drivers/net/(all types of NIC drivers, load on demand)
3c59x.ko Bnx2.ko e1000 igb mlx5 ppp_async.ko R8169.ko Sundance.ko Via-rhine.ko
8139cp.ko bnx2x e1000e igbvf myri10ge ppp_deflate.ko S2io.ko Sungem.ko via-velocity . Ko
8139too.ko bonding E100.ko Ipg.ko natsemi.ko ppp_generic.ko Sc92031.ko Sungem_phy.ko virtio_net.k O
8390.ko can enic ixgb ne2k-pci.ko ppp_mppe.ko SFC Sunhme.ko vmxnet3
Acenic.ko Cassini.ko Epic100.ko Ixgbe netconsole.ko pppoe.ko Sis190.ko Tehuti.ko vxge
Amd8111e.ko Chelsio Ethoc.ko ixgbevf netxen pppol2tp.ko Sis900.ko Tg3.ko Vxlan.ko
atl1c Cnic.ko Fealnx.ko Jme.ko niu.ko Pppox.ko Skge.ko Tlan.ko Wan
ATL1E cxgb3 Forcedeth.ko Macvlan.ko ns83820.ko Ppp_synctty.ko Sky2.ko Tulip WiMAX
ATLX cxgb4 hyperv Macvtap.ko Pch_gbe Qla3xxx.ko Slhc.ko Tun.ko Wireless
B44.ko Dl2k.ko i40e Mdio.ko PCMCIA qlcnic Slip.ko Typhoon.ko Xen-netfront . Ko
Benet Dnet.ko i40evf Mii.ko pcnet32.ko qlge Smsc9420.ko usb
BNA Dummy.ko Ifb.ko mlx4 PHY R6040.ko Starfire.ko Veth.ko
[Email protected] kernel]#




Analog root Switching

Chroot:chroot/path/to/temproot [COMMAND ...]
Chroot/test/virrrot/bin/bash


[[email protected] ~]# ldd/test/myroot/bin/bash   (displays the shared library on which the binaries depend)
  Linux-vdso.so.1 =>  (0x00007fff557dd000)
 libtinfo.so.5 =/lib64/libtinfo.so.5 ( 0x0000003ca3600000)
 libdl.so.2 =/lib64/libdl.so.2 (0x0000003c98a00000)
 libc.so.6 =/ Lib64/libc.so.6 (0x0000003c98e00000)
 /lib64/ld-linux-x86-64.so.2 (0x0000003c98600000)

[[email protected] ~]# mkdir-p/test/myroot/lib64  (64-bit, creating/lib64)
[[email  Protected] ~]# cp/lib64/libtinfo.so.5/test/myroot/lib64
[[email protected] ~]# cp/lib64/libdl.so.2/test/ Myroot/lib64
[[email protected] ~]# cp/lib64/libc.so.6/test/myroot/lib64
[[email protected] ~]# CP /lib64/ld-linux-x86-64.so.2/test/myroot/lib64
[[email protected] ~]# ll/test/myroot/lib64
Total 2200
-rwxr-xr-x. 1 root root  156936 mar  1 19:55 ld-linux-x86-64.so.2
-rwxr-xr-x. 1 root root 1926760 Mar&nbs P 1 19:55 libc.so.6
-rwxr-xr-x. 1 root root   22536 mar  1 19:54 libdl.so.2
-rwxr-xr-x. 1 root Root&nbs P 138280 mar  1 19:54 libtinfo.so.5

[Email protected]ocalhost ~]# ll/test/myroot/bin/
Total 920
-rwxr-xr-x. 1 root root 940416 Mar 1 19:44 Bash
[Email protected] ~]# ll/test/myroot/
Total 12
Drwxr-xr-x. 2 root root 4096 Mar 1 19:44 Bin
Drwxr-xr-x. 2 root root 4096 Mar 1 19:46 Lib
Drwxr-xr-x. 2 root root 4096 Mar 1 19:55 lib64
[Email protected] ~]# chroot/test/myroot/
bash-4.1# LL
Bash:ll:command not found
bash-4.1# cd/bin/
bash-4.1# ls
Bash:ls:command not found
bash-4.1#





Single core: Linux (LWP)
Core: KO (Kernel object)



So ()

Microkernel: Windows, Solaris (threads)


Chroot:chroot/path/to/temproot [COMMAND ...]
Chroot/test/virrrot/bin/bash

Ldd/path/to/binary_file: Shows the shared libraries on which the binaries depend


Linux-grub, kernel and module relationships, CHROOT,LDD

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.