Package: thunderbolt-tools
Version: 0.9.3-3
Severity: wishlist
Tags: patch

Hello,

This patch adds thunderbolt support to initramfs.  It is enabled by installing
a new package: thunderbolt-tools-initramfs.  This allows me to enter my
cryptsetup password with a keyboard plugged into a tb3 dock.

Thanks,
Ross

-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing'), (40, 'unstable'), (30, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.18.0-rc4-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages thunderbolt-tools depends on:
ii  libboost-filesystem1.62.0  1.62.0+dfsg-8
ii  libboost-system1.62.0      1.62.0+dfsg-8
ii  libc6                      2.27-5
ii  libgcc1                    1:8.2.0-3
ii  libstdc++6                 8.2.0-3

thunderbolt-tools recommends no packages.

thunderbolt-tools suggests no packages.

-- no debconf information
>From 57fc7029b73ee1eef8a4c0dc87732da1f0f08657 Mon Sep 17 00:00:00 2001
From: Ross Vandegrift <r...@kallisti.us>
Date: Sun, 26 Aug 2018 18:01:06 -0700
Subject: [PATCH] Add support for activating thunderbolt in initramfs

---
 debian/README.Debian                          | 13 ++++++++
 debian/changelog                              |  7 ++++
 debian/control                                | 11 +++++++
 debian/copyright                              |  6 ++++
 debian/initramfs/hooks/thunderbolt-tools      | 33 +++++++++++++++++++
 debian/thunderbolt-tools-initramfs.install    |  2 ++
 debian/{install => thunderbolt-tools.install} |  0
 7 files changed, 72 insertions(+)
 create mode 100644 debian/README.Debian
 create mode 100755 debian/initramfs/hooks/thunderbolt-tools
 create mode 100644 debian/thunderbolt-tools-initramfs.install
 rename debian/{install => thunderbolt-tools.install} (100%)

diff --git a/debian/README.Debian b/debian/README.Debian
new file mode 100644
index 0000000..4d8d9ab
--- /dev/null
+++ b/debian/README.Debian
@@ -0,0 +1,13 @@
+thunderbolt-tools initramfs support
+-----------------------------------
+
+thunderbolt-tools-initramfs provides scripts to built thunderbolt
+support into an initramfs.  Support is enabled by default.  It can be
+disabled /etc/initramfs/conf.d/thunderbolt-tools with THUNDERBOLT=n.
+
+This supports secure-mode thunderbolt and ACLs by using the tbtacl
+data.  All devices you wish to use at boot must have been authorized
+already: new devices can't be authorized in the initramfs.  Re-run
+update-initramfs after changing authorized devices.
+
+ -- Ross Vandegrift <r...@kallisti.us>, Sun, 26 Aug 2018 17:59:55 -0700
diff --git a/debian/changelog b/debian/changelog
index b7174bf..5970a3f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+thunderbolt-tools (0.9.3-4) unstable; urgency=medium
+
+  * thunderbolt-tools-initramfs: Add support for udev thunderbolt
+    activation in initramfs.  See README.Debian for details.
+
+ -- Ross Vandegrift <r...@kallisti.us>  Sun, 26 Aug 2018 17:58:27 -0700
+
 thunderbolt-tools (0.9.3-3) unstable; urgency=medium
 
   * Remove redundant copy of udev rules (LP: #1762187)
diff --git a/debian/control b/debian/control
index b3ad7ca..9161d78 100644
--- a/debian/control
+++ b/debian/control
@@ -20,3 +20,14 @@ Depends: ${shlibs:Depends}, ${misc:Depends}
 Description: Intel Thunderbolt userspace components
  Provides components for using Intel Thunderbolt controllers with
  security level features
+
+Package: thunderbolt-tools-initramfs
+Architecture: all
+Depends: ${misc:Depends},
+        initramfs-tools (>= 0.129) | linux-initramfs-tool,
+        thunderbolt-tools
+Description: Intel Thunderbolt userspace components - initramfs integration
+ Provides components for using Intel Thunderbolt controllers with
+ security level features
+ .
+ This package provides initramfs integration for thunderbolt-tools.
diff --git a/debian/copyright b/debian/copyright
index 6224da8..8353d0d 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -29,8 +29,14 @@ License: BSD-3-clause
  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+Files: debian/initramfs/*
+Copyright: 2018 Ross Vandegrift <r...@kallisti.us>
+License: GPL-2+
+
 Files: debian/*
 Copyright: 2016 Mario Limonciello <mario_limoncie...@dell.com>
+License: GPL-2+
+
 License: GPL-2+
  This package is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
diff --git a/debian/initramfs/hooks/thunderbolt-tools 
b/debian/initramfs/hooks/thunderbolt-tools
new file mode 100755
index 0000000..02354e8
--- /dev/null
+++ b/debian/initramfs/hooks/thunderbolt-tools
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+    echo "$PREREQ"
+}
+
+case "$1" in
+    prereqs)
+       prereqs
+       exit 0
+       ;;
+esac
+
+THUNDERBOLT=n
+THUNDERBOLT_AUTH_DATA=/var/lib/thunderbolt
+
+. /etc/initramfs-tools/conf.d/thunderbolt-tools
+. /usr/share/initramfs-tools/hook-functions
+
+if [ z"${THUNDERBOLT}" != "zy" ]; then exit 0; fi
+
+manual_add_modules thunderbolt
+
+copy_exec /lib/udev/tbtacl-write
+copy_file script /lib/udev/tbtacl
+copy_file config /lib/udev/rules.d/60-tbtacl.rules
+
+for i in $(find "${THUNDERBOLT_AUTH_DATA}"); do
+    copy_file config $i
+done
diff --git a/debian/thunderbolt-tools-initramfs.install 
b/debian/thunderbolt-tools-initramfs.install
new file mode 100644
index 0000000..a72ae6b
--- /dev/null
+++ b/debian/thunderbolt-tools-initramfs.install
@@ -0,0 +1,2 @@
+debian/initramfs/conf.d/* /etc/initramfs/conf.d/
+debian/initramfs/hooks/* /etc/initramfs/hooks/
diff --git a/debian/install b/debian/thunderbolt-tools.install
similarity index 100%
rename from debian/install
rename to debian/thunderbolt-tools.install
-- 
2.18.0

Reply via email to