From 68e46fb40bfb23445f8d3e7ea6f95bace5da8702 2018-11-24 02:01:48 From: Unknown Date: 2018-11-24 02:01:48 Subject: [PATCH] 0 --- diff --git a/README.md b/README.md index d0411be..9043297 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,9 @@ Allow the installation of non-free Debian packages that do not comply with the D ##### `ENABLE_WIRELESS`=false Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`. +##### `ENABLE_BLUETOOTH`=false +Enable Bluetooth interface on the RPi0/3. + ##### `ENABLE_RSYSLOG`=true If set to false, disable and uninstall rsyslog (so logs will be available only in journal files) diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index a10e002..faad9cf 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -104,44 +104,46 @@ if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then if [ "$ENABLE_CONSOLE" = true ] && [ "$ENABLE_UBOOT" = false ] ; then echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" echo "enable_uart=1" >> "${BOOT_DIR}/config.txt" - else - # Create temporary directory for Bluetooth sources - temp_dir=$(as_nobody mktemp -d) + fi +fi - # Fetch Bluetooth sources - as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}" +if [ "$ENABLE_BLUETOOTH" = true ] ; then + # Create temporary directory for Bluetooth sources + temp_dir=$(as_nobody mktemp -d) - # Copy downloaded sources - mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" + # Fetch Bluetooth sources + as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}" - # Raspberry-sys-mod package for /dev/serial device needed by bluetooth service - as_nobody wget -q -O "${R}/tmp/pi-bluetooth/99-com.rules" https://raw.githubusercontent.com/RPi-Distro/raspberrypi-sys-mods/master/etc.armhf/udev/rules.d/99-com.rules - # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/ - as_nobody wget -q -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth - as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth + # Copy downloaded sources + mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" - # Set permissions - chown -R root:root "${R}/tmp/pi-bluetooth" + # Raspberry-sys-mod package for /dev/serial device needed by bluetooth service + as_nobody wget -q -O "${R}/tmp/pi-bluetooth/99-com.rules" https://raw.githubusercontent.com/RPi-Distro/raspberrypi-sys-mods/master/etc.armhf/udev/rules.d/99-com.rules + # Bluetooth firmware from arch aur https://aur.archlinux.org/packages/pi-bluetooth/ + as_nobody wget -q -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth + as_nobody wget -q -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth - # Install tools - install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart" - install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper" + # Set permissions + chown -R root:root "${R}/tmp/pi-bluetooth" - # Install bluetooth udev rule - install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules" + # Install tools + install_readonly "${R}/tmp/pi-bluetooth/usr/bin/btuart" "${R}/usr/bin/btuart" + install_readonly "${R}/tmp/pi-bluetooth/usr/bin/bthelper" "${R}/usr/bin/bthelper" - # Install Firmware Flash file and apropiate licence - mkdir "${ETC_DIR}/firmware/" - install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" - install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" - install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" - install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" - # Install udev rule for bluetooth device - install_readonly "${R}/tmp/pi-bluetooth/99-com.rules" "${ETC_DIR}/udev/rules.d/99-com.rules" + # Install bluetooth udev rule + install_readonly "${R}/tmp/pi-bluetooth/lib/udev/rules.d/90-pi-bluetooth.rules" "${LIB_DIR}/udev/rules.d/90-pi-bluetooth.rules" + + # Install Firmware Flash file and apropiate licence + mkdir "${ETC_DIR}/firmware/" + install_readonly "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" + install_readonly "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" "${ETC_DIR}/firmware/LICENCE.broadcom_bcm43xx" + install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.bthelper@.service" "${ETC_DIR}/systemd/system/pi-bluetooth.bthelper@.service" + install_readonly "${R}/tmp/pi-bluetooth/debian/pi-bluetooth.hciuart.service" "${ETC_DIR}/systemd/system/pi-bluetooth.hciuart.service" + # Install udev rule for bluetooth device + install_readonly "${R}/tmp/pi-bluetooth/99-com.rules" "${ETC_DIR}/udev/rules.d/99-com.rules" - # Remove temporary directory - rm -fr "${temp_dir}" - fi + # Remove temporary directory + rm -fr "${temp_dir}" fi # Create firmware configuration and cmdline symlinks diff --git a/bootstrap.d/20-networking.sh b/bootstrap.d/20-networking.sh index 3ca9f60..3aca05f 100644 --- a/bootstrap.d/20-networking.sh +++ b/bootstrap.d/20-networking.sh @@ -107,28 +107,26 @@ if [ "$ENABLE_WIRELESS" = true ] ; then as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.bin" as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.txt" as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.clm_blob" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.clm_blob" + + # Move downloaded firmware binary blob + mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/" + + # Set permissions of the firmware binary blob + chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* + chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then # Fetch firmware binary blob for RPi3 as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" - fi - - # Move downloaded firmware binary blob - if [ "$RPI_MODEL" = 3P ] ; then - mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/" - elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then - mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" + + # Move downloaded firmware binary blob + mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" + + # Set permissions of the firmware binary blob + chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* + chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* fi # Remove temporary directory for firmware binary blob rm -fr "${temp_dir}" - - # Set permissions of the firmware binary blob - if [ "$RPI_MODEL" = 3P ] ; then - chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* - chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* - elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then - chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* - chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* - fi fi diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 30680a8..9e37246 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -112,6 +112,7 @@ APT_PROXY=${APT_PROXY:=""} APT_SERVER=${APT_SERVER:="ftp.debian.org"} # Feature settings +ENABLE_BLUETOOTH=${ENABLE_BLUETOOTH:=false} ENABLE_CONSOLE=${ENABLE_CONSOLE:=true} ENABLE_I2C=${ENABLE_I2C:=false} ENABLE_SPI=${ENABLE_SPI:=false} @@ -387,6 +388,14 @@ else fi fi +if [ "$ENABLE_BLUETOOTH" = true ] ; then + if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then + if [ "$ENABLE_CONSOLE" = false ] ; then + APT_INCLUDES="${APT_INCLUDES},bluetooth,bluez" + fi + fi +fi + # Check if root SSH (v2) public key file exists if [ -n "$SSH_ROOT_PUB_KEY" ] ; then if [ ! -f "$SSH_ROOT_PUB_KEY" ] ; then