mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-09 18:45:54 +02:00
add swconfig for lamobo-r1 switch setup.
This commit is contained in:
@@ -117,6 +117,7 @@ etc/rc.d/init.d/sshd
|
||||
etc/rc.d/init.d/static-routes
|
||||
#etc/rc.d/init.d/stunnel
|
||||
etc/rc.d/init.d/swap
|
||||
etc/rc.d/init.d/swconfig
|
||||
etc/rc.d/init.d/sysctl
|
||||
etc/rc.d/init.d/sysklogd
|
||||
etc/rc.d/init.d/teamspeak
|
||||
@@ -223,6 +224,7 @@ etc/rc.d/rcsysinit.d/S45udev_retry
|
||||
etc/rc.d/rcsysinit.d/S50cleanfs
|
||||
etc/rc.d/rcsysinit.d/S60setclock
|
||||
etc/rc.d/rcsysinit.d/S70console
|
||||
etc/rc.d/rcsysinit.d/S73swconfig
|
||||
etc/rc.d/rcsysinit.d/S75firstsetup
|
||||
etc/rc.d/rcsysinit.d/S80localnet
|
||||
etc/rc.d/rcsysinit.d/S85firewall
|
||||
|
||||
1
config/rootfiles/common/armv5tel/swconfig
Normal file
1
config/rootfiles/common/armv5tel/swconfig
Normal file
@@ -0,0 +1 @@
|
||||
usr/bin/swconfig
|
||||
1
config/rootfiles/core/86/filelists/armv5tel/swconfig
Symbolic link
1
config/rootfiles/core/86/filelists/armv5tel/swconfig
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../common/armv5tel/swconfig
|
||||
@@ -1,7 +1,7 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2010 IPFire Team <info@ipfire.org> #
|
||||
# Copyright (C) 2007-2015 IPFire Team <info@ipfire.org> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
@@ -194,10 +194,12 @@ $(TARGET) :
|
||||
ln -sf any /etc/rc.d/init.d/networking/$$i; \
|
||||
done
|
||||
|
||||
# ARM does not need checkfstab and acpid
|
||||
# ARM does not need checkfstab and acpid, intel no swconfig
|
||||
ifeq "$(MACHINE_TYPE)" "arm"
|
||||
rm -vf /etc/rc.d/init.d/{acpid,checkfstab}
|
||||
ln -sf ../init.d/swconfig /etc/rc.d/rcsysinit.d/S73swconfig
|
||||
else
|
||||
rm -vf /etc/rc.d/init.d/swconfig
|
||||
ln -sf ../init.d/acpid /etc/rc.d/rc3.d/S12acpid
|
||||
ln -sf ../init.d/acpid /etc/rc.d/rc0.d/K87acpid
|
||||
ln -sf ../init.d/acpid /etc/rc.d/rc6.d/K87acpid
|
||||
|
||||
@@ -174,6 +174,9 @@ ifeq "$(KCFG)" "-multi"
|
||||
|
||||
# After next kernel update this patch will included to arm7-multi patchset.
|
||||
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/linux-3.14.x-lamobo-r1.patch
|
||||
|
||||
# Install switch api userspace header
|
||||
cd $(DIR_APP) && install -v -m644 include/uapi/linux/switch.h /usr/include/linux/
|
||||
endif
|
||||
|
||||
ifeq "$(KCFG)" "-rpi"
|
||||
|
||||
77
lfs/swconfig
Normal file
77
lfs/swconfig
Normal file
@@ -0,0 +1,77 @@
|
||||
###############################################################################
|
||||
# #
|
||||
# IPFire.org - A linux based firewall #
|
||||
# Copyright (C) 2007-2015 IPFire Team <info@ipfire.org> #
|
||||
# #
|
||||
# This program is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or #
|
||||
# (at your option) any later version. #
|
||||
# #
|
||||
# This program is distributed in the hope that it will be useful, #
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
|
||||
# GNU General Public License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU General Public License #
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. #
|
||||
# #
|
||||
###############################################################################
|
||||
|
||||
###############################################################################
|
||||
# Definitions
|
||||
###############################################################################
|
||||
|
||||
include Config
|
||||
|
||||
VER = 001
|
||||
|
||||
THISAPP = swconfig-$(VER)
|
||||
DL_FILE = $(THISAPP).tar.xz
|
||||
DL_FROM = $(URL_IPFIRE)
|
||||
DIR_APP = $(DIR_SRC)/$(THISAPP)
|
||||
TARGET = $(DIR_INFO)/$(THISAPP)
|
||||
SUP_ARCH = armv5tel
|
||||
|
||||
###############################################################################
|
||||
# Top-level Rules
|
||||
###############################################################################
|
||||
|
||||
objects = $(DL_FILE)
|
||||
|
||||
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
|
||||
|
||||
$(DL_FILE)_MD5 = c35919a05fc82b3f8b311da8dfc2cd3e
|
||||
|
||||
install : $(TARGET)
|
||||
|
||||
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
|
||||
|
||||
download :$(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
|
||||
md5 : $(subst %,%_MD5,$(objects))
|
||||
|
||||
###############################################################################
|
||||
# Downloading, checking, md5sum
|
||||
###############################################################################
|
||||
|
||||
$(patsubst %,$(DIR_CHK)/%,$(objects)) :
|
||||
@$(CHECK)
|
||||
|
||||
$(patsubst %,$(DIR_DL)/%,$(objects)) :
|
||||
@$(LOAD)
|
||||
|
||||
$(subst %,%_MD5,$(objects)) :
|
||||
@$(MD5)
|
||||
|
||||
###############################################################################
|
||||
# Installation Details
|
||||
###############################################################################
|
||||
|
||||
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
|
||||
@$(PREBUILD)
|
||||
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar axf $(DIR_DL)/$(DL_FILE)
|
||||
cd $(DIR_APP) && make $(MAKETUNING)
|
||||
cd $(DIR_APP) && install -v -m755 swconfig /usr/bin/
|
||||
@rm -rf $(DIR_APP)
|
||||
@$(POSTBUILD)
|
||||
1
make.sh
1
make.sh
@@ -809,6 +809,7 @@ buildipfire() {
|
||||
ipfiremake squid-accounting
|
||||
ipfiremake pigz
|
||||
ipfiremake tmux
|
||||
ipfiremake swconfig
|
||||
}
|
||||
|
||||
buildinstaller() {
|
||||
|
||||
79
src/initscripts/init.d/swconfig
Normal file
79
src/initscripts/init.d/swconfig
Normal file
@@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
########################################################################
|
||||
# Begin $rc_base/init.d/swconfig
|
||||
#
|
||||
# Description : Script to setup lan switch.
|
||||
# don't edit this script! If you want change the functions
|
||||
# create an own script called swconfig.user
|
||||
########################################################################
|
||||
|
||||
. /etc/sysconfig/rc
|
||||
. ${rc_functions}
|
||||
|
||||
if [ -e /etc/init.d/swconfig.user ]; then
|
||||
/etc/init.d/swconfig.user $*
|
||||
exit ${?}
|
||||
fi
|
||||
|
||||
if [ -e /var/ipfire/ethernet/swconfig_mac ]; then
|
||||
SWMAC=`cat /var/ipfire/ethernet/swconfig_mac`
|
||||
else
|
||||
# Generate a random local administrated mac address for vlan swconfig.
|
||||
SWMAC=`printf "%1x2:%02x:%02x:%02x:%02x" $[RANDOM%16] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256] $[RANDOM%256]`
|
||||
echo $SWMAC > /var/ipfire/ethernet/swconfig_mac
|
||||
fi
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
case `cat /proc/device-tree/model` in
|
||||
"Lamobo-R1")
|
||||
#
|
||||
# Lamobo R1 aka BPi R1 Routerboard
|
||||
#
|
||||
# Speaker | LAN1 | LAN2 | LAN3 | LAN4 || LAN5 | HDMI
|
||||
# SW-Port | P2 | P1 | P0 | P4 || P3 |
|
||||
# VLAN | 11 | 12 | 13 | 14 ||ALL(t)|
|
||||
#
|
||||
# Switch-Port P8 - ALL(t) boards internal CPU Port
|
||||
#
|
||||
device=`ls /sys/class/net/*/device/stmmac-0* | head -1 | cut -d/ -f5`
|
||||
ip link set $device up
|
||||
boot_mesg "Configure vlan-switch on $device ..."
|
||||
# Reset switch, counter and enable vlan mode
|
||||
swconfig dev $device set reset 1
|
||||
swconfig dev $device set reset_mib 1
|
||||
swconfig dev $device set enable_vlan 1
|
||||
# configure vlans
|
||||
swconfig dev $device vlan 11 set ports "2 3t 8t"
|
||||
swconfig dev $device vlan 12 set ports "1 3t 8t"
|
||||
swconfig dev $device vlan 13 set ports "0 3t 8t"
|
||||
swconfig dev $device vlan 14 set ports "4 3t 8t"
|
||||
# activate new config
|
||||
swconfig dev $device set apply 1
|
||||
# create interfaces for the vlan's
|
||||
modprobe 8021q
|
||||
vconfig add $device 11
|
||||
vconfig add $device 12
|
||||
vconfig add $device 13
|
||||
vconfig add $device 14
|
||||
# set local mac addresses.
|
||||
ip link set dev $device.11 address $SWMAC:11
|
||||
ip link set dev $device.12 address $SWMAC:12
|
||||
ip link set dev $device.13 address $SWMAC:13
|
||||
ip link set dev $device.14 address $SWMAC:14
|
||||
# need to restart udev...
|
||||
killall udevd
|
||||
/etc/init.d/udev start
|
||||
;;
|
||||
esac
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: ${0} {start}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# End $rc_base/init.d/swconfig
|
||||
|
||||
Reference in New Issue
Block a user