From bfe5dbcd83a8d3e684ef4ac158f5b6fe2256e26c Mon Sep 17 00:00:00 2001 From: James Turton Date: Mon, 2 Nov 2026 23:15:16 +0100 Subject: [PATCH] Add udev rule to mount correct /boot-resource on CC2 --- meta-opencentauri/images/cosmos-image-base.bb | 5 ++++- .../files/centauri-carbon-2/sw-description | 16 +++++++++++---- .../u-boot/files/elegoo-centauri-carbon2.env | 2 +- .../boot-resource-mount_1.0.bb | 20 +++++++++++++++++++ .../files/99-boot-resource.rules | 1 + 5 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 meta-opencentauri/recipes-core/boot-resource-mount/boot-resource-mount_1.0.bb create mode 100644 meta-opencentauri/recipes-core/boot-resource-mount/files/99-boot-resource.rules diff --git a/meta-opencentauri/images/cosmos-image-base.bb b/meta-opencentauri/images/cosmos-image-base.bb index 31e34d7f..60571b6b 100644 --- a/meta-opencentauri/images/cosmos-image-base.bb +++ b/meta-opencentauri/images/cosmos-image-base.bb @@ -52,7 +52,10 @@ CORE_IMAGE_EXTRA_INSTALL += "\ git \ " -CORE_IMAGE_EXTRA_INSTALL:append:centauri-carbon-2 = " centauri-carbon-2-detect" +CORE_IMAGE_EXTRA_INSTALL:append:centauri-carbon-2 = " \ + centauri-carbon-2-detect \ + boot-resource-mount \ +" INITRAMFS_IMAGE = "core-image-tiny-initramfs" INITRAMFS_FSTYPES = "cpio.gz" diff --git a/meta-opencentauri/images/files/centauri-carbon-2/sw-description b/meta-opencentauri/images/files/centauri-carbon-2/sw-description index 5d18c91e..1d4fa263 100644 --- a/meta-opencentauri/images/files/centauri-carbon-2/sw-description +++ b/meta-opencentauri/images/files/centauri-carbon-2/sw-description @@ -56,6 +56,10 @@ software = name = "boot_part"; value = "6"; }, + { + name = "boot_resource_part"; + value = "2"; + }, { name = "mmc_root"; value = "/dev/mmcblk0p8"; @@ -86,7 +90,7 @@ software = }, { name = "setargs_mainline"; - value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next}"; + value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next} bootresource.part=${boot_resource_part}"; }, { name = "bootcmd_"; @@ -102,7 +106,7 @@ software = }, { name = "preboot"; - value = "load mmc 1:2 0x43000000 bootlogo.bmp; bmp display 0x43000000; usb start"; + value = "load mmc 1:${boot_resource_part} 0x43000000 bootlogo.bmp; bmp display 0x43000000; usb start"; }, { name = "stdin"; @@ -170,6 +174,10 @@ software = name = "boot_part"; value = "5"; }, + { + name = "boot_resource_part"; + value = "1"; + }, { name = "mmc_root"; value = "/dev/mmcblk0p7"; @@ -200,7 +208,7 @@ software = }, { name = "setargs_mainline"; - value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next}"; + value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next} bootresource.part=${boot_resource_part}"; }, { name = "bootcmd_"; @@ -216,7 +224,7 @@ software = }, { name = "preboot"; - value = "load mmc 1:1 0x43000000 bootlogo.bmp; bmp display 0x43000000; usb start"; + value = "load mmc 1:${boot_resource_part} 0x43000000 bootlogo.bmp; bmp display 0x43000000; usb start"; }, { name = "stdin"; diff --git a/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env b/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env index 32a492ad..9a04e5a5 100644 --- a/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env +++ b/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env @@ -3,6 +3,6 @@ swu_mode=mainline systemAB_next=A boot_part=5 mmc_root=/dev/mmcblk0p7 -setargs_mainline=setenv bootargs console=ttyS2,115200 root=${mmc_root} rootwait gpt systemAB.slot=${systemAB_next} +setargs_mainline=setenv bootargs console=ttyS2,115200 root=${mmc_root} rootwait gpt systemAB.slot=${systemAB_next} bootresource.part=${boot_resource_part} bootcmd_mainline=run setargs_mainline; fatload mmc 1:${boot_part} 43000000 zImage; fatload mmc 1:${boot_part} 43800000 elegoo-centauri-carbon2.dtb; bootz 43000000 - 43800000 bootcmd=if test x${swu_mode} = xmainline; then run bootcmd_mainline; else run bootcmd_stock; fi diff --git a/meta-opencentauri/recipes-core/boot-resource-mount/boot-resource-mount_1.0.bb b/meta-opencentauri/recipes-core/boot-resource-mount/boot-resource-mount_1.0.bb new file mode 100644 index 00000000..3f464d39 --- /dev/null +++ b/meta-opencentauri/recipes-core/boot-resource-mount/boot-resource-mount_1.0.bb @@ -0,0 +1,20 @@ +SUMMARY = "Mount the boot-resource partition selected by u-boot" +LICENSE = "GPL-3.0-only" +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-3.0-only;md5=c79ff39f19dfec6d293b95dea7b07891" + +SRC_URI = "\ + file://99-boot-resource.rules \ +" + +S = "${UNPACKDIR}" + +RDEPENDS:${PN} = "udev" + +do_install() { + install -d ${D}${sysconfdir}/udev/rules.d + install -m 0644 ${S}/99-boot-resource.rules ${D}${sysconfdir}/udev/rules.d/99-boot-resource.rules +} + +FILES:${PN} = "\ + ${sysconfdir}/udev/rules.d/99-boot-resource.rules \ +" diff --git a/meta-opencentauri/recipes-core/boot-resource-mount/files/99-boot-resource.rules b/meta-opencentauri/recipes-core/boot-resource-mount/files/99-boot-resource.rules new file mode 100644 index 00000000..76cedc4d --- /dev/null +++ b/meta-opencentauri/recipes-core/boot-resource-mount/files/99-boot-resource.rules @@ -0,0 +1 @@ +ACTION=="add", KERNEL=="mmcblk0", IMPORT{cmdline}="bootresource.part", RUN+="/bin/mount /dev/mmcblk0p$env{bootresource.part} /boot-resource"