From 3b0f6dc8a83ae1fe3aaa0034b44e5f81815e4ff1 Mon Sep 17 00:00:00 2001 From: op52 Date: Thu, 20 Dec 2018 08:43:40 +0800 Subject: [PATCH] Fix --- _nv_modeset | 1 + _undervolt | 6 ++++++ _undervolt_timer | 12 ++++++++++++ _wakeup_fix | 9 +++++++++ setup3_ubuntu_pkg.sh | 2 +- setupo_laptop_pwr.sh | 7 +++++++ setupo_laptop_undervolt.sh | 14 ++++++++++++++ setupo_laptop_wakeup.sh | 7 +++++++ setupo_prime_sync.sh | 4 ++++ 9 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 _nv_modeset create mode 100644 _undervolt create mode 100644 _undervolt_timer create mode 100644 _wakeup_fix create mode 100644 setupo_laptop_pwr.sh create mode 100644 setupo_laptop_undervolt.sh create mode 100644 setupo_laptop_wakeup.sh create mode 100644 setupo_prime_sync.sh diff --git a/_nv_modeset b/_nv_modeset new file mode 100644 index 0000000..b1e8df2 --- /dev/null +++ b/_nv_modeset @@ -0,0 +1 @@ +options nvidia-drm modeset=1 \ No newline at end of file diff --git a/_undervolt b/_undervolt new file mode 100644 index 0000000..5b89e3e --- /dev/null +++ b/_undervolt @@ -0,0 +1,6 @@ +[Unit] +Description=undervolt + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/undervolt -v --core -125 --cache -125 --uncore -125 --analogio -125 --gpu -50 \ No newline at end of file diff --git a/_undervolt_timer b/_undervolt_timer new file mode 100644 index 0000000..c53bd30 --- /dev/null +++ b/_undervolt_timer @@ -0,0 +1,12 @@ +[Unit] +Description=Apply undervolt settings + +[Timer] +Unit=undervolt.service +# Wait 2 minutes after boot before first applying +OnBootSec=2min +# Run every 30 seconds +OnUnitActiveSec=30 + +[Install] +WantedBy=multi-user.target diff --git a/_wakeup_fix b/_wakeup_fix new file mode 100644 index 0000000..8e006c9 --- /dev/null +++ b/_wakeup_fix @@ -0,0 +1,9 @@ +[Unit] +Description=Wakeup fix + +[Service] +ExecStart=/bin/sh -c '/bin/echo XHC > /proc/acpi/wakeup; /bin/echo LID0 > /proc/acpi/wakeup; /bin/echo PBTN > /proc/acpi/wakeup; /bin/echo deep > /sys/power/mem_sleep' + + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/setup3_ubuntu_pkg.sh b/setup3_ubuntu_pkg.sh index 87daf1e..b462412 100644 --- a/setup3_ubuntu_pkg.sh +++ b/setup3_ubuntu_pkg.sh @@ -5,6 +5,6 @@ sudo add-apt-repository -y -u ppa:snwh/ppa sudo add-apt-repository -y ppa:graphics-drivers sudo apt-get -y update sudo apt-get -y upgrade -sudo apt install -y vim arc-theme gnome-tweak-tool paper-icon-theme ibus-pinyin clang lld qemu cmake nasm grub-pc-bin bochs bochs-sdl xorriso +sudo apt install -y vim arc-theme gnome-tweak-tool paper-icon-theme ibus-pinyin clang lld qemu nasm grub-pc-bin bochs bochs-sdl xorriso git dconf-editor sudo apt-get -y autoremove ibus restart \ No newline at end of file diff --git a/setupo_laptop_pwr.sh b/setupo_laptop_pwr.sh new file mode 100644 index 0000000..46f8981 --- /dev/null +++ b/setupo_laptop_pwr.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Installing power-saving packages" +sudo apt install -y powertop tlp +sudo apt-get -y autoremove + +echo "Edit /etc/default/tlp such that the default mode is BAT" \ No newline at end of file diff --git a/setupo_laptop_undervolt.sh b/setupo_laptop_undervolt.sh new file mode 100644 index 0000000..c378fde --- /dev/null +++ b/setupo_laptop_undervolt.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +echo "Installing undervolt packages" +sudo apt install -y python-pip +sudo apt-get -y autoremove +sudo pip install undervolt + + +echo "Applying undervolt" +sudo cp _undervolt /etc/systemd/system/undervolt.service +sudo cp _undervolt_timer /etc/systemd/system/undervolt-timer.service + +sudo systemctl enable undervolt-timer +sudo systemctl start undervolt-timer \ No newline at end of file diff --git a/setupo_laptop_wakeup.sh b/setupo_laptop_wakeup.sh new file mode 100644 index 0000000..f651eb2 --- /dev/null +++ b/setupo_laptop_wakeup.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +echo "Applying wakeup fix" +sudo cp _wakeup_fix /etc/systemd/system/wakeup-fix.service +sudo systemctl enable wakeup-fix +sudo systemctl start wakeup-fix + diff --git a/setupo_prime_sync.sh b/setupo_prime_sync.sh new file mode 100644 index 0000000..ca83a19 --- /dev/null +++ b/setupo_prime_sync.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +sudo cp _nv_modeset /etc/modprobe.d/zz-nvidia-modeset.conf +sudo update-initramfs -u \ No newline at end of file