\mysubsection*{Detecting 32bit EFI \& Dealing With It}
\label{subsec:boot-32bit}
- No provided install image will boot
- Windows is installed in 32bit mode
- Some older Macbooks also have this configuration
It is possible to install Linux on such devices, but requires some more handwork. Note that we only ever found this configuration on 64 bit processors, so it's usually possible to install 64 bit Linux.
* Ask the Patrol for a 32-bit-Grub-USB.
* Plug both the 32-bit-Grub-USB and the Linux Installer USB in the device
* Boot from the 32-bit-Grub-USB
* You should land in a grub shell. The command prompt should say `grub>`, not `grub-rescue>`. If you see `rescue`, something went wrong.
* Type `ls`, you should see a list of partitions in the form `(HD0,GPT1)`. Try to guess which disk (HD0, HD1, HD2...) is the USB Installer - they usually have two GPT partitions.
* Type `set root=(HDX,GPT1)`, X being the number of the disk you think is the installer.
* If you get some error, it was the wrong partition or disk. Reboot and try another.
* The Kernel files reside in `/casper/vmlinuz.efi` and `/casper/initrd.lz` for Ubuntu installers, `/boot/x86_64/loader/linux` and `/boot/x86_64/loader/initrd` for opensuse.
* Load the vmlinuz by typing: (change path as required)
`vmlinuz casper/vmlinuz.efi`
* Load the initial ramdisk by typing: (change path as required)
`initrd casper/initrd.lz`
* You can use tab completion in the above step. If there are multiple files starting with `vmlinuz` or `initrd`, you usually need the one with the shortest file name.
* If you can't find the kernel files, you probably loaded the wrong partition or disk. Reboot and try again.
* Type `boot`, hit enter and pray.
* If all goes well, the installer now boots. Install Linux as normal.
After the install, you might still need to install the 32 bit version of grub in order to boot anything at all. If Linux doesn't boot now, do the following:
* Plug in the 32-bit-Grub-USB, unplug all other USB keys.
* Boot the 32-bit-Grub-USB. Type 'ls'. Try to guess on which partition you installed Linux before (root partition)
*`set root=(HD0,GPTX)`, X being the partition number you installed Linux on.
* The kernel files usually reside in `/boot/grub` or `/boot/distroname`. Just like before, load the vmlinuz.efi and initrd files.
* Type `boot`, hit enter and PRAY.
* If you're lucky, the freshly installed Linux now comes up.
* once it is up, `sudo grub-install --target=i386-efi /dev/sda1` (if your boot partition is not `sda1`, change accordingly).
* regenerate the grub config (`grub-mkconfig -o /boot/grub/grub.cfg`). Change the path accordingly.
From there, install kernel-default-ipts and kernel-firmware-ipts (for
intel precise touch support). **Uninstall the default kernel**.
Unfortunately, the SP4 drivers are only available for kernel 4.4, so you
are effectively downgrading the Linux kernel. If you leave the default
kernel installed, grub will boot it since it is newer.
After that, you need to copy some hardware descriptor files from the
Windows partition:
- iaPreciseTouchDescriptor.bin
- SurfaceTouchServicingDescriptorMSHW0078.bin
- SurfaceTouchServicingKernelSKLMSHW0078.bin
- SurfaceTouchServicingSFTConfigMSHW0078.bin
These files are located in:
`\\Windows\\inf\\PreciseTouch\\Intel`
Note that the name might vary slightly. Specifically, there might be different versions of the latter three files, which different numbers at the end (76, 78, 79...). If that is the case, use the files with the highest number.
Kernel will look for these user space binaries in /itouch folder under
specific names (same order as above):
- /itouch/integ\_descriptor.bin
- /itouch/vendor\_descriptor.bin
- /itouch/vendor\_kernel\_skl.bin
- /itouch/integ\_sft\_cfg\_skl.bin
After that, reboot and verify the touchscreen works.
On the Surface Book, we have observed that the touchscreen is inverted after the above steps (the y axis is mirrored, so when you type in the bottom left corner, the reaction happens in the top left corner). To fix this, we use xinput to set the coordinate transformation matrix.
Note that only finger touch is affected, touch with the Surface Pen is correct.
* Install xinput (sometimes named xorg-xinput).
* Run `xinput` and look for a touch device that might be the touchscreen. There should be two devices, one named something like `0000:0000` and the other `0000:0000 Pen`. You want the one without the `Pen` suffix.
* Run `xinput set-prop "Device Name" "Coordinate Transformation Matrix" 1 0 0 0 -1 1 0 0 1`, where "Device Name" is the name of the touchscreen you found previously.
* Test whether the touchscreen behaves properly now.
Note that this solution is temporary. We have not yet tested any ways to
make it permanent. You could try to put the above `xinput
set-prop` command in `~/.xinitrc` or some other auto-start script. The proper solution would be to create a file for the touchscreen in `/etc/X11/xorg.conf.d/` and set the `TransformationMatrix` option. If you find a working solution, please tell the Patrol.