diff mbox series

[v2,5/7] Adjust directory layout for rootfs.cpio.gz

Message ID 20250414101843.2348330-6-andrew.cooper3@citrix.com (mailing list archive)
State New
Headers show
Series Rootfs/argo cleanup and microcode support | expand

Commit Message

Andrew Cooper April 14, 2025, 10:18 a.m. UTC
All tests using the rootfs currently modify it with:

  mkdir proc
  mkdir run
  mkdir srv
  mkdir sys
  rm var/run

This is because the rootfs doesn't have the correct top level directories.
Furthermore, dev is currently included when it oughtn't to be.

srv is easy.  It's an empty directory and can be included in PATHS.

dev, proc, run and sys are all mount points, which OpenRC knows how to
populate on boot.  Create only the top level directories in rootfs, without
`find` recursing into them.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Anthony PERARD <anthony.perard@vates.tech>
CC: Stefano Stabellini <sstabellini@kernel.org>
CC: Michal Orzel <michal.orzel@amd.com>
CC: Doug Goldstein <cardoe@cardoe.com>
CC: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>

v2:
 * New
---
 scripts/alpine-rootfs.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Marek Marczykowski-Górecki April 14, 2025, 2:21 p.m. UTC | #1
On Mon, Apr 14, 2025 at 11:18:41AM +0100, Andrew Cooper wrote:
> All tests using the rootfs currently modify it with:
> 
>   mkdir proc
>   mkdir run
>   mkdir srv
>   mkdir sys
>   rm var/run
> 
> This is because the rootfs doesn't have the correct top level directories.
> Furthermore, dev is currently included when it oughtn't to be.
> 
> srv is easy.  It's an empty directory and can be included in PATHS.
> 
> dev, proc, run and sys are all mount points, which OpenRC knows how to
> populate on boot.  Create only the top level directories in rootfs, without
> `find` recursing into them.
> 
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>

Reviewed-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
diff mbox series

Patch

diff --git a/scripts/alpine-rootfs.sh b/scripts/alpine-rootfs.sh
index 72c29e0a0a13..53547b5c5282 100755
--- a/scripts/alpine-rootfs.sh
+++ b/scripts/alpine-rootfs.sh
@@ -71,8 +71,11 @@  passwd -d "root" root
 cd /
 case $1 in
     cpio)
-        PATHS="bin dev etc home init lib mnt opt root sbin usr var"
-        find $PATHS -print0 | cpio -0 -H newc -o | gzip > "${COPYDIR}/rootfs.cpio.gz"
+        {
+            PATHS="bin etc home init lib mnt opt root sbin srv usr var"
+            find $PATHS -print0
+            echo -ne "dev\0proc\0run\0sys\0"
+        } | cpio -0 -H newc -o | gzip > "${COPYDIR}/rootfs.cpio.gz"
 
         # Print the contents for the build log
         zcat "${COPYDIR}/rootfs.cpio.gz" | cpio -tv