From 03f5acb3915d87c3e57eb187ac2405a981020073 Mon Sep 17 00:00:00 2001 From: Shengwen Cheng Date: Sun, 16 Jun 2024 15:44:43 +0800 Subject: [PATCH] Build DirectFB2 --- patches/riscv-directfb2.patch | 12 ++++++++++++ scripts/build-image.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 patches/riscv-directfb2.patch diff --git a/patches/riscv-directfb2.patch b/patches/riscv-directfb2.patch new file mode 100644 index 0000000..805bcf8 --- /dev/null +++ b/patches/riscv-directfb2.patch @@ -0,0 +1,12 @@ +diff --git a/lib/direct/os/linux/system.c b/lib/direct/os/linux/system.c +index fffc495b2..9d871da74 100644 +--- a/lib/direct/os/linux/system.c ++++ b/lib/direct/os/linux/system.c +@@ -1,3 +1,6 @@ ++#ifndef __NR_futex ++#define __NR_futex __NR_futex_time64 ++#endif + /* + This file is part of DirectFB. + + \ No newline at end of file diff --git a/scripts/build-image.sh b/scripts/build-image.sh index 5e5c82c..748d4d9 100755 --- a/scripts/build-image.sh +++ b/scripts/build-image.sh @@ -38,16 +38,49 @@ function do_buildroot function do_linux { ASSERT git clone https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git -b linux-6.1.y --depth=1 + mkdir -p linux/out cp -f configs/linux.config linux/.config export PATH="$PWD/buildroot/output/host/bin:$PATH" export CROSS_COMPILE=riscv32-buildroot-linux-gnu- export ARCH=riscv + export INSTALL_MOD_PATH="out" pushd linux ASSERT make olddefconfig ASSERT make $PARALLEL + ASSERT make modules_install cp -f arch/riscv/boot/Image ../Image popd } +function do_directfb +{ + mkdir -p directfb + ASSERT git clone https://github.com/directfb2/DirectFB2.git + export PATH=$PATH:$PWD/buildroot/output/host/bin + export BUILDROOT_OUT=$PWD/buildroot/output/ + pushd DirectFB2 + git apply ../patches/riscv-directfb2.patch + ASSERT wget https://gist.githubusercontent.com/shengwen-tw/098da8c41ba7fbb9162ddaa4ff62b29e/raw/5ab962990d19a8bd1a8f378ef9b0b0ef1c5fb36a/riscv-cross-file + ASSERT meson --cross-file riscv-cross-file build/riscv + ASSERT meson compile -C build/riscv + DESTDIR=$BUILDROOT_OUT/host/riscv32-buildroot-linux-gnu/sysroot meson install -C build/riscv + DESTDIR=../../../directfb meson install -C build/riscv + popd +} + +function do_directfb_examples +{ + ASSERT git clone https://github.com/directfb2/DirectFB-examples.git + export PATH=$PATH:$PWD/buildroot/output/host/bin + pushd DirectFB-examples/ + ASSERT wget https://gist.githubusercontent.com/shengwen-tw/098da8c41ba7fbb9162ddaa4ff62b29e/raw/5ab962990d19a8bd1a8f378ef9b0b0ef1c5fb36a/riscv-cross-file + ASSERT meson --cross-file riscv-cross-file build/riscv + ASSERT meson compile -C build/riscv + DESTDIR=../../../directfb meson install -C build/riscv + popd +} + do_buildroot && OK do_linux && OK +do_directfb && OK +do_directfb_examples && OK