https://github.com/clearlinux-pkgs/linux
https://aur.archlinux.org/packages/linux-clear/
如何在 ubuntu 中使用 clearlinux 内核?
希望一步步 复制粘贴使用 clearlinux 内核替换 ubuntu 内核的指南。复制/粘贴代码仍不完整。我希望有一天它能完成。
**DONE**
android@nazar:~/patched_source/linux-5.6.10$ cd ../
android@nazar:~/patched_source$ ls
linux-5.6.10 linux-headers-5.6.10+_5.6.10+-1_amd64.deb
linux-5.6.10+_5.6.10+-1_amd64.buildinfo linux-image-5.6.10+_5.6.10+-1_amd64.deb
linux-5.6.10+_5.6.10+-1_amd64.changes linux-libc-dev_5.6.10+-1_amd64.deb
android@nazar:~/patched_source$ uname -a
Linux nazar 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
android@nazar:~/patched_source$ sudo dpkg -i ../*.deb
[sudo] password for android:
dpkg: error: cannot access archive '../*.deb': No such file or directory
android@nazar:~/patched_source$ sudo dpkg -i *.deb
Selecting previously unselected package linux-headers-5.6.10+.
(Reading database ... 152012 files and directories currently installed.)
Preparing to unpack linux-headers-5.6.10+_5.6.10+-1_amd64.deb ...
Unpacking linux-headers-5.6.10+ (5.6.10+-1) ...
Selecting previously unselected package linux-image-5.6.10+.
Preparing to unpack linux-image-5.6.10+_5.6.10+-1_amd64.deb ...
Unpacking linux-image-5.6.10+ (5.6.10+-1) ...
Preparing to unpack linux-libc-dev_5.6.10+-1_amd64.deb ...
Unpacking linux-libc-dev:amd64 (5.6.10+-1) over (5.4.0-26.30) ...
Setting up linux-headers-5.6.10+ (5.6.10+-1) ...
Setting up linux-image-5.6.10+ (5.6.10+-1) ...
* dkms: running auto installation service for kernel 5.6.10+
Kernel preparation unnecessary for this kernel. Skipping...
applying patch 0002-Makefile.patch...patching file Makefile
Hunk #1 succeeded at 113 with fuzz 1.
Hunk #2 succeeded at 132 with fuzz 2 (offset 1 line).
applying patch 0003-Make-up-for-missing-init_MUTEX.patch...patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 111 with fuzz 2 (offset 12 lines).
applying patch 0010-change-the-network-interface-name-from-eth-to-wlan.patch...patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 221 (offset -14 lines).
applying patch 0013-gcc.patch...patching file Makefile
applying patch 0019-broadcom-sta-6.30.223.248-3.18-null-pointer-fix.patch...patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 2169 (offset 12 lines).
applying patch 0020-add-support-for-linux-4.3.patch...patching file src/shared/linux_osl.c
applying patch 0021-add-support-for-Linux-4.7.patch...patching file src/wl/sys/wl_cfg80211_hybrid.c
applying patch 0022-add-support-for-Linux-4.8.patch...patching file src/wl/sys/wl_cfg80211_hybrid.c
Hunk #1 succeeded at 2391 (offset 3 lines).
Hunk #2 succeeded at 2501 (offset 3 lines).
Hunk #3 succeeded at 2933 (offset 9 lines).
applying patch 0023-add-support-for-Linux-4.11.patch...patching file src/include/linuxver.h
patching file src/wl/sys/wl_linux.c
Hunk #1 succeeded at 2919 (offset 4 lines).
applying patch 0024-add-support-for-Linux-4.12.patch...patching file src/wl/sys/wl_cfg80211_hybrid.c
Hunk #1 succeeded at 55 (offset 5 lines).
Hunk #2 succeeded at 472 (offset 5 lines).
Hunk #3 succeeded at 2371 (offset 5 lines).
Hunk #4 succeeded at 2388 (offset 5 lines).
applying patch 0025-add-support-for-Linux-4.14.patch...patching file src/shared/linux_osl.c
Hunk #1 succeeded at 1080 (offset 4 lines).
applying patch 0026-add-support-for-Linux-4.15.patch...patching file src/wl/sys/wl_linux.c
Hunk #2 succeeded at 2306 (offset 4 lines).
Hunk #3 succeeded at 2368 (offset 4 lines).
applying patch 0027-add-support-for-linux-5.1.patch...patching file src/include/linuxver.h
Hunk #1 succeeded at 595 (offset 4 lines).
Building module:
cleaning build area...
make -j4 KERNELRELEASE=5.6.10+ -C /lib/modules/5.6.10+/build M=/var/lib/dkms/bcmwl/6.30.223.271+bdcom/build....(bad exit status: 2)
ERROR (dkms apport): kernel package linux-headers-5.6.10+ is not supported
Error! Bad return status for module build on kernel: 5.6.10+ (x86_64)
Consult /var/lib/dkms/bcmwl/6.30.223.271+bdcom/build/make.log for more information.
[ OK ]
update-initramfs: Generating /boot/initrd.img-5.6.10+
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.6.10+
Found initrd image: /boot/initrd.img-5.6.10+
Found linux image: /boot/vmlinuz-5.4.0-26-generic
Found initrd image: /boot/initrd.img-5.4.0-26-generic
Adding boot menu entry for UEFI Firmware Settings
done
Setting up linux-libc-dev:amd64 (5.6.10+-1) ...
重启前 android@nazar:~/patched_source$ uname -a Linux nazar 5.4.0-26-generic #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
答案1
我没有使用 ClearLinux 的具体经验,但看起来你可以:
# It's best to first compile their gcc (https://github.com/clearlinux-pkgs/gcc)
mkdir ~/patched_source
git clone https://github.com/clearlinux-pkgs/linux ~/clearlinux_patches
cd ~/clearlinux_patches
./scripts/develop.sh linux.spec ~/patched_source
这应该将上游内核下载到 ~/patched_source 下面的文件夹(它会告诉您确切的名称)并应用 ClearLinux 自己的补丁和默认值config
。
然后您可以照常编译内核,例如:
cd that_folder
CC=/the/clearlinux/gcc make -j4 bindeb-pkg
# This will take a while and create a few linux-xxx.deb files in the parent directory
sudo dpkg -i ../*.deb # Or just the latest
禁用 CONFIG_RETPOLINE 缓解措施可以使用 Ubuntu 的 gcc 进行编译(显然需要付出代价)。
常见的警告适用:首先在虚拟机中尝试,安全启动可能很棘手,可能缺少一些特定于 Ubuntu 的补丁,...
如果你喜欢冒险,你也可以添加一些他们自己的命令行选项(如/etc/default/grub
第 8-15 行)
答案2
感谢@Jacopo,我重新发布此文以供将来参考。
如何在 ubuntu 中安装 clearlinux gcc?
https://cdn.download.clearlinux.org/releases/33040/clear/x86_64/os/Packages/
android@nazar:~/
wget https://cdn.download.clearlinux.org/releases/33030/clear/x86_64/os/Packages/gcc7-7.5.0-440.x86_64.rpm
sudo apt install alien git curl flex bison libssl-dev
sudo alien gcc7-7.5.0-440.x86_64.rpm
sudo dpkg -i gcc7_7.5.0-441_amd64.deb
gcc7 -v
mkdir ~/patched_source
git clone https://github.com/clearlinux-pkgs/linux ~/clearlinux_patches
cd ~/clearlinux_patches
git clone https://github.com/clearlinux-pkgs/linux ~/clearlinux_patches
cd ~/clearlinux_patches
./scripts/develop.sh linux.spec ~/patched_source
git config --global user.email "[email protected]"
./scripts/develop.sh linux.spec ~/patched_source
cd /home/android/patched_source/linux*
CC=/the/clearlinux/gcc make -j4 bindeb-pkg
sudo dpkg -i ../*.deb
安装后冻结内核
sudo apt-mark hold linux-generic linux-image-generic linux-headers-generic