Skip to content

Commit

Permalink
Add initrd script for packing virtio-gpu related files
Browse files Browse the repository at this point in the history
  • Loading branch information
shengwen-tw committed Jun 18, 2024
1 parent 1120c97 commit 791d6d9
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/initrd-image.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/bash

IMG=ext4.img
KERNEL_VER=$(git -C linux/ tag | sed "s/^v//")
SRC=linux/out/lib/modules/$KERNEL_VER
DEST=rootfs/lib/modules/$KERNEL_VER

# Add path of kernel modules to load with dependency file, for example:
# for example:
# FILES='kernel/drivers/gpu/drm/drm.ko
# modules.dep'
FILES=''

for file in $FILES; do
mkdir -p `dirname $DEST/$file`
cp -f $SRC/$file $DEST/$file
done

cp -r directfb rootfs
cp target/run.sh rootfs

# DirectFB-example requires ~60MiB of space
dd if=/dev/zero of=${IMG} bs=4k count=20000
mkfs.ext4 -F ${IMG} -d rootfs

rm -rf rootfs

# show image size
du -h ${IMG}
15 changes: 15 additions & 0 deletions target/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/bash

# Install kernel modules
if [ -d "/lib/modules/" ]; then
mkdir -p /lib/modules/
cp -r ./lib/modules/* /lib/modules/
fi

# Install DirectFB and examples
cp -r ./usr/local /usr/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export PATH=$PATH:/usr/local/bin/

# Load kernel modules if exists
# modprobe virtio-gpu

0 comments on commit 791d6d9

Please sign in to comment.