Skip to contentSkip to conversation

recipes-core: initrdscripts overlayroot allow boot partition

PATCH In review Anibal Limon 2 participants 3 messages Jul 1, 2025 – Jul 7, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 recipes-core: initrdscripts overlayroot allow boot partition

Test if /boot is previously mounted on the OLDROOT and move it into NEWROOT (ro).

---
 .../initrdscripts/initramfs-framework/overlayroot        | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework/overlayroot +7 -2
index 0d41432878..db164d9846 100644
@@ -38,10 +38,10 @@
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
 # We get OLDROOT from the rootfs module
-OLDROOT="/rootfs"
+OLDROOT="${ROOTFS_DIR}"
 
-NEWROOT="${RWMOUNT}/root"
 RWMOUNT="/overlay"
+NEWROOT="${RWMOUNT}/root"
 ROMOUNT="${RWMOUNT}/rofs"
 UPPER_DIR="${RWMOUNT}/upper"
 WORK_DIR="${RWMOUNT}/work"
@@ -115,4 +115,9 @@ mount -n --move /proc ${NEWROOT}/proc
 mount -n --move /sys ${NEWROOT}/sys
 mount -n --move /dev ${NEWROOT}/dev
 
+# Mount/move boot if is already mounted
+if mountpoint -q ${OLDROOT}/boot; then
+    mount -n --move ${OLDROOT}/boot ${NEWROOT}/boot
+fi
+
 exec chroot ${NEWROOT}/ ${bootparam_init:-/sbin/init} || exit_gracefully "Couldn't chroot into overlay"
Signature · 1 line
2.39.5
#1 lore raw
Quoted 3 lines · Anibal Limon via lists.openembedded.org

Test if /boot is previously mounted on the OLDROOT and move it into NEWROOT (ro).

While change looks innocuous, I am curious what prompted this change. Secondly, these changes can have subtle side-effects
for that it would be good to have a testcase so this behaviour does not regress.

Quoted 45 lines
---
 .../initrdscripts/initramfs-framework/overlayroot        | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
meta/recipes-core/initrdscripts/initramfs-framework/overlayroot +7 -3
index 0d41432878..db164d9846 100644
@@ -38,10 +38,10 @@
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
 # We get OLDROOT from the rootfs module
-OLDROOT="/rootfs"
+OLDROOT="${ROOTFS_DIR}"
 
-NEWROOT="${RWMOUNT}/root"
 RWMOUNT="/overlay"
+NEWROOT="${RWMOUNT}/root"
 ROMOUNT="${RWMOUNT}/rofs"
 UPPER_DIR="${RWMOUNT}/upper"
 WORK_DIR="${RWMOUNT}/work"
@@ -115,4 +115,9 @@ mount -n --move /proc ${NEWROOT}/proc
 mount -n --move /sys ${NEWROOT}/sys
 mount -n --move /dev ${NEWROOT}/dev
 
+# Mount/move boot if is already mounted
+if mountpoint -q ${OLDROOT}/boot; then
+    mount -n --move ${OLDROOT}/boot ${NEWROOT}/boot
+fi
+
 exec chroot ${NEWROOT}/ ${bootparam_init:-/sbin/init} || exit_gracefully "Couldn't chroot into overlay"
--

2.39.5

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#219735): https://lists.openembedded.org/g/openembedded-core/message/219735
Mute This Topic: https://lists.openembedded.org/mt/113938218/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#2 lore raw

Hi Khem,

Yes, let me look into the current tests for this one.

Regards!,
Anibal

Quoted 62 lines · Khem Raj
Quoted 3 lines · Anibal Limon via lists.openembedded.org

Test if /boot is previously mounted on the OLDROOT and move it into NEWROOT (ro).

While change looks innocuous, I am curious what prompted this change. Secondly, these changes can have subtle side-effects
for that it would be good to have a testcase so this behaviour does not regress.

Quoted 7 lines
---
 .../initrdscripts/initramfs-framework/overlayroot        | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git

a/meta/recipes-core/initrdscripts/initramfs-framework/overlayroot b/meta/recipes-core/initrdscripts/initramfs-framework/overlayroot

Quoted 17 lines

index 0d41432878..db164d9846 100644

meta/recipes-core/initrdscripts/initramfs-framework/overlayroot +2 -2
@@ -38,10 +38,10 @@
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 
 # We get OLDROOT from the rootfs module
-OLDROOT="/rootfs"
+OLDROOT="${ROOTFS_DIR}"
 
-NEWROOT="${RWMOUNT}/root"
 RWMOUNT="/overlay"
+NEWROOT="${RWMOUNT}/root"
 ROMOUNT="${RWMOUNT}/rofs"
 UPPER_DIR="${RWMOUNT}/upper"
 WORK_DIR="${RWMOUNT}/work"

meta/recipes-core/initrdscripts/initramfs-framework/overlayroot mount -n --move /proc ${NEWROOT}/proc · line 123

Quoted 9 lines
meta/recipes-core/initrdscripts/initramfs-framework/overlayroot +5 -0
@@ -115,4 +115,9 @@ mount -n --move /proc ${NEWROOT}/proc
 mount -n --move /sys ${NEWROOT}/sys
 mount -n --move /dev ${NEWROOT}/dev
 
+# Mount/move boot if is already mounted
+if mountpoint -q ${OLDROOT}/boot; then
+    mount -n --move ${OLDROOT}/boot ${NEWROOT}/boot
+fi
+
 exec chroot ${NEWROOT}/ ${bootparam_init:-/sbin/init} ||

exit_gracefully "Couldn't chroot into overlay"

Quoted 7 lines

--
2.39.5

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#219735):

https://lists.openembedded.org/g/openembedded-core/message/219735

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/113938218/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-