Mount filesystems earlier (#568)

* Mount local filesystems earlier

* cleanup

* rm

* revert that

* cleanup
This commit is contained in:
Adeeb Shihadeh
2026-05-01 19:57:02 -07:00
committed by GitHub
parent 68ec292277
commit 98e4c291da
8 changed files with 71 additions and 45 deletions

View File

@@ -106,7 +106,8 @@ RUN chown -R $USERNAME: /home/$USERNAME/.config
RUN rm -rf /root/.config && ln -s /home/$USERNAME/.config /root/.config
RUN chmod 644 /etc/logrotate.conf
RUN touch -r /lib/systemd/systemd /etc/fstab
RUN touch -r /lib/systemd/systemd
RUN rm -f /etc/fstab
# Install kernel headers
COPY ./output/linux-headers/include/ /usr/include/

View File

@@ -1,8 +0,0 @@
/dev/disk/by-label/dsp /dsp auto ro
/dev/disk/by-partlabel/modem_a /firmware auto ro
/dev/disk/by-partlabel/persist /persist auto ro,discard,nosuid,nodev,noexec
/dev/disk/by-partlabel/userdata /data auto discard,noatime,nodiratime,nosuid,nodev,nofail 0 0
/dev/disk/by-partlabel/cache /cache ext4 relatime,data=ordered,noauto_da_alloc,discard,noexec,nodev,nosuid,x-systemd.makefs 0 0
tmpfs /var tmpfs rw,nosuid,nodev,size=128M,mode=755 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev,size=150M,mode=1777 0 0
tmpfs /rwtmp tmpfs rw,nosuid,nodev,size=100M,mode=1777 0 0

View File

@@ -0,0 +1,2 @@
[Unit]
After=fs_setup.service

View File

@@ -1,34 +0,0 @@
# Copyright (c) 2017, The Linux Foundation. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials provided
# with the distribution.
# * Neither the name of The Linux Foundation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE
[Unit]
Before=local-fs.target
[Mount]
What=/dev/disk/by-partlabel/systemrw
Where=/systemrw
Options=relatime,data=ordered,noauto_da_alloc,discard,noexec,nodev

View File

@@ -1,6 +1,5 @@
[Unit]
Description=Setup rootfs
After=data.mount tmp.mount rwtmp.mount var.mount
Before=local-fs.target
DefaultDependencies=no

View File

@@ -1,5 +1,61 @@
#!/bin/bash
PATH=/usr/sbin:/usr/bin:/sbin:/bin
log() {
echo "fs_setup[$$]: $(cut -d' ' -f1 /proc/uptime) $*" > /dev/kmsg
}
wait_for_block() {
local device="$1"
local i
for ((i = 0; i < 150; i++)); do
if [[ -b "$device" ]]; then
return 0
fi
sleep 0.02
done
log "timed out waiting for $device"
return 1
}
mount_fs() {
local what="$1"
local where="$2"
local type="$3"
local options="$4"
if [[ "$what" == /dev/* ]] && ! wait_for_block "$what"; then
failed=1
return 1
fi
log "mounting $where"
if mount --mkdir -t "$type" -o "$options" "$what" "$where"; then
log "mounted $where"
return 0
fi
log "failed mounting $where"
failed=1
return 1
}
log "start"
failed=0
mount_fs /dev/sde9 /dsp ext4 ro
mount_fs /dev/sde4 /firmware vfat ro
mount_fs /dev/sda2 /persist squashfs ro,nosuid,nodev,noexec
mount_fs /dev/sda10 /systemrw ext4 relatime,data=ordered,noauto_da_alloc,discard,noexec,nodev
mount_fs /dev/sda12 /data ext4 discard,noatime,nodiratime,nosuid,nodev
mount_fs /dev/sda11 /cache ext4 relatime,data=ordered,noauto_da_alloc,discard,noexec,nodev,nosuid
mount_fs tmpfs /var tmpfs rw,nosuid,nodev,size=128M,mode=755
mount_fs tmpfs /tmp tmpfs rw,nosuid,nodev,size=150M,mode=1777
mount_fs tmpfs /rwtmp tmpfs rw,nosuid,nodev,size=100M,mode=1777
# Ensure the symlinks in the read only rootfs are
# backed by real files and directories on userdata.
@@ -39,3 +95,10 @@ mkdir -p /data/tmp/
if [[ ! -d /data/persist ]]; then
sudo cp -r /system/persist /data
fi
if [[ "$failed" -ne 0 ]]; then
log "mounts failed"
exit 1
fi
log "done"

View File

@@ -10,6 +10,7 @@ WESTON_SOCK_PATH = os.path.join(WESTON_RUNTIME_DIR, "wayland-0")
SOCK_PATH = "/tmp/drmfd.sock"
DRM_DEVICE = "/dev/dri/card0"
BACKLIGHT_POWER = "/sys/class/backlight/panel0-backlight/bl_power"
BACKGROUND = "/usr/comma/bg.jpg"
# This is needed to keep the old updater working. Updater used to be stored in
@@ -93,6 +94,9 @@ def main():
time.sleep(0.1)
os.environ['DRM_FD'] = str(drm_master)
while not os.access(BACKLIGHT_POWER, os.W_OK):
time.sleep(0.1)
rl.init_window(0, 0, "not weston")
img = rl.load_image(BACKGROUND)
rl.image_resize(img, rl.get_screen_width(), rl.get_screen_width()//2)