switching to simplified setup process

This commit is contained in:
Jake Day 2018-04-29 19:36:59 -04:00
parent e96abf4d00
commit 376e51c2d7
2 changed files with 138 additions and 53 deletions

View file

@ -44,69 +44,27 @@ You will need to download the image, headers and libc-dev deb files for the vers
### Instructions
Surface Series Devices:
* Series 5 devices: Surface Book 2, Surface Pro 2017
* Series 4 devices: Surface Book, Surface Pro 4, Surface Laptop
* Series 3 devices: Surface Pro 3
For the ipts_firmware files (series 4/5 devices only), please select the version for your device.
* v76 for the Surface Book
* v78 for the Surface Pro 4
* v79 for the Surface Laptop
* v101 for Surface Book 2 15"
* v102 for the Surface Pro 2017
* v137 for the Surface Book 2 13"
For the i915_firmware files (series 3/4/5 devices), please select the version for your device.
* kbl for series 5 devices
* skl for series 4 devices
* bxt for series 3 devices
These steps assume are you in the linux-surface repo.
1. Copy the files under root to where they belong:
0. (Prep) Install Git:
```
sudo cp -R root/* /
sudo apt install git
```
2. Make /lib/systemd/system-sleep/hibernate as executable:
1. Clone the linux-surface repo:
```
sudo chmod a+x /lib/systemd/system-sleep/hibernate
git clone https://github.com/jakeday/linux-surface.git ~/linux-surface
```
3. (Series 4/5 only) Extract ipts_firmware_[VERSION].zip to /lib/firmware/intel/ipts/
2. Change directory to linux-surface repo:
```
sudo mkdir -p /lib/firmware/intel/ipts
sudo unzip firmware/ipts_firmware_[VERSION].zip -d /lib/firmware/intel/ipts/
cd ~/linux-surface
```
4. (Series 3/4/5 only) Extract i915_firmware_[VERSION].zip to /lib/firmware/i915/
3. Run setup script:
```
sudo mkdir -p /lib/firmware/i915
sudo unzip firmware/i915_firmware_[VERSION].zip -d /lib/firmware/i915/
sudo sh setup.sh
```
5. (Surface Book 2 only) Extract nvidia_firmware_gp108.zip to /lib/firmware/nvidia/gp108/
```
sudo mkdir -p /lib/firmware/nvidia/gp108
sudo unzip firmware/nvidia_firmware_gp108.zip -d /lib/firmware/nvidia/gp108/
```
6. (Ubuntu 17.10) Fix issue with Suspend to Disk:
```
sudo ln -s /lib/systemd/system/hibernate.target /etc/systemd/system/suspend.target && sudo ln -s /lib/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
```
7. (all other distros) Fix issue with Suspend to Disk:
```
sudo ln -s /usr/lib/systemd/system/hibernate.target /etc/systemd/system/suspend.target && sudo ln -s /usr/lib/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
```
8. Install the latest marvell firmware (if their repo is down, use my copy in the firmware folder):
```
git clone git://git.marvell.com/mwifiex-firmware.git
sudo mkdir -p /lib/firmware/mrvl/
sudo cp mwifiex-firmware/mrvl/* /lib/firmware/mrvl/
```
9. Install the headers, kernel and libc-dev (or follow the steps for compiling the kernel from source below):
4. Install the headers, kernel and libc-dev (make sure you cd to your download location first):
```
sudo dpkg -i linux-headers-[VERSION].deb linux-image-[VERSION].deb linux-libc-dev-[VERSION].deb
```
10. Reboot on installed kernel.
5. Reboot on installed kernel.
### Compiling the Kernel from Source
@ -114,7 +72,7 @@ If you don't want to use the pre-built kernel and headers, you can compile the k
0. (Prep) Install the required packages for compiling the kernel:
```
sudo apt-get install build-essential binutils-dev libncurses5-dev libssl-dev ccache bison flex
sudo apt install build-essential binutils-dev libncurses5-dev libssl-dev ccache bison flex
```
1. Assuming you cloned the linux-surface repo (this one) into ~/linux-surface, go to the parent directory:
```

127
setup.sh Normal file
View file

@ -0,0 +1,127 @@
#!/bin/sh
LX_BASE=""
LX_VERSION=""
if [ -r /etc/os-release ]; then
. /etc/os-release
if [ $ID = arch ]; then
LX_BASE=$ID
elif [ $ID = ubuntu ]; then
LX_BASE=$ID
LX_VERSION=$VERSION_ID
elif [ ! -z "$UBUNTU_CODENAME" ] ; then
LX_BASE="ubuntu"
LX_VERSION=$VERSION_ID
else
LX_BASE=$ID
LX_VERSION=$VERSION
fi
else
echo "Could not identify your distro. Please open script and run commands manually."
exit
fi
SUR_MODEL="$(dmidecode | grep "Product Name" -m 1 | xargs | sed -e 's/Product Name: //g')"
echo "\nRunning $LX_BASE version $LX_VERSION on a $SUR_MODEL.\n"
read -rp "Press enter if this is correct, or CTRL-C to cancel." cont;echo
echo "\nContinuing setup...\n"
echo "Coping the config files under root to where they belong...\n"
cp -R root/* /
echo "Making /lib/systemd/system-sleep/hibernate executable...\n"
chmod a+x /lib/systemd/system-sleep/hibernate
read -rp "Do you want to replace suspend with hibernate? (type yes or no) " usehibernate;echo
if [ "$usehibernate" = "yes" ]; then
if [ "$LX_BASE" = "ubuntu" ] && [ 1 -eq "$(echo "${LX_VERSION} >= 17.10" | bc)" ]; then
echo "Using Hibernate instead of Suspend...\n"
ln -sf /lib/systemd/system/hibernate.target /etc/systemd/system/suspend.target && sudo ln -sf /lib/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
else
echo "Using Hibernate instead of Suspend...\n"
ln -sf /usr/lib/systemd/system/hibernate.target /etc/systemd/system/suspend.target && sudo ln -sf /usr/lib/systemd/system/systemd-hibernate.service /etc/systemd/system/systemd-suspend.service
fi
else
echo "Not touching Suspend\n"
fi
read -rp "Do you want use the patched libwacom packages? (type yes or no) " uselibwacom;echo
if [ "$uselibwacom" = "yes" ]; then
echo "Installing patched libwacom packages..."
dpkg -i packages/libwacom/*.deb
else
echo "Not touching Suspend"
fi
if [ "$SUR_MODEL" = "Surface Pro 3" ]; then
echo "\nInstalling i915 firmware for Surface Pro 3...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_bxt.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Pro 4" ]; then
echo "\nInstalling IPTS firmware for Surface Pro 4...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v78.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Pro 4...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_skl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Pro 2017" ]; then
echo "\nInstalling IPTS firmware for Surface Pro 2017...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v102.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Pro 2017...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_kbl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Laptop" ]; then
echo "\nInstalling IPTS firmware for Surface Laptop...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v79.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Laptop...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_skl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Book" ]; then
echo "\nInstalling IPTS firmware for Surface Book...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v76.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Book...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_skl.zip -d /lib/firmware/i915/
fi
if [ "$SUR_MODEL" = "Surface Book 2" ]; then
echo "\nInstalling IPTS firmware for Surface Book 2...\n"
mkdir -p /lib/firmware/intel/ipts
unzip -o firmware/ipts_firmware_v137.zip -d /lib/firmware/intel/ipts/
unzip -o firmware/ipts_firmware_v101.zip -d /lib/firmware/intel/ipts/
echo "\nInstalling i915 firmware for Surface Book 2...\n"
mkdir -p /lib/firmware/i915
unzip -o firmware/i915_firmware_kbl.zip -d /lib/firmware/i915/
echo "\nInstalling nvidia firmware for Surface Book 2...\n"
mkdir -p /lib/firmware/nvidia/gp108
unzip -o firmware/nvidia_firmware_gp108.zip -d /lib/firmware/nvidia/gp108/
fi
echo "Installing marvell firmware...\n"
mkdir -p /lib/firmware/mrvl/
unzip -o firmware/mrvl_firmware.zip -d /lib/firmware/mrvl/
echo "\nAll done! Please reboot."