Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Apr 14th, 2014  |  syntax: None  |  size: 3.89 KB  |  views: 313  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/bin/bash
  2. # Modified for Arch Linux from ChrUbuntu's cros-haswell-modules.sh
  3. # for kernel 3.14
  4.  
  5. set -e
  6.  
  7. # Create a temp directory for our work
  8. tempbuild=`mktemp -d`
  9. cd $tempbuild
  10.  
  11. # Determine kernel version
  12. archkernver=$(uname -r)
  13. kernver=$(uname -r | cut -d'-' -f 1)
  14.  
  15. # Install necessary deps to build a kernel
  16. echo "Installing linux-headers..."
  17. sudo pacman -S --needed linux-headers
  18.  
  19. # Grab kernel source
  20. echo "Fetching kernel sources..."
  21. wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-${kernver}.tar.gz
  22. echo "Extracting kernel sources..."
  23. tar xfvz linux-${kernver}.tar.gz
  24. cd linux-${kernver}
  25.  
  26. # Use Benson Leung's post-Pixel Chromebook patches: # 3074391 3074441 3074421
  27. # https://patchwork.kernel.org/bundle/bleung/chromeos-laptop-deferring-and-haswell/ # 3078491 3078481 3074391 3074441 3074421 3074401 3074431 3074411
  28. echo "Applying Chromebook Haswell Patches..."
  29. for patch in 3078491 3078481 3074401 3074431 3074411; do
  30.   wget -O - https://patchwork.kernel.org/patch/$patch/raw/ | sed 's/drivers\/platform\/x86\/chromeos_laptop.c/drivers\/platform\/chrome\/chromeos_laptop.c/g'| patch -p1
  31. done
  32.  
  33.  
  34. # fetch the chromeos_laptop and atmel maxtouch source code
  35. # Copy made from chromium.googlesource.com chromeos-3.8 branch
  36. # https://chromium.googlesource.com/chromiumos/third_party/kernel-next/+/refs/heads/chromeos-3.8
  37. wget https://googledrive.com/host/0BxMvXgjEztvAbEdYM1o0ck5rOVE --output-document=patch_atmel_mxt_ts.c
  38. wget https://googledrive.com/host/0BxMvXgjEztvAdVBjQUljYWtiR2c --output-document=patch_chromeos_laptop.c
  39.  
  40. # copy source files into kernel tree replacing existing Ubuntu source
  41. #cp ./patch_atmel_mxt_ts.c drivers/input/touchscreen/atmel_mxt_ts.c
  42. sed -e 's/INIT_COMPLETION(/reinit_completion(\&/g' ./patch_atmel_mxt_ts.c > drivers/input/touchscreen/atmel_mxt_ts.c
  43. cp ./patch_chromeos_laptop.c drivers/platform/chrome/chromeos_laptop.c
  44.  
  45.  
  46. # Need this
  47. cp /usr/lib/modules/${archkernver}/build/Module.symvers .
  48.  
  49. # Prep tree
  50. zcat /proc/config.gz > ./.config
  51. make oldconfig
  52. make prepare
  53. make modules_prepare
  54.  
  55. echo "Building relevant modules..."
  56. # Build only the needed directories
  57. make SUBDIRS=drivers/platform/chrome modules
  58. make SUBDIRS=drivers/i2c/busses modules
  59. make SUBDIRS=drivers/input/touchscreen modules
  60.  
  61. echo "Installing relevant modules..."
  62. # switch to using our new chromeos_laptop.ko module
  63. # preserve old as .orig
  64. chros_lap='/lib/modules/$archkernver/kernel/drivers/platform/chrome/chromeos_laptop.ko.gz'
  65. if [ -f $chros_lap ];
  66. then
  67. sudo mv  $chros_lap ${chros_lap}.orig
  68. fi
  69. sudo cp drivers/platform/chrome/chromeos_laptop.ko /lib/modules/$archkernver/kernel/drivers/platform/chrome/
  70. sudo gzip /lib/modules/$archkernver/kernel/drivers/platform/chrome/chromeos_laptop.ko
  71.  
  72. # switch to using our new designware i2c modules
  73. # preserve old as .orig
  74. sudo mv /lib/modules/$archkernver/kernel/drivers/i2c/busses/i2c-designware-core.ko.gz /lib/modules/$archkernver/kernel/drivers/i2c/busses/i2c-designware-core.ko.gz.orig
  75. sudo mv /lib/modules/$archkernver/kernel/drivers/i2c/busses/i2c-designware-pci.ko.gz /lib/modules/$archkernver/kernel/drivers/i2c/busses/i2c-designware-pci.ko.gz.orig
  76. sudo cp drivers/i2c/busses/i2c-designware-*.ko /lib/modules/$archkernver/kernel/drivers/i2c/busses/
  77. sudo gzip /lib/modules/$archkernver/kernel/drivers/i2c/busses/i2c-designware-*.ko
  78.  
  79. # switch to using our new atmel_mxt_ts.ko module
  80. # preserve old as .orig
  81. sudo mv /lib/modules/$archkernver/kernel/drivers/input/touchscreen/atmel_mxt_ts.ko.gz /lib/modules/$archkernver/kernel/drivers/input/touchscreen/atmel_mxt_ts.ko.gz.orig
  82. sudo cp drivers/input/touchscreen/atmel_mxt_ts.ko /lib/modules/$archkernver/kernel/drivers/input/touchscreen/
  83. sudo gzip /lib/modules/$archkernver/kernel/drivers/input/touchscreen/atmel_mxt_ts.ko
  84.  
  85. sudo depmod -a $archkernver
  86.  
  87. echo "Installing xf86-input-synaptics..."
  88. sudo pacman -S --needed xf86-input-synaptics
  89.  
  90. echo "Reboot to use your touchpad!"