-
Notifications
You must be signed in to change notification settings - Fork 153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added firmware and modules for the wlan on RPi3 and ZeroW #470
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3e64ef3
Added firmware and required modules for the wireless network on
343a647
* Added raspberrypi.org as secondary mirror
355f8d0
Merge branch 'v1.1.x' into WirelessRPi3
diederikdehaas 8b55352
Merge branch 'v1.1.x' into WirelessRPi3
56c82ec
Merge branch 'v1.1.x' into WirelessRPi3
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,8 @@ RASPBERRYPI_ARCHIVE_KEY_FILE_NAME="raspberrypi.gpg.key" | |
RASPBERRYPI_ARCHIVE_KEY_URL="${RASPBERRYPI_ARCHIVE_KEY_DIRECTORY}/${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}" | ||
RASPBERRYPI_ARCHIVE_KEY_FINGERPRINT="CF8A1AF502A2AA2D763BAE7E82B129927FA3303E" | ||
|
||
mirror=http://archive.raspbian.org/raspbian/ | ||
mirror_raspbian="http://archive.raspbian.org/raspbian" | ||
mirror_raspberrypi="http://archive.raspberrypi.org/debian" | ||
release=jessie | ||
|
||
packages=() | ||
|
@@ -22,6 +23,7 @@ packages=() | |
packages+=("raspberrypi-bootloader-nokernel") | ||
packages+=("linux-image-${KERNEL_VERSION_RPI1}") | ||
packages+=("linux-image-${KERNEL_VERSION_RPI2}") | ||
packages+=("firmware-brcm80211") | ||
packages+=("btrfs-tools") | ||
packages+=("busybox") | ||
packages+=("cdebootstrap-static") | ||
|
@@ -75,21 +77,30 @@ packages+=("libtinfo5") | |
packages+=("libuuid1") | ||
packages+=("zlib1g") | ||
|
||
packages_found= | ||
packages_debs= | ||
packages_sha256= | ||
download_file() { | ||
local source="$1" | ||
local target="$2" | ||
local options=(-q --show-progress --no-cache) | ||
if [ -n "${target}" ] ; then | ||
options+=(-O "${target}") | ||
fi | ||
if ! wget "${options[@]}" "${source}" ; then | ||
echo -e "ERROR\nDownloading file '${source}' failed! Exiting." | ||
exit 1 | ||
fi | ||
} | ||
|
||
check_key() { | ||
# param 1 = keyfile | ||
# param 2 = key fingerprint | ||
|
||
# check input parameters | ||
if [ -z $1 ] || [ ! -f $1 ] ; then | ||
if [ -z "$1" ] || [ ! -f "$1" ] ; then | ||
echo "Parameter 1 of check_key() is not a file!" | ||
return 1 | ||
fi | ||
|
||
if [ -z $2 ] ; then | ||
if [ -z "$2" ] ; then | ||
echo "Parameter 2 of check_key() is not a key fingerprint!" | ||
return 1 | ||
fi | ||
|
@@ -100,14 +111,14 @@ check_key() { | |
echo -n "Checking key file '${KEY_FILE}'... " | ||
|
||
# check that there is only 1 public key in the key file | ||
if [ ! $(gpg --homedir gnupg --keyid-format long --with-fingerprint --with-colons ${KEY_FILE} | grep ^pub: | wc -l) -eq 1 ] ; then | ||
if [ "$(gpg --homedir gnupg --keyid-format long --with-fingerprint --with-colons "${KEY_FILE}" | grep ^pub: | wc -l)" -ne 1 ] ; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice |
||
echo "FAILED!" | ||
echo "There are zero or more than one keys in the ${KEY_FILE} key file!" | ||
return 1 | ||
fi | ||
|
||
# check that the key file's fingerprint is correct | ||
if [ "$(gpg --homedir gnupg --keyid-format long --with-fingerprint --with-colons ${KEY_FILE} | grep ^fpr: | awk -F: '{print $10}')" != "${KEY_FINGERPRINT}" ] ; then | ||
if [ "$(gpg --homedir gnupg --keyid-format long --with-fingerprint --with-colons "${KEY_FILE}" | grep ^fpr: | awk -F: '{print $10}')" != "${KEY_FINGERPRINT}" ] ; then | ||
echo "FAILED!" | ||
echo "Bad GPG key fingerprint for ${KEY_FILE}!" | ||
return 1 | ||
|
@@ -118,15 +129,14 @@ check_key() { | |
} | ||
|
||
setup_archive_keys() { | ||
|
||
mkdir -m 0700 -p gnupg | ||
# Let gpg set itself up already in the 'gnupg' dir before we actually use it | ||
echo "Setting up gpg... " | ||
gpg --homedir gnupg --list-secret-keys | ||
echo "" | ||
|
||
echo "Downloading ${RASPBIAN_ARCHIVE_KEY_FILE_NAME}." | ||
curl -# -O ${RASPBIAN_ARCHIVE_KEY_URL} | ||
download_file "${RASPBIAN_ARCHIVE_KEY_URL}" | ||
if check_key "${RASPBIAN_ARCHIVE_KEY_FILE_NAME}" "${RASPBIAN_ARCHIVE_KEY_FINGERPRINT}" ; then | ||
# GPG key checks out, thus import it into our own keyring | ||
echo -n "Importing '${RASPBIAN_ARCHIVE_KEY_FILE_NAME}' into keyring... " | ||
|
@@ -143,7 +153,7 @@ setup_archive_keys() { | |
echo "" | ||
|
||
echo "Downloading ${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}." | ||
curl -# -O ${RASPBERRYPI_ARCHIVE_KEY_URL} | ||
download_file "${RASPBERRYPI_ARCHIVE_KEY_URL}" | ||
if check_key "${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}" "${RASPBERRYPI_ARCHIVE_KEY_FINGERPRINT}" ; then | ||
# GPG key checks out, thus import it into our own keyring | ||
echo -n "Importing '${RASPBERRYPI_ARCHIVE_KEY_FILE_NAME}' into keyring..." | ||
|
@@ -158,7 +168,6 @@ setup_archive_keys() { | |
fi | ||
|
||
return 0 | ||
|
||
} | ||
|
||
required() { | ||
|
@@ -187,106 +196,142 @@ filter_package_list() { | |
download_package_list() { | ||
# Download and verify package list for $package_section, then add to Packages file | ||
# Assume that the repository's base Release file is present | ||
local source="$1" | ||
local base_url="$2" | ||
|
||
extensions=( '.xz' '.bz2' '.gz' '' ) | ||
for extension in "${extensions[@]}" ; do | ||
|
||
# Check that this extension is available | ||
if grep -q ${package_section}/binary-armhf/Packages${extension} Release ; then | ||
if grep -q "${package_section}/binary-armhf/Packages${extension}" "${source}_Release" ; then | ||
|
||
# Download Packages file | ||
echo -e "\nDownloading ${package_section} package list..." | ||
curl -# -o tmp${extension} $mirror/dists/$release/$package_section/binary-armhf/Packages${extension} | ||
if ! download_file "${base_url}/dists/${release}/${package_section}/binary-armhf/Packages${extension}" "Packages${extension}" ; then | ||
echo -e "ERROR\nDownloading '${package_section}' package list failed! Exiting." | ||
cd .. | ||
exit 1 | ||
fi | ||
|
||
# Verify the checksum of the Packages file, assuming that the last checksums in the Release file are SHA256 sums | ||
echo -n "Verifying ${package_section} package list... " | ||
if [ $(grep ${package_section}/binary-armhf/Packages${extension} Release | tail -n1 | awk '{print $1}') = \ | ||
$(sha256sum tmp${extension} | awk '{print $1}') ]; then | ||
if [ "$(grep "${package_section}/binary-armhf/Packages${extension}" "${source}_Release" | tail -n1 | awk '{print $1}')" = \ | ||
"$(sha256sum "Packages${extension}" | awk '{print $1}')" ] ; then | ||
echo "OK" | ||
else | ||
echo -e "ERROR\nThe checksum of the ${package_section}/binary-armhf/Packages${extension} file doesn't match!" | ||
echo -e "ERROR\nThe checksum of file '${package_section}/binary-armhf/Packages${extension}' doesn't match!" | ||
cd .. | ||
exit 1 | ||
fi | ||
|
||
# Decompress the Packages file | ||
if [ $extension = ".bz2" ] ; then | ||
if [ "${extension}" = ".bz2" ] ; then | ||
decompressor="bunzip2 -c " | ||
elif [ $extension = ".xz" ] ; then | ||
elif [ "${extension}" = ".xz" ] ; then | ||
decompressor="xzcat " | ||
elif [ $extension = ".gz" ] ; then | ||
elif [ "${extension}" = ".gz" ] ; then | ||
decompressor="gunzip -c " | ||
elif [ $extension = "" ] ; then | ||
elif [ "${extension}" = "" ] ; then | ||
decompressor="cat " | ||
fi | ||
${decompressor} tmp${extension} >> Packages | ||
rm tmp${extension} | ||
${decompressor} "Packages${extension}" >> "${source}_Packages" | ||
rm "Packages${extension}" | ||
break | ||
fi | ||
done | ||
} | ||
|
||
download_package_lists() { | ||
|
||
setup_archive_keys | ||
if [ $? != 0 ] ; then | ||
echo -e "ERROR\nSetting up the archives failed! Exiting." | ||
cd .. | ||
exit 1 | ||
fi | ||
local source="$1" | ||
local base_url="$2" | ||
|
||
echo -e "\nDownloading Release file and its signature..." | ||
curl -# -O $mirror/dists/$release/Release -O $mirror/dists/$release/Release.gpg | ||
download_file "${base_url}/dists/$release/Release" "${source}_Release" | ||
download_file "${base_url}/dists/$release/Release.gpg" "${source}_Release.gpg" | ||
echo -n "Verifying Release file... " | ||
if gpg --homedir gnupg --verify Release.gpg Release &> /dev/null ; then | ||
if gpg --homedir gnupg --verify "${source}_Release.gpg" "${source}_Release" &> /dev/null ; then | ||
echo "OK" | ||
else | ||
echo -e "ERROR\nBroken GPG signature on Release file!" | ||
cd .. | ||
exit 1 | ||
fi | ||
|
||
echo -n > Packages | ||
package_section=firmware | ||
download_package_list | ||
package_section=main | ||
download_package_list | ||
package_section=non-free | ||
download_package_list | ||
echo -n > "${source}_Packages" | ||
|
||
for package_section in firmware main non-free; do | ||
download_package_list "${source}" "${base_url}" | ||
done | ||
} | ||
|
||
search_for_packages() { | ||
local source="$1" | ||
local base_url="$2" | ||
|
||
while read -r k v | ||
do | ||
if [ "${k}" = "Package:" ] ; then | ||
current_package="${v}" | ||
elif [ "${k}" = "Filename:" ] ; then | ||
current_filename="${v}" | ||
elif [ "${k}" = "SHA256:" ] ; then | ||
current_sha256="${v}" | ||
elif [ "${k}" = "" ] ; then | ||
if required "$current_package" ; then | ||
printf " %-32s %s\n" "${current_package}" "$(basename "${current_filename}")" | ||
unset_required "${current_package}" | ||
packages_debs+=("${base_url}/${current_filename}") | ||
packages_sha256+=("${current_sha256} $(basename "${current_filename}")") | ||
allfound && break | ||
fi | ||
|
||
current_package= | ||
current_filename= | ||
current_sha256= | ||
fi | ||
done < <(filter_package_list <"${source}_Packages") | ||
} | ||
|
||
download_packages() { | ||
echo -e "\nDownloading packages..." | ||
if ! wget -q --show-progress --no-cache -- "${packages_debs[@]}" ; then | ||
echo -e "ERROR\nDownloading packages failed! Exiting." | ||
cd .. | ||
exit 1 | ||
fi | ||
|
||
echo -ne "\nVerifying downloaded packages... " | ||
printf "%s\n" "${packages_sha256[@]}" > SHA256SUMS | ||
if sha256sum --quiet -c SHA256SUMS; then | ||
echo "OK" | ||
else | ||
echo -e "ERROR\nThe checksums of the downloaded packages don't match the package lists!" | ||
cd .. | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Setup | ||
rm -rf packages/ | ||
mkdir packages | ||
cd packages | ||
mkdir packages/ && cd packages | ||
|
||
download_package_lists | ||
if ! setup_archive_keys ; then | ||
echo -e "ERROR\nSetting up the archives failed! Exiting." | ||
exit 1 | ||
fi | ||
|
||
packages_debs=() | ||
packages_sha256=() | ||
## Download package list | ||
download_package_lists raspberry "${mirror_raspberrypi}" | ||
download_package_lists raspbian "${mirror_raspbian}" | ||
|
||
## Select packages for download | ||
echo -e "\nSearching for required packages..." | ||
while read k v | ||
do | ||
if [ "$k" = "Package:" ]; then | ||
current_package=$v | ||
elif [ "$k" = "Filename:" ]; then | ||
current_filename=$v | ||
elif [ "$k" = "SHA256:" ]; then | ||
current_sha256=$v | ||
elif [ "$k" = "" ]; then | ||
if required $current_package; then | ||
printf " %-32s %s\n" $current_package $(basename $current_filename) | ||
unset_required $current_package | ||
packages_debs+=("${mirror}${current_filename}") | ||
packages_sha256+=("${current_sha256} $(basename ${current_filename})") | ||
allfound && break | ||
fi | ||
|
||
current_package= | ||
current_filename= | ||
current_sha256= | ||
fi | ||
done < <(filter_package_list <Packages) | ||
packages_debs=() | ||
packages_sha256=() | ||
|
||
search_for_packages raspberry "${mirror_raspberrypi}" | ||
search_for_packages raspbian "${mirror_raspbian}" | ||
|
||
if ! allfound ; then | ||
echo "ERROR: Unable to find all required packages in package list!" | ||
|
@@ -295,17 +340,7 @@ if ! allfound ; then | |
exit 1 | ||
fi | ||
|
||
echo -e "\nDownloading packages..." | ||
curl -# --remote-name-all ${packages_debs[@]} | ||
|
||
echo -n "Verifying downloaded packages... " | ||
printf "%s\n" "${packages_sha256[@]}" > SHA256SUMS | ||
if sha256sum --quiet -c SHA256SUMS ; then | ||
echo "OK" | ||
else | ||
echo -e "ERROR\nThe checksums of the downloaded packages don't match the package lists!" | ||
cd .. | ||
exit 1 | ||
fi | ||
## Download selected packages | ||
download_packages | ||
|
||
cd .. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My concern here: Please look at lines 335-346, 605-612 & 1120-1127 -- which (also) supports WiFi dongles -- and confirm that these pieces of code will work together with your change.
I have no possibility to test this anymore :-(
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirmed.
This just installs another package with firmware blobs, which are used by the driver if needed.
The other sections install the program wpa_supplicant, which is needed as well. It handles the actual wireless connections in user mode for both on-board WiFi and dongles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Thanks