Skip to content

Commit c957c68

Browse files
committed
[DO NOT MERGE] Test for kernel drivers
1 parent 5b4a1da commit c957c68

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
#------------------------------------------------------------------------------
3+
# QEMU OpenTitan CI
4+
#
5+
# Copyright (c) 2023-2025 Rivos, Inc.
6+
# SPDX-License-Identifier: Apache License 2.0
7+
#------------------------------------------------------------------------------
8+
9+
name: Test kernel modules
10+
on:
11+
- pull_request
12+
- workflow_dispatch
13+
jobs:
14+
test-usb:
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: Print kernel config
18+
run: |
19+
cat /boot/config-`uname -r`
20+
- name: Install deps
21+
run: |
22+
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
23+
sudo apt-get update
24+
sudo apt-get install -y linux-headers-generic
25+
mkdir linux
26+
cd linux
27+
apt-get source linux-image-unsigned-$(uname -r)
28+
- name: Build and load dummy_hcd module
29+
run: |
30+
cd linux
31+
cp $(ls | grep linux- | head -n1)/drivers/usb/gadget/udc/dummy_hcd.c dummy_hcd.c
32+
cat >Makefile <<'EOF'
33+
obj-m := dummy_hcd.o
34+
KDIR := /lib/modules/$(shell uname -r)/build
35+
PWD := $(shell pwd)
36+
37+
default:
38+
$(MAKE) -C $(KDIR) M=$(PWD) SUBDIRS=$(PWD) modules
39+
40+
clean:
41+
$(MAKE) -C $(KDIR) M=$(PWD) SUBDIRS=$(PWD) clean
42+
EOF
43+
cat Makefile
44+
make
45+
sudo modprobe udc_core
46+
sudo insmod dummy_hcd.ko
47+

0 commit comments

Comments
 (0)