Skip to content

Commit 3b236c3

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

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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: Install deps
18+
run: |
19+
sudo sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources
20+
sudo apt-get update
21+
sudo apt-get install -y linux-headers-generic
22+
mkdir linux
23+
cd linux
24+
apt-get source linux-image-unsigned-$(uname -r)
25+
- name: Print kernel config
26+
cat /boot/config-`uname -r`
27+
- name: Build and load dummy_hcd module
28+
run: |
29+
cd linux
30+
cp $(ls | grep linux- | head -n1)/drivers/usb/gadget/udc/dummy_hcd.c dummy_hcd.c
31+
cat >Makefile <<'EOF'
32+
obj-m := dummy_hcd.o
33+
KDIR := /lib/modules/$(shell uname -r)/build
34+
PWD := $(shell pwd)
35+
36+
default:
37+
$(MAKE) -C $(KDIR) M=$(PWD) SUBDIRS=$(PWD) modules
38+
39+
clean:
40+
$(MAKE) -C $(KDIR) M=$(PWD) SUBDIRS=$(PWD) clean
41+
EOF
42+
cat Makefile
43+
make
44+
sudo modprobe udc_core
45+
sudo insmod dummy_hcd.ko
46+

0 commit comments

Comments
 (0)