在 Ubuntu 20.04.2 LTS 上编译/安装 RealTime 内核时出错

在 Ubuntu 20.04.2 LTS 上编译/安装 RealTime 内核时出错

我需要安装一个 RealTime 内核才能使用 ROS2,我已经按照这个指导非常小心。但我总是得到同样的错误:

make[2]: *** [debian/rules:6: build] Errore 2
dpkg-buildpackage: Errore: debian/rules build subprocess returned exit status 2
make[1]: *** [scripts/Makefile.package:77: deb-pkg] Errore 2
make: *** [Makefile:1464: deb-pkg] Errore 2

例如我在终端上使用过的段落如下:

  • 新建一个文件夹,并在文件夹中输入:mkdir kernel && cd kernel
  • 下载内核和补丁wget https://mirrors.edge.kernel.org/pub/linux/kernel/v5.x/linux-5.4.78.tar.gzwget http://cdn.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patch-5.4.78-rt44.patch.gz
  • 解压并解压缩这两个档案tar -xzf linux-5.4.78.tar.gzgunzip patch-5.4.78-rt44.patch.gz
  • 进入内核文件夹:cd linux-5.4.78
  • 修补文件:patch -p1 < ../patch-5.4.78-rt44.patch
  • 使用旧的配置,在这种情况下,我有 2 个配置,所以我使用了:cp /boot/config-$(uname -r) .config对于我的情况$(uname -r)5.4.0-70-generic
  • 在更新源代码的设置中添加了源,并按照指南中的说明安装了其他依赖项
  • 启用配置:yes '' | make oldconfig
  • 之后在菜单中启用不同的设置:make menuconfig
  • make -j使用nproc进行制作时发生错误deb-pkg

我该如何解决?

部分输出(警告和错误在这里):


scripts/kconfig/conf  --syncconfig Kconfig
make clean
  CLEAN   arch/x86/purgatory
  CLEAN   arch/x86/realmode/rm
  CLEAN   arch/x86/kernel/cpu
  CLEAN   arch/x86/kernel
  CLEAN   arch/x86/entry/vdso
  CLEAN   kernel/debug/kdb
  CLEAN   kernel
  CLEAN   usr
  CLEAN   fs/unicode
  CLEAN   arch/x86/tools
sh ./scripts/package/mkdebian
  TAR     linux-5.4.78-rt44.tar.gz
origversion=$(dpkg-parsechangelog -SVersion |sed 's/-[^-]*$//');\
    mv linux-5.4.78-rt44.tar.gz ../linux-5.4.78-rt44_${origversion}.orig.tar.gz
dpkg-buildpackage -r"fakeroot -u" -a$(cat debian/arch)  -i.git -us -uc
dpkg-buildpackage: Informazioni: Pacchetto sorgente linux-5.4.78-rt44
dpkg-buildpackage: Informazioni: Versione sorgente 5.4.78-rt44-1
dpkg-buildpackage: Informazioni: Distribuzione sorgente focal
dpkg-buildpackage: Informazioni: Sorgente modificata da kappa95 <kappa95@kappa95-asus-laptop-x505za>
dpkg-buildpackage: Informazioni: Architettura host amd64
 dpkg-source -i.git --before-build .
 fakeroot -u debian/rules clean
rm -rf debian/*tmp debian/files
make clean
 dpkg-source -i.git -b .
dpkg-source: Informazioni: using source format '1.0'
dpkg-source: Avviso: source directory 'linux-5.4.78' is not <sourcepackage>-<upstreamversion> 'linux-5.4.78-rt44-5.4.78-rt44'
dpkg-source: Avviso: .orig directory name linux-5.4.78.orig is not <package>-<upstreamversion> (wanted linux-5.4.78-rt44-5.4.78-rt44.orig)
dpkg-source: Informazioni: building linux-5.4.78-rt44 using existing linux-5.4.78-rt44_5.4.78-rt44.orig.tar.gz
dpkg-source: Informazioni: building linux-5.4.78-rt44 in linux-5.4.78-rt44_5.4.78-rt44-1.diff.gz
dpkg-source: Avviso: ignoring deletion of file .scmversion
dpkg-source: Avviso: the diff modifies the following upstream files: 
 .clang-format
 .cocciconfig
 .config.old
 .get_maintainer.ignore
 .mailmap
 CREDITS
 MAINTAINERS
 README
dpkg-source: Informazioni: use the '3.0 (quilt)' format to have separate and documented changes to upstream files, see dpkg-source(1)
dpkg-source: Informazioni: building linux-5.4.78-rt44 in linux-5.4.78-rt44_5.4.78-rt44-1.dsc
dpkg-source: Avviso: missing information for output field Standards-Version
 debian/rules build
make KERNELRELEASE=5.4.78-rt44 ARCH=x86     KBUILD_BUILD_VERSION=1 -f ./Makefile
make[4]: ***  Nessuna regola per generare l'obiettivo «debian/canonical-certs.pem», necessario per «certs/x509_certificate_list».  Arresto.
make[4]: *** Attesa per i processi non terminati....
make[3]: *** [Makefile:1729: certs] Errore 2
make[3]: *** Attesa per i processi non terminati....
arch/x86/hyperv/hv_apic.c: In function ‘__send_ipi_one’:
arch/x86/hyperv/hv_apic.c:201:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  201 | }
      | ^
arch/x86/hyperv/hv_apic.c: In function ‘hv_send_ipi_mask_allbutself’:
arch/x86/hyperv/hv_apic.c:226:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  226 | }
      | ^
arch/x86/kernel/cpu/mce/core.o: warning: objtool: mce_panic()+0x123: unreachable instruction
kernel/exit.o: warning: objtool: __x64_sys_exit_group()+0x18: unreachable instruction
fs/btrfs/extent_io.o: warning: objtool: __set_extent_bit.cold()+0xc: unreachable instruction
fs/btrfs/relocation.o: warning: objtool: update_backref_node.cold()+0xb: unreachable instruction
arch/x86/xen/enlighten_pv.o: warning: objtool: xen_cpuid()+0x20: can't find jump dest instruction at .text+0x97
arch/x86/kernel/smpboot.o: warning: objtool: native_play_dead()+0x131: unreachable instruction
arch/x86/kernel/kvm.c: In function ‘kvm_send_ipi_mask_allbutself’:
arch/x86/kernel/kvm.c:503:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  503 | }
      | ^
  
fs/jffs2/xattr.c: In function ‘jffs2_build_xattr_subsystem’:
fs/jffs2/xattr.c:887:1: warning: the frame size of 1128 bytes is larger than 1024 bytes [-Wframe-larger-than=]
  887 | }
      | ^

make[2]: *** [debian/rules:6: build] Errore 2
dpkg-buildpackage: Errore: debian/rules build subprocess returned exit status 2
make[1]: *** [scripts/Makefile.package:77: deb-pkg] Errore 2
make: *** [Makefile:1464: deb-pkg] Errore 2

答案1

我遵循了本指南https://unix.stackexchange.com/a/294116/419660

sudo gedit .config

#在行前添加CONFIG_SYSTEM_TRUSTED_KEYCONFIG_MODULE_SIG_KEY注释掉它们。运行后出现提示时选择所有默认值make -j numproc deb-pkg

我还需要关闭 BIOS 中的安全启动https://github.com/jakeday/linux-surface/issues/575

答案2

我在安装实时内核时多次遇到此错误,问题似乎出在编译为 debian 软件包上。我遵循的每个未编译为 debian 软件包的教程都有效。以下是我尝试过并有效的 2 个简单教程(您还需要安装 flex 和 bison): https://hmenn.github.io/pages/UbuntuRT_patch.html https://stackoverflow.com/a/51709420

另外,您使用的是戴尔电脑吗?到目前为止,我发现遇到此问题的每个人都在使用戴尔电脑。

答案3

这看起来和我遇到的错误一样,解决方案是删除内核的这个功能。

SYSTEM_BLACKLIST_KEYRING = 否

答案4

你可以尝试一下

scripts/config --set-str CONFIG_SYSTEM_TRUSTED_KEYS=""
scripts/config --set-str CONFIG_SYSTEM_REVOCATION_KEYS=""

相关内容