主要是编译生成的 ko 文件增大所致,应该包含了 debug 信息和符号表 make INSTALL_MOD_STRIP=1 rpm-pkg
安装
1
rpm -iUv ~/rpmbuild/RPMS/x86_64/kernel-*.rpm
1
yum install ~/rpmbuild/RPMS/x86_64/kernel-*.rpm
内核编译命令
编译内核生成 centos rpm 或 ubuntu deb 包
1 2 3 4 5
make rpm #生成带源码的RPM包 make rpm-pkg #生成带源码的RPM包,同上 make binrpm-pkg #生成包含内核和驱动的RMP包 make deb-pkg #生成带源码的debian包 make bindeb-pkg #生成包含内核和驱动的debian包
rpm-pkg: 每次编译前会先 clean, 重复编译会很慢
linux 内核 make help:
1 2 3 4 5 6 7 8 9 10 11 12 13
Kernel packaging: rpm-pkg - Build both source and binary RPM kernel packages binrpm-pkg - Build only the binary kernel RPM package deb-pkg - Build both source and binary deb kernel packages bindeb-pkg - Build only the binary kernel deb package tar-pkg - Build the kernel as an uncompressed tarball targz-pkg - Build the kernel as a gzip compressed tarball tarbz2-pkg - Build the kernel as a bzip2 compressed tarball tarxz-pkg - Build the kernel as a xz compressed tarball perf-tar-src-pkg - Build perf-4.14.105.tar source tarball perf-targz-src-pkg - Build perf-4.14.105.tar.gz source tarball perf-tarbz2-src-pkg - Build perf-4.14.105.tar.bz2 source tarball perf-tarxz-src-pkg - Build perf-4.14.105.tar.xz source tarball
make clean #删除编译中间文件,但是保留配置 make mrproper #删除包括配置文件的所有构建文件 make distclean #执行mrproper所做的一切,并删除备份文件
make menuconfig #文本图形方式配置内核 make oldconfig #基于当前的.config文件提示更新内核 make defconfig #生成默认的内核配置 make allmodconfig #所有的可选的选项构建成模块 make allyesconfig #生成全部选择是内核配置 make noconfig #生成全部选择否的内核配置
make all #构建所有目标 make bzImage #构建内核映像 make modules #构建所有驱动 make dir/ #构建指定目录 make dir/file.[s|o|i] #构建指定文件 make dir/file.ko #构建指定驱动
make install #安装内核 make modules_install #安装驱动
make xmldocs #生成xml文档 make pdfdocs #生成pdf文档 maek htmldocs #生成html文档
echo '/usr/local/ssl-3.3.1/lib64' >> /etc/ld.so.conf ldconfig -v openssl version
# 安装zlib-1.3.1 tar -xf zlib-1.3.1.tar.gz cd ./zlib-1.3.1 ./configure --prefix=/usr/local/zlib-1.3.1 make && make install chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key chmod 600 /etc/ssh/ssh_host_ecdsa_key
# 安装openssh-9.8p1
tar -xf openssh-9.8p1.tar.gz cd openssh-9.8p1 ./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-openssl-includes=/usr/local/ssl-3.3.1/include --with-ssl-dir=/usr/local/ssl-3.3.1 --with-zlib=/usr/local/zlib-1.3.1 --with-md5-passwords --with-pam cp -r /etc/ssh /etc/ssh_${now} # make 报错的话执行以下命令 #autoreconf make && make install
sed -i '/X11Forwarding/s/#X11Forwarding yes/X11Forwarding yes/' /etc/ssh/sshd_config sed -i '/PermitRootLogin/s/#PermitRootLogin yes/PermitRootLogin yes/' /etc/ssh/sshd_config sed -i '/UseDNS/s/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config echo "KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1" >> /etc/ssh/sshd_config \cp -a ./contrib/redhat/sshd.init /etc/init.d/sshd \cp -a ./contrib/redhat/sshd.pam /etc/pam.d/sshd.pam