mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 21:49:33 +02:00
overlayfs-etc: add option to skip creation of mount dirs
The 'preinit' script can't create mount directories when rootfs is read-only. Add an option to skip this step. The user must make sure that all required directories are already in the rootfs directory layout. Cc: Vyacheslav Yurkov <uvv.mail@gmail.com> (From OE-Core rev: 302dd4a63f97e23631a62a0b902cc253f6843ab0) Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> (cherry picked from commit 3d433d8559467d255bd19af2d0999c65ea24a48d) Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
d3e106ba1e
commit
d92e3d8193
@@ -35,6 +35,7 @@ OVERLAYFS_ETC_USE_ORIG_INIT_NAME ??= "1"
|
|||||||
OVERLAYFS_ETC_MOUNT_OPTIONS ??= "defaults"
|
OVERLAYFS_ETC_MOUNT_OPTIONS ??= "defaults"
|
||||||
OVERLAYFS_ETC_INIT_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-etc-preinit.sh.in"
|
OVERLAYFS_ETC_INIT_TEMPLATE ??= "${COREBASE}/meta/files/overlayfs-etc-preinit.sh.in"
|
||||||
OVERLAYFS_ETC_EXPOSE_LOWER ??= "0"
|
OVERLAYFS_ETC_EXPOSE_LOWER ??= "0"
|
||||||
|
OVERLAYFS_ETC_CREATE_MOUNT_DIRS ??= "1"
|
||||||
|
|
||||||
python create_overlayfs_etc_preinit() {
|
python create_overlayfs_etc_preinit() {
|
||||||
overlayEtcMountPoint = d.getVar("OVERLAYFS_ETC_MOUNT_POINT")
|
overlayEtcMountPoint = d.getVar("OVERLAYFS_ETC_MOUNT_POINT")
|
||||||
@@ -56,6 +57,7 @@ python create_overlayfs_etc_preinit() {
|
|||||||
initBaseName = oe.path.join(d.getVar("base_sbindir"), "init")
|
initBaseName = oe.path.join(d.getVar("base_sbindir"), "init")
|
||||||
origInitNameSuffix = ".orig"
|
origInitNameSuffix = ".orig"
|
||||||
exposeLower = oe.types.boolean(d.getVar('OVERLAYFS_ETC_EXPOSE_LOWER'))
|
exposeLower = oe.types.boolean(d.getVar('OVERLAYFS_ETC_EXPOSE_LOWER'))
|
||||||
|
createMoundDirs = oe.types.boolean(d.getVar('OVERLAYFS_ETC_CREATE_MOUNT_DIRS'))
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
'OVERLAYFS_ETC_MOUNT_POINT': overlayEtcMountPoint,
|
'OVERLAYFS_ETC_MOUNT_POINT': overlayEtcMountPoint,
|
||||||
@@ -63,7 +65,8 @@ python create_overlayfs_etc_preinit() {
|
|||||||
'OVERLAYFS_ETC_FSTYPE': overlayEtcFsType,
|
'OVERLAYFS_ETC_FSTYPE': overlayEtcFsType,
|
||||||
'OVERLAYFS_ETC_DEVICE': overlayEtcDevice,
|
'OVERLAYFS_ETC_DEVICE': overlayEtcDevice,
|
||||||
'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName,
|
'SBIN_INIT_NAME': initBaseName + origInitNameSuffix if useOrigInit else initBaseName,
|
||||||
'OVERLAYFS_ETC_EXPOSE_LOWER': "true" if exposeLower else "false"
|
'OVERLAYFS_ETC_EXPOSE_LOWER': "true" if exposeLower else "false",
|
||||||
|
'CREATE_MOUNT_DIRS': "true" if createMoundDirs else "false"
|
||||||
}
|
}
|
||||||
|
|
||||||
if useOrigInit:
|
if useOrigInit:
|
||||||
|
|||||||
@@ -3,12 +3,15 @@
|
|||||||
echo "PREINIT: Start"
|
echo "PREINIT: Start"
|
||||||
|
|
||||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||||
mount -o remount,rw /
|
if {CREATE_MOUNT_DIRS}; then
|
||||||
|
mount -o remount,rw /
|
||||||
|
|
||||||
mkdir -p /proc
|
mkdir -p /proc
|
||||||
mkdir -p /sys
|
mkdir -p /sys
|
||||||
mkdir -p /run
|
mkdir -p /run
|
||||||
mkdir -p /var/run
|
mkdir -p /var/run
|
||||||
|
mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}
|
||||||
|
fi
|
||||||
|
|
||||||
mount -t proc proc /proc
|
mount -t proc proc /proc
|
||||||
mount -t sysfs sysfs /sys
|
mount -t sysfs sysfs /sys
|
||||||
@@ -20,7 +23,6 @@ UPPER_DIR=$BASE_OVERLAY_ETC_DIR/upper
|
|||||||
WORK_DIR=$BASE_OVERLAY_ETC_DIR/work
|
WORK_DIR=$BASE_OVERLAY_ETC_DIR/work
|
||||||
LOWER_DIR=$BASE_OVERLAY_ETC_DIR/lower
|
LOWER_DIR=$BASE_OVERLAY_ETC_DIR/lower
|
||||||
|
|
||||||
mkdir -p {OVERLAYFS_ETC_MOUNT_POINT}
|
|
||||||
if mount -n -t {OVERLAYFS_ETC_FSTYPE} \
|
if mount -n -t {OVERLAYFS_ETC_FSTYPE} \
|
||||||
-o {OVERLAYFS_ETC_MOUNT_OPTIONS} \
|
-o {OVERLAYFS_ETC_MOUNT_OPTIONS} \
|
||||||
{OVERLAYFS_ETC_DEVICE} {OVERLAYFS_ETC_MOUNT_POINT}
|
{OVERLAYFS_ETC_DEVICE} {OVERLAYFS_ETC_MOUNT_POINT}
|
||||||
|
|||||||
Reference in New Issue
Block a user