machine=dir300 target=$builddir/$machine board_prepare() { cat ./bsp/$machine/000-squashfs-image-params.patch | patch -p0 -d $target cat build_patches/dont_overwrite_wan_config.patch | patch -p0 -d $target /bin/rm $target/target/linux/atheros/base-files/etc/uci-defaults/network } board_prebuild() { # Remove fastd and configurator start on WAN event /bin/rm $target/files/etc/hotplug.d/iface/50-fastdstart /bin/rm $target/files/etc/hotplug.d/iface/51-configurator # Remove fastd /bin/rm $target/files/etc/fastdstart.sh.tpl } board_postbuild() { cp $target/bin/atheros/openwrt-atheros-root.squashfs ./bin/openwrt-$machine-root.squashfs cp $target/bin/atheros/openwrt-atheros-vmlinux.lzma ./bin/openwrt-$machine-vmlinux.lzma cp $target/bin/atheros/openwrt-atheros-combined.squashfs.img ./bin/openwrt-$machine-combined.squashfs.img } board_flash() { if [ ! "`whoami`" = "root" ] then echo "You need to be root to flash!" exit 1 fi echo "Do not plugin your router now, you will be asked to do this later!" echo "Stopping Network manager and starting normal network and tftp server..." if [ -f /etc/rc.d/networkmanager ];then /etc/rc.d/networkmanager stop /etc/rc.d/tftpd start elif [ -f /etc/init.d/networkmanager ];then /etc/init.d/networkmanager stop /etc/init.d/tftpd start elif [ -f /usr/sbin/invoke-rc.d ];then invoke-rc.d tftpd-hpa start || invoke-rc.d tftpd-hpa start || invoke-rc.d tftpd-hpa start || echo "FAILED TO START TFTD" invoke-rc.d network-manager stop elif [ -f /usr/sbin/systemctl ];then systemctl start tftpd.socket tftpd.service fi ifconfig $1 up echo "Clearing Firewall!" iptables -F iptables -P INPUT ACCEPT iptables -P OUTPUT ACCEPT echo "Flashing now! Please plugin your router into the powerline now" ./flash_tools/dir300-flash/dir300-flash.sh $1 ./bin/openwrt-$machine-vmlinux.lzma ./bin/openwrt-$machine-root.squashfs echo "Starting Networkmanager again" sleep 5; if [ -f /etc/rc.d/networkmanager ];then /etc/rc.d/networkmanager start elif [ -f /etc/init.d/networkmanager ];then /etc/init.d/networkmanager start elif [ -f /usr/sbin/invoke-rc.d ];then invoke-rc.d tftpd-hpa stop invoke-rc.d network-manager start elif [ -f /usr/sbin/systemctl ];then systemctl stop tftpd.socket tftpd.service fi } board_clean() { /bin/rm -rf $target bin/*$machine* }