Raspberry Pi 4 自定义内核无法安装在 Ubuntu 19.10 中

Raspberry Pi 4 自定义内核无法安装在 Ubuntu 19.10 中

我在 Ubuntu 64 位服务器上安装了 Lubuntu。我编译了一个内核并为镜像创建了一个 deb 文件。当我使用 gdebi 安装 deb 文件时,出现了一个奇怪的错误sudo gdebi -n linux-image-4.19.71-custom-rt24+_4.19.71-custom-rt24+-10.00.Custom_arm64.deb

ubuntu@ubuntu:~$ sudo gdebi -n linux-image-4.19.71-custom-rt24+_4.19.71-custom-rt24+-10.00.Custom_arm64.deb
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Reading state information... Done
Selecting previously unselected package linux-image-4.19.71-custom-rt24+.
(Reading database ... 315908 files and directories currently installed.)
Preparing to unpack linux-image-4.19.71-custom-rt24+_4.19.71-custom-rt24+-10.00.Custom_arm64.deb ...
Done.
Unpacking linux-image-4.19.71-custom-rt24+ (4.19.71-custom-rt24+-10.00.Custom) ...
Setting up linux-image-4.19.71-custom-rt24+ (4.19.71-custom-rt24+-10.00.Custom) ...
Running depmod.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.19.71-custom-rt24+ /boot/vmlinuz-4.19.71-custom-rt24+
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.19.71-custom-rt24+ /boot/vmlinuz-4.19.71-custom-rt24+
update-initramfs: Generating /boot/initrd.img-4.19.71-custom-rt24+
Using DTB: bcm2711-rpi-4-b.dtb
Installing /usr/lib/linux-image-4.19.71-custom-rt24+/broadcom/bcm2711-rpi-4-b.dtb into /boot/dtbs/4.19.71-custom-rt24+/./bcm2711-rpi-4-b.dtb
Installing new bcm2711-rpi-4-b.dtb.
Ignoring old or unknown version 4.19.71-custom-rt24+ (latest is 5.3.0-1014-raspi2)
run-parts: executing /etc/kernel/postinst.d/unattended-upgrades 4.19.71-custom-rt24+ /boot/vmlinuz-4.19.71-custom-rt24+
run-parts: executing /etc/kernel/postinst.d/update-notifier 4.19.71-custom-rt24+ /boot/vmlinuz-4.19.71-custom-rt24+
run-parts: executing /etc/kernel/postinst.d/zz-flash-kernel 4.19.71-custom-rt24+ /boot/vmlinuz-4.19.71-custom-rt24+
Using DTB: bcm2711-rpi-4-b.dtb
Installing /usr/lib/linux-image-4.19.71-custom-rt24+/broadcom/bcm2711-rpi-4-b.dtb into /boot/dtbs/4.19.71-custom-rt24+/./bcm2711-rpi-4-b.dtb
Taking backup of bcm2711-rpi-4-b.dtb.
Installing new bcm2711-rpi-4-b.dtb.
Ignoring old or unknown version 4.19.71-custom-rt24+ (latest is 5.3.0-1014-raspi2`

看起来好像可以安装,但显示未知版本。我该如何纠正这个问题,以便安装模块和 dtbs 文件来完成安装?

答案1

我认为安装,特别是“flash-kernel”(参见手册页) 工具将内核映像复制到正确的位置,如果内核名称不以-raspi或结尾,则会出错-raspi2

您必须make deb-pkg LOCALVERSION=-raspi KDEB_PKGVERSION=$(make kernelversion)-1在编译时使用类似的东西。

如果你看一下/usr/share/flash-kernel/db/all.db(raspi 设备从第 1565 行左右开始)

你发现

Machine: Raspberry Pi 4 Model B
Machine: Raspberry Pi 4 Model B Rev 1.1
Machine: Raspberry Pi 4 Model B Rev 1.2
Machine: Raspberry Pi 4 Model B Rev 1.4
Method: pi
Kernel-Flavors: raspi raspi2
DTB-Id: bcm2711-rpi-4-b.dtb
U-Boot-Script-Name: bootscr.rpi
Required-Packages: u-boot-tools

可以看到“Kernel-Flavors: raspi raspi2”如果不匹配这里被视为未知

因此,你可以编译为“-raspi”或“-raspi2”,或者添加/编辑可能应该进入的机器定义/etc/flash-kernel/db

在最后调用 flash-kernel 来update-initramfs将新的内核映像复制到正确的位置。

答案2

刚刚构建并安装了 6.0.1-v8+

make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg LOCALVERSION=-raspi KDEB_PKGVERSION=$(make kernelversion)-1

在 Ubuntu 22.04.1 上为 raspi 运行。仍然运行良好。无论如何,flash-kernel 似乎是主要障碍。使用参数--force似乎是一个可行的解决方案。您可以通过以下方式强制安装:

sudo flash-kernel --force 6.0.1-rc1-v8 

这是为了测试被识别为“旧的或未知的”新内核。

相关内容