Hi Daniel,
On 01.03.22 11:49, Daniel Hofer wrote:
> Hi, I successfully got basic dual-copy updating working on a Raspberry
> Pi 4 thanks to SWUpdate!
> However, I am still struggling to understand how to safely update the
> kernel.
>
Please think about that recipes in meta-swupdate-boards are just
*examples* and there is some work if you want to have it in production.
In your use case, this depends how RPI[3|4] is working. The closed
source bootloader is generating the DT for kernel, and if something
changed (bootloader files, DTBO, etc.), kernel does not boot. It is a
different issue as what you are reporting, but this will happen, too.
> I basically got it working by taking the examples for the Raspberry Pi 3
> from meta-swupdate-boards and renaming the folders from raspberrypi3 to
> raspberrypi4. At this point the boot fails with the following error and
> some follow-up error messages:
> /Failed to load 'boot/uImage'/
>
> I could fix this by changing a line in the file/
boot.cmd.in/:
> - load mmc 0:${rpipart} ${kernel_addr_r} boot/@@KERNEL_IMAGETYPE@@
> + fatload mmc 0:1 ${kernel_addr_r} @@KERNEL_IMAGETYPE@@
This is wrong, you are fixing the kernel to boot just from first
partition. If kernel is upgraded and goes into the second partition, you
are still oading the wrong one. The variable rpipart is used to get
where to load the kernel and to set rootfs, and of course you wil lhave
a mismatch here.
It could be you are hitting the issue I report above, for example if
there is no uImage anymore (but maybe a zImage, or..).
>
> The initial line in /
boot.cmd.in/ suggests that the kernel is included
> in the rootfs partition, but not in my case apparently.
It is in the example. The uImage file in the examples is *NOT* kernel,
but it is U-Boot. It looks like you are booting from the closed source
bootloader, but this is not able to work with a dual-copy concept (it
loads always a uImage in the first FAT partition).
> I did not find anything in meta-swupdate-boards that would put the
> kernel into rootfs and I am not sure how to proceed.
To build it you should have in distro or local.conf:
IMAGE_INSTALL:append = " kernel-image kernel-modules"
DISTRO_FEATURES:append = " systemd"
DISTRO_FEATURES_BACKFILL_CONSIDERED += "sysvinit"
VIRTUAL-RUNTIME_init_manager = "systemd"
VIRTUAL-RUNTIME_initscripts = "systemd-compat-units"
# meta-raspberrypi
RPI_USE_U_BOOT = "1"
>
> By default meta-raspberrypi seems to put the kernel onto the /boot
Right, but then there is just one kernel without redundancy, and a
power-cut when kernel is updated bricks the board.
> partition and disables putting the kernel onto rootfs, which can be seen
> by the following line in/rpi-base.inc:/
> /
> # The kernel image is installed into the FAT32 boot partition and does
> not need
> # to also be installed into the rootfs.
....if the update is done by replacing the SD-Card
> RDEPENDS:${KERNEL_PACKAGE_NAME}-base =""
> /
> My question is: How was the original/
boot.cmd.in/intended to work with
> Raspberry Pi regarding the kernel location?
See above
> I don't think the step from
> Pi 3 to Pi 4 changed anything relevant here, but maybe I am missing
> something.
Best regards,
Stefano Babic
--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone:
+49-8142-66989-53 Fax:
+49-8142-66989-80 Email:
sba...@denx.de
=====================================================================