Skip to content

Commit

Permalink
move /dev_host setup from S06InitSystem to S01InitHost and added rtc
Browse files Browse the repository at this point in the history
device node symlinking for the LXC/OCI platform case so that upon
startup an already available RTC clock can be correctly identified.
  • Loading branch information
jens-maus committed Jun 21, 2024
1 parent 430625a commit 9e9d9fc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
20 changes: 20 additions & 0 deletions buildroot-external/overlay/base/etc/init.d/S01InitHost
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,23 @@ identify_host() {
fi
}

init_host() {
# setup /dev_host for OCI/Docker and LXC environments (excluding HA)
if [[ "${HM_HOST}" =~ oci\|lxc ]] &&
[[ -z "${HM_RUNNING_IN_HA}" ]]; then
# To avoid sharing the whole host /dev with the container we
# mount devtmps in /dev_host and symlink the required devices
mount -o noatime -t devtmpfs devtmpfs /dev_host
if [[ -d "/dev_host" ]]; then
for device in raw-uart raw-uart1 eq3loop mmd_bidcos mmd_hmip usb rtc rtc0 rtc1; do
if [[ ! -e "/dev/${device}" ]]; then
ln -s "/dev_host/${device}" "/dev/${device}"
fi
done
fi
fi
}

start() {
echo -n "Identifying host system: "

Expand All @@ -219,6 +236,9 @@ start() {
# run identify routine
identify_host

# run init host routine
init_host

# save all HM_ env variables
set | grep '^HM_' >/var/hm_mode

Expand Down
15 changes: 0 additions & 15 deletions buildroot-external/overlay/base/etc/init.d/S06InitSystem
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,6 @@ init_system() {
mkdir -p /var/empty
chmod 0700 /var/empty

# setup /dev_host for OCI/Docker and LXC environments (excluding HA)
if [[ "${HM_HOST}" =~ oci\|lxc ]] &&
[[ -z "${HM_RUNNING_IN_HA}" ]]; then
# To avoid sharing the whole host /dev with the container we
# mount devtmps in /dev_host and symlink the required devices
mount -o noatime -t devtmpfs devtmpfs /dev_host
if [[ -d "/dev_host" ]]; then
for device in raw-uart raw-uart1 eq3loop mmd_bidcos mmd_hmip usb; do
if [[ ! -e "/dev/${device}" ]]; then
ln -s "/dev_host/${device}" "/dev/${device}"
fi
done
fi
fi

# create /media/usbX directories for automounting USB devices
for i in $(seq 1 8); do
mkdir -p "/media/usb${i}"
Expand Down

0 comments on commit 9e9d9fc

Please sign in to comment.