mirror of
https://github.com/commaai/agnos-builder.git
synced 2026-09-30 11:23:52 +08:00
launch magic and comma services immediately after comma-init (#588)
move those up
This commit is contained in:
@@ -9,21 +9,22 @@ INSTALLER="/tmp/installer"
|
||||
RESET_TRIGGER="/data/__system_reset__"
|
||||
|
||||
# blip power to ~10W to see if the PSU is stable
|
||||
sudo chrt -i 0 timeout --kill-after=1 1 /home/comma/power_burn_max 0.5 8 &
|
||||
|
||||
# use max freq to boot up quickly, then limit
|
||||
echo 1689600 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
|
||||
echo 1689600 | sudo tee /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq
|
||||
function power_burn {
|
||||
sudo chrt -i 0 timeout --kill-after=1 1 /home/comma/power_burn_max 0.5 8
|
||||
# limit after burn
|
||||
echo 1689600 | sudo tee /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq
|
||||
echo 1689600 | sudo tee /sys/devices/system/cpu/cpufreq/policy4/scaling_max_freq
|
||||
}
|
||||
power_burn &
|
||||
|
||||
echo "waiting for magic"
|
||||
for i in {1..200}; do
|
||||
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
|
||||
if [ -S /tmp/drmfd.sock ]; then
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
|
||||
if systemctl is-active --quiet magic && [ -S /tmp/drmfd.sock ]; then
|
||||
if [ -S /tmp/drmfd.sock ]; then
|
||||
echo "magic ready after ${SECONDS}s"
|
||||
else
|
||||
echo "timed out waiting for magic, ${SECONDS}s"
|
||||
@@ -65,10 +66,6 @@ if [ ! -f /tmp/booted ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# setup /data/tmp
|
||||
rm -rf /data/tmp
|
||||
mkdir -p /data/tmp
|
||||
|
||||
# symlink vscode to userdata
|
||||
mkdir -p /data/tmp/vscode-server
|
||||
ln -s /data/tmp/vscode-server ~/.vscode-server
|
||||
@@ -83,7 +80,7 @@ while true; do
|
||||
exec "$CONTINUE"
|
||||
fi
|
||||
|
||||
sudo abctl --set_success
|
||||
sudo abctl --set_success &
|
||||
|
||||
# cleanup installers from previous runs
|
||||
rm -f $INSTALLER
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
[Unit]
|
||||
After=comma-init.service local-fs.target
|
||||
DefaultDependencies=no
|
||||
Requires=comma-init.service
|
||||
Wants=magic.service
|
||||
After=comma-init.service magic.service
|
||||
Before=basic.target shutdown.target
|
||||
Conflicts=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
[Unit]
|
||||
Description=Magic
|
||||
DefaultDependencies=no
|
||||
After=comma-init.service
|
||||
Requires=comma-init.service
|
||||
Before=basic.target shutdown.target
|
||||
Conflicts=shutdown.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
Reference in New Issue
Block a user