Skip to content

Commit d2bb26c

Browse files
Merge pull request #47 from random-archer/dev-util-usb-hci
support usb hcd
2 parents eaed9a0 + eebc307 commit d2bb26c

File tree

4 files changed

+71
-0
lines changed

4 files changed

+71
-0
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ PREFIX ?= /usr/local
22
SYSTEMD_SYSTEM_PATH ?= /usr/lib
33

44
install:
5+
install -vDm 644 src/*.conf -t $(DESTDIR)/etc/mkinitcpio-systemd-tool/config
56
install -vDm 644 src/fstab -t $(DESTDIR)/etc/mkinitcpio-systemd-tool/config
67
install -vDm 644 src/crypttab -t $(DESTDIR)/etc/mkinitcpio-systemd-tool/config
78
install -vDm 644 src/initrd-network.network -t $(DESTDIR)/etc/mkinitcpio-systemd-tool/network/

src/initrd-util-usb-hcd.conf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
2+
3+
# Provide enhanced configuration for usb keyboard inside initramfs.
4+
5+
# file location in initramfs:
6+
# /etc/modprobe.d/initrd-util-usb-hcd.conf
7+
8+
# file location in real-root:
9+
# /etc/mkinitcpio-systemd-tool/config/initrd-util-usb-hcd.conf
10+
11+
# required module load order: xhci-hcd ehci-hcd uhci-hcd ohci-hcd
12+
13+
softdep ehci-hcd pre: xhci-hcd
14+
softdep uhci-hcd pre: ehci-hcd
15+
softdep ohci-hcd pre: uhci-hcd

src/initrd-util-usb-hcd.service

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This file is part of https://github.com/random-archer/mkinitcpio-systemd-tool
2+
3+
# Provide enhanced configuration for usb keyboard inside initramfs.
4+
5+
# note:
6+
# * sometimes usb drives are not properly detected/loaded for initrd
7+
# * try to enable this service to see if that resolves the issue
8+
9+
[Unit]
10+
Description=Initrd/Util USB-HCD Service
11+
ConditionPathExists=/etc/initrd-release
12+
DefaultDependencies=no
13+
14+
[Service]
15+
Type=oneshot
16+
RemainAfterExit=true
17+
ExecStart=/bin/true
18+
19+
[Install]
20+
WantedBy=sysinit.target
21+
22+
[X-SystemdTool]
23+
24+
# driver terminology:
25+
# xhci = eXtensible Host Controller Interface, USB 3.0
26+
# ehci = Enhanced Host Controller Interface, USB 2.0
27+
# *hcd = host controller driver
28+
# *pci = pci bus glue
29+
30+
#
31+
# provision usb modules
32+
#
33+
34+
# http://cateee.net/lkddb/web-lkddb/USB_XHCI_HCD.html
35+
InitrdCall=add_module xhci_hcd
36+
InitrdCall=add_module xhci_pci
37+
38+
# http://cateee.net/lkddb/web-lkddb/USB_EHCI_HCD.html
39+
InitrdCall=add_module ehci_hcd
40+
InitrdCall=add_module ehci_pci
41+
42+
# http://cateee.net/lkddb/web-lkddb/HID_GENERIC.html
43+
InitrdCall=add_module hid_generic
44+
45+
#
46+
# provision module config
47+
#
48+
49+
# enforce module load order
50+
InitrdPath=/etc/modprobe.d/initrd-util-usb-hcd.conf source=/etc/mkinitcpio-systemd-tool/config/initrd-util-usb-hcd.conf

tool/image/test/unitada/verify.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,16 @@
2222

2323
machine.service_enable_list([
2424
"root-entry.mount",
25+
"initrd-util-usb-hcd.service",
2526
])
2627

2728
machine.produce_boot_result()
2829

2930
path_list = [
3031

3132
"/etc/systemd/system/root-entry.mount",
33+
34+
"/etc/modprobe.d/initrd-util-usb-hcd.conf",
3235

3336
]
3437

@@ -37,6 +40,8 @@
3740
"/etc/systemd/system/custom-tester.target.wants/root-entry.mount",
3841
"/etc/systemd/system/super-duper.mount.requires/root-entry.mount",
3942

43+
"/etc/systemd/system/sysinit.target.wants/initrd-util-usb-hcd.service",
44+
4045
]
4146

4247
text_list = [

0 commit comments

Comments
 (0)