From 147c01ce63db3381614763182f9eb8055c33a498 2018-11-17 21:23:08 From: Unknown Date: 2018-11-17 21:23:08 Subject: [PATCH] Raspberry Userland vcgencmd for arm64bit --- diff --git a/README.md b/README.md index 04723a1..b232d33 100644 --- a/README.md +++ b/README.md @@ -224,6 +224,12 @@ Install and enable the [hardware accelerated Xorg video driver](https://github.c ##### `FBTURBOSRC_DIR`="" Path to a directory (`xf86-video-fbturbo`) of [hardware accelerated Xorg video driver sources](https://github.com/ssvb/xf86-video-fbturbo) that will be copied, configured, build and installed inside the chroot. +##### `ENABLE_VIDEOCORE`=false +Install and enable the [Source code for ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) `vcgencmd`. Please note that this driver is currently limited to hardware accelerated window moving and scrolling. + +##### `VIDEOCORESRC_DIR`="" +Path to a directory (`userland`) of [Source code for ARM side libraries for interfacing to Raspberry Pi GPU](https://github.com/raspberrypi/userland) that will be copied, configured, build and installed inside the chroot. + ##### `ENABLE_IPTABLES`=false Enable iptables IPv4/IPv6 firewall. Simplified ruleset: Allow all outgoing connections. Block all incoming connections except to OpenSSH service. diff --git a/bootstrap.d/16-videocore.sh b/bootstrap.d/16-videocore.sh new file mode 100644 index 0000000..6a3acc9 --- /dev/null +++ b/bootstrap.d/16-videocore.sh @@ -0,0 +1,33 @@ +# +# Setup videocore - Raspberry Userland +# + +# Load utility functions +. ./functions.sh + +if [ "$ENABLE_VIDEOCORE" = true ] ; then + # Copy existing videocore sources into chroot directory + if [ -n "$VIDEOCORESRC_DIR" ] && [ -d "$VIDEOCORESRC_DIR" ] ; then + # Copy local U-Boot sources + cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp" + else + # Create temporary directory for U-Boot sources + temp_dir=$(as_nobody mktemp -d) + + # Fetch U-Boot sources + as_nobody git -C "${temp_dir}" clone "${VIDEOCORE_URL}" + + # Copy downloaded U-Boot sources + mv "${temp_dir}/userland" "${R}/tmp/" + + # Set permissions of the U-Boot sources + chown -R root:root "${R}/tmp/userland" + + # Remove temporary directory for U-Boot sources + rm -fr "${temp_dir}" + fi + + cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DARM64=ON -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_ASM_COMPILER=aarch64-linux-gnu-gcc -DVIDEOCORE_BUILD_DIR="${R}"/opt/vc + make -j $(nproc) + chroot_exec PATH=${PATH}:/opt/vc/bin +fi diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 103e58f..d975b24 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -103,6 +103,7 @@ WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-no COLLABORA_URL=${COLLABORA_URL:=https://repositories.collabora.co.uk/debian} FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} +VIDEOCORE_URL=${VIDEOCORE_URL=https://github.com/raspberrypi/userland} # Build directories BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}} @@ -191,6 +192,8 @@ ENABLE_REDUCE=${ENABLE_REDUCE:=false} ENABLE_UBOOT=${ENABLE_UBOOT:=false} UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} +ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=true} +VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""} FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} ENABLE_HARDNET=${ENABLE_HARDNET:=false} ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} @@ -321,6 +324,10 @@ if [ "$BUILD_KERNEL" = true ] ; then fi fi +if [ "$ENABLE_VIDEOCORE" = true ] ; then + REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cmake" +fi + # Add libncurses5 to enable kernel menuconfig if [ "$KERNEL_MENUCONFIG" = true ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} libncurses5-dev" @@ -413,6 +420,12 @@ if [ -n "$UBOOTSRC_DIR" ] && [ ! -d "$UBOOTSRC_DIR" ] ; then exit 1 fi +# Check if specified VIDEOCORESRC_DIR directory exists +if [ -n "$VIDEOCORESRC_DIR" ] && [ ! -d "$VIDEOCORESRC_DIR" ] ; then + echo "error: '${VIDEOCORESRC_DIR}' specified directory not found (VIDEOCORESRC_DIR)!" + exit 1 +fi + # Check if specified FBTURBOSRC_DIR directory exists if [ -n "$FBTURBOSRC_DIR" ] && [ ! -d "$FBTURBOSRC_DIR" ] ; then echo "error: '${FBTURBOSRC_DIR}' specified directory not found (FBTURBOSRC_DIR)!"