mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-07-16 20:32:06 +08:00
Mount filesystems earlier (#568)
* Mount local filesystems earlier * cleanup * rm * revert that * cleanup
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user