-
Notifications
You must be signed in to change notification settings - Fork 42
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
Hostap update for Orange Pi #106
Changes from 11 commits
9c70f91
f21c96f
5585290
37d527f
0d996f3
be70244
dd1d5bc
18153d9
165d30f
66bb95c
7826520
0f17ffb
d1794da
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
interface=wlan0 | ||
dhcp-range=10.0.0.2,10.0.0.127,255.255.255.0,12h | ||
bind-interfaces |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,7 @@ set -e | |
BASE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
|
||
# Install hostapd and dnsmasq to run IEEE 802.11 Access Point | ||
if ! [ "$(which hostapd)" ] || ! [ "$(which dnsmasq)" ]; then | ||
sudo apt-get install hostapd dnsmasq radvd -y | ||
fi | ||
sudo apt-get install hostapd dnsmasq radvd dnsmasq iptables -y | ||
|
||
# Configure wlan0 interface | ||
sudo cp /etc/network/interfaces /etc/network/interfaces.backup | ||
|
@@ -16,6 +14,7 @@ if [ ! -z $START ]; then | |
END=$(expr $START + 3) | ||
sudo sed -i "${START},${END}d" /etc/network/interfaces | ||
fi | ||
|
||
echo "" | sudo tee --append /etc/network/interfaces > /dev/null | ||
echo "allow-hotplug wlan0" | sudo tee --append /etc/network/interfaces > /dev/null | ||
echo "iface wlan0 inet static" | sudo tee --append /etc/network/interfaces > /dev/null | ||
|
@@ -26,6 +25,8 @@ echo " broadcast 10.0.0.255" | sudo tee --append /etc/network/interfaces > /d | |
echo "iface wlan0 inet6 static" | sudo tee --append /etc/network/interfaces > /dev/null | ||
echo " address fdfc::2" | sudo tee --append /etc/network/interfaces > /dev/null | ||
echo " netmask 64" | sudo tee --append /etc/network/interfaces > /dev/null | ||
echo "allow-hotplug eth0" | sudo tee --append /etc/network/interfaces > /dev/null | ||
echo "iface eth0 inet dhcp" | sudo tee --append /etc/network/interfaces > /dev/null | ||
|
||
# Enable packet forwarding | ||
sudo cp /etc/sysctl.conf /etc/sysctl.conf.backup | ||
|
@@ -73,16 +74,28 @@ else | |
fi | ||
|
||
# Configure DHCP with dnsmasq | ||
sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.backup | ||
if [ -f /etc/dnsmasq.conf ]; then | ||
sudo cp /etc/dnsmasq.conf /etc/dnsmasq.conf.backup | ||
fi | ||
sudo cp "$BASE_DIR/dnsmasq.conf" /etc/dnsmasq.conf | ||
sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.backup | ||
sudo echo "" | sudo tee --append /etc/dhcpcd.conf > /dev/null | ||
sudo echo "denyinterfaces wlan0" | sudo tee --append /etc/dhcpcd.conf > /dev/null | ||
|
||
|
||
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. Please do not have random newlines everywhere. |
||
if [ -f /etc/dhcpcd.conf ]; then | ||
sudo cp /etc/dhcpcd.conf /etc/dhcpcd.conf.backup | ||
sudo echo "" | sudo tee --append /etc/dhcpcd.conf > /dev/null | ||
sudo echo "denyinterfaces wlan0" | sudo tee --append /etc/dhcpcd.conf > /dev/null | ||
fi | ||
|
||
# Configure IPv6 router advertisement with radvd | ||
sudo cp "$BASE_DIR/radvd.conf" /etc/radvd.conf | ||
|
||
# Enable hostapd service | ||
if [ -f /etc/default/hostapd ]; then | ||
|
||
sed '\?^DAEMON_CONF?d' /etc/default/hostapd | sudo tee /etc/default/hostapd > /dev/null | ||
sudo echo DAEMON_CONF="/etc/hostapd.conf" | sudo tee --append /etc/default/hostapd > /dev/null | ||
fi | ||
|
||
sudo cp "$BASE_DIR/hostapd.service" /etc/systemd/system/hostapd.service | ||
sudo systemctl daemon-reload | ||
sudo systemctl enable hostapd.service | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,18 @@ BOARD_REVISION="?" | |
CJDNS_BUILD_CMD="sudo Seccomp_NO=1 NO_NEON=1 ./do" | ||
BOARD_HARDWARE=$(cat /proc/cpuinfo | grep Hardware | awk '{print $3}' | head -n 1) | ||
|
||
ALLOW_HOSTAP=false #Flag for prompt of hostap | ||
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.
|
||
|
||
# Possibly use /sys/firmware/devicetree/base/model | ||
if [[ "$BOARD_HARDWARE" == 'Allwinner' || "$BOARD_HARDWARE" == 'Generic' ]]; then | ||
if [[ "$BOARD_HARDWARE" == 'Allwinner' || "$BOARD_HARDWARE" == 'Generic' ]]; then | ||
BOARD_FAMILY="Orange Pi" | ||
BOARD_NAME=$(grep BOARD_NAME /etc/armbian-image-release | awk -F \= '{print $2}' | tr -d \" | sed 's/Orange Pi //g') | ||
BOARD_REVISION="experimental" | ||
if [[ '$BOARD_NAME' == 'Zero' ]]; then | ||
if [[ "$BOARD_NAME" == "Zero" ]]; then | ||
CJDNS_BUILD_CMD="sudo Seccomp_NO=1 CFLAGS=\"-s -static -Wall -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -fomit-frame-pointer -marm\" ./do" | ||
if [ "$(lsmod | grep xradio_wlan)" ]; then #If board already support xradio, let it install hostapd | ||
ALLOW_HOSTAP=true | ||
fi | ||
else | ||
CJDNS_BUILD_CMD="sudo Seccomp_NO=1 CFLAGS=\"-s -static -Wall -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard -fomit-frame-pointer -marm\" ./do" | ||
fi | ||
|
@@ -41,6 +46,7 @@ else | |
elif [[ $BOARD_REVISION == *"a02082"* || $BOARD_REVISION == *"a22082"* ]]; then | ||
BOARD_NAME="3" | ||
CJDNS_BUILD_CMD="sudo NO_TEST=1 CFLAGS=\"-march=armv8-a+crc -mtune=cortex-a53 -mfpu=crypto-neon-fp-armv8 -mfloat-abi=hard\" ./do" | ||
ALLOW_HOSTAP=true #has onboard wifi, use it | ||
fi | ||
fi | ||
|
||
|
@@ -61,6 +67,9 @@ if [[ $BOARD_FAMILY == "Orange Pi" ]]; then | |
wget http://apt.armbian.com/pool/main/l/linux-4.10.0-sun8i/linux-image-dev-sun8i_5.26_armhf.deb | ||
sudo dpkg -i linux-image-dev-sun8i_5.26_armhf.deb | ||
rm -rf linux-image-dev-sun8i_5.26_armhf.deb | ||
ALLOW_HOSTAP=true #downgrading kernel, allow hostapd | ||
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. The downgrade is still needed here? |
||
else | ||
ALLOW_HOSTAP=false #Zero is not downgraded from broken kernel, dont allow hostap | ||
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.
|
||
fi | ||
fi | ||
fi | ||
|
@@ -78,7 +87,7 @@ if [ -z "$WITH_MESH_POINT" -o "$WITH_MESH_POINT" != "true" -a "$WITH_MESH_POINT" | |
WITH_MESH_POINT=true | ||
fi | ||
fi | ||
if [[ $BOARD_REVISION == *"a02082"* || $BOARD_REVISION == *"a22082"* ]] && [ -z "$WITH_WIFI_AP" -o "$WITH_WIFI_AP" != "true" -a "$WITH_WIFI_AP" != "false" ]; then | ||
if [[ "$ALLOW_HOSTAP" == "true" ]] && [ -z "$WITH_WIFI_AP" -o "$WITH_WIFI_AP" != "true" -a "$WITH_WIFI_AP" != "false" ]; then | ||
read -p "Configure WiFi Access Point (Y/n)? " -n 1 -r | ||
echo "" | ||
if [[ $REPLY =~ ^[Nn]$ ]]; then | ||
|
@@ -246,7 +255,7 @@ if [ ! -z "$WITH_MESH_POINT" -a "$WITH_MESH_POINT" == "true" ]; then | |
fi | ||
|
||
# WiFi Access Point on RPi3 | ||
if [[ $BOARD_REVISION == *"a02082"* || $BOARD_REVISION == *"a22082"* ]] && [ ! -z "$WITH_WIFI_AP" -a "$WITH_WIFI_AP" == "true" ]; then | ||
if [[ "$ALLOW_HOSTAP" == "true" ]] && [ ! -z "$WITH_WIFI_AP" -a "$WITH_WIFI_AP" == "true" ]; then | ||
source hostapd/install | ||
fi | ||
|
||
|
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.
# Install packages to run IEEE 802.11 Access Point
anddnsmasq
is doubled