1. Trang chủ
  2. » Công Nghệ Thông Tin

Topic 7 Linux Kernel

7 4 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Triển khai một máy tính làm việc Linux với các tính năng về đồ họa, vi tính văn phòng,… Hệ thống vận hành: cài đặt, cấu hình, quản trị, xử lý sự cố,… Vận hành hệ điều hành Linux: cài đặt, cấu hình mạng, máy trong, sử dụng thành thạo các công cụ quản lý mạng, cấu hình nhân, DFS, lập kế hoạch cho việc lưu trữ và phục hồi dữ liệu, TCP IP , config device,… Liên kết cơ bản kỹ năng đến Internet: kết nối, email, bảo mật, DNS, Apache, SSH, NTP,…

Topic 7: Linux Kernel Kernel Components Compiling a kernel Patching a kernel Customise, build and install a custom kernel and kernel modules Kernel module: Xem version kernel lệnh: [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux [root@ Dùng lệnh lsmod để liệt kê module kernel: [root@localhost ~]# lsmod | more Module Size Used by tcp_lp 12663 nls_utf8 12557 isofs 39844 bnep 19704 bluetooth 372662 bnep 26536 bluetooth rfkill fuse 87741 coretemp 13435 crct10dif_pclmul 14289 crc32_pclmul 13113 crc32c_intel 22079 ghash_clmulni_intel 13259 aesni_intel 52846 lrw 13286 aesni_intel gf128mul 14951 lrw glue_helper 13990 aesni_intel ablk_helper 13597 aesni_intel cryptd 20359 ghash_clmulni_intel,aesni_intel,ablk_helper snd_ens1371 25243 snd_rawmidi 30824 snd_ens1371 snd_ac97_codec 130476 snd_ens1371 12730 snd_ac97_codec ac97_bus snd_seq 63074 snd_seq_device 14497 snd_seq,snd_rawmidi ppdev 17671 snd_pcm 103996 snd_ac97_codec,snd_ens1371 13415 vmw_balloon serio_raw 13462 pcspkr 12718 snd_timer 29562 snd_pcm,snd_seq Dùng lệnh modinfo để xem thông tin module: [root@localhost ~]# modinfo ext4 filename: /lib/modules/3.10.0-229.el7.x86_64/kernel/fs/ext4/ext4.ko license: GPL description: Fourth Extended Filesystem 116 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ author: Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others alias: fs-ext4 Dùng lệnh insmod để insert thêm module vào kernel: [root@localhost ~]# insmod /lib/modules/3.10.0-229.el7.x86_64/kernel/crypto/arc4.ko Nếu báo lỗi module phụ thuộc vào module khác chưa insert Tìm file /lib/modules/3.10.0-229.el7.x86_64/modules.dep để biết mối quan hệ phụ thuộc Dùng lệnh lsmod, liệt kê lại module: [root@localhost Desktop]# lsmod | grep arc4 arc4 12608 Dùng lệnh rmmod để remove module vừa insert # rmmod arc4 Liệt kê module lại để kiểm tra [root@localhost Desktop]# lsmod | grep arc4 Compiling kernel Cài thư viện : # yum install gcc ncurses ncurses-devel - Download source kernel từ trang kernel.org - Để biên dịch kernel, cần cài C compiler Xem lại phần cài đặt trước - Giải nén gói source: - Tạo file config Có thể tạo file config: o make config: dạng text file, hình nhiều câu hỏi, trả lời o make menuconfig: dạng đồ họa, (kiểu đồ họa DOS), dễ sử dụng o make xconfig gconfig: giao diện đồ họa o make oldconfig: lấy lại file config cũ - Sau tạo file config, thực lệnh sau để tiến hành biên dịch kernel: o make dep: kiểm tra phụ thuộc file C 118 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ o o make clean: dọn dẹp file biên dịch cũ, tạo gói source make bzImage: tạo kernel image o make modules: biên dịch module chọn lựa o make modules_install: module biên dịch đưa vào /lib/modules/kernel-version o make install: Kernel image initrd đưa vào /boot/ [root@localhost linux-3.2.3]# ll /boot/ total 116292 -rw-r r root root 123838 Mar 18:45 config-3.10.0-229.el7.x86_64 drwxr-xr-x root root 1024 Apr 28 15:20 extlinux drwxr-xr-x root root 1024 Apr 14 17:17 grub drwxr-xr-x root root 1024 Apr 28 16:51 grub2 -rw-r r root root 16496720 Apr 14 17:25 initramfs-3.10.0-229.el7.x86_64.img -rw-r r root root 16569444 Apr 18 10:24 initramfs-3.10.0-229.el7.x86_64kdump.img -rw-r r root root 15951823 Apr 28 16:51 initramfs-3.2.3.img -rwxr-xr-x root root 5029136 Mar 18:45 vmlinuz-3.10.0-229.el7.x86_64 -rw-r r root root 3855312 Apr 28 16:51 vmlinuz-3.2.3 -rw-r r root root 3855312 Apr 28 16:48 vmlinuz-3.2.3.old o o Kiểm tra thư mục /boot có kernel image initrd Xem file /boot/grub2/grub.conf để kiểm tra kernel thêm vào 76 menuentry 'CentOS Linux (3.2.3) (Core)' class rhel fedora class gnu-linux class gnu class os unrestricted $men uentry_id_option 'gnulinux-3.10.0-229.el7.x86_64advanced-92dd65a3-6293-4f7c-ac60-8cc0599cfe87' { 77 load_video 78 set gfxpayload=keep 79 insmod gzio 80 insmod part_msdos 81 insmod ext2 82 set root='hd0,msdos1' 83 if [ x$feature_platform_search_hint = xy ]; then 84 search no-floppy fs-uuid set=root hint-bios=hd0,msdos1 hintefi=hd0,msdos1 hint-baremetal=ahci0,msdo s1 hint='hd0,msdos1' d1bf360f50b5-459d-92f5-195aa5215f54 85 else 86 search no-floppy fs-uuid set=root d1bf360f-50b5-459d-92f5-195aa5215f54 87 fi 88 linux16 /vmlinuz-3.2.3 root=UUID=92dd65a3-6293-4f7c-ac60-8cc0599cfe87 ro crashkernel=auto rhgb quiet LANG=en_US.UT F-8 systemd.debug 89 initrd16 /initramfs-3.2.3.img 90 } 120 Phiên Bản Thử Nghiệm – Lưu Hành Nội Bộ Menu khởi động Kiểm tra kernel ... ghash_clmulni_intel,aesni_intel,ablk_helper snd_ens1 371 25243 snd_rawmidi 30824 snd_ens1 371 snd_ac 97_ codec 130 476 snd_ens1 371 1 273 0 snd_ac 97_ codec ac 97_ bus snd_seq 63 074 snd_seq_device 144 97 snd_seq,snd_rawmidi ppdev 176 71 snd_pcm 103996... unrestricted $men uentry_id_option 'gnulinux-3.10.0-229.el7.x86_64advanced-92dd65a3-6293-4f7c-ac60-8cc0599cfe 87' { 77 load_video 78 set gfxpayload=keep 79 insmod gzio 80 insmod part_msdos 81...1 Kernel module: Xem version kernel lệnh: [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09: 27 UTC 20 17 x86_64 x86_64 x86_64 GNU/Linux

Ngày đăng: 27/09/2022, 02:29

Xem thêm: