Skip to content

Commit a723e75

Browse files
committed
Add script for packing kernel modules to image
1 parent 9b03123 commit a723e75

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

scripts/create-initrd-img.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/bash
2+
3+
IMG=ext4.img
4+
5+
mkdir -p rootfs
6+
mkdir -p rootfs/modules
7+
8+
MODULES='linux/drivers/i2c/i2c-core.ko
9+
linux/drivers/i2c/algos/i2c-algo-bit.ko
10+
linux/drivers/virtio/virtio_dma_buf.ko
11+
linux/drivers/gpu/drm/drm_kms_helper.ko
12+
linux/drivers/gpu/drm/virtio/virtio-gpu.ko
13+
linux/drivers/gpu/drm/drm.ko
14+
linux/drivers/gpu/drm/drm_shmem_helper.ko
15+
linux/drivers/gpu/drm/drm_panel_orientation_quirks.ko'
16+
17+
for file in $MODULES; do
18+
cp $file rootfs/modules
19+
done
20+
21+
cp scripts/run.sh rootfs
22+
23+
# kernel objects of virtio-gpu and root files requires ~35MiB of space
24+
dd if=/dev/zero of=${IMG} bs=4k count=9000
25+
mkfs.ext4 -F ${IMG} -d rootfs
26+
27+
rm -rf rootfs
28+
29+
# show image size
30+
du -h ${IMG}

scripts/run.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/bash
2+
3+
# Run this script to install virtio-gpu module into
4+
# the guest Linux system
5+
6+
mkdir -p /lib/modules/$(uname -r)
7+
cp ./modules/*.ko /lib/modules/$(uname -r)
8+
9+
depmod -a
10+
modprobe virtio-gpu

0 commit comments

Comments
 (0)