Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added debian-related instructions and fixed some arch-only lines #556

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions docs/guides/kernel.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If your distro is not one of the distros with documentation on this Wiki, you ma
- You will need some packages to build the kernel:

- Arch based systems: `sudo pacman --needed -S bc kmod libelf pahole cpio perl tar xz git`
- Debian based systems: `sudo apt install build-essential libncurses-dev libssl-dev flex bison libelf-dev bc dwarves openssl`
- Debian based systems: `sudo apt install autoconf bc bison build-essential cpio curl debhelper dkms dwarves fakeroot flex gawk git kernel-wedge libcap-dev libelf-dev libiberty-dev libncurses-dev libpci-dev libssl-dev libudev-dev openssl python3 rsync wget xz-utils zstd`
- For other distros you will need the equivalent of these, but if you miss something you'll most likely get an error saying what's missing, and you can then install it and re-run `make` to continue where you left off.

- You will need about 20GB of disk space to compile the kernel. If you have a large amount of ram, you could use tmpfs to store build files in ram.
Expand All @@ -23,8 +23,7 @@ If your distro is not one of the distros with documentation on this Wiki, you ma

```bash
mkdir build && cd build
git clone --depth=1 https://github.com/t2linux/linux-t2-patches patches

git clone --depth 1 https://github.com/t2linux/linux-t2-patches patches
pkgver=$(curl -sL https://github.com/t2linux/T2-Ubuntu-Kernel/releases/latest/ | grep "<title>Release" | awk -F " " '{print $2}' | cut -d "v" -f 2 | cut -d "-" -f 1)
_srcname=linux-${pkgver}
wget https://www.kernel.org/pub/linux/kernel/v${pkgver//.*}.x/linux-${pkgver}.tar.xz
Expand All @@ -39,10 +38,24 @@ done
### Setting kernel configuration

!!! Info "Using config from lower kernel versions"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why extra line here? Remove this.

We will use the config of the kernel that is currently running. If your running kernel is an older longterm/stable kernel, it's possible that some of the default choices for new options added to the kernel might not be what you want. You can replace `make olddefconfig` in the code block below with `make oldconfig` if you want to manually set new options. You can always later use `make menuconfig` to change kernel config options if you have issues.

**for Arch Linux:** extract current config

```bash
zcat /proc/config.gz > .config
```

**for Debian-based distros:** extract current config

```bash
cat /boot/config-$(uname -r) > .config
```

Next steps for all distros:

```bash
make olddefconfig
scripts/config --module CONFIG_BT_HCIBCM4377
scripts/config --module CONFIG_HID_APPLETB_BL
Expand Down
39 changes: 36 additions & 3 deletions docs/guides/postinstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ blacklist cdc_mbim" >> /etc/modprobe.d/blacklist.conf'

Please note that this internal ethernet interface is required for various services including touchid that there currently is no Linux support for. In the future, if any of these services are supported, you'll need to undo this.


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This extra line is unnecessary

# Suspend Workaround

S3 suspend has been broken since macOS Sonoma, it has never been fixed, but this workaround will make deep suspend work:
Expand All @@ -161,6 +162,7 @@ S3 suspend has been broken since macOS Sonoma, it has never been fixed, but this
Type=oneshot
RemainAfterExit=yes

#ExecStartPre=+/usr/bin/modprobe -r hid_appletb_kbd
ExecStart=/usr/bin/modprobe -r brcmfmac_wcc
ExecStart=/usr/bin/modprobe -r brcmfmac
ExecStart=/usr/bin/rmmod -f apple-bce
Expand All @@ -172,9 +174,40 @@ S3 suspend has been broken since macOS Sonoma, it has never been fixed, but this
[Install]
WantedBy=sleep.target
```
3. Check your modprobe location
```bash
which modprobe
which rmmod
```
and fix the pathes in service script if they differ for your system. If you having problems with touchbar being dead after restoring state from suspend then uncomment ExecStartPre line.

3. Enable the service by running: `sudo systemctl enable --now suspend-fix-t2.service`
4. Enable the service by running: `sudo systemctl enable --now suspend-fix-t2.service`

!!! note
This seems to be working only on Arch with `CONFIG_MODULE_FORCE_UNLOAD=y` in the kernel config.
To check, run: `zcat /proc/config.gz | grep "CONFIG_MODULE_FORCE_UNLOAD"`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No blank line here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not resolved

This seems to be working with `CONFIG_MODULE_FORCE_UNLOAD=y` in the kernel config.
To check, run: `zcat /proc/config.gz | grep "CONFIG_MODULE_FORCE_UNLOAD"` on arch or `cat /boot/config-$(uname -r) | grep "CONFIG_MODULE_FORCE_UNLOAD"` on Debian-based distros.

Without this config option you wont be able to unload the required modules, they will be busy.

5. If touchbar occasionally does not work on boot but works after suspend+restore then you can place this workaround somewhere late after boot
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why brcmfmac is touchbar? Both have no relation to each other.

```bash
modprobe -r hid_appletb_kbd
modprobe -r brcmfmac_wcc
modprobe -r brcmfmac
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, why apple-bce is being removed?

rmmod -f apple-bce

sleep 1

modprobe apple-bce
modprobe brcmfmac
modprobe brcmfmac_wcc

touchbar --restart
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

touchbar --restart is an Ubuntu only command. Make it disable and enable tiny-dfr.service instead.

```
This literally just simulates the behaviour that is executed when `suspend-fix-t2.service` is triggered with one extra step at the end which helps to bring touchbar back.
Comment the first line (that kills keyboard brighntess control) if it works fine without that.

You can place this file in your desktop environment autorun folder, create systemd service for running this script or just execute it manually when yout touchbar doesn't want to work.