linux内核编译(2.4.20--->2.6.14)
按照网上资料:
1.下载,解压在/usr/src中,有dir名为linux-2.6.14.
2.在/usr/src,建立ln,ln -s linux-2.6.14 linux-2.6
3.在/usr/include中,rm -rf asm linux scsi(分别地),
ln -s /usr/src/linxu-2.6.14/include/asm-i386 asm
ln -s /usr/src/linxu-2.6.14/include/linux linux
ln -s /usr/src/linxu-2.6.14/include/scsi scsi (why?)有人说可以不需要
4.在目录/usr/src/linux-2.6.14下,(一定要在这个目录下,否则会有错误出现),
make mrproper,
make menuconfig,这个可能出现些错误,
HOSTCC scripts/basic/split-include
In file included from /usr/include/linux/errno.h:4,
from /usr/include/bits/errno.h:25,
from /usr/include/errno.h:36,
from scripts/basic/split-include.c:26:
/usr/include/asm/errno.h:4:31: asm-generic/errno.h: 没有那个文件或目录
make[1]: *** [scripts/basic/split-include] Error 1
make: *** [scripts_basic] Error 2
改:
手动改了两个文件把原有的路径改成绝对路径了
vi /usr/include/asm/errno.h
#ifndef _I386_ERRNO_H
#define _I386_ERRNO_H
#include <asm-generic/errno.h>改成我的路径</usr/src/linux/include/asm-generic/errno.h>
#endif
再改一下这个文件
vi /usr/src/linux/include/asm-generic/errno.h
ifndef _ASM_GENERIC_ERRNO_H
#define _ASM_GENERIC_ERRNO_H
#include <asm-generic/errno-base.h>改成我的路径</usr/src/linux/include/asm-generic/errno-base.h>
这样以后就可能成功运行make menuconfig了。
另外,因为在安装redhat的时候,没有选择安装kde,所以如果用qt就会有问题,故,这里不可以用
make xconfig,
(这里郁闷了很久,最后才明白qt->kde,get->gnome,这期间,试用了make gconfig,主要想解决问题:
Unable to find the QT installation. Please make sure that the
* QT development package is correctly installed and the QTDIR
* environment variable is set to the correct location.
*
make[1]: *** [scripts/kconfig/.tmp_qtcheck] Error 1
make: *** [xconfig] Error 2)
还试用了xhost + 127.0.0.1:0.0,和
export DISPLAY="127.0.0.1:0.0",
xterm,结果证明是不行的.
然后,
#make dep
#make clean
#make bzImage或make zImage
#make modules
#make modules_install
#depmod -a
好像后面的工作用make install能自己搞定(试试)
上面的命令"make install"将: (1)把压缩内核映象拷贝到/boot目录下, 并创建相应的System.map符号链接; (2)修改bootloader的配置文件; (3)调用mkinitrd程序创建内核的initrd映象. 对于GRUB而言, 将在/boot/grub/grub.conf配置文件增加如下类似的配置行:
#cp /usr/src/linux/System.map /boot/System.map-2.4.18
#cp /usr/src/linux/arch/i386/bzImage /boot/vmlinuz-2.4.18
#cd /boot;rm -f System.map vmlinuz
#ln -s vmlinuz-2.4.18 vmlinuz
#ln -s System.map-2.4.18 System.map
改grub
title Red Hat linux (2.4.18)
root (hd0,0)
kernel /vmlinuz-2.4.18 ro root=/dev/hda2
(参考而已)
在make install 后,会自动在/boot/grub/grub.conf中加入一些东西,
但是还存在一些问题:
在选择新的内核启动系统的时候,出现:
VFS:cannot open root driver "NULL" or unkown block(8,3),
please append a correct "root=" boot option.
kernel panic: not syncing: VFS :unable to nount root fs on unkown block(8,3)
这个问题下次到校来解决吧.
按照资料上的说法:
一是不要root后的label,不行的.再说吧.
关于模块的几个命令:
lsmod 是列出目前系统中已加载的模块的名称及大小等;另外我们还可以查看 /proc/modules
modinfo 可以查看模块的信息,通过查看模块信息来判定这个模块的用途
modprobe 我们常用的功能就是挂载模块,在挂载某个内核模块的同时,这个模块所依赖的模块也被同时挂载;当然modprobe 也有列出内核所有模块,还有移除模块的功能;下在我们举个例子说一说咱们常用的功能和参数;
代码:
modprobe [-v] [-V] [-C config-file] [-n] [-i] [-q] [-o <modname>] <modname> [parameters...]
modprobe -r [-n] [-i] [-v] <modulename> ...
modprobe -l -t <dirname> [ -a <modulename> ...]
注意: 模块名是不能带有后缀的,我们通过modprobe -l 所看到的模块,都是带有.ko 或.o后缀;
rmmod 移除已挂载模块;
root@localhost beinan]# depmod -a 注:为所有列在/etc/modprobe.conf 或/etc/modules.conf 中的所有模块创建依赖关系,并且写入到modules.dep文件;
[root@localhost beinan]# depmod -e 注:列出已挂载但不可用的模块;
[root@localhost beinan]# depmod -n 注:列出所有模块的依赖关系,但仅仅是输出出来 (Write the dependency file on stdout only)
insmod 这个工具,和modprobe 有点类似,但功能上没有modprobe 强,modprobe 在挂载模块是不用指定模块文件的路径,也不用带文件的后缀.o 或.ko ;而insmod 需要的是模块的所在目录的绝对路径,并且一定要带有模块文件名后缀的(modulefile.o 或modulesfile.ko );
openEuler 是由开放原子开源基金会孵化的全场景开源操作系统项目,面向数字基础设施四大核心场景(服务器、云计算、边缘计算、嵌入式),全面支持 ARM、x86、RISC-V、loongArch、PowerPC、SW-64 等多样性计算架构
更多推荐

所有评论(0)