From cb7e8e01bebe13416c30b0957f7293ccbe7ed2c3 2018-11-19 16:51:23 From: burnbabyburn <2515038+burnbabyburn@users.noreply.github.com> Date: 2018-11-19 16:51:23 Subject: [PATCH] Merge pull request #5 from drtyhlpr/master pullback --- diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 031776b..8b1bc3b 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -99,6 +99,49 @@ 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) + + # Fetch Bluetooth sources + as_nobody git -C "${temp_dir}" clone "${BLUETOOTH_URL}" + + # Copy downloaded sources + mv "${temp_dir}/pi-bluetooth" "${R}/tmp/" + + # Set permissions + chown -R root:root "${R}/tmp/pi-bluetooth" + + # Install files to chroot + # 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 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" + #aur + #install_readonly "${R}/tmp/pi-bluetooth/50-bluetooth-hci-auto-poweron.rules" "${ETC_DIR}/udev/rules.d/50-bluetooth-hci-auto-poweron.rules" + + # Install Firmware Flash file and apropiate licence + mkdir "${ETC_DIR}/firmware/" + + #aur https://aur.archlinux.org/packages/pi-bluetooth/ + #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/BCM43430A1.hcd" + + wget -O "${R}/tmp/pi-bluetooth/LICENCE.broadcom_bcm43xx" https://aur.archlinux.org/cgit/aur.git/plain/LICENCE.broadcom_bcm43xx?h=pi-bluetooth + wget -O "${R}/tmp/pi-bluetooth/BCM43430A1.hcd" https://aur.archlinux.org/cgit/aur.git/plain/BCM43430A1.hcd?h=pi-bluetooth + + # Install systemd service for bluetooth + #install_readonly "${R}/tmp/pi-bluetooth/brcm43438.service" "${ETC_DIR}/systemd/system/brcm43438.service" + + # Remove temporary directory + #rm -fr "${temp_dir}" + + # Get /dev/serial back for compability + # Raspberry-sys-mod package + wget -O "${ETC_DIR}/udev/rules.d/99-com.rules" https://raw.githubusercontent.com/RPi-Distro/raspberrypi-sys-mods/master/etc.armhf/udev/rules.d/99-com.rules + fi fi @@ -107,17 +150,17 @@ ln -sf firmware/config.txt "${R}/boot/config.txt" ln -sf firmware/cmdline.txt "${R}/boot/cmdline.txt" # Install and setup kernel modules to load at boot -mkdir -p "${R}/lib/modules-load.d/" -install_readonly files/modules/rpi2.conf "${R}/lib/modules-load.d/rpi2.conf" +mkdir -p "${LIB_DIR}/modules-load.d/" +install_readonly files/modules/rpi2.conf "${LIB_DIR}/modules-load.d/rpi2.conf" # Load hardware random module at boot if [ "$ENABLE_HWRANDOM" = true ] && [ "$BUILD_KERNEL" = false ] ; then - sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${R}/lib/modules-load.d/rpi2.conf" + sed -i "s/^# bcm2708_rng/bcm2708_rng/" "${LIB_DIR}/modules-load.d/rpi2.conf" fi # Load sound module at boot if [ "$ENABLE_SOUND" = true ] ; then - sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${R}/lib/modules-load.d/rpi2.conf" + sed -i "s/^# snd_bcm2835/snd_bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf" else echo "dtparam=audio=off" >> "${BOOT_DIR}/config.txt" fi @@ -125,16 +168,16 @@ fi # Enable I2C interface if [ "$ENABLE_I2C" = true ] ; then echo "dtparam=i2c_arm=on" >> "${BOOT_DIR}/config.txt" - sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${R}/lib/modules-load.d/rpi2.conf" - sed -i "s/^# i2c-dev/i2c-dev/" "${R}/lib/modules-load.d/rpi2.conf" + sed -i "s/^# i2c-bcm2708/i2c-bcm2708/" "${LIB_DIR}/modules-load.d/rpi2.conf" + sed -i "s/^# i2c-dev/i2c-dev/" "${LIB_DIR}/modules-load.d/rpi2.conf" fi # Enable SPI interface if [ "$ENABLE_SPI" = true ] ; then echo "dtparam=spi=on" >> "${BOOT_DIR}/config.txt" - echo "spi-bcm2708" >> "${R}/lib/modules-load.d/rpi2.conf" + echo "spi-bcm2708" >> "${LIB_DIR}/modules-load.d/rpi2.conf" if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then - sed -i "s/spi-bcm2708/spi-bcm2835/" "${R}/lib/modules-load.d/rpi2.conf" + sed -i "s/spi-bcm2708/spi-bcm2835/" "${LIB_DIR}/modules-load.d/rpi2.conf" fi fi diff --git a/bootstrap.d/16-videocore.sh b/bootstrap.d/16-videocore.sh index 8621560..026b9ee 100644 --- a/bootstrap.d/16-videocore.sh +++ b/bootstrap.d/16-videocore.sh @@ -9,7 +9,7 @@ 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" + cp -r "${VIDEOCORESRC_DIR}" "${R}/tmp/userland" else # Create temporary directory for U-Boot sources temp_dir=$(as_nobody mktemp -d) @@ -26,8 +26,26 @@ if [ "$ENABLE_VIDEOCORE" = true ] ; then # Remove temporary directory for U-Boot sources rm -fr "${temp_dir}" fi + + # Create build dir + mkdir "${R}"/tmp/userland/build + # push us to build directory + pushd "${R}"/tmp/userland/build - 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 + if [ "$RELEASE_ARCH" = "arm64" ] ; then + 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 -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" + fi + + if [ "$RELEASE_ARCH" = "armel" ] ; then + cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_C_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabi-g++ -DCMAKE_ASM_COMPILER=arm-linux-gnueabi-gcc -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -U_FORTIFY_SOURCE" -DCMAKE_ASM_FLAGS="${CMAKE_ASM_FLAGS} -c" -DCMAKE_SYSTEM_PROCESSOR="arm" -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" + fi + + if [ "$RELEASE_ARCH" = "armhf" ] ; then + cmake -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_BUILD_TYPE=release -DCMAKE_TOOLCHAIN_FILE="${R}"/tmp/userland/makefiles/cmake/toolchains/arm-linux-gnueabihf.cmake -DVIDEOCORE_BUILD_DIR="${R}" "${R}/tmp/userland" + fi + + #build userland make -j "$(nproc)" - chroot_exec PATH="${PATH}":/opt/vc/bin + #pop us out of build dir + popd fi diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 04de63a..7bb82c1 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -104,6 +104,7 @@ 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} +BLUETOOTH_URL=${BLUETOOTH_URL:=https://github.com/RPi-Distro/pi-bluetooth.git} # Build directories BASEDIR=${BASEDIR:=$(pwd)/images/${RELEASE}}