From cf37cb89e24a22e05bc649ef2971856149bf92da 2018-10-25 18:31:08 From: Unknown Date: 2018-10-25 18:31:08 Subject: [PATCH] Merge branch 'master' into RPI3B --- diff --git a/README.md b/README.md index d470b0f..1672c2a 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ A comma separated list of additional packages to be installed by apt after boots #### General system settings: ##### `RPI_MODEL`=2 -Specifiy the target Raspberry Pi hardware model. The script at this time supports the Raspberry Pi models `2` and `3`. `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` is used. +Specifiy the target Raspberry Pi hardware model. The script at this time supports the Raspberry Pi models `2`,`3` and `3B`. `BUILD_KERNEL`=true will automatically be set if the Raspberry Pi model `3` or `3B` is used. ##### `RELEASE`="jessie" Set the desired Debian release name. The script at this time supports the bootstrapping of the Debian releases "jessie", "stretch" and "buster". `BUILD_KERNEL`=true will automatically be set if the Debian releases `stretch` or `buster` are used. diff --git a/bootstrap.d/20-networking.sh b/bootstrap.d/20-networking.sh index 2229d72..ec0cfa0 100644 --- a/bootstrap.d/20-networking.sh +++ b/bootstrap.d/20-networking.sh @@ -30,10 +30,16 @@ install_readonly files/network/interfaces "${ETC_DIR}/network/interfaces" # Install configuration for interface eth0 install_readonly files/network/eth.network "${ETC_DIR}/systemd/network/eth.network" +# Install configuration for interface wl* +install_readonly files/network/wlan.network "${ETC_DIR}/systemd/network/wlan.network" + +#always with dhcp since wpa_supplicant integration is missing +sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/wlan.network" + if [ "$ENABLE_DHCP" = true ] ; then # Enable DHCP configuration for interface eth0 sed -i -e "s/DHCP=.*/DHCP=yes/" -e "/DHCP/q" "${ETC_DIR}/systemd/network/eth.network" - + # Set DHCP configuration to IPv4 only if [ "$ENABLE_IPV6" = false ] ; then sed -i "s/DHCP=.*/DHCP=v4/" "${ETC_DIR}/systemd/network/eth.network" @@ -55,10 +61,15 @@ fi # Remove empty settings from network configuration sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/eth.network" +# Remove empty settings from wlan configuration +sed -i "/.*=\$/d" "${ETC_DIR}/systemd/network/wlan.network" # Move systemd network configuration if required by Debian release if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then mv -v "${ETC_DIR}/systemd/network/eth.network" "${LIB_DIR}/systemd/network/10-eth.network" + if [ "$ENABLE_WIRELESS" = true ] ; then + mv -v "${ETC_DIR}/systemd/network/wlan.network" "${LIB_DIR}/systemd/network/11-wlan.network" + fi rm -fr "${ETC_DIR}/systemd/network" fi @@ -85,23 +96,39 @@ fi # Download the firmware binary blob required to use the RPi3 wireless interface if [ "$ENABLE_WIRELESS" = true ] ; then if [ ! -d ${WLAN_FIRMWARE_DIR} ] ; then - mkdir -p ${WLAN_FIRMWARE_DIR} + mkdir -p ${WLAN_FIRMWARE_DIR} fi # Create temporary directory for firmware binary blob temp_dir=$(as_nobody mktemp -d) - # Fetch firmware binary blob + # Fetch firmware binary blob for RPI3B+ + if [ "$RPI_MODEL" = 3B ] ; 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" + else + # 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" = 3B ] ; then + mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/" + else mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" - + fi + # Remove temporary directory for firmware binary blob rm -fr "${temp_dir}" # Set permissions of the firmware binary blob + if [ "$RPI_MODEL" = 3B ] ; then + chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* + chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* + else chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* + fi fi diff --git a/files/network/wlan.network b/files/network/wlan.network new file mode 100644 index 0000000..5f252c3 --- /dev/null +++ b/files/network/wlan.network @@ -0,0 +1,12 @@ +[Match] +Name=wlan0 + +[Network] +DHCP=no +Address= +Gateway= +DNS= +DNS= +Domains= +NTP= +NTP= diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index 7f6970b..03239dd 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -46,6 +46,8 @@ RPI2_DTB_FILE=${RPI2_DTB_FILE:=bcm2709-rpi-2-b.dtb} RPI2_UBOOT_CONFIG=${RPI2_UBOOT_CONFIG:=rpi_2_defconfig} RPI3_DTB_FILE=${RPI3_DTB_FILE:=bcm2710-rpi-3-b.dtb} RPI3_UBOOT_CONFIG=${RPI3_UBOOT_CONFIG:=rpi_3_32b_defconfig} +RPI3B_DTB_FILE=${RPI3B_DTB_FILE:=bcm2710-rpi-3-b-plus.dtb} +RPI3B_UBOOT_CONFIG=${RPI3_UBOOT_CONFIG:=rpi_3_32b_defconfig} # Debian release RELEASE=${RELEASE:=jessie} @@ -207,9 +209,6 @@ CRYPTFS_MAPPING=${CRYPTFS_MAPPING:="secure"} CRYPTFS_CIPHER=${CRYPTFS_CIPHER:="aes-xts-plain64:sha512"} CRYPTFS_XTSKEYSIZE=${CRYPTFS_XTSKEYSIZE:=512} -# Stop the Crypto Wars -DISABLE_FBI=${DISABLE_FBI:=false} - # Chroot scripts directory CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} @@ -234,16 +233,20 @@ elif [ "$RPI_MODEL" = 3 ] ; then DTB_FILE=${RPI3_DTB_FILE} UBOOT_CONFIG=${RPI3_UBOOT_CONFIG} BUILD_KERNEL=true +elif [ "$RPI_MODEL" = 3B ] ; then + DTB_FILE=${RPI3B_DTB_FILE} + UBOOT_CONFIG=${RPI3B_UBOOT_CONFIG} + BUILD_KERNEL=true else echo "error: Raspberry Pi model ${RPI_MODEL} is not supported!" exit 1 fi # Check if the internal wireless interface is supported by the RPi model -if [ "$ENABLE_WIRELESS" = true ] && [ "$RPI_MODEL" != 3 ] ; then +if [ "$ENABLE_WIRELESS" = true ] && [ "$RPI_MODEL" = 2 ]; then echo "error: The selected Raspberry Pi model has no internal wireless interface" exit 1 -fi +fi # Check if DISABLE_UNDERVOLT_WARNINGS parameter value is supported if [ ! -z "$DISABLE_UNDERVOLT_WARNINGS" ] ; then @@ -277,15 +280,10 @@ if [ "$KERNEL_CCACHE" = true ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} ccache" fi -# Stop the Crypto Wars -if [ "$DISABLE_FBI" = true ] ; then - ENABLE_CRYPTFS=true -fi - # Add cryptsetup package to enable filesystem encryption if [ "$ENABLE_CRYPTFS" = true ] && [ "$BUILD_KERNEL" = true ] ; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} cryptsetup" - APT_INCLUDES="${APT_INCLUDES},cryptsetup" + APT_INCLUDES="${APT_INCLUDES},cryptsetup,console-setup" if [ -z "$CRYPTFS_PASSWORD" ] ; then echo "error: no password defined (CRYPTFS_PASSWORD)!"