Orange Pi R1 のSPIフラッシュにOSを入れてルーターにする

メニュー

hostapd

LinuxをWifiアクセスポイントにするためのアプリケーションです。

Buildroot
Target packages  --->
  Networking applications  --->
    [*] hostapd
    [*]   Enable nl80211 driver
でビルドすればインストールされます。

なくても機能しそうですが、rfkillが利用できないと起動時に警告が出ます。
kernel config
[*] Networking support  --->
  <*>   RF switch subsystem support  --->
    <*>   GPIO RFKILL driver
GPIOは必要か不明。
Buildroot
Target packages  --->
  System tools  --->
    [*] util-linux  --->
    [*]   rfkill

/etc/hostapd.conf
ssid=OPI-R1
wpa_passphrase=passphrase
interface=wlan0
auth_algs=3
channel=7
driver=nl80211
hw_mode=g

/etc/init.d/S80hostapd
#!/bin/sh


[ -f /etc/hostapd.conf ] || exit 0

case "$1" in
        start)
                printf "Starting hostapd: "
                start-stop-daemon -S -x /usr/sbin/hostapd -- -B /etc/hostapd.conf
                [ $? = 0 ] && echo "OK" || echo "FAIL"
                ;;
        stop)
                printf "Stopping hostapd: "
                start-stop-daemon -K -q -x /usr/sbin/hostapd
                [ $? = 0 ] && echo "OK" || echo "FAIL"
                ;;
        restart|reload)
                $0 stop
                sleep 1
                $0 start
                ;;
        *)
                echo "Usage: $0 {start|stop|restart}"
                exit 1
esac

exit 0
Buildrootでhostapdを入れても起動スクリプトがないので、dnsmasqの起動スクリプトを参考に作りました。
restartはsleep入れないとエラーが出ました。

/dev/random の問題が生じる場合は haveged をインストールすれば改善します。

wifiクライアントとしてよく使われるwpa_supplicantもAPモードを有効にしてビルドすればアクセスポイントとして利用できます。
[編集]   [AD]
rentafree.net