Skip to content
Snippets Groups Projects
Commit dc8a32cf authored by Thomas Mittelstädt's avatar Thomas Mittelstädt
Browse files

Mounting of images without an hierarchical partition structure and a defined / implemented.


If no mount for / (root) at given mount point can be established before mounting a sub partition, a virtual mountpoint
with a small tmpfs (ramdisk) is set up for / (root), so also non hierarchical images without a defined root partition
can be set up. This is usable, if partitions of an image are not mountable at one hierarchical mount tree.
Unmounting the image automatically removes the ram disk.

Signed-off-by: default avatarThomas Mittelstaedt <thomas.mittelstaedt@de.bosch.com>
parent 79c283ec
No related branches found
No related tags found
No related merge requests found
......@@ -3,7 +3,7 @@
#
# Copyright (c) 2023 Thomas Mittelstaedt <thomas.mittelstaedt@de.bosch.com>
VERSION=2.1.3
VERSION=2.2.0
VERSIONDATE=2023
SHORT=hp:m:vr:ulf
......@@ -189,11 +189,13 @@ The first valid mount can be setup by an option or be set automatically, if foll
- GPT partitioning is used
- One has a partition type "SD_GPT_ROOT*" or "SD_GPT_ESP" (the related UUID) set.
- A file /etc/fstab exists at this partition
- If more than one partition have been marked as ROOT partition, the first partition is used
- If more than one partition has been marked as ROOT partition, the first partition is used
Some information about partition types can be found at:
https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
If there is still no root partition mountable, a small ramfs file system is created to mount the sub directories
Possible entries for MDESCR:
PARTLABEL=<label>:<mount point>
......@@ -316,21 +318,20 @@ local found_valid_root_partition
root_devices=( $(get_root_partitions ${IMAGE_DEVICE} ${IMAGE_DEVICE_P}) )
size=${#root_devices[@]}
if [ "$size" -eq "0" ]; then
print_verbose_line "/ is not mounted for $IMAGE_DEVICE, can't handle sub mounts"
mdevice=''
mbind=''
else
for id in "${root_devices[@]}"; do
mount "$id" "${CMD_MOUNTPOINT}/"
check_return_code $? $LINENO
if [ -f "${CMD_MOUNTPOINT}/etc/fstab" ]; then
break
else
umount "${CMD_MOUNTPOINT}/"
check_return_code $? $LINENO
fi
done
print_verbose_line "/ is not mounted for $IMAGE_DEVICE, creating ramfs as stub"
mount -t ramfs -o size=1M ext4 "${CMD_MOUNTPOINT}"
check_return_code $? $LINENO
fi
for id in "${root_devices[@]}"; do
mount "$id" "${CMD_MOUNTPOINT}/"
check_return_code $? $LINENO
if [ -f "${CMD_MOUNTPOINT}/etc/fstab" ]; then
break
else
umount "${CMD_MOUNTPOINT}/"
check_return_code $? $LINENO
fi
done
root_mountpoint=$(findmnt "${CMD_MOUNTPOINT}" -o TARGET -n)
fi
echo "$root_mountpoint"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment