Skip to content

Commit 2329167

Browse files
committed
Add virtual disk script for packing virtio-gpu related files
1 parent 7620fdf commit 2329167

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed

scripts/virt-disk-img.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/bash
2+
3+
IMG=ext4.img
4+
KERNEL_VER=$(git -C linux/ tag | sed "s/^v//")
5+
SRC=linux/out/lib/modules/$KERNEL_VER
6+
DEST=rootfs/lib/modules/$KERNEL_VER
7+
8+
# Add path of kernel modules to load with dependency file, for example:
9+
# FILES='kernel/drivers/gpu/drm/drm.ko
10+
# modules.dep'
11+
FILES=''
12+
13+
mkdir -p rootfs
14+
15+
for file in $FILES; do
16+
mkdir -p `dirname $DEST/$file`
17+
cp -f $SRC/$file $DEST/$file
18+
done
19+
20+
cp -r libepoxy_out/* rootfs
21+
cp -r virglrenderer_out/* rootfs
22+
cp -r directfb/* rootfs
23+
cp target/run.sh rootfs
24+
25+
# DirectFB-example requires ~60MiB of space
26+
dd if=/dev/zero of=${IMG} bs=4k count=20000
27+
mkfs.ext4 -F ${IMG} -d rootfs
28+
29+
rm -rf rootfs
30+
31+
# show image size
32+
du -h ${IMG}

target/run.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/bash
2+
3+
# Install kernel modules
4+
if [ -d "/lib/modules/" ]; then
5+
mkdir -p /lib/modules/
6+
cp -r ./lib/modules/* /lib/modules/
7+
fi
8+
9+
# Install DirectFB and examples
10+
cp -r ./usr/local /usr/
11+
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
12+
export PATH=$PATH:/usr/local/bin/
13+
14+
# Load kernel modules if exist
15+
# modprobe virtio-gpu

0 commit comments

Comments
 (0)