about summary refs log tree commit diff
path: root/modules/nixos-hardware/toshiba
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 16:23:40 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 16:24:02 +0000
commit8c0790eb6095ef59a9623596f5794d250b95c699 (patch)
tree4801e46054b433e786e15d030b6cab991d8a6724 /modules/nixos-hardware/toshiba
parent36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (diff)
parent99cdc883064ac5a1b9e189d3500a809616e79765 (diff)
downloadnixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar
nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.gz
nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.bz2
nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.lz
nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.xz
nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.tar.zst
nixlib-8c0790eb6095ef59a9623596f5794d250b95c699.zip
Add 'modules/nixos-hardware/' from commit '99cdc883064ac5a1b9e189d3500a809616e79765'
git-subtree-dir: modules/nixos-hardware
git-subtree-mainline: 36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2
git-subtree-split: 99cdc883064ac5a1b9e189d3500a809616e79765
Diffstat (limited to 'modules/nixos-hardware/toshiba')
-rw-r--r--modules/nixos-hardware/toshiba/swanky/README.md66
-rw-r--r--modules/nixos-hardware/toshiba/swanky/default.nix30
2 files changed, 96 insertions, 0 deletions
diff --git a/modules/nixos-hardware/toshiba/swanky/README.md b/modules/nixos-hardware/toshiba/swanky/README.md
new file mode 100644
index 000000000000..ab4c072c6b09
--- /dev/null
+++ b/modules/nixos-hardware/toshiba/swanky/README.md
@@ -0,0 +1,66 @@
+# Toshiba Chromebook 2 `swanky`
+
+There might be a way to install NixOS without hardware modifications (via
+enabled developer mode and SeaBIOS boot on Ctrl+L), however I'd highly
+recommend replacing Google's Coreboot payload with Tianocore: that allows for
+proper virtualization, suspend, removes annoying developer mode screen, and
+generally just works much better.
+
+These instructions carry some risk of bricking your device, since you'll be
+reflashing BIOS. Risk is rather low, but please for the love of god make a BIOS
+backup and store it someplace safe. That's the only way to reinstall ChromeOS
+back after this procedure (BIOS image has licensing info), and it's much easier
+to use a known good state to unbrick the laptop if things go wrong.
+
+If you ever get unlucky, you can unbrick your device using Raspberry Pi,
+some cables and a SOIC clip, see:
+http://sicarul.com/how-to-un-brick-your-toshiba-chromebook-2-gandof-without-invoking-any-demons/
+
+## Enable developer mode
+
+This will wipe all user data and settings from the laptop.
+
+Power off, then hold ESC + Refresh (F3) and abruptly press power button. You
+should see "Chrome OS is missing or damaged" message. Press Ctrl+D. Press enter
+at the next screen, then press Ctrl+D again. Wait until the laptop boots into
+ChromeOS, then power it off.
+
+## Disable hardware-backed BIOS write protection
+
+Follow the first part of the guide at:
+https://github.com/brendenyule/NativeToshibaCB2Guide/wiki/Remove-Write-Protect
+
+Ignore SeaBIOS section. I also used some ductape over #5 to make sure that
+metallic motherboard shield would not re-enable write protection.
+
+## Flash Coreboot + Tianocore BIOS
+
+Prepare a FAT32-formatted flash drive for BIOS backup in advance.
+
+Go through ChromeOS installation dialogues until you have network access and
+are able to log into a guest session. Open Chrome, press Ctrl+Alt+T to open
+`crosh`, type in `shell` to get a real shell. Then, run:
+
+```
+$ cd ~
+$ curl -LO https://mrchromebox.tech/firmware-util.sh
+$ sudo bash firmware-util.sh
+```
+
+Choose "Install/Update Full ROM Firmware" option and follow instructions.
+Do not skip BIOS backup!
+
+Documentation: https://mrchromebox.tech/#fwscript
+
+## Enable hardware-backed BIOS write protection
+
+This is a cool security feature, so after flashing Coreboot + Tianocore BIOS
+and making sure new BIOS works, consider re-enabling BIOS protection. Just put
+in the missing screw #5.
+
+## Install NixOS
+
+`dd` an image on a flash drive, partition the drive, etc. On some later models,
+you can swap SSD with any other 2242 M.2 SATA SSD, but on `swanky`, you have
+to live with what you have (16GB eMMC). I recommend `256MB` for EFI partition,
+and the rest for `/`.
diff --git a/modules/nixos-hardware/toshiba/swanky/default.nix b/modules/nixos-hardware/toshiba/swanky/default.nix
new file mode 100644
index 000000000000..9504d147db00
--- /dev/null
+++ b/modules/nixos-hardware/toshiba/swanky/default.nix
@@ -0,0 +1,30 @@
+{ lib, pkgs, ... }:
+
+let
+  ucm = pkgs.fetchzip {
+    url = "https://github.com/plbossart/UCM/archive/2050ca78a4d1a853d1ba050b591f42e6f97adfc0.tar.gz";
+    sha256 = "1rs4mpz3b965nmz0yhy6j4ga3fdz320qnpkd7d61nvpv9c3i6zwj";
+  };
+in
+
+{
+  imports = [
+    ../../common/cpu/intel
+    ../../common/pc/laptop
+  ];
+
+  # Sound only properly works out of the box on 4.18+ kernels.
+  boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
+
+  # Required for screen brightness control:
+  boot.kernelParams = [ "acpi_backlight=vendor" ];
+
+  # Sound requires a custom UCM config:
+  system.replaceRuntimeDependencies = [{
+    original = pkgs.alsaLib;
+
+    replacement = pkgs.alsaLib.overrideAttrs (super: {
+      postFixup = "cp -r ${ucm}/chtmax98090 $out/share/alsa/ucm";
+    });
+  }];
+}