From 3387bc67049d211e64a5e9e5b6840a4ab706bbb8 2018-11-17 21:33:58 From: burnbabyburn Date: 2018-11-17 21:33:58 Subject: [PATCH] Merge branch 'ref+fix' of https://github.com/burnbabyburn/rpi23-gen-image into ref+fix --- diff --git a/README.md b/README.md index 384bfd0..81c36cb 100644 --- a/README.md +++ b/README.md @@ -212,6 +212,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 df07428..bfa83bc 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -54,6 +54,7 @@ export FIRMWARE_URL=${FIRMWARE_URL:=https://github.com/raspberrypi/firmware/raw/ export WLAN_FIRMWARE_URL=${WLAN_FIRMWARE_URL:=https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm} export FBTURBO_URL=${FBTURBO_URL:=https://github.com/ssvb/xf86-video-fbturbo.git} export UBOOT_URL=${UBOOT_URL:=https://git.denx.de/u-boot.git} +export VIDEOCORE_URL=${VIDEOCORE_URL=https://github.com/raspberrypi/userland} # Firmware directory: Blank if download from github export RPI_FIRMWARE_DIR=${RPI_FIRMWARE_DIR:=""} @@ -143,6 +144,8 @@ export ENABLE_UBOOT=${ENABLE_UBOOT:=false} export UBOOTSRC_DIR=${UBOOTSRC_DIR:=""} export ENABLE_UBOOTUSB=${ENABLE_UBOOTUSB=false} export ENABLE_FBTURBO=${ENABLE_FBTURBO:=false} +export ENABLE_VIDEOCORE=${ENABLE_VIDEOCORE:=true} +export VIDEOCORESRC_DIR=${VIDEOCORESRC_DIR:=""} export FBTURBOSRC_DIR=${FBTURBOSRC_DIR:=""} export ENABLE_HARDNET=${ENABLE_HARDNET:=false} export ENABLE_IPTABLES=${ENABLE_IPTABLES:=false} @@ -333,6 +336,10 @@ if [ -n "$DISABLE_UNDERVOLT_WARNINGS" ] ; 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} libncurses-dev" @@ -430,6 +437,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)!"