我在一台新笔记本电脑上运行 Ubuntu 15.10,但为了获得对该硬件的适当全面支持,我显然需要 4.4 内核 + 一个自定义补丁。如果您对详细信息感兴趣,请参阅此处。
我知道主线内核 PPA,但我的理解是它们没有源代码。如果是这种情况,这似乎消除了使用主线内核 PPA 的可能性,因为我无法修补它。所以我一直在尝试查看 git 源代码并构建它,但找不到最新的相关说明。
有人可以帮助说明在 15.10 上构建 4.4 内核的说明吗?
Dou*_*ies 13
获取并编译主线内核,git方法:
另见:https : //wiki.ubuntu.com/KernelTeam/GitKernelBuild 我做的事情有点不同(还有什么新东西?)。
先决条件(必须):
第 1 步是apt-get update和apt-get dist-upgrade(即确保一切都是最新的)
第 2 步
sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge
Run Code Online (Sandbox Code Playgroud)
第 3 步
sudo apt-get build-dep linux
Run Code Online (Sandbox Code Playgroud)
第四步
sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev
Run Code Online (Sandbox Code Playgroud)
自内核 4.3 起的先决条件:
sudo apt-get install libssl-dev
Run Code Online (Sandbox Code Playgroud)
第 5 步 - 基于无法在新的 20.04 服务器安装 2019.12.02 上编译
sudo apt install flex bison
Run Code Online (Sandbox Code Playgroud)
第 6 步 - 基于无法在 20.04 服务器 2021.07.02 上编译内核 5.13
sudo apt install zstd
Run Code Online (Sandbox Code Playgroud)
先决条件(可选):
sudo apt-get install git-email git-doc
Run Code Online (Sandbox Code Playgroud)
git部分:
mkdir temp-k-git
cd temp-k-git
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
Run Code Online (Sandbox Code Playgroud)
永远不要在默认的主分支中做任何事情。总是做一些工作区。
git checkout -b k44rc8_stock v4.4-rc8
Run Code Online (Sandbox Code Playgroud)
窃取Ubuntu内核配置文件(已经安装):
ls -l /boot
cp /boot/config-4.4.0-040400rc8-generic .config
Run Code Online (Sandbox Code Playgroud)
Ubuntu 配置文件具有完整的调试功能。制作一个巨大的内核,编译时间是原来的两倍
scripts/config --disable DEBUG_INFO
Run Code Online (Sandbox Code Playgroud)
特别注意从内核 4.4 开始,如果使用 Ubuntu 14.04(我不知道 15.10)编译,使用旧版本的 c 编译器:它不能用 CONFIG_CC_STACKPROTECTOR_STRONG 编译。
scripts/config --disable CC_STACKPROTECTOR_STRONG
Run Code Online (Sandbox Code Playgroud)
如果您的版本没有 LZ4 压缩(即 16.04),您还需要:
scripts/config --disable KERNEL_LZ4
scripts/config --enable KERNEL_GZIP
Run Code Online (Sandbox Code Playgroud)
特别注意从内核 5.12-rc1 开始,需要覆盖一些新添加的证书内容。
scripts/config --set-str SYSTEM_TRUSTED_KEYS ""
Run Code Online (Sandbox Code Playgroud)
或者
scripts/config --disable SYSTEM_TRUSTED_KEYS
Run Code Online (Sandbox Code Playgroud)
特别注意从内核 5.14-rc2 开始,需要覆盖一些更多添加的证书内容。
scripts/config scripts/config --disable SYSTEM_REVOCATION_KEYS
Run Code Online (Sandbox Code Playgroud)
编译内核:
time make -j9 bindeb-pkg <<< Suggest use number of CPUs + 1. Use less for some responsiveness to be left for other uses
<<< I always time the kernel build.
Run Code Online (Sandbox Code Playgroud)
或者
time make -j9 bindeb-pkg LOCALVERSION=-stock <<< For a localized verion name append
Run Code Online (Sandbox Code Playgroud)
或者
time make -j9 olddefconfig bindeb-pkg LOCALVERSION=-stock <<< To automatically use defaults for any new config stuff (particuarly useful when bisecting the kernel).
Run Code Online (Sandbox Code Playgroud)
构建完成后,安装它:
sudo dpkg -i ../linux-headers-4.4.0-rc8-stock_4.4.0-rc8-stock-144_amd64.deb
sudo dpkg -i ../linux-image-4.4.0-rc8-stock_4.4.0-rc8-stock-144_amd64.deb
Run Code Online (Sandbox Code Playgroud)
所以,此时我们知道主线内核编译正常,所以转到自定义内核。创建一个新分支,应用补丁并编译:
$ git checkout -b k44rc8_custom v4.4-rc8
Switched to a new branch 'k44rc8_custom'
$ git am plv6_1_3.patch
Applying: cpufreq: intel_pstate: configurable algorithm to get target pstate
$ git am plv6_2_3.patch
Applying: cpufreq: intel_pstate: account for non C0 time
$ git am plv6_3_3.patch
Applying: cpufreq: intel_pstate: Account for IO wait time
$ time make -j9 olddefconfig bindeb-pkg LOCALVERSION=-custom
Run Code Online (Sandbox Code Playgroud)
请注意,我故意不执行 a make clean,因为希望通过执行增量构建来节省大量时间。第一次编译用了 21 分 26 秒,但下一次自定义编译只用了 4 分 43 秒。
| 归档时间: |
|
| 查看次数: |
22423 次 |
| 最近记录: |