I spent some time trying to figure out how to use hostapd in bridge mode with nfs root on osmc alpha 4. The problem is that once you add eth0 to the bridge you loose nfs.
Well, after some tests, this seems to work:
br="br0" dev="eth0" wlan="wlan0" # find the IPs on $dev and the default route ip4=$(ip addr show dev $dev | sed -e "s/ \+/ /g" -e "s/^ //g" | grep "^inet " | cut -d ' ' -f 2) ip6=$(ip addr show dev $dev | sed -e "s/ \+/ /g" -e "s/^ //g" | grep "^inet6 " | cut -d ' ' -f 2) rt=$(ip route show | sed -e "s/ \+/ /g" -e "s/^ //g" | grep ^default | grep " dev $dev") if [ -z "$ip4" -a -z "$ip6" ] then echo >&2 "Cannot find either IPv4 or IPv6 IP on eth0." exit 1 fi echo "Adding the $br bridge..." ip link add $br type bridge || exit 1 for ip in $ip4 do echo "Adding IPv4 IP $ip to the $br bridge..." ip -4 addr add $ip dev $br || exit 1 done for ip in $ip6 do echo "Adding IPv6 IP $ip to the $br bridge..." ip -6 addr add $ip dev $br || exit 1 done echo "Bringing the $br bridge UP..." ip link set dev $br up || exit 1 echo "Adding $dev to the $br bridge..." ip link set $dev master $br || exit 1 for ip in $ip4 do echo "Deleting IPv4 IP $ip from $dev..." ip -4 addr del $ip dev $dev done for ip in $ip6 do echo "Deleting IPv6 IP $ip from $dev..." ip -6 addr del $ip dev $dev done if [ ! -z "$rt" ] then rt=$(echo " $rt " | sed "s/ dev $dev / dev $br /g") echo "Adding default gateway: $rt..." ip route add $rt || ip route replace $rt fi ip link set $wlan master $br
The script uses the linux disk cache to execute the
ip commands after
ip link set $dev master $br. The nfs is actually lost after this command, but the next ones are executed without any disk access and restore it.
Ideally, it should be done with connman. However I couldn’t find any information for connman bridge configuration. It is supposed to support tethering, but I couldn’t make it work.
Anyway, I start the above script from rc.local with a delay of 150 seconds (so after the Pi has been booted and kodi has been started).