├── .gdbinit ├── .gdbinit.py ├── .github └── workflows │ ├── build.yml │ └── release.yml ├── .gitignore ├── .gitmodules ├── Config.in ├── HACKING.md ├── Makefile ├── README.md ├── board ├── app │ ├── busybox.fragment │ └── rootfs │ │ └── etc │ │ ├── fstab │ │ └── network │ │ └── interfaces ├── basis │ ├── README.md │ ├── linux_defconfig │ └── post-image.sh ├── byron │ ├── README.md │ ├── linux_defconfig │ └── post-image.sh ├── common │ ├── busybox.config │ ├── gns3.tmpl │ ├── post-build.sh │ ├── post-image.sh │ ├── rootfs │ │ ├── .hushlogin │ │ ├── bin │ │ │ ├── help │ │ │ └── show │ │ ├── etc │ │ │ ├── finit.d │ │ │ │ └── system-init.conf │ │ │ ├── fstab │ │ │ ├── iproute2 │ │ │ │ └── group │ │ │ ├── mdev.conf │ │ │ ├── motd │ │ │ ├── network │ │ │ │ ├── interfaces │ │ │ │ └── interfaces.d │ │ │ │ │ └── .emtpy │ │ │ ├── profile.d │ │ │ │ ├── convenience.sh │ │ │ │ ├── ls.sh │ │ │ │ ├── ps1.sh │ │ │ │ └── resize.sh │ │ │ ├── rc.local │ │ │ ├── resolv.conf │ │ │ └── syslog.conf │ │ ├── host │ │ │ └── .empty │ │ ├── lib │ │ │ └── system │ │ │ │ ├── ident │ │ │ │ ├── if │ │ │ │ ├── leds │ │ │ │ └── mnt │ │ ├── log │ │ └── usr │ │ │ ├── sbin │ │ │ └── upgrade │ │ │ └── share │ │ │ ├── udhcpc │ │ │ └── default.script │ │ │ └── zcip │ │ │ └── default.script │ ├── users_table.txt │ └── xattrs ├── coronet │ ├── linux_defconfig │ └── post-image.sh ├── dagger │ ├── README.md │ ├── linux_defconfig │ └── post-image.sh ├── ember │ ├── README.md │ ├── linux_defconfig │ └── post-image.sh ├── envoy │ ├── README.md │ ├── genimage.cfg │ ├── linux_defconfig │ ├── post-image.sh │ └── rootfs │ │ ├── etc │ │ └── finit.d │ │ │ ├── available │ │ │ └── poe-supervision.conf │ │ │ └── system-envoy.conf │ │ └── lib │ │ └── system │ │ └── envoy │ │ ├── if │ │ ├── init-envious │ │ └── poe-supervision └── zero │ ├── genimage.cfg │ ├── isolinux.cfg │ ├── linux_defconfig │ └── post-image.sh ├── configs ├── include │ ├── app.m4 │ ├── base.m4 │ ├── defs.m4 │ ├── os.m4 │ ├── plat-basis.m4 │ ├── plat-byron.m4 │ ├── plat-coronet.m4 │ ├── plat-dagger.m4 │ ├── plat-ember.m4 │ ├── plat-envoy.m4 │ ├── plat-zero.m4 │ ├── toolchain-bootlin-app.m4 │ └── toolchain-bootlin-os.m4 ├── netbox_app_basis_defconfig.m4 ├── netbox_app_byron_defconfig.m4 ├── netbox_app_coronet_defconfig.m4 ├── netbox_app_dagger_defconfig.m4 ├── netbox_app_ember_defconfig.m4 ├── netbox_app_envoy_defconfig.m4 ├── netbox_app_zero_defconfig.m4 ├── netbox_os_basis_defconfig.m4 ├── netbox_os_byron_defconfig.m4 ├── netbox_os_coronet_defconfig.m4 ├── netbox_os_dagger_defconfig.m4 ├── netbox_os_ember_defconfig.m4 ├── netbox_os_envoy_defconfig.m4 └── netbox_os_zero_defconfig.m4 ├── doc └── igmp-seminar │ ├── README.md │ ├── join.sh │ ├── net.sh │ └── topology.dot.in ├── dts ├── Makefile ├── basis │ └── 0000-default │ │ └── device-tree.dts ├── byron │ ├── 0000-default │ │ └── device-tree.dts │ ├── 0001-sam9x │ │ └── device-tree.dts │ └── 0002-sama5 │ │ └── device-tree.dts ├── coronet │ ├── 0000-default │ │ └── device-tree.dts │ ├── 0001-viper-tbn │ │ └── device-tree.dts │ ├── 0002-viper-212a │ │ └── device-tree.dts │ └── 0003-viper-220a │ │ └── device-tree.dts ├── dagger │ └── 0000-default │ │ └── device-tree.dts ├── ember │ ├── 0000-default │ │ └── device-tree.dts │ └── 0001-sparx5-135-emmc │ │ └── device-tree.dts ├── envoy │ ├── 0000-default │ │ └── device-tree.dts │ └── 0001-imx8mn-peridot │ │ └── device-tree.dts └── include │ ├── basis │ ├── base.dtsi │ ├── lynx-cpu.dtsi │ └── lynx-power.dtsi │ ├── common │ ├── mv6.h │ ├── peridot-db.dtsi │ └── system-flash │ │ ├── 128M-dual.dtsi │ │ ├── 32M-dual.dtsi │ │ └── 32M-single.dtsi │ └── coronet │ ├── a-common.dtsi │ ├── a12-cpu.dtsi │ ├── a20-cpu.dtsi │ ├── base.dtsi │ ├── t1023-post.dtsi │ ├── tbn-chan0-rgmii.dtsi │ ├── tbn-chan0-sgmii.dtsi │ └── tbn-cpu.dtsi ├── external.desc ├── external.mk ├── package ├── Config.in ├── brist │ ├── Config.in │ ├── brist.hash │ └── brist.mk ├── factory │ ├── Config.in │ └── factory.mk ├── finit │ ├── Config.in │ ├── finit.hash │ └── finit.mk ├── libnsh │ ├── Config.in │ └── libnsh.mk ├── mcjoin │ ├── Config.in │ ├── mcjoin.hash │ └── mcjoin.mk ├── mdnsd-finit │ ├── Config.in │ ├── mdnsd-finit.mk │ └── mdnsd-finit.svc ├── nemesis │ ├── Config.in │ ├── nemesis.hash │ └── nemesis.mk ├── querierd │ ├── Config.in │ ├── querierd.conf │ ├── querierd.hash │ ├── querierd.mk │ └── querierd.svc ├── skeleton-init-finit │ ├── Config.in │ ├── skeleton-init-finit.mk │ └── skeleton │ │ ├── etc │ │ ├── default │ │ │ ├── gdbserver │ │ │ ├── querierd │ │ │ └── sysklogd │ │ ├── finit.conf │ │ ├── finit.d │ │ │ ├── available │ │ │ │ ├── dnsmasq.conf │ │ │ │ ├── dropbear.conf │ │ │ │ ├── gdbserver.conf │ │ │ │ ├── getty.conf │ │ │ │ ├── inadyn.conf │ │ │ │ ├── inetd.conf │ │ │ │ ├── isisd.conf │ │ │ │ ├── lldpd.conf │ │ │ │ ├── mini-snmpd.conf │ │ │ │ ├── mstpd.conf │ │ │ │ ├── ntpd.conf │ │ │ │ ├── ospf6d.conf │ │ │ │ ├── ospfd.conf │ │ │ │ ├── querierd.conf │ │ │ │ ├── ripd.conf │ │ │ │ ├── ripng.conf │ │ │ │ ├── smcroute.conf │ │ │ │ ├── ssdp-responder.conf │ │ │ │ ├── sysklogd.conf │ │ │ │ ├── syslogd.conf │ │ │ │ ├── telnetd.conf │ │ │ │ ├── watchdogd.conf │ │ │ │ └── zebra.conf │ │ │ └── enabled │ │ │ │ └── .empty │ │ └── fstab │ │ └── var │ │ ├── cache │ │ └── .empty │ │ ├── lib │ │ └── misc │ │ │ └── .empty │ │ ├── lock │ │ └── .empty │ │ ├── log │ │ └── .empty │ │ ├── run │ │ ├── spool │ │ └── .empty │ │ └── tmp │ │ └── .empty └── westermo-dts │ ├── Config.in │ └── westermo-dts.mk ├── patches ├── busybox │ └── 1.37.0 │ │ └── logger-i.patch ├── finit │ └── 4.7 │ │ ├── disable-unused-hotplug-options.patch │ │ ├── dont-remount-ro-root-on-shutdown.patch │ │ ├── integration-remap-syslog-events.patch │ │ └── missing-cgroup-warn.patch ├── iproute2 │ └── 5.16.0 │ │ ├── 0001-build-integration-with-Westermo-system.patch │ │ ├── 0002-ip-Add-ability-to-set-address-protocol-when-adding-a.patch │ │ └── 0003-iplink_bridge-Add-local_receive-flag.patch └── linux │ └── 5.16.8 │ ├── 0002-mv88e6390x-cmode-fix.patch │ ├── 0003-sparx5-stats-iteration-page-fault.patch │ ├── 0004-powerpc-qemu-idle.patch │ ├── 0005-br-local-receive.patch │ └── 0006-mtd-spinor-erase-fix.patch ├── provides ├── init.in └── skeleton.in ├── screenshot.png ├── src └── factory │ ├── LICENSE │ ├── Makefile │ └── factory.c ├── support └── scripts │ ├── fitimage.sh │ ├── fitimage_legacy.sh │ ├── gns3.sh │ ├── image.sh │ └── qemu.sh └── utils ├── diffdefconfig ├── gendefconfig ├── mkversion └── qemu /.gdbinit: -------------------------------------------------------------------------------- 1 | # Collection of useful macros to aid debugging with QEMU 2 | # 3 | # This file will be automatically loaded when launching GDB from 4 | # staging/. 5 | # 6 | # In addition, if there is a file called .gdbinit in your home 7 | # directory, that file is also loaded. Please put personal output 8 | # settings etc. there, not in this file. 9 | # 10 | # When doing post-mortem debugging (core dumps), just launch gdb, from 11 | # the staging directory, with the binary and core file as the first 12 | # and second argument respectively. 13 | # 14 | # Examples: 15 | # 16 | # To run a user application under gdb: 17 | # user-load sbin/ip 18 | # # set relevant breakpoints and so on 19 | # run link set dev eth0 master br0 20 | # 21 | # To attach to an already running process: 22 | # user-attach sbin/finit 1 23 | # # set relevant breakpoints and so on 24 | # continue 25 | # 26 | # To debug the kernel: 27 | # kernel-attach 28 | # # set relevant breakpoints and so on 29 | # continue 30 | # 31 | # To debug the kernel on a physical target: 32 | # # login to device and enter the shell 33 | # kernel-attach-console ser1 34 | # # set relevant breakpoints and so on 35 | # continue 36 | # 37 | # To debug a core dump: 38 | # user@host:~/weos/staging # gdb bin/sleep ~/tmp/sleep.core 39 | # 40 | source .gdbinit.py 41 | 42 | # Connect to KGDB over a conserver console and load the kernel debug symbols. 43 | # 44 | # The remote system must be running a kernel built with KGDB 45 | # support. This command also assumes that the system is logged in to 46 | # and broken out into the shell. 47 | # 48 | # If the system ever gets stuck in KGDB, type the following string 49 | # into the console window to detach from KGDB: $D#44$ 50 | # 51 | # usage: kernel-attach-console 52 | # example: kernel-attach-console ser1 53 | define kernel-attach-console 54 | file boot/vmlinux 55 | target-console $arg0 56 | end 57 | 58 | # Connect to the GDB Server in QEMU and load the kernel debug symbols. 59 | # 60 | # usage: kernel-attach [HOST] [PORT] 61 | define kernel-attach 62 | file boot/vmlinux 63 | if $argc == 0 64 | target extended-remote localhost:4711 65 | end 66 | if $argc == 1 67 | target extended-remote localhost:$arg0 68 | end 69 | if $argc == 2 70 | target extended-remote $arg0:$arg1 71 | end 72 | end 73 | 74 | # Connect to a GDB Server process running in the guest OS. 75 | # 76 | # usage: user-connect [HOST] [PORT] 77 | define user-connect 78 | if $argc == 0 79 | target extended-remote localhost:4712 80 | end 81 | if $argc == 1 82 | target extended-remote localhost:$arg0 83 | end 84 | if $argc == 2 85 | target extended-remote $arg0:$arg1 86 | end 87 | set sysroot ./ 88 | end 89 | 90 | # Select an application to debug in the guest OS. 91 | # 92 | # usage: user-load [HOST] [PORT] 93 | # example: user-load sbin/finit 94 | define user-load 95 | if $argc == 1 96 | user-connect 97 | file $arg0 98 | set remote exec-file /$arg0 99 | end 100 | if $argc == 2 101 | user-connect $arg0 102 | file $arg1 103 | set remote exec-file /$arg1 104 | end 105 | if $argc == 3 106 | user-connect $arg0 $arg1 107 | file $arg2 108 | set remote exec-file /$arg2 109 | end 110 | end 111 | 112 | # Attach to a running process in the guest OS. 113 | # 114 | # usage: user-attach [HOST] [PORT] 115 | # example: user-attach sbin/finit 1 116 | define user-attach 117 | if $argc == 2 118 | user-load $arg0 119 | attach $arg1 120 | end 121 | if $argc == 3 122 | user-load $arg0 $arg1 123 | attach $arg2 124 | end 125 | if $argc == 4 126 | user-load $arg0 $arg1 $arg2 127 | attach $arg3 128 | end 129 | end 130 | 131 | directory ../build 132 | 133 | set solib-absolute-prefix . 134 | set solib-search-path lib 135 | -------------------------------------------------------------------------------- /.gdbinit.py: -------------------------------------------------------------------------------- 1 | import gdb 2 | import os 3 | import time 4 | from select import select 5 | from subprocess import Popen, PIPE 6 | 7 | class TargetConsole (gdb.Command): 8 | """ Connect to a remote system with KGDB support over a conserver console """ 9 | 10 | def __init__ (self): 11 | super (TargetConsole, self).__init__ ("target-console", gdb.COMMAND_USER) 12 | 13 | def usage(): 14 | print("Connect to kgdb over a conserver console\n" + 15 | "target-console \n") 16 | 17 | def invoke (self, args, from_tty): 18 | parsed = [gdb.parse_and_eval(arg) for arg in args.split()] 19 | if len(parsed) != 1: 20 | return self.usage() 21 | 22 | con = parsed[0].string() 23 | 24 | p = Popen(args = ["console", "-f", con], 25 | stdin = PIPE, stdout = PIPE, stderr = PIPE) 26 | 27 | p.stdin.write(b"echo ttyS0 >/sys/module/kgdboc/parameters/kgdboc\r\n") 28 | p.stdin.write(b"echo g >/proc/sysrq-trigger\r\n") 29 | p.stdin.flush() 30 | 31 | out = b"" 32 | while True: 33 | r, w, x = select((p.stdout.fileno(),), (), (), .5) 34 | if not len(r): 35 | break 36 | 37 | out += os.read(p.stdout.fileno(), 4096) 38 | 39 | if b"Entering KGDB" not in out: 40 | print("Unable to enter KGDB.\n" + 41 | "The target must be at the shell prompt, running a kernel" + 42 | "with KGDB support.") 43 | 44 | p.terminate() 45 | p.wait() 46 | 47 | os.system("socat pty,link=/tmp/wmo-kgdb,wait-slave exec:'console -f " + 48 | con + "' &") 49 | time.sleep(.5) 50 | gdb.execute("target remote /tmp/wmo-kgdb") 51 | 52 | TargetConsole () 53 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Bob the Builder 2 | 3 | on: 4 | push: 5 | branches: 6 | - '*' 7 | pull_request: 8 | branches: 9 | - '*' 10 | 11 | jobs: 12 | build: 13 | name: Build ${{ matrix.platform }} ${{ matrix.profile }} 14 | runs-on: ubuntu-latest 15 | strategy: 16 | matrix: 17 | profile: [app, os] 18 | platform: [basis, coronet, dagger, envoy, ember, zero] 19 | fail-fast: false 20 | steps: 21 | - uses: actions/checkout@v2 22 | - name: Set Build Variables 23 | id: vars 24 | run: | 25 | export NETBOX_TUPLE=${{ matrix.profile }}-${{ matrix.platform }} 26 | echo ::set-output name=dir::netbox-${NETBOX_TUPLE} 27 | echo ::set-output name=tgz::netbox-${NETBOX_TUPLE}.tar.gz 28 | - name: Restore Cache of dl/ 29 | uses: actions/cache@v2 30 | with: 31 | path: dl/ 32 | key: dl-${{ matrix.platform }}-${{ matrix.profile }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }} 33 | restore-keys: | 34 | dl-${{ matrix.platform }}-${{ matrix.profile }}- 35 | dl-${{ matrix.platform }}-os- 36 | dl-${{ matrix.platform }}- 37 | dl- 38 | - name: Restore Cache of .ccache/ 39 | uses: actions/cache@v2 40 | with: 41 | path: .buildroot-ccache/ 42 | key: ccache-${{ matrix.board }}-os-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }} 43 | restore-keys: | 44 | ccache-${{ matrix.board }}-os- 45 | ccache-${{ matrix.board }}- 46 | ccache--os- 47 | - name: Configure & Build 48 | run: | 49 | make netbox_${{ matrix.profile }}_${{ matrix.platform }}_defconfig 50 | make 51 | - name: Prepare Artifact 52 | # The tarball helps retain file modes and gives us a containing 53 | # directory, something the upload-artifact does not support. 54 | # Downside, we get a zip with a tar.gz on download 55 | run: | 56 | cd output 57 | rm -rf images/syslinux 58 | if [ -f images/qemu.cfg ]; then 59 | sed -i 's,/home/runner/work/netbox/netbox/output/images/,,g' images/qemu.cfg 60 | cp ../utils/qemu images/ 61 | fi 62 | mv images ${{ steps.vars.outputs.dir }} 63 | tar cfz ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }} 64 | - name: Upload Artifact 65 | uses: actions/upload-artifact@v2 66 | with: 67 | name: ${{ steps.vars.outputs.tgz }} 68 | path: output/${{ steps.vars.outputs.tgz }} 69 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release General 2 | 3 | on: 4 | push: 5 | tags: 6 | - '[0-9]*.*' 7 | 8 | jobs: 9 | release: 10 | name: Create GitHub release from ${{ github.ref }} 11 | if: startsWith(github.ref, 'refs/tags/') 12 | runs-on: ubuntu-latest 13 | outputs: 14 | upload_url: ${{ steps.create_release.outputs.upload_url }} 15 | release_id: ${{ steps.create_release.outputs.id }} 16 | steps: 17 | - uses: actions/checkout@v2 18 | - name: Set Release Variables 19 | id: vars 20 | run: | 21 | ver=${GITHUB_REF#refs/tags/} 22 | if echo $ver | grep -qE '[0-9.]+(-alpha|-beta|-rc)[0-9]*'; then 23 | echo ::set-output name=pre::true 24 | else 25 | echo ::set-output name=pre::false 26 | fi 27 | - name: Create release ... 28 | id: create_release 29 | uses: actions/create-release@v1 30 | env: 31 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 32 | with: 33 | tag_name: ${{ github.ref }} 34 | release_name: NetBox ${{ github.ref }} 35 | draft: false 36 | prerelease: ${{ steps.vars.outputs.pre }} 37 | build: 38 | name: Build ${{ matrix.platform }} ${{ matrix.profile }} 39 | needs: release 40 | if: startsWith(github.ref, 'refs/tags/') 41 | runs-on: ubuntu-latest 42 | strategy: 43 | matrix: 44 | profile: [app, os] 45 | platform: [basis, coronet, dagger, envoy, ember, zero] 46 | fail-fast: false 47 | steps: 48 | - uses: actions/checkout@v2 49 | - name: Set Build Variables 50 | id: vars 51 | run: | 52 | export NETBOX_TUPLE=${{ matrix.profile }}-${{ matrix.platform }} 53 | export NETBOX_VER=${GITHUB_REF#refs/tags/} 54 | echo ::set-output name=tag::${NETBOX_VER} 55 | echo ::set-output name=dir::netbox-${NETBOX_TUPLE}-${NETBOX_VER} 56 | echo ::set-output name=tgz::netbox-${NETBOX_TUPLE}-${NETBOX_VER}.tar.gz 57 | - uses: actions/cache@v2 58 | with: 59 | path: dl/ 60 | key: dl-${{ matrix.platform }}-${{ matrix.profile }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'configs/*', 'package/*/*.hash') }} 61 | restore-keys: | 62 | dl-${{ matrix.platform }}-${{ matrix.profile }}- 63 | dl-${{ matrix.platform }}-os- 64 | dl-${{ matrix.platform }}- 65 | dl- 66 | - name: Configure & Build 67 | env: 68 | RELEASE: ${{ steps.vars.outputs.tag }} 69 | run: | 70 | make netbox_${{ matrix.profile }}_${{ matrix.platform }}_defconfig 71 | make 72 | cd output 73 | mv images ${{ steps.vars.outputs.dir }} 74 | tar --exclude=${{ steps.vars.outputs.dir }}/syslinux -czf ${{ steps.vars.outputs.tgz }} ${{ steps.vars.outputs.dir }} 75 | - name: Upload release artifacts ... 76 | uses: skx/github-action-publish-binaries@release-0.15 77 | env: 78 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 79 | with: 80 | releaseId: ${{ needs.release.outputs.release_id }} 81 | args: output/${{ steps.vars.outputs.tgz }} 82 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | # Please never commit any local.mk to the repo. Instead, put your own 3 | # in the root and symlink to output-envoy/local.mk, or similar. 4 | /.buildroot-ccache/ 5 | /local.mk 6 | /dl 7 | /output 8 | /output-* 9 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "buildroot"] 2 | path = buildroot 3 | url = https://github.com/buildroot/buildroot.git 4 | -------------------------------------------------------------------------------- /HACKING.md: -------------------------------------------------------------------------------- 1 | Hacking the NetBox 2 | ================== 3 | 4 | This file is a Checklist and things to consider when hacking on this 5 | project. Maintainers, and project leads, check section Releases. 6 | 7 | 8 | Contributing 9 | ------------ 10 | 11 | We prefer GitHub pull requests since it allows for auditing all changes 12 | that go into the tree: 13 | 14 | 0. If you already have write access to the repo, continue to 2. 15 | 1. Clone the project to your own user on GitHub 16 | 2. Create a branch for your feature/fix, use a descriptive branch name 17 | 3. Prepare your GitHub Pull Request 18 | 19 | General guidelines: 20 | 21 | 1. Keep commits small and logical: 22 | - separate white space changes from actual changes 23 | - changes to different demos should be different pull requests, 24 | unless the pull request is common to more than one 25 | 2. For C code we use Linux kernel coding style, no exceptions 26 | 3. For C code, try building (and running) locally first. Always set 27 | strict warning flags to GCC, e.g. `-W -Wall -Wextra` 28 | 4. For shell scripts, run them locally first 29 | 5. For shell scripts, run `shellcheck` to lint 30 | 6. For changes to either C or shell scripts; *follow the coding style 31 | used in the existing code*. Shell scripts are either tab or four 32 | space indent -- never mixed in the same script 33 | 34 | And ... to add new packages, please follow the [Buildroot Guidelines][]. 35 | 36 | Reviewers: 37 | 38 | 1. Check general guidelines (above) 39 | 2. Add your `Reviewed-by: First Last ` in a comment 40 | 3. The assignee copies all `Reviewd-by:` and other tags to the merge commit 41 | 42 | 43 | Kernel Upgrade 44 | -------------- 45 | 46 | 0. Remember to also update `patches/` symlinks 47 | 48 | 49 | Releases 50 | -------- 51 | 52 | To trigger release builds, the `RELEASE=` variable must be set from the 53 | command line, but you must also have tagged the repository. 54 | 55 | 1. Tag the repository: `$BR2_VERSION-rN` 56 | 2. Set the environment `RELEASE=$BR2_VERSION-rN` and run make 57 | 58 | A less error-prone alternative, GitHub actions run when a tag is pushed. 59 | They are completely automated; release-generation, build, as well as 60 | upload of `.tar.gz` archives of the `output/images` directory for each 61 | profile-platform tuple. 62 | 63 | Tags must follow the following syntax: 64 | 65 | BUILDROOT.VERSION-rNUM[-(alpha|beta|rc)NUM] 66 | 67 | For details on the versioning scheme, see section Versioning, below. 68 | 69 | **Examples:** 70 | 71 | - 2020.02-r0 72 | - 2020.02-r1 73 | - 2021.02-r0-beta1 74 | - 2038.02-r42-rc1 75 | 76 | Please note, `-alphaN`, `-betaN`, and `-rcN` are tagged as `prerelease` 77 | in the GitHub Release page, and should only be used for internal testing 78 | at Westermo. 79 | 80 | 81 | Versioning 82 | ---------- 83 | 84 | NetBox use the same versioning as Buildroot, with an appended `-rN` to 85 | denote the *revision* of Buildroot with Westermo extensions. E.g., the 86 | first release is 2020.02-r1. 87 | 88 | NetBox releases are generally cut from the Buildroot LTS branch as base. 89 | Buildroot starts a new LTS cycle every year in February, hence NetBox 90 | releases are usually named `YEAR.02-rN`. The *revision* is not in any 91 | way reflecting content level, it is simply incremented for each release 92 | with the same base, there may be hundreds of changes, or just one. 93 | 94 | 95 | [Buildroot Guidelines]: https://buildroot.org/downloads/manual/manual.html#adding-packages 96 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | export BR2_EXTERNAL := $(CURDIR) 2 | export PATH := $(CURDIR)/utils:$(PATH) 3 | export M4PATH := $(CURDIR)/configs:$(CURDIR)/configs/include:$(M4PATH) 4 | 5 | ARCH ?= $(shell uname -m) 6 | O ?= $(CURDIR)/output 7 | 8 | config := $(O)/.config 9 | bmake = $(MAKE) -C buildroot O=$(O) $1 10 | 11 | 12 | all: $(config) | buildroot/Makefile 13 | @+$(call bmake,$@) 14 | 15 | $(config): 16 | @+$(call bmake,list-defconfigs) 17 | @echo "\e[7mERROR: No configuration selected.\e[0m" 18 | @echo "Please choose a configuration from the list above by first calling " 19 | @echo "> make netbox___defconfig" 20 | @exit 1 21 | 22 | netbox_%_defconfig: configs/netbox_%_defconfig | buildroot/Makefile 23 | @+$(call bmake,$@) 24 | @rm $< 25 | 26 | configs/netbox_%_defconfig: configs/netbox_%_defconfig.m4 configs/include/*.m4 27 | @echo "\e[7m>>> Generating temporary $(@F) to bootstrap $O/.config\e[0m" 28 | @gendefconfig -d $(@D) $($@ 29 | 30 | diff-defconfig: $(config) 31 | @echo "\e[7m>>> Generating defconfig diff for manual update of configs/*.m4 files ...\e[0m" 32 | @diffdefconfig $< 33 | 34 | %: | buildroot/Makefile 35 | @+$(call bmake,$@) 36 | 37 | buildroot/Makefile: 38 | @git submodule update --init 39 | 40 | run: 41 | @qemu -f $(O)/images/qemu.cfg 42 | 43 | debug: 44 | @[ -f $(O)/staging/.gdbinit ] || cp $(CURDIR)/.gdbinit $(O)/staging/.gdbinit 45 | @[ -f $(O)/staging/.gdbinit.py ] || cp $(CURDIR)/.gdbinit.py $(O)/staging/.gdbinit.py 46 | @(cd $(O)/staging/ && gdb-multiarch) 47 | 48 | .PHONY: all defconfig run 49 | -------------------------------------------------------------------------------- /board/app/busybox.fragment: -------------------------------------------------------------------------------- 1 | # enable iproute2 compat tools 2 | CONFIG_IP=y 3 | CONFIG_FEATURE_IP_ADDRESS=y 4 | CONFIG_FEATURE_IP_LINK=y 5 | CONFIG_FEATURE_IP_NEIGH=y 6 | CONFIG_FEATURE_IP_ROUTE=y 7 | CONFIG_FEATURE_IP_RULE=y 8 | CONFIG_FEATURE_IP_TUNNEL=y 9 | 10 | # we don't have netcalc so enable this 11 | CONFIG_IPCALC=y 12 | 13 | # we don't have full-blown syskogd in app builds 14 | CONFIG_KLOGD=y 15 | # CONFIG_FEATURE_KLOGD_KLOGCTL is not set 16 | CONFIG_LOGGER=y 17 | # CONFIG_LOGREAD is not set 18 | # CONFIG_FEATURE_LOGREAD_REDUCED_LOCKING is not set 19 | CONFIG_SYSLOGD=y 20 | CONFIG_FEATURE_ROTATE_LOGFILE=y 21 | CONFIG_FEATURE_REMOTE_LOG=y 22 | # CONFIG_FEATURE_SYSLOGD_DUP is not set 23 | # CONFIG_FEATURE_SYSLOGD_CFG is not set 24 | # CONFIG_FEATURE_SYSLOGD_PRECISE_TIMESTAMPS is not set 25 | CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256 26 | # CONFIG_FEATURE_IPC_SYSLOG is not set 27 | CONFIG_FEATURE_IPC_SYSLOG_BUFFER_SIZE=0 28 | # CONFIG_FEATURE_KMSG_SYSLOG is not set 29 | -------------------------------------------------------------------------------- /board/app/rootfs/etc/fstab: -------------------------------------------------------------------------------- 1 | # Virtual filesystems 2 | tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0 3 | #tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0 4 | mkdir#-p /run/dropbear helper none 0 0 5 | 6 | # Ensure that all overlay directories are available 7 | mkdir#-p#-m0755 /tmp/system/var.u helper none 0 0 8 | mkdir#-p#-m0755 /tmp/system/var.w helper none 0 0 9 | mkdir#-p#-m0755 /mnt/system/varlib.u helper none 0 0 10 | mkdir#-p#-m0755 /mnt/system/varlib.w helper none 0 0 11 | mkdir#-p#-m0755 /mnt/system/etc.u helper none 0 0 12 | mkdir#-p#-m0755 /mnt/system/etc.w helper none 0 0 13 | mkdir#-p#-m0700 /mnt/system/root.u helper none 0 0 14 | mkdir#-p#-m0700 /mnt/system/root.w helper none 0 0 15 | mkdir#-p#-m0700 /mnt/system/home.u helper none 0 0 16 | mkdir#-p#-m0700 /mnt/system/home.w helper none 0 0 17 | 18 | # Overlay selected parts of the filesystem with persistent storage 19 | rw-var /var overlay lowerdir=/var,upperdir=/tmp/system/var.u,workdir=/tmp/system/var.w 0 0 20 | rw-vlib /var/lib overlay lowerdir=/var/lib,upperdir=/mnt/system/varlib.u,workdir=/mnt/system/varlib.w 0 0 21 | rw-etc /etc overlay lowerdir=/etc,upperdir=/mnt/system/etc.u,workdir=/mnt/system/etc.w 0 0 22 | rw-root /root overlay lowerdir=/root,upperdir=/mnt/system/root.u,workdir=/mnt/system/root.w 0 0 23 | rw-home /home overlay lowerdir=/home,upperdir=/mnt/system/home.u,workdir=/mnt/system/home.w 0 0 24 | -------------------------------------------------------------------------------- /board/app/rootfs/etc/network/interfaces: -------------------------------------------------------------------------------- 1 | # interfaces(5) file used by ifup(8) and ifdown(8) 2 | auto lo 3 | iface lo inet loopback 4 | 5 | # DHCP address, or comment out and enable static below 6 | auto eth0 7 | iface eth0 inet dhcp 8 | 9 | # DHCP with one (or more) static IP addresses 10 | #auto eth0 11 | #iface eth0 inet dhcp 12 | # up ip address add 192.168.2.200/24 dev eth0 13 | 14 | # Static IP, notice ifupdown in BusyBox doesn't support 192.168.2.200/24 15 | #auto eth0 16 | #iface eth0 inet static 17 | # address 192.168.2.200 18 | # netmask 255.255.255.0 19 | # gateway 192.168.2.1 20 | 21 | # Include files from /etc/network/interfaces.d: 22 | source-directory /etc/network/interfaces.d 23 | -------------------------------------------------------------------------------- /board/basis/README.md: -------------------------------------------------------------------------------- 1 | Westermo Basis 2 | ============== 3 | 4 | Basis is the collective Westermo platform name for an Arm CPU with a 5 | Marvell SoHo switchcore. 6 | 7 | -------------------------------------------------------------------------------- /board/basis/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Board specific additions or cleanup, runs after common/post-image.sh 3 | 4 | exit 0 5 | -------------------------------------------------------------------------------- /board/byron/README.md: -------------------------------------------------------------------------------- 1 | Westermo Byron 2 | ============== 3 | 4 | Byron is the collective Westermo platform name for an Arm CPU with a 5 | Marvell SoHo or an Flexibilis switchcore. 6 | 7 | -------------------------------------------------------------------------------- /board/byron/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Board specific additions or cleanup, runs after common/post-image.sh 3 | 4 | exit 0 5 | -------------------------------------------------------------------------------- /board/common/gns3.tmpl: -------------------------------------------------------------------------------- 1 | { 2 | "name": "VENDOR_NAME", 3 | "category": "router", 4 | "description": "VENDOR_DESC", 5 | "vendor_name": "Westermo Network Technologies", 6 | "vendor_url": "VENDOR_HOME", 7 | "product_name": "VENDOR_NAME", 8 | "registry_version": 6, 9 | "status": "stable", 10 | "maintainer": "Westermo Network Technologies", 11 | "maintainer_email": "info@westermo.com", 12 | "port_name_format": "eth{0}", 13 | "linked_clone": true, 14 | "qemu": { 15 | "adapter_type": "e1000", 16 | "adapters": 8, 17 | "ram": 384, 18 | "cpus": 1, 19 | "hda_disk_interface": "virtio", 20 | "arch": "x86_64", 21 | "console_type": "telnet", 22 | "kvm": "allow" 23 | }, 24 | "images": [ 25 | { 26 | "filename": "ROOTFS_FILE", 27 | "filesize": ROOTFS_SIZE, 28 | "md5sum": "ROOTFS_MD5SUM", 29 | "version": "VENDOR_VERSION" 30 | }, 31 | { 32 | "filename": "CONFIG_FILE", 33 | "filesize": CONFIG_SIZE, 34 | "md5sum": "CONFIG_MD5SUM", 35 | "version": "CONFIG_VERSION" 36 | } 37 | ], 38 | "versions": [ 39 | { 40 | "name": "VENDOR_VERSION", 41 | "images": { 42 | "cdrom_image": "ROOTFS_FILE", 43 | "hda_disk_image": "CONFIG_FILE" 44 | } 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /board/common/post-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . $BR2_CONFIG 2>/dev/null 3 | 4 | TARGET_DIR=$1 5 | 6 | # Used for matching host and guest 7 | platform=$NETBOX_PLAT 8 | Platform=`echo $platform | awk '{print toupper(substr($0,0,1))tolower(substr($0,2))}'` 9 | 10 | # This is a symlink to /usr/lib/os-release, so we remove this to keep 11 | # original Buildroot information. 12 | rm $TARGET_DIR/etc/os-release 13 | 14 | echo "NAME=\"${NETBOX_VENDOR_NAME}\"" >$TARGET_DIR/etc/os-release 15 | echo "VERSION=${NETBOX_VENDOR_VERSION}" >>$TARGET_DIR/etc/os-release 16 | echo "ID=${NETBOX_VENDOR_ID}" >>$TARGET_DIR/etc/os-release 17 | echo "VERSION_ID=${NETBOX_VENDOR_VERSION}" >>$TARGET_DIR/etc/os-release 18 | echo "PRETTY_NAME=\"${NETBOX_VENDOR_DESC}\"" >>$TARGET_DIR/etc/os-release 19 | echo "VARIANT=${Platform}" >>$TARGET_DIR/etc/os-release 20 | echo "VARIANT_ID=${platform}" >>$TARGET_DIR/etc/os-release 21 | echo "HOME_URL=${NETBOX_VENDOR_HOME}" >>$TARGET_DIR/etc/os-release 22 | 23 | printf "$NETBOX_VENDOR_NAME $NETBOX_VENDOR_VERSION -- `date +"%b %e %H:%M %Z %Y"`\n" > $TARGET_DIR/etc/version 24 | cat $TARGET_DIR/etc/version >> $TARGET_DIR/etc/motd 25 | printf "Type: 'help' for help with commands, 'exit' to log out.\n\n" >> $TARGET_DIR/etc/motd 26 | 27 | # Default buildroot is a symlink to /var/run/dropbear, meaning 28 | # 1. the /var/run/dropbear directory must be created at boot 29 | # 2. the host key will be regenerated every boot == annoying 30 | # NetBox has writable overlayfs for /etc, so let's use that. 31 | if [ -h $TARGET_DIR/etc/dropbear ]; then 32 | rm $TARGET_DIR/etc/dropbear 33 | mkdir $TARGET_DIR/etc/dropbear 34 | fi 35 | 36 | # Make sure we have /sbin/bridge-stp and /etc/default/mstpd set up 37 | if [ "$BR2_PACKAGE_MSTPD" = "y" ]; then 38 | [ -e "$TARGET_DIR/sbin/bridge-stp" ] || ln -s ../usr/sbin/bridge-stp "$TARGET_DIR/sbin/" 39 | [ -e "$TARGET_DIR/etc/default/mstpd" ] || ln -s ../bridge-stp.conf "$TARGET_DIR/etc/default/mstpd" 40 | 41 | grep -qE "^MSTP_BRIDGES=.*" "$TARGET_DIR/etc/bridge-stp.conf" || \ 42 | echo "MSTP_BRIDGES=br0" >> "$TARGET_DIR/etc/bridge-stp.conf" 43 | fi 44 | 45 | if [ "$NETBOX_PLAT" != "app" ]; then 46 | kernel=$(basename $TARGET_DIR/boot/*Image) 47 | 48 | for board in $(find $TARGET_DIR/boot -mindepth 1 -type d); do 49 | if [ -f $board/kernel ]; then 50 | continue 51 | fi 52 | 53 | ln -s ../$kernel $board/kernel 54 | done 55 | 56 | # If we've enabled kselftests, add writable forwarding.config symlink 57 | if [ -d $TARGET_DIR/usr/lib/kselftests/net/forwarding/ ]; then 58 | ln -sf /tmp/forwarding.config $TARGET_DIR/usr/lib/kselftests/net/forwarding/ 59 | fi 60 | fi 61 | -------------------------------------------------------------------------------- /board/common/rootfs/.hushlogin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/board/common/rootfs/.hushlogin -------------------------------------------------------------------------------- /board/common/rootfs/bin/help: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | fn=$(mktemp /tmp/system-help.XXXXXX) 3 | H1=$(printf '\e[7m') 4 | H2=$(printf '\e[1m') 5 | H0=$(printf '\e[0m') 6 | 7 | #clear 8 | cat << EOF > "$fn" 9 | ${H2}Syntax:${H0} 10 | cmd [optional arg] E.g., use 'date -h' to get help for date command 11 | 12 | ${H2}File system:${H0} 13 | pwd | ls | cd Show directory (contents) or change directory 14 | cat file Show file contents 15 | vi | mg [file] Edit file with the VI or Micro Emacs editor 16 | 17 | ${H2}Services:${H0} 18 | initctl list Lists all configurable services (svc's) 19 | initctl enable svc Enable a service 'svc' 20 | initctl reload Reload init process' state, start/stop svc's 21 | initctl start svc Start a stopped service 'svc' 22 | initctl stop svc Stop 'svc' 23 | initctl restart svc Restart a running 'svc' 24 | initctl status [svc] Display running status of all services, or one 'svc' 25 | 26 | ${H2}Tools:${H0} 27 | date [-h] Display current time, or sets the system date 28 | factory [-h] Factory reset the device (on the next boot) 29 | hwclock [-h] Query or set the hardware clock (RTC) 30 | logout | Ctrl-D Log out from TTY 31 | mdio | mvls Low-level MDIO access, also for Marvell switch status 32 | tail -F file Continuously read from a file Useful for monitoring the 33 | health of services, see 'ls /var/log/' for log files 34 | reboot Restart the device 35 | reset Reset the shell prompt if it gets garbled 36 | 37 | ${H2}Network Tools:${H0} 38 | ethtool [-h] Ethernet stats, and low-level MAC/PHY settings 39 | traceroute [-h] Trace the route ip packets follow going to a host 40 | tcpdump [-h] Display network packet headers in real-time 41 | arping [-h] Ping hosts by ARP requests/replies 42 | ping [-h] Send ICMP ECHO_REQUEST packets to network hosts 43 | nft [-h] Edit the kernel's netfilter rules (firewall) 44 | netcalc [-h] Calculate IP network settings from a IP address 45 | netcat [-h] NetCat - TCP/IP swiss army knife (alias: nc) 46 | 47 | ifconfig [--help] See/Reconfigure available network interfaces 48 | route [--help] Edit the kernel's routing tables 49 | 50 | ifup | ifdown IFACE Bring up/down interfaces in /etc/network/interfaces 51 | 52 | ip [link|addr] Manage available network interfaces 53 | ip [rule|route] Manage routing tables 54 | bridge [link|vlan] Manage bridge ports and VLANs 55 | 56 | scp Securely copy a file to a remote host file system 57 | tftp Copy a file to/from a remote host 58 | ftpput Store a local file on a remote machine via FTP 59 | ftpget Retrieve a remote file via FTP 60 | wget Get a file using http or ftp from a remote host 61 | 62 | ${H2}Overview:${H0} 63 | df -h List disk usage (in human readable format) 64 | free List memory usage 65 | ps List running processes 66 | show [arg] Show system status, see 'show help' for more info 67 | top Displays CPU usage and top list of running tasks 68 | 69 | ${H2}Interesting Files:${H0} 70 | /etc/default/svc Command line args for service 'svc' (see above) 71 | /etc/rc.local Local setup, runs after all services have started 72 | /etc/network/ Directory of networking setup, most intersting is > 73 | interfaces > Bridge setup and VLAN interfaces config 74 | 75 | ${H2}Examples:${H0} 76 | cd /tmp; wget ftp://192.168.55.43/some_file 77 | cd /var/log; tftp -p -l messages 192.168.55.43 78 | cat /proc/net/arp 79 | edit /etc/network/interfaces 80 | 81 | ${H2}.--.--.--.-----.-----.-------.-----.----.--------.-----.${H0} 82 | ${H2}| | | | -__|__ --|_ _| -__| _| | _ |${H0} 83 | ${H2}|________|_____|_____| |___| |_____|__| |__|__|__|_____|${H0} 84 | ${H2} https://www.westermo.com${H0} 85 | EOF 86 | 87 | #less -R "$fn" 88 | cat "$fn" 89 | rm "$fn" 90 | -------------------------------------------------------------------------------- /board/common/rootfs/bin/show: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Displays basic information about the system, similar to WeOS CLI show command 3 | . /etc/os-release 4 | 5 | opt="-br" 6 | all="" 7 | 8 | TTY=$(resize) 9 | eval "$TTY" 10 | 11 | usage() 12 | { 13 | cat < \e[0m\n" 37 | if grep -q port /etc/iproute2/group && [ -z "$all" ]; then 38 | ip $opt link show group port 39 | else 40 | ip $opt link show 41 | fi 42 | printf "\e[2m______________________________________________________________________________\e[0m\n" 43 | printf "\e[2mUse: '[ip|bridge] --help' and '[ip|bridge] link help' for more details.\e[0m\n" 44 | } 45 | 46 | vlans() 47 | { 48 | printf "\e[7mINTERFACE VLAN FLAGS \e[0m\n" 49 | bridge vlan show |tail +2 | awk 'NF { iface=$1; vid=$2; printf("%-16s %4d ", iface, vid); for (i=3; i <= NF; i++) printf("%s ", $i); printf("\n"); }' 50 | printf "\e[2m______________________________________________________________________________\e[0m\n" 51 | printf "\e[2mSee: 'bridge --help' and 'bridge vlan help' for more details.\e[0m\n" 52 | } 53 | 54 | ifaces() 55 | { 56 | printf "\e[7mINTERFACE STATE ADDRESS \e[0m\n" 57 | if [ -n "$all" ]; then 58 | ip $opt addr show 59 | else 60 | ip $opt addr show |awk '{ if ($1 !~ /eth[0-9]*/ && $1 !~ /.*@NONE/) { print }}' 61 | fi 62 | printf "\e[2m______________________________________________________________________________\e[0m\n" 63 | printf "\e[2mSee: 'ip --help' and 'ip address help' for more details.\e[0m\n" 64 | } 65 | 66 | log() 67 | { 68 | if [ -n "$1" ] && [ -r "/var/log/$1" ]; then 69 | fn="/var/log/$1" 70 | else 71 | fn="/var/log/syslog" 72 | fi 73 | if [ -n "$all" ]; then 74 | cat $fn 75 | else 76 | tail -$LINES $fn 77 | fi 78 | printf "\e[2m______________________________________________________________________________\e[0m\n" 79 | printf "\e[2mSee: 'tail -25 /log/FILE', 'tail -F /log/FILE' to continuously monitor files.\e[0m\n" 80 | } 81 | 82 | rmon() 83 | { 84 | if [ -z "$*" ]; then 85 | echo "Missing argument, see 'show port' for available interfaces" 86 | exit 1 87 | fi 88 | for port in $*; do 89 | ethtool -S "$port" 90 | done 91 | printf "\e[2m______________________________________________________________________________\e[0m\n" 92 | printf "\e[2mSee: 'ethtool --help' for more details.\e[0m\n" 93 | } 94 | 95 | rstp() 96 | { 97 | mstpctl showbridge 98 | echo "br0 port info" 99 | mstpctl showport br0 100 | } 101 | 102 | routes() 103 | { 104 | ip route show 105 | } 106 | 107 | igmp() 108 | { 109 | querierctl $@ 110 | } 111 | 112 | system() 113 | { 114 | printf "\e[7mSYSTEM INFORMATION \e[0m\n" 115 | echo "System Name : $(uname -n)" 116 | echo "System Description : $PRETTY_NAME" 117 | echo "System Contact : $HOME_URL" 118 | echo "System Timezone : $TZ" 119 | echo "System Type : $NAME" 120 | echo "System Version : $(cat /etc/version)" 121 | echo "Kernel Version : $(uname -sr)" 122 | echo "Platform : $VARIANT ($(uname -m))" 123 | } 124 | 125 | version() 126 | { 127 | cat /etc/version 128 | } 129 | 130 | while [ "$1" != "" ]; do 131 | case $1 in 132 | -a) 133 | all=1 134 | ;; 135 | -f) 136 | opt="" 137 | ;; 138 | -h) 139 | usage 140 | exit 0 141 | ;; 142 | *) 143 | break 144 | esac 145 | shift 146 | done 147 | 148 | cmd=$1 149 | if [ -n "$cmd" ]; then 150 | shift 151 | fi 152 | 153 | case $cmd in 154 | help) 155 | usage 156 | ;; 157 | port*) 158 | ports 159 | ;; 160 | vlan*) 161 | vlans 162 | ;; 163 | if*) 164 | ifaces 165 | ;; 166 | ip) 167 | cmd=$1 168 | shift 169 | case $cmd in 170 | addr*) 171 | ifaces 172 | ;; 173 | route*) 174 | routes 175 | ;; 176 | igmp*) 177 | igmp "$*" 178 | ;; 179 | *) 180 | usage 181 | ;; 182 | esac 183 | ;; 184 | log) 185 | log "$1" 186 | ;; 187 | rmon) 188 | rmon "$*" 189 | ;; 190 | route*) 191 | routes 192 | ;; 193 | span*) 194 | rstp 195 | ;; 196 | sys*) 197 | system 198 | ;; 199 | ver*) 200 | version 201 | ;; 202 | *) 203 | usage 204 | exit 1 205 | ;; 206 | esac 207 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/finit.d/system-init.conf: -------------------------------------------------------------------------------- 1 | run [S] /lib/system/ident -- 2 | run [S] /lib/system/if -- 3 | 4 | task [123456789] /lib/system/leds -- 5 | 6 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/fstab: -------------------------------------------------------------------------------- 1 | # Virtual filesystems 2 | devtmpfs /dev devtmpfs defaults 0 0 3 | mkdir#-p /dev/pts helper none 0 0 4 | devpts /dev/pts devpts mode=620,ptmxmode=0666 0 0 5 | mkdir#-p /dev/shm helper none 0 0 6 | tmpfs /dev/shm tmpfs mode=0777 0 0 7 | proc /proc proc defaults 0 0 8 | tmpfs /tmp tmpfs mode=1777,nosuid,nodev 0 0 9 | tmpfs /run tmpfs mode=0755,nosuid,nodev 0 0 10 | mkdir#-p /run/dropbear helper none 0 0 11 | sysfs /sys sysfs defaults 0 0 12 | debugfs /sys/kernel/debug debugfs nofail 0 0 13 | 14 | # Optional host share when running in Qemu 15 | hostfs /host 9p nofail,cache=none,msize=16384 0 0 16 | 17 | # Persistent store on MTD if available, fallback to LABEL:Config, or ramdisk 18 | mtd:Config /mnt jffs2 noatime,nodiratime,noauto 0 0 19 | LABEL=Config /mnt auto noatime,nodiratime,noauto 0 0 20 | tmpfs-Config /mnt tmpfs noatime,nodiratime,noauto 0 0 21 | /lib/system/mnt# /mnt helper none 0 0 22 | 23 | # Ensure that all overlay directories are available 24 | mkdir#-p#-m0755 /tmp/system/var.u helper none 0 0 25 | mkdir#-p#-m0755 /tmp/system/var.w helper none 0 0 26 | mkdir#-p#-m0755 /mnt/system/varlib.u helper none 0 0 27 | mkdir#-p#-m0755 /mnt/system/varlib.w helper none 0 0 28 | mkdir#-p#-m0755 /mnt/system/etc.u helper none 0 0 29 | mkdir#-p#-m0755 /mnt/system/etc.w helper none 0 0 30 | mkdir#-p#-m0700 /mnt/system/root.u helper none 0 0 31 | mkdir#-p#-m0700 /mnt/system/root.w helper none 0 0 32 | mkdir#-p#-m0700 /mnt/system/home.u helper none 0 0 33 | mkdir#-p#-m0700 /mnt/system/home.w helper none 0 0 34 | 35 | # Upgrade partition 36 | mkdir#-p#-m0755 /tmp/upgrade helper none 0 0 37 | 38 | # Overlay selected parts of the filesystem with persistent storage 39 | rw-var /var overlay lowerdir=/var,upperdir=/tmp/system/var.u,workdir=/tmp/system/var.w 0 0 40 | rw-vlib /var/lib overlay lowerdir=/var/lib,upperdir=/mnt/system/varlib.u,workdir=/mnt/system/varlib.w 0 0 41 | rw-etc /etc overlay lowerdir=/etc,upperdir=/mnt/system/etc.u,workdir=/mnt/system/etc.w 0 0 42 | rw-root /root overlay lowerdir=/root,upperdir=/mnt/system/root.u,workdir=/mnt/system/root.w 0 0 43 | rw-home /home overlay lowerdir=/home,upperdir=/mnt/system/home.u,workdir=/mnt/system/home.w 0 0 44 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/iproute2/group: -------------------------------------------------------------------------------- 1 | 0 default 2 | 1 port 3 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/mdev.conf: -------------------------------------------------------------------------------- 1 | # NetBox mdev.conf based on https://github.com/slashbeast/mdev-like-a-boss/ 2 | 3 | # Syntax: 4 | # [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...] 5 | # [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...] 6 | # [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...] 7 | # 8 | # [-]: do not stop on this match, continue reading mdev.conf 9 | # =: move, >: move and create a symlink 10 | # !: do not create device node 11 | # @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases 12 | 13 | # support module loading on hotplug 14 | $MODALIAS=.* root:root 660 @modprobe -b "$MODALIAS" 15 | 16 | # null may already exist; therefore ownership has to be changed with command 17 | null root:root 666 @chmod 666 $MDEV 18 | zero root:root 666 19 | full root:root 666 20 | random root:root 444 21 | urandom root:root 444 22 | hwrandom root:root 444 23 | grsec root:root 660 24 | 25 | # Kernel-based Virtual Machine. 26 | #kvm root:kvm 660 27 | 28 | # vhost-net, to be used with kvm. 29 | #vhost-net root:kvm 660 30 | 31 | kmem root:root 640 32 | mem root:root 640 33 | port root:root 640 34 | # console may already exist; therefore ownership has to be changed with command 35 | console root:tty 600 @chmod 600 $MDEV 36 | ptmx root:tty 666 37 | pty.* root:tty 660 38 | 39 | # Typical devices 40 | tty root:tty 666 41 | tty[0-9]* root:tty 660 42 | vcsa*[0-9]* root:tty 660 43 | ttyS[0-9]* root:dialout 660 44 | 45 | # block devices 46 | ram([0-9]*) root:disk 660 >rd/%1 47 | loop([0-9]+) root:disk 660 >loop/%1 48 | sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom 49 | fd[0-9]* root:floppy 660 50 | #SUBSYSTEM=block;.* root:disk 660 */lib/system/storage-device 51 | 52 | # Run settle-nics every time new NIC appear. 53 | # If you don't want to auto-populate /etc/mactab with NICs, 54 | # run 'settle-nis' without '--write-mactab' param. 55 | #-SUBSYSTEM=net;DEVPATH=.*/net/.*;.* root:root 600 @/lib/system/settle-nics --write-mactab 56 | 57 | net/tun[0-9]* root:netdev 660 58 | net/tap[0-9]* root:root 600 59 | 60 | # alsa sound devices and audio stuff 61 | #SUBSYSTEM=sound;.* root:audio 660 @/lib/system/sound-control 62 | 63 | adsp root:audio 660 >sound/ 64 | audio root:audio 660 >sound/ 65 | dsp root:audio 660 >sound/ 66 | mixer root:audio 660 >sound/ 67 | sequencer.* root:audio 660 >sound/ 68 | 69 | 70 | # raid controllers 71 | cciss!(.*) root:disk 660 =cciss/%1 72 | ida!(.*) root:disk 660 =ida/%1 73 | rd!(.*) root:disk 660 =rd/%1 74 | 75 | 76 | fuse root:root 666 77 | 78 | card[0-9] root:video 660 =dri/ 79 | 80 | agpgart root:root 660 >misc/ 81 | psaux root:root 660 >misc/ 82 | rtc root:root 664 >misc/ 83 | 84 | # input stuff 85 | SUBSYSTEM=input;.* root:plugdev 660 86 | 87 | # v4l stuff 88 | vbi[0-9] root:video 660 >v4l/ 89 | video[0-9] root:video 660 >v4l/ 90 | 91 | # dvb stuff 92 | dvb.* root:video 660 93 | 94 | # drm etc 95 | dri/.* root:video 660 96 | 97 | # Don't create old usbdev* devices. 98 | usbdev[0-9].[0-9]* root:root 660 ! 99 | 100 | # Stop creating x:x:x:x which looks like /dev/dm-* 101 | [0-9]+\:[0-9]+\:[0-9]+\:[0-9]+ root:root 660 ! 102 | 103 | # /dev/cpu support. 104 | microcode root:root 600 =cpu/ 105 | cpu([0-9]+) root:root 600 =cpu/%1/cpuid 106 | msr([0-9]+) root:root 600 =cpu/%1/msr 107 | 108 | # Populate /dev/bus/usb. 109 | #SUBSYSTEM=usb;DEVTYPE=usb_device;.* root:root 660 */lib/system/dev-bus-usb 110 | 111 | # Catch-all other devices, Right now useful only for debuging. 112 | #.* root:root 660 */lib/system/catch-all 113 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/motd: -------------------------------------------------------------------------------- 1 | .--.--.--.-----.-----.-------.-----.----.--------.-----. 2 | Welcome to NetBox | | | | -__|__ --|_ _| -__| _| | _ | 3 | Made by Westermo |________|_____|_____| |___| |_____|__| |__|__|__|_____| 4 | https://www.westermo.com 5 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/network/interfaces: -------------------------------------------------------------------------------- 1 | # interfaces(5) file used by ifup(8) and ifdown(8) 2 | auto lo 3 | iface lo inet loopback 4 | 5 | # Default is to have all ports (group port from /etc/iproute2/group) bridged 6 | # as untagged members in the same VLAN (VID 1). 7 | auto br0 8 | iface br0 inet manual 9 | pre-up ip link add dev br0 type bridge stp_state 1 \ 10 | vlan_filtering 1 mcast_vlan_snooping 1 11 | pre-up ip link set group port master br0 12 | pre-up ip link set group port up 13 | pre-up ip link set dev br0 up 14 | post-down ip link set dev br0 down 15 | 16 | # DHCP address, or comment out and enable static below 17 | auto vlan1 18 | iface vlan1 inet dhcp 19 | pre-up bridge vlan global set vid 1 dev br0 mcast_snooping 1 \ 20 | mcast_querier 1 mcast_igmp_version 3 mcast_mld_version 2 21 | pre-up bridge vlan add dev br0 vid 1 self 22 | pre-up ip link add link br0 dev vlan1 type vlan id 1 23 | post-down ip link del vlan1 24 | post-down bridge vlan del vid 1 dev br0 self 25 | 26 | # DHCP with one (or more) static IP addresses 27 | #auto vlan1 28 | #iface vlan1 inet dhcp 29 | # pre-up bridge vlan add dev br0 vid 1 self 30 | # pre-up ip link add link br0 dev vlan1 type vlan id 1 31 | # up ip link set vlan1 up 32 | # up ip address add 192.168.2.200/24 dev vlan1 33 | # up ip route add default via 192.168.2.1 34 | # post-down ip link del vlan1 35 | # post-down bridge vlan del vid 1 dev br0 self 36 | 37 | # Static IP, notice ifupdown in BusyBox doesn't support 192.168.2.200/24 38 | #auto vlan1 39 | #iface vlan1 inet static 40 | # pre-up bridge vlan add dev br0 vid 1 self 41 | # pre-up ip link add link br0 dev vlan1 type vlan id 1 42 | # post-down ip link del vlan1 43 | # post-down bridge vlan del vid 1 dev br0 self 44 | # address 192.168.2.200 45 | # netmask 255.255.255.0 46 | # gateway 192.168.2.1 47 | 48 | # Include files from /etc/network/interfaces.d: 49 | source-directory /etc/network/interfaces.d 50 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/network/interfaces.d/.emtpy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/board/common/rootfs/etc/network/interfaces.d/.emtpy -------------------------------------------------------------------------------- /board/common/rootfs/etc/profile.d/convenience.sh: -------------------------------------------------------------------------------- 1 | alias vim='vi' 2 | alias view='vi -R' 3 | alias emacs='mg' 4 | alias edit='mg' 5 | alias editor=edit 6 | alias sensible-editor=edit 7 | alias sensible-pager=less 8 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/profile.d/ls.sh: -------------------------------------------------------------------------------- 1 | alias l='ls -CF' 2 | alias la='ls -A' 3 | alias ll='ls -alF' 4 | alias ls='ls --color=auto' 5 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/profile.d/ps1.sh: -------------------------------------------------------------------------------- 1 | PS1='\u@\h:\w\$ ' 2 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/profile.d/resize.sh: -------------------------------------------------------------------------------- 1 | TTY=`resize` 2 | eval $TTY 3 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/rc.local: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Called after all other services have been started by Finit 3 | 4 | # Set up firewall rules, port forwards, etc. 5 | #nft -f /etc/nftables.conf 6 | 7 | exit 0 -------------------------------------------------------------------------------- /board/common/rootfs/etc/resolv.conf: -------------------------------------------------------------------------------- 1 | # Used to resolve DNS names 2 | 3 | # Example 1: static setup using private DNS namespaces, from 4 | # https://datatracker.ietf.org/doc/html/rfc6762#appendix-G 5 | #nameserver 192.168.1.1 6 | #search intranet 7 | #domain intranet 8 | 9 | # Example 2: dnsmasq runs locally 10 | #nameserver 127.0.0.53 11 | #search internal lan 12 | #domain internal 13 | 14 | ############################################################################### 15 | ## udhcpc.script adds namesaver and search domain automatically below this line 16 | 17 | -------------------------------------------------------------------------------- /board/common/rootfs/etc/syslog.conf: -------------------------------------------------------------------------------- 1 | # /etc/syslog.conf - Configuration file for syslogd(8) 2 | # 3 | # For information about the format of this file, see syslog.conf(5) 4 | # 5 | 6 | # 7 | # First some standard log files. Log by facility. 8 | # 9 | auth,authpriv.* /var/log/auth.log 10 | 11 | # Everything except debug and security tokens 12 | *.*;*.!=debug;\ 13 | auth,authpriv.none -/var/log/syslog 14 | 15 | #cron.* /var/log/cron.log 16 | #daemon.* -/var/log/daemon.log 17 | kern.* -/var/log/kern.log 18 | #lpr.* -/var/log/lpr.log 19 | mail.* -/var/log/mail.log 20 | #user.* -/var/log/user.log 21 | 22 | # 23 | # Logging for the mail system. Split it up so that 24 | # it is easy to write scripts to parse these files. 25 | # 26 | #mail.info -/var/log/mail.info 27 | #mail.warn -/var/log/mail.warn 28 | mail.err /var/log/mail.err 29 | #mail.*;mail.!=info -/var/log/mail 30 | #mail,news.=info -/var/log/info 31 | 32 | # The tcp wrapper loggs with mail.info, we display all 33 | # the connections on tty12 34 | # 35 | #mail.=info /dev/tty12 36 | 37 | # 38 | # Some "catch-all" log files. 39 | # 40 | #*.=debug;\ 41 | # auth,authpriv.none;\ 42 | # news.none;mail.none -/var/log/debug 43 | *.=info;*.=notice;*.=warn;\ 44 | auth,authpriv.none;\ 45 | cron,daemon.none;\ 46 | mail,news.none -/var/log/messages 47 | 48 | # Store all critical eventes, except kernel logs in critical 49 | # 50 | #*.=crit;kern.none /var/log/critical 51 | 52 | # Example of sending events to remote syslog server. 53 | # All events from notice and above, except auth, authpriv 54 | # and any kernel message are sent to server finlandia in 55 | # RFC5424 formatted output. 56 | # 57 | #*.notice;auth,authpriv.none; 58 | # kern.none\ @finlandia ;RFC5424 59 | 60 | # Emergencies are sent to anyone logged in 61 | # 62 | *.=emerg * 63 | 64 | # Priority alert and above are sent to the operator 65 | # 66 | #*.alert root,joey 67 | 68 | # 69 | # Include all config files in /etc/syslog.d/ 70 | # 71 | include /etc/syslog.d/*.conf 72 | -------------------------------------------------------------------------------- /board/common/rootfs/host/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/board/common/rootfs/host/.empty -------------------------------------------------------------------------------- /board/common/rootfs/lib/system/ident: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Create a finit condition on the form hw/model/. This 4 | # makes it easy to condition a service/task/run based on the 5 | # underlying hardware. 6 | 7 | conddir=/var/run/finit/cond/hw/model 8 | dtmodel=/sys/firmware/devicetree/base/model 9 | 10 | if ! test -e $dtmodel; then 11 | exit 0 12 | fi 13 | 14 | model=$(cat $dtmodel | tr "[A-Z] " "[a-z]-") 15 | 16 | mkdir -p $conddir 17 | ln -s ../../reconf $conddir/$model 18 | -------------------------------------------------------------------------------- /board/common/rootfs/lib/system/if: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | opt="-k" 4 | ident=$(basename "$0") 5 | chans=0 6 | 7 | setup_chan() { 8 | ip link set dev $1 name chan$chans 9 | 10 | # Disable SLAAC frames and such, that's for the port interfaces, and 11 | # bring it up so we get link events from the ports to the bridge. 12 | sysctl -q net.ipv6.conf.chan$chans.disable_ipv6=1 13 | ip link set dev chan$chans up 14 | 15 | chans=$(($chans + 1)) 16 | } 17 | 18 | # fall back to console logging if sysklogd is too old 19 | if ! logger -? |grep -q "Log to kernel"; then 20 | opt="-c" 21 | fi 22 | 23 | # If any ethernet interface is being used as a channel between the CPU 24 | # and a switch managed by DSA, set it up early. 25 | for iface in $(ls /sys/class/net); do 26 | if [ -f /sys/class/net/$iface/dsa/tagging ]; then 27 | setup_chan $iface 28 | fi 29 | done 30 | 31 | # Perform any interface renames as dictated by /etc/mactab. 32 | if [ -f /etc/mactab ]; then 33 | nameif -s 34 | fi 35 | 36 | # Place all eth* interfaces in the "port" group, such that we can 37 | # reference them together later, e.g. in /etc/network/interfaces. 38 | awk -F: ' 39 | /^\s*eth|^\s*lan/ { 40 | print("link set dev", $1, " group port"); 41 | }' > /etc/bridge-stp.conf 48 | fi 49 | 50 | # Check for and fix duplicate MAC addresses 51 | if [ "$(ip -br link show group port | uniq -f 2 -d)" ]; then 52 | logger $opt -p user.warning -t "$ident" \ 53 | "Port MAC addresses not unique, assigning from randomized base MAC." 54 | 55 | base=$(printf '%.2x:%.2x:%.2x:%.2x:%.2x' \ 56 | $(($RANDOM & 0xfe | 0x02)) $(($RANDOM & 0xff)) \ 57 | $(($RANDOM & 0xff)) $(($RANDOM & 0xff)) $(($RANDOM & 0xff))) 58 | lsb=1; 59 | 60 | # Try to be cute and assign the LSB according to the natural order 61 | # of the interface names. E.g. on a system with eth1..eth10, eth1 62 | # would be assigned $base:01 and eth10 $base:0a. 63 | for iface in $(ip -br link show group port \ 64 | | awk '{ sub(/@.*/, ""); print($1); }' | sort -V); do 65 | ip link set dev $iface address $base:$(printf '%.2x' $lsb) 66 | lsb=$(($lsb + 1)) 67 | done 68 | fi 69 | 70 | # Let other scripts depend on us 71 | cond=/var/run/finit/cond/system/if 72 | mkdir -p $(dirname $cond) 73 | ln -s ../reconf $cond 74 | -------------------------------------------------------------------------------- /board/common/rootfs/lib/system/leds: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # The system is now up. Turn off any red status LEDs and turn on any 4 | # green ones. 5 | 6 | for led in $(find /sys/class/leds/ -name '*red:status' -o -name '*red:on'); do 7 | echo 0 >$led/brightness 8 | done 9 | 10 | for led in $(find /sys/class/leds/ -name '*green:status' -o -name '*green:on'); do 11 | echo 1 >$led/brightness 12 | done 13 | -------------------------------------------------------------------------------- /board/common/rootfs/lib/system/mnt: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Called from /etc/fstab to ensure we have something mounted at /mnt, 4 | # which is used by Netbox to store device modifications made to /root, 5 | # /var/lib and /etc. 6 | # 7 | # The source can be (1) an MTD partition named "Config", (2) a disk 8 | # partition labeled "Config". If none of those are available, (3) fall 9 | # back to a tmpfs based RAM disk. This effectively brings up the 10 | # system with the default configuration, but obviously any subsequent 11 | # configuration is ephemeral. 12 | # 13 | # This script also performs the actual factory reset. Before mounting 14 | # the overlays the worker and upper dirs are cleaned. This is the safe 15 | # way to do it. 16 | 17 | set -e 18 | 19 | rc=0 20 | opt="-k" 21 | tab="" 22 | ident=$(basename "$0") 23 | resetme=/mnt/factory-reset.now 24 | 25 | mnt() 26 | { 27 | # If something is already setup, leave it be. 28 | mountpoint -q /mnt && return 0 29 | 30 | # Internal FLASH takes precedence over disks. 31 | mount $tab mtd:Config && return 0 32 | mount $tab LABEL=Config && return 0 33 | 34 | return 1 35 | } 36 | 37 | # fall back to console logging if sysklogd is too old 38 | if ! logger -? |grep -q "Log to kernel"; then 39 | opt="-c" 40 | fi 41 | 42 | if [ -n "$FSTAB_FILE" ]; then 43 | tab="-T $FSTAB_FILE" 44 | fi 45 | 46 | if ! mnt; then 47 | logger $opt -p user.crit -t "$ident" \ 48 | "/mnt was not properly mounted, falling back to tmpfs." 49 | 50 | # Fall back to RAM disk. 51 | mount $tab tmpfs-Config 52 | rc=1 53 | fi 54 | 55 | # Allow users in wheel group to write to /mnt 56 | chgrp wheel /mnt && chmod g+w /mnt 57 | 58 | # Migrate from previous namespace for overlay 59 | if [ -d /mnt/netbox ]; then 60 | mv /mnt/netbox /mnt/system 61 | fi 62 | 63 | # Perform factory reset before mounting overlay 64 | if [ -f "$resetme" ]; then 65 | logger $opt -p user.crit -t "$ident" \ 66 | "Resetting to factory default settings." 67 | rm -rf /mnt/system/*.u /mnt/system/*.w 68 | rm "$resetme" 69 | fi 70 | 71 | exit $rc 72 | -------------------------------------------------------------------------------- /board/common/rootfs/log: -------------------------------------------------------------------------------- 1 | var/log -------------------------------------------------------------------------------- /board/common/rootfs/usr/sbin/upgrade: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | TMP_UPGRADE="/tmp/upgrade/" 4 | filename="" 5 | 6 | usage() 7 | { 8 | cat < <[URI://][ADDRESS[:PORT]/]FILE | ADDRESS FILE> 11 | 12 | Upgrade primary (main), secondary (backup) or bootloader firmware. 13 | 14 | examples: 15 | > upgrade pri ftp://192.0.2.1/netbox-os.img 16 | > upgrade sec http://myfancywebsite.com/downloads/netbox-os.img 17 | > upgrade boot 192.0.2.1 netbox-os.img 18 | EOF 19 | } 20 | 21 | test_ping() 22 | { 23 | timeout 1s ping $1 -c 1 &> /dev/null 24 | if [ $? -ne 0 ]; then 25 | echo "Could not reach host with ping, Terminating."; 26 | exit 1; 27 | fi 28 | } 29 | 30 | use_wget() 31 | { 32 | host=$(echo $1 | awk -F"/" '{ print $3 }') 33 | test_ping $host 34 | filename=$(echo $1 | awk -F"/" '{ print $NF }') 35 | wget -P $TMP_UPGADE $1 36 | } 37 | 38 | use_tftp() 39 | { 40 | tftp -g -r $2 -l $TMP_UPGRADE$filename $1 41 | echo "Dowload finished." 42 | return $? 43 | } 44 | 45 | use_ftp() 46 | { 47 | test_ping $1 48 | filename=$(echo "$2" | awk -F"/" '{ print $NF }'); 49 | ftpget $1 $TMP_UPGRADE$filename $2 50 | if [ $? -ne 0 ]; then 51 | echo "Could not get file via FTP, trying TFTP next." 52 | use_tftp $1 $2; 53 | return $? 54 | fi 55 | } 56 | 57 | get_file() 58 | { 59 | remloc=$(echo "$1" | awk '/ftp/{print}') 60 | 61 | # If not ftp or tftp then try http 62 | if [ -z "$remloc" ]; then 63 | remloc=$(echo "$1" | awk '/http/{print}'); 64 | # If still not found, wrong input from user 65 | if [ -z "$remloc" ]; then 66 | echo "Incorrect search path"; 67 | usage 68 | exit 1; 69 | fi 70 | use_wget $remloc 71 | # Try get the file via ftp/tftp 72 | else 73 | host=$(echo "$remloc" | awk -F"/" '{ print $3 }'); 74 | filepath=$(echo "$remloc" | awk -F"/" '{ print substr($0, index($0,$4)) }'); 75 | use_ftp $host $filepath 76 | fi 77 | } 78 | 79 | upgrade() 80 | { 81 | partition=$1 82 | printf "Upgrading partition %s ...... " "$partition" 83 | flash_unlock $partition 2> /dev/null 84 | flashcp -v $TMP_UPGRADE$filename $partition 85 | flash_lock $partition 0 -1 2> /dev/null 86 | printf "[Done]\n" 87 | } 88 | 89 | find_mtd() 90 | { 91 | local partname="None" 92 | inp=$(echo $1 | awk '{print tolower(substr($0,0,3))}') 93 | 94 | grep "Primary" /proc/mtd > /dev/null 95 | if [ $? -eq 1 ]; then 96 | if [ "$inp" = "pri" ]; then 97 | partname="Linux_main"; 98 | elif [ "$inp" = "sec" ]; then 99 | partname="Linux_backup"; 100 | elif [ "$inp" = "boo" ]; then 101 | partname="Barebox"; 102 | else 103 | exit; 104 | fi 105 | else 106 | if [ "$inp" = "pri" ]; then 107 | partname="Primary"; 108 | elif [ "$inp" = "sec" ]; then 109 | partname="Secondary"; 110 | elif [ "$inp" = "boo" ]; then 111 | partname="Bootloader"; 112 | else 113 | exit; 114 | fi 115 | fi 116 | 117 | if [ "$partname" = "None" ]; then 118 | echo "Bad partition name." 119 | usage 120 | return 1; 121 | fi 122 | 123 | mtd=$(awk -v part="$partname" -F":" '$0 ~ part { print $1 }' /proc/mtd) 124 | 125 | if [ -z "$mtd" ]; then 126 | echo "Could not find mtd partition '$partname' in /proc/mtd" 127 | usage 128 | return 1 129 | fi 130 | 131 | echo "/dev/$mtd" 132 | } 133 | 134 | if [ "$1" = "" ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then 135 | usage; 136 | exit 0; 137 | fi 138 | 139 | partname="$(find_mtd $1)" 140 | if [ $? -ne 0 ]; then 141 | echo $partname; 142 | exit 1; 143 | fi 144 | 145 | if [ $# -eq 2 ]; then 146 | get_file $2 147 | elif [ $# -eq 3 ]; then 148 | use_ftp $2 $3 149 | else 150 | echo "Wrong number of arguments" 151 | usage 152 | exit 1 153 | fi 154 | 155 | upgrade "$partname" 156 | -------------------------------------------------------------------------------- /board/common/rootfs/usr/share/udhcpc/default.script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Based on the buildroot udhcpc script edited by Tim Riker 3 | # Changes made by Joachim Wiberg : 4 | # - s/avahi-autoipd/zcip/g 5 | # - s/ifconfig/ip addr/g TODO 6 | # 7 | # shellcheck disable=SC2154 # variables set by udhcpc on entry 8 | 9 | [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1 10 | 11 | # ZeroConf options 12 | zcip=$(command -v zcip) 13 | zcip_pid="/var/run/zcip-$interface.pid" 14 | zcip_cache="/var/cache/zcip-$interface.cache" 15 | zcip_script="/usr/share/zcip/default.script" 16 | export LOGGING=none 17 | 18 | # DHCP options 19 | ACTION="$1" 20 | RESOLV_CONF="/etc/resolv.conf" 21 | tag="udhcpc" 22 | [ -e $RESOLV_CONF ] || touch $RESOLV_CONF 23 | [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" 24 | [ -n "$subnet" ] && NETMASK="netmask $subnet" 25 | # Handle stateful DHCPv6 like DHCPv4 26 | [ -n "$ipv6" ] && ip="$ipv6/128" 27 | 28 | if [ -z "${IF_WAIT_DELAY}" ]; then 29 | IF_WAIT_DELAY=10 30 | fi 31 | 32 | status_zcip() { 33 | [ -f "$zcip_pid" ] || return 1 34 | 35 | pid=$(cat "$zcip_pid") 36 | comm=$(cat "/proc/$pid/comm") 37 | [ "$comm" = "zcip" ] || return 1 38 | 39 | return 0 40 | } 41 | 42 | start_zcip() { 43 | [ -z "$zcip" ] && return 44 | status_zcip && return 45 | 46 | if [ -f "$zcip_cache" ]; then 47 | ARGS="-r $(cat $zcip_cache)" 48 | fi 49 | 50 | start-stop-daemon -Sq -bmp "$zcip_pid" -x "$zcip" -- \ 51 | $ARGS -f "$interface" "$zcip_script" 52 | } 53 | 54 | stop_zcip() { 55 | [ -z "$zcip" ] && return 56 | status_zcip || return 57 | 58 | start-stop-daemon -Kq -p "$zcip_pid" -x "$zcip" 59 | rm -f "$zcip_pid" 60 | } 61 | 62 | wait_for_ipv6_default_route() { 63 | logger -t "$tag" -p daemon.info "$interface: waiting for IPv6 default route to appear ..." 64 | while [ $IF_WAIT_DELAY -gt 0 ]; do 65 | if ip -6 route list 2>/dev/null | grep -q default; then 66 | return 67 | fi 68 | sleep 1 69 | : $((IF_WAIT_DELAY -= 1)) 70 | done 71 | logger -t "$tag" -p daemon.info "$interface: IPv6 default route timeout!" 72 | } 73 | 74 | case "$ACTION" in 75 | deconfig) 76 | logger -t "$tag" -p daemon.debug "$interface: initializing ..." 77 | /sbin/ifconfig $interface up 78 | /sbin/ifconfig $interface 0.0.0.0 79 | 80 | # drop info from this interface 81 | # resolv.conf may be a symlink to /tmp/, so take care 82 | TMPFILE=$(mktemp) 83 | grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE 84 | cat $TMPFILE > $RESOLV_CONF 85 | rm -f $TMPFILE 86 | 87 | stop_zcip 88 | ;; 89 | 90 | leasefail|nak) 91 | logger -t "$tag" -p daemon.info "$interface: no response from DHCP server" 92 | start_zcip 93 | ;; 94 | 95 | renew|bound) 96 | stop_zcip 97 | 98 | logger -t "$tag" -p daemon.info "$interface: got DHCP lease $ip" 99 | /sbin/ifconfig $interface $ip $BROADCAST $NETMASK 100 | if [ -n "$ipv6" ] ; then 101 | wait_for_ipv6_default_route 102 | fi 103 | 104 | # RFC3442: If the DHCP server returns both a Classless 105 | # Static Routes option and a Router option, the DHCP 106 | # client MUST ignore the Router option. 107 | if [ -n "$staticroutes" ]; then 108 | logger -t "$tag" -p daemon.debug "$interface: deleting routers" 109 | route -n | while read dest gw mask flags metric ref use iface; do 110 | [ "$iface" != "$interface" -o "$gw" = "0.0.0.0" ] || \ 111 | route del -net "$dest" netmask "$mask" gw "$gw" dev "$interface" 112 | done 113 | 114 | # format: dest1/mask gw1 ... destn/mask gwn 115 | set -- $staticroutes 116 | while [ -n "$1" -a -n "$2" ]; do 117 | route add -net "$1" gw "$2" dev "$interface" 118 | shift 2 119 | done 120 | elif [ -n "$router" ] ; then 121 | logger -t "$tag" -p daemon.debug "$interface: deleting routers" 122 | while route del default gw 0.0.0.0 dev $interface 2> /dev/null; do 123 | : 124 | done 125 | 126 | for i in $router ; do 127 | route add default gw $i dev $interface 128 | done 129 | fi 130 | 131 | # drop info from this interface 132 | # resolv.conf may be a symlink to /tmp/, so take care 133 | TMPFILE=$(mktemp) 134 | grep -vE "# $interface\$" $RESOLV_CONF > $TMPFILE 135 | cat $TMPFILE > $RESOLV_CONF 136 | rm -f $TMPFILE 137 | 138 | # prefer rfc3397 domain search list (option 119) if available 139 | if [ -n "$search" ]; then 140 | search_list=$search 141 | elif [ -n "$domain" ]; then 142 | search_list=$domain 143 | fi 144 | 145 | [ -n "$search_list" ] && 146 | echo "search $search_list # $interface" >> $RESOLV_CONF 147 | 148 | for i in $dns ; do 149 | logger -t "$tag" -p daemon.debug "$interface: adding dns $i" 150 | echo "nameserver $i # $interface" >> $RESOLV_CONF 151 | done 152 | ;; 153 | esac 154 | 155 | HOOK_DIR="$0.d" 156 | for hook in "${HOOK_DIR}/"*; do 157 | [ -f "${hook}" -a -x "${hook}" ] || continue 158 | "${hook}" "$ACTION" 159 | done 160 | 161 | exit 0 162 | -------------------------------------------------------------------------------- /board/common/rootfs/usr/share/zcip/default.script: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # for now, zcip requires the link to be already up, 3 | # and it drops links when they go down. that isn't 4 | # the most robust model... 5 | # shellcheck disable=SC2154 # variables set by zcip on entry 6 | 7 | # only for use as a "zcip" callback script 8 | if [ "x$interface" = x ]; then 9 | exit 1 10 | fi 11 | 12 | tag="zcip" 13 | cache="/var/cache/zcip-$interface.cache" 14 | 15 | 16 | # zcip should start on boot/resume and various media changes 17 | case "$1" in 18 | init) 19 | logger -t "$tag" -p daemon.debug "$interface: initializing ..." 20 | /sbin/ifconfig "$interface" up 21 | exit 0 22 | ;; 23 | 24 | config) 25 | [ "x$ip" = "x" ] && exit 1 26 | 27 | # remember $ip for $interface, to use on restart 28 | echo "$ip" > "$cache" 29 | 30 | logger -t "$tag" -p daemon.info "$interface: setting address $ip" 31 | exec ip address add dev "$interface" \ 32 | scope link local "$ip/16" broadcast + 33 | ;; 34 | 35 | deconfig) 36 | [ "x$ip" = "x" ] && exit 1 37 | logger -t "$tag" -p daemon.info "$interface: removing address $ip" 38 | exec ip address del dev "$interface" local "$ip" 39 | ;; 40 | 41 | *) 42 | logger -t "$tag" -p daemon.warn "$interface: uknown action $1" 43 | ;; 44 | esac 45 | 46 | exit 1 47 | -------------------------------------------------------------------------------- /board/common/users_table.txt: -------------------------------------------------------------------------------- 1 | factory -1 wheel -1 =reset - /sbin/factory - Reset to factory configuration 2 | frr -1 frr -1 * /run/frr /usr/sbin/nologin - FRRouting suite 3 | - -1 frrvty -1 * - - - 4 | -------------------------------------------------------------------------------- /board/common/xattrs: -------------------------------------------------------------------------------- 1 | # Allow all users to do reboot via factory reset program 2 | /sbin/factory f 4755 root root - - - - - 3 | -------------------------------------------------------------------------------- /board/coronet/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Board specific additions or cleanup, runs after common/post-image.sh 3 | 4 | exit 0 5 | -------------------------------------------------------------------------------- /board/dagger/README.md: -------------------------------------------------------------------------------- 1 | Westermo Dagger 2 | =============== 3 | 4 | This is a proprietary platform based around a dual-core ARMv7 Cortex-A9 5 | with a Marvell Prestera switchcore chipset. 6 | 7 | State: only tested in Qemu (make run), no xc3 driver yet 8 | 9 | -------------------------------------------------------------------------------- /board/dagger/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Board specific additions or cleanup, runs after common/post-image.sh 3 | 4 | exit 0 5 | -------------------------------------------------------------------------------- /board/ember/README.md: -------------------------------------------------------------------------------- 1 | Westermo Ember 2 | ============== 3 | 4 | Ember is the collective Westermo platform name for an Arm64 CPU with a 5 | Microship Sparx5i switchcore. 6 | 7 | -------------------------------------------------------------------------------- /board/ember/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Board specific additions or cleanup, runs after common/post-image.sh 3 | 4 | exit 0 5 | -------------------------------------------------------------------------------- /board/envoy/README.md: -------------------------------------------------------------------------------- 1 | Westermo Envoy 2 | ============== 3 | 4 | Envoy is the collective Westermo platform name for an Arm64 CPU with a 5 | Marvell SOHO switchcore. Publicliy available, and supported, target 6 | boards include the Marvell ESPRESSObin from Globalscale Technologies. 7 | 8 | This file details how to connect to, and configure, supported boards. 9 | 10 | You need a UART connection, using the on-board micro/type-c USB port. 11 | All supported boards default to 115200 8N1. The on-board serial TTL to 12 | USB converter is either a Prolific or FTDI controller. 13 | 14 | 15 | Marvell ESPRESSObin 16 | ------------------- 17 | 18 | ### Booting 19 | 20 | By default, the ESPRESSObin comes with a pre-flashed U-Boot set up to 21 | load the kernel, device-tree and rootfs from SPI NOR flash. The board 22 | jumpers can be changed to boot from different sources, see the quick 23 | start guide for each board revision for details: 24 | 25 | - ftp://downloads.globalscaletechnologies.com/Downloads/Espressobin/ESPRESSObin%20V5/ 26 | - ftp://downloads.globalscaletechnologies.com/Downloads/Espressobin/ESPRESSObin%20V7/ 27 | 28 | Note: the v5, and earlier, cannot boot from sd card, so you have to set 29 | up the factory U-Boot to boot into Buildroot: 30 | 31 | 1. Flash rootfs image to sdcard drive, your `of=` device may differ: 32 | 33 | $ sudo dd if=output/images/sdcard.img of=/dev/mmcblk0 bs=1M status=progress oflag=direct 34 | $ sync 35 | 36 | 2. Boot board from SPI NOR, interrupt boot by pressing any key ... 37 | 3. Check with `printenv` that the default setup is OK, otherwise ensure 38 | the following are set, and define `bootcmd` for automatic boot. 39 | Notice the device tree file (.dtb), depending on the board and 40 | kernel, you may want see what other .dtb files are available: 41 | 42 | > setenv kernel_addr 0x5000000 43 | > setenv fdt_addr 0x1800000 44 | > setenv fdt_name boot/marvell/armada-3720-espressobin.dtb 45 | > setenv console console=ttyMV0,115200 earlycon=ar3700_uart,0xd0012000 46 | > setenv bootcmd 'mmc dev 0; ext4load mmc 0:1 $kernel_addr $image_name;ext4load mmc 0:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk0p1 ro quiet block2mtd.block2mtd=/dev/mmcblk0p2,,Config net.ifnames=0 biosdevname=0; booti $kernel_addr - $fdt_addr' 47 | 48 | 4. Optionally save the new settings for the next boot with `saveenv` 49 | 5. Call the boot command, or `reset` the board to start: 50 | 51 | > run bootcmd 52 | 53 | 54 | Marvell MACCHIATObin 55 | -------------------- 56 | 57 | ### Booting 58 | 59 | By default, the MACCHIATObin is set to boot from SD card, so the switches 60 | SW2 and SW1 needs to be changed to boot from SPI flash. That way we can 61 | reuse the same SD card and boot method for the ESPRESSObin (above). 62 | 63 | | Boot | SW2(1/5) | SW2(2/5) | SW2(3/5) | SW2(4/5) | SW2(5/5) | SW1(1/5) | SW1(2/5) | SW1(3/5) | SW1(4/5) | SW1(5/5) | 64 | |---------|----------|----------|----------|----------|----------|----------|----------|----------|----------|----------| 65 | | SPI ROM | off | off | off | on | on | off | x | x | x | x | 66 | | SD card | off | on | on | on | off | on | x | x | x | x | 67 | | eMMC | off | on | on | on | on | off | x | x | x | x | 68 | 69 | https://developer.solid-run.com/knowledge-base/marvell-armada-8040-dipswitch/ 70 | 71 | There some differences to the ESPRSSObin though, so pay attention to 72 | these U-Boot commands: 73 | 74 | > setenv image_name boot/Image 75 | > setenv kernel_addr 0x5000000 76 | > setenv fdt_addr 0x4f00000 77 | > setenv fdt_name boot/marvell/armada-8040-mcbin.dtb 78 | > setenv console console=ttyS0,115200 79 | > setenv bootcmd 'mmc dev 1; ext4load mmc 1:1 $kernel_addr $image_name;ext4load mmc 1:1 $fdt_addr $fdt_name;setenv bootargs $console root=/dev/mmcblk1p1 ro quiet block2mtd.block2mtd=/dev/mmcblk1p2,,Config net.ifnames=0 biosdevname=0; booti $kernel_addr - $fdt_addr' 80 | > saveenv 81 | > run bootcmd 82 | 83 | On the next board reset, the `$bootcmd` will be executed automatically. 84 | 85 | 86 | Networking 87 | ---------- 88 | 89 | In contrast to vanilla Buildroot, NetBox comes prefconfigured with all¹ 90 | ports set up in a VLAN capable bridge, with offloading to the underlying 91 | switchcore enabled. On top of the bridge a VLAN interface (vlan1) is 92 | set up which runs a DHCP client. 93 | 94 | vlan1 vlan2 Layer-3 :: IP Networking 95 | \ / ------------------------------- 96 | br0 97 | ____|____ Layer-2 :: Switching 98 | [#_#_#_#_#] 99 | / | \ ------------------------------- 100 | eth0 eth1 eth2 Layer-1 :: Link layer 101 | 102 | Adding another VLAN interface (vlan2), and/or moving physical ports to 103 | that VLAN, is outside the scope of this README. See, for instance, the 104 | blog post: 105 | 106 | https://westermo.github.io/howto/2020/03/24/linux-networking-bridge.html 107 | 108 | ____ 109 | ¹ Exceptions to the rule exist, the ESPRESSObin has two lan ports and one 110 | wan port, only the lan ports are included in the bridge. 111 | -------------------------------------------------------------------------------- /board/envoy/genimage.cfg: -------------------------------------------------------------------------------- 1 | # this generates an sd card image for the EspressoBin. We use the 2 | # on-board U-boot because the older cards (pre v7) cannot read the 3 | # bootloader from mmc. 4 | # 5 | # See the README.md file in this directory for details on how to set up 6 | # U-boot to load and run. Notice the use of the mtd2block driver where 7 | # we fake a writable JFFS2 MTD partition using the second partition in 8 | # this image. 9 | image sdcard.img { 10 | hdimage { 11 | } 12 | 13 | partition rootfs { 14 | partition-type = 0x83 15 | image = "rootfs.ext2" 16 | } 17 | 18 | partition config { 19 | partition-type = 0x83 20 | image = "config.ext3" 21 | } 22 | } 23 | 24 | image config.ext3 { 25 | ext3 { 26 | label = "Config" 27 | } 28 | empty = true 29 | size = 16M 30 | } 31 | 32 | # silence warning 33 | config { 34 | } 35 | -------------------------------------------------------------------------------- /board/envoy/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Board specific additions or cleanup, runs after common/post-image.sh 3 | 4 | # Only used for creating the sdcard.img 5 | rm ${BINARIES_DIR}/config.ext3 6 | 7 | exit 0 8 | -------------------------------------------------------------------------------- /board/envoy/rootfs/etc/finit.d/available/poe-supervision.conf: -------------------------------------------------------------------------------- 1 | service [2345] /lib/system/envoy/poe-supervision -- PoE Supervision 2 | -------------------------------------------------------------------------------- /board/envoy/rootfs/etc/finit.d/system-envoy.conf: -------------------------------------------------------------------------------- 1 | run :envoy [S] /lib/system/envoy/if -- 2 | 3 | task [2] /lib/system/envoy/init-envious -- Initializing Envious board 4 | -------------------------------------------------------------------------------- /board/envoy/rootfs/lib/system/envoy/if: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | case $(ethtool -i chan0 | awk '/driver: / { print($2); }') in 4 | fec) 5 | # Driver has an idiosyncratic default setting where IRQs are 6 | # coalesced up to 1ms, or until at least 200 packets are 7 | # pending. Latency is thus awful in low rate scenarios 8 | # (e.g. pinging an idle system). Turn it down to a level where 9 | # a sudden spike in ingress traffic will still directly switch 10 | # to polled NAPI mode, yet keeps latency within reason. 11 | ethtool -C chan0 rx-usecs 40 rx-frames 64 12 | ;; 13 | esac 14 | -------------------------------------------------------------------------------- /board/envoy/rootfs/lib/system/envoy/init-envious: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | opt="-k" 4 | ident=$(basename $0) 5 | 6 | gpiobyname() { 7 | gpioinfo | awk -v pin=$1 ' 8 | /^[^\t]/ { chip=$1 } 9 | /^\t/ { 10 | if ($3 == "\"" pin "\"") { 11 | gsub(":", ""); 12 | print(chip, $2); 13 | } 14 | } 15 | ' 16 | } 17 | 18 | # fall back to console logging if sysklogd is too old 19 | if ! logger -? |grep -q "Log to kernel"; then 20 | opt="-c" 21 | fi 22 | 23 | # Release expansion board from reset 24 | gpioset $(gpiobyname exp-reset)=1 25 | sleep 0.1 26 | 27 | # Check for ID memory 28 | if ! i2cget -f -y 2 0x54 &>/dev/null; then 29 | logger $opt -p user.info -t "$ident" \ 30 | "No expansion board connected" 31 | 32 | exit 0 33 | fi 34 | 35 | # TODO: Support multiple boards 36 | logger $opt -p user.info -t "$ident" \ 37 | "Assuming PoE expansion board" 38 | 39 | ids="0x20 0x24" 40 | 41 | for id in $ids; do 42 | i2cget -y 2 $id &>/dev/null && continue 43 | 44 | logger $opt -p user.err -t "$ident" \ 45 | "PoE Controller $id not present" 46 | 47 | exit 1 48 | done 49 | 50 | for id in $ids; do 51 | # Enable high power on all ports 52 | i2cset -y 2 $id 0x44 0x0f 53 | 54 | reg=0x46 55 | for p in 0 1 2 3; do 56 | # Enable 2 event classification 57 | i2cset -y 2 $id $reg 0x01 58 | reg=$(printf '%#x' $(($reg + 1))) 59 | 60 | # Icut set to 0,6 A (i.e. 32,4 W when 54V supply) 61 | i2cset -y 2 $id $reg 0x10 62 | reg=$(printf '%#x' $(($reg + 1))) 63 | 64 | # Ilim set to 0,850 A 65 | i2cset -y 2 $id $reg 0xa0 66 | reg=$(printf '%#x' $(($reg + 3))) 67 | done 68 | 69 | # Set all ports in auto mode i.e. controller will automatically 70 | # detect/classify and power up. 71 | i2cset -y 2 $id 0x12 0xff 72 | # Enable detection and classification on all ports. 73 | i2cset -y 2 $id 0x14 0xff 74 | # Disable AC disconnect and enable DC disconnect on all ports. 75 | i2cset -y 2 $id 0x13 0x0f 76 | done 77 | -------------------------------------------------------------------------------- /board/envoy/rootfs/lib/system/envoy/poe-supervision: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | opt="-k" 4 | ident=$(basename $0) 5 | 6 | gpiobyname() { 7 | gpioinfo | awk -v pin=$1 ' 8 | /^[^\t]/ { chip=$1 } 9 | /^\t/ { 10 | if ($3 == "\"" pin "\"") { 11 | gsub(":", ""); 12 | print(chip, $2); 13 | } 14 | } 15 | ' 16 | } 17 | 18 | # fall back to console logging if sysklogd is too old 19 | if ! logger -? |grep -q "Log to kernel"; then 20 | opt="-c" 21 | fi 22 | 23 | loop=1 24 | undervoltage=0 25 | 26 | while [ $loop -gt 0 ] 27 | do 28 | rawread=`cat /sys/bus/iio/devices/iio:device0/in_voltage_raw` 29 | let rawmV=rawread*1000 30 | let rawmV=rawmV*66 31 | let voltagemV=rawmV/255 32 | 33 | if [ $voltagemV -lt 44000 ]; then 34 | if [ $undervoltage -eq 0 ]; then 35 | logger $opt -p user.info -t "$ident" \ 36 | "PoE Undervoltage: $voltagemV" 37 | fi 38 | undervoltage=1 39 | 40 | # Reset via PoE_RST 41 | gpioset $(gpiobyname exp-reset)=0 42 | sleep 0.1 43 | elif [ $voltagemV -gt 45500 ]; then 44 | if [ $undervoltage -eq 1 ]; then 45 | logger $opt -p user.info -t "$ident" \ 46 | "PoE voltage ok: $voltagemV" 47 | 48 | # Release PoE_RST 49 | gpioset $(gpiobyname exp-reset)=1 50 | sleep 0.1 51 | 52 | Check for ID memory 53 | if ! i2cget -f -y 2 0x54 &>/dev/null; then 54 | logger $opt -p user.info -t "$ident" \ 55 | "No expansion board connected" 56 | 57 | exit 0 58 | fi 59 | 60 | # TODO: Support multiple boards 61 | 62 | ids="0x20 0x24" 63 | 64 | for id in $ids; do 65 | i2cget -y 2 $id &>/dev/null && continue 66 | exit 1 67 | done 68 | 69 | for id in $ids; do 70 | # Enable high power on all ports 71 | i2cset -y 2 $id 0x44 0x0f 72 | 73 | reg=0x46 74 | for p in 0 1 2 3; do 75 | # Enable 2 event classification 76 | i2cset -y 2 $id $reg 0x01 77 | reg=$(printf '%#x' $(($reg + 1))) 78 | 79 | # Icut set to 0,6 A (i.e. 32,4 W when 54V supply) 80 | i2cset -y 2 $id $reg 0x10 81 | reg=$(printf '%#x' $(($reg + 1))) 82 | 83 | # Ilim set to 0,850 A 84 | i2cset -y 2 $id $reg 0xa0 85 | reg=$(printf '%#x' $(($reg + 3))) 86 | done 87 | 88 | # Set all ports in auto mode i.e. controller will automatically 89 | # detect/classify and power up. 90 | i2cset -y 2 $id 0x12 0xff 91 | # Enable detection and classification on all ports. 92 | i2cset -y 2 $id 0x14 0xff 93 | # Disable AC disconnect and enable DC disconnect on all ports. 94 | i2cset -y 2 $id 0x13 0x0f 95 | done 96 | fi 97 | 98 | undervoltage=0 99 | fi 100 | 101 | sleep 2 102 | done 103 | -------------------------------------------------------------------------------- /board/zero/genimage.cfg: -------------------------------------------------------------------------------- 1 | image config.ext3 { 2 | ext3 { 3 | label = "Config" 4 | } 5 | empty = true 6 | size = 16M 7 | } 8 | 9 | config { 10 | } 11 | -------------------------------------------------------------------------------- /board/zero/isolinux.cfg: -------------------------------------------------------------------------------- 1 | serial 0 115200 2 | timeout 20 3 | totaltimeout 100 4 | ontimeout qemu 5 | ui menu.c32 6 | 7 | label qemu 8 | kernel __KERNEL_PATH__ 9 | initrd __INITRD_PATH__ 10 | append quiet console=ttyS0 11 | 12 | label live 13 | kernel __KERNEL_PATH__ 14 | initrd __INITRD_PATH__ 15 | append quiet console=tty0 16 | -------------------------------------------------------------------------------- /board/zero/post-image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Board specific additions or cleanup, runs after common/post-image.sh 3 | 4 | exit 0 5 | -------------------------------------------------------------------------------- /configs/include/app.m4: -------------------------------------------------------------------------------- 1 | # BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW is not set 2 | # APP profile selects the following packages 3 | BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES="$(BR2_EXTERNAL_NETBOX_PATH)/board/app/busybox.fragment" 4 | NETBOX_TYPE_APP=y 5 | BR2_PACKAGE_DROPBEAR=y 6 | BR2_PACKAGE_TCPDUMP=y 7 | include([toolchain-bootlin-app.m4]) -------------------------------------------------------------------------------- /configs/include/base.m4: -------------------------------------------------------------------------------- 1 | BR2_DL_DIR="$(BR2_EXTERNAL_NETBOX_PATH)/dl" 2 | BR2_CCACHE=y 3 | BR2_CCACHE_DIR="$(BR2_EXTERNAL_NETBOX_PATH)/.buildroot-ccache" 4 | BR2_ENABLE_DEBUG=y 5 | BR2_GLOBAL_PATCH_DIR="$(BR2_EXTERNAL_NETBOX_PATH)/patches" 6 | BR2_TARGET_GENERIC_HOSTNAME="$(NETBOX_PLAT)" 7 | BR2_TARGET_GENERIC_ISSUE="NetBox - The Networking Toolbox" 8 | BR2_INIT_FINIT=y 9 | dnl Include platform-specific overlay if plat_overlay is set 10 | format([BR2_ROOTFS_OVERLAY="$(BR2_EXTERNAL_NETBOX_PATH)/board/common/rootfs %s %s"], 11 | ifdef([os_rootfs_overlay], os_rootfs_overlay,), 12 | ifdef([os_rootfs_overlay_extra], os_rootfs_overlay_extra,)) 13 | BR2_ROOTFS_POST_BUILD_SCRIPT="$(BR2_EXTERNAL_NETBOX_PATH)/board/common/post-build.sh" 14 | BR2_ROOTFS_POST_IMAGE_SCRIPT="$(BR2_EXTERNAL_NETBOX_PATH)/board/common/post-image.sh $(BR2_EXTERNAL_NETBOX_PATH)/board/$(NETBOX_PLAT)/post-image.sh " 15 | BR2_PACKAGE_BUSYBOX_CONFIG="$(BR2_EXTERNAL_NETBOX_PATH)/board/common/busybox.config" 16 | BR2_PACKAGE_BUSYBOX_SHOW_OTHERS=y 17 | BR2_TARGET_ROOTFS_SQUASHFS=y 18 | BR2_PACKAGE_HOST_GENIMAGE=y 19 | BR2_PACKAGE_HOST_GENEXT2FS=y 20 | BR2_PACKAGE_HOST_SQUASHFS=y 21 | # BR2_TARGET_ROOTFS_TAR is not set 22 | -------------------------------------------------------------------------------- /configs/include/defs.m4: -------------------------------------------------------------------------------- 1 | dnl Remap qoutes from std m4 style `' to autoconf style [] 2 | dnl https://lists.gnu.org/archive/html/m4-discuss/2015-04/msg00005.html 3 | changequote([, ]) 4 | -------------------------------------------------------------------------------- /configs/include/os.m4: -------------------------------------------------------------------------------- 1 | BR2_LINUX_KERNEL=y 2 | BR2_LINUX_KERNEL_CUSTOM_VERSION=y 3 | BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="5.16.8" 4 | BR2_LINUX_KERNEL_USE_CUSTOM_CONFIG=y 5 | BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE="$(BR2_EXTERNAL_NETBOX_PATH)/board/$(NETBOX_PLAT)/linux_defconfig" 6 | BR2_LINUX_KERNEL_INSTALL_TARGET=y 7 | 8 | dnl Additional users and their permiossions 9 | BR2_ROOTFS_USERS_TABLES="$(BR2_EXTERNAL_NETBOX_PATH)/board/common/users_table.txt" 10 | BR2_ROOTFS_DEVICE_TABLE="$(BR2_EXTERNAL_NETBOX_PATH)/board/common/xattrs" 11 | 12 | dnl OS profile requires the following extra Finit plugins, which make no sense for apps 13 | BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y 14 | BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD=y 15 | BR2_PACKAGE_FINIT_PLUGIN_MODPROBE=y 16 | BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG=y 17 | BR2_PACKAGE_FINIT_PLUGIN_RTC=y 18 | BR2_PACKAGE_FINIT_PLUGIN_URANDOM=y 19 | 20 | dnl OS profile selects the following packages 21 | NETBOX_TYPE_OS=y 22 | BR2_PACKAGE_BRIST=y 23 | BR2_PACKAGE_FACTORY=y 24 | BR2_PACKAGE_DNSMASQ=y 25 | BR2_PACKAGE_DROPBEAR=y 26 | BR2_PACKAGE_ETHTOOL=y 27 | BR2_PACKAGE_EVTEST=y 28 | BR2_PACKAGE_INADYN=y 29 | BR2_PACKAGE_IPERF=y 30 | BR2_PACKAGE_IPERF3=y 31 | BR2_PACKAGE_IPROUTE2=y 32 | BR2_PACKAGE_LIBCURL=y 33 | BR2_PACKAGE_LIBGPIOD=y 34 | BR2_PACKAGE_LIBGPIOD_TOOLS=y 35 | BR2_PACKAGE_LIBNL=y 36 | BR2_PACKAGE_LLDPD=y 37 | BR2_PACKAGE_LM_SENSORS=y 38 | BR2_PACKAGE_MCJOIN=y 39 | BR2_PACKAGE_MDNSD=y 40 | BR2_PACKAGE_MDNSD_FINIT=y 41 | BR2_PACKAGE_MDIO_TOOLS=y 42 | BR2_PACKAGE_MG=y 43 | BR2_PACKAGE_MRP=y 44 | BR2_PACKAGE_MSTPD=y 45 | BR2_PACKAGE_NEMESIS=y 46 | BR2_PACKAGE_NETCALC=y 47 | # BR2_PACKAGE_NETSNMP_ENABLE_MIBS is not set 48 | BR2_PACKAGE_NETSNMP_OPENSSL_INTERNAL=y 49 | BR2_PACKAGE_NETSNMP=y 50 | BR2_PACKAGE_NFTABLES=y 51 | BR2_PACKAGE_QUERIERD=y 52 | BR2_PACKAGE_SMCROUTE=y 53 | BR2_PACKAGE_SOCAT=y 54 | BR2_PACKAGE_SSDP_RESPONDER=y 55 | BR2_PACKAGE_STRESS_NG=y 56 | BR2_PACKAGE_SYSKLOGD=y 57 | BR2_PACKAGE_SYSKLOGD_LOGGER=y 58 | BR2_PACKAGE_TCPDUMP=y 59 | BR2_PACKAGE_WATCHDOGD=y 60 | include([toolchain-bootlin-os.m4]) 61 | -------------------------------------------------------------------------------- /configs/include/plat-basis.m4: -------------------------------------------------------------------------------- 1 | define([toolchain_arch], [ARMV5_EABI])dnl 2 | BR2_arm=y 3 | -------------------------------------------------------------------------------- /configs/include/plat-byron.m4: -------------------------------------------------------------------------------- 1 | define([toolchain_arch], [ARMV5_EABI])dnl 2 | BR2_arm=y 3 | 4 | NETBOX_PLAT="byron" 5 | -------------------------------------------------------------------------------- /configs/include/plat-coronet.m4: -------------------------------------------------------------------------------- 1 | define([toolchain_arch], [POWERPC_E500MC])dnl 2 | BR2_powerpc=y 3 | BR2_powerpc_e500mc=y 4 | -------------------------------------------------------------------------------- /configs/include/plat-dagger.m4: -------------------------------------------------------------------------------- 1 | define([toolchain_arch], [ARMV7_EABIHF])dnl 2 | BR2_arm=y 3 | BR2_pj4=y 4 | -------------------------------------------------------------------------------- /configs/include/plat-ember.m4: -------------------------------------------------------------------------------- 1 | define([toolchain_arch], [AARCH64])dnl 2 | BR2_aarch64=y 3 | 4 | NETBOX_PLAT="ember" 5 | -------------------------------------------------------------------------------- /configs/include/plat-envoy.m4: -------------------------------------------------------------------------------- 1 | define([toolchain_arch], [AARCH64])dnl 2 | BR2_aarch64=y 3 | -------------------------------------------------------------------------------- /configs/include/plat-zero.m4: -------------------------------------------------------------------------------- 1 | define([toolchain_arch], [X86_64_CORE_I7])dnl 2 | BR2_x86_64=y 3 | BR2_x86_corei7=y 4 | -------------------------------------------------------------------------------- /configs/include/toolchain-bootlin-app.m4: -------------------------------------------------------------------------------- 1 | BR2_TOOLCHAIN_EXTERNAL=y 2 | BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y 3 | format([BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_%s_GLIBC_STABLE=y], toolchain_arch) 4 | BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y 5 | -------------------------------------------------------------------------------- /configs/include/toolchain-bootlin-os.m4: -------------------------------------------------------------------------------- 1 | BR2_TOOLCHAIN_EXTERNAL=y 2 | BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y 3 | format([BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_%s_GLIBC_BLEEDING_EDGE=y], toolchain_arch) 4 | BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY=y 5 | -------------------------------------------------------------------------------- /configs/netbox_app_basis_defconfig.m4: -------------------------------------------------------------------------------- 1 | define([os_rootfs_overlay], $(BR2_EXTERNAL_NETBOX_PATH)/board/app/rootfs) 2 | include([plat-basis.m4]) 3 | include([base.m4]) 4 | include([app.m4]) 5 | -------------------------------------------------------------------------------- /configs/netbox_app_byron_defconfig.m4: -------------------------------------------------------------------------------- 1 | define([os_rootfs_overlay], $(BR2_EXTERNAL_NETBOX_PATH)/board/app/rootfs) 2 | include([plat-byron.m4]) 3 | include([base.m4]) 4 | include([app.m4]) 5 | -------------------------------------------------------------------------------- /configs/netbox_app_coronet_defconfig.m4: -------------------------------------------------------------------------------- 1 | define([os_rootfs_overlay], $(BR2_EXTERNAL_NETBOX_PATH)/board/app/rootfs) 2 | include([plat-coronet.m4]) 3 | include([base.m4]) 4 | include([app.m4]) 5 | -------------------------------------------------------------------------------- /configs/netbox_app_dagger_defconfig.m4: -------------------------------------------------------------------------------- 1 | define([os_rootfs_overlay], $(BR2_EXTERNAL_NETBOX_PATH)/board/app/rootfs) 2 | include([plat-dagger.m4]) 3 | include([base.m4]) 4 | BR2_PIC_PIE=y 5 | include([app.m4]) 6 | -------------------------------------------------------------------------------- /configs/netbox_app_ember_defconfig.m4: -------------------------------------------------------------------------------- 1 | include([plat-ember.m4]) 2 | include([base.m4]) 3 | include([app.m4]) 4 | -------------------------------------------------------------------------------- /configs/netbox_app_envoy_defconfig.m4: -------------------------------------------------------------------------------- 1 | define([os_rootfs_overlay], $(BR2_EXTERNAL_NETBOX_PATH)/board/app/rootfs) 2 | include([plat-envoy.m4]) 3 | include([base.m4]) 4 | include([app.m4]) 5 | -------------------------------------------------------------------------------- /configs/netbox_app_zero_defconfig.m4: -------------------------------------------------------------------------------- 1 | define([os_rootfs_overlay], $(BR2_EXTERNAL_NETBOX_PATH)/board/app/rootfs) 2 | include([plat-zero.m4]) 3 | include([base.m4]) 4 | include([app.m4]) 5 | -------------------------------------------------------------------------------- /configs/netbox_os_basis_defconfig.m4: -------------------------------------------------------------------------------- 1 | include([plat-basis.m4]) 2 | include([base.m4]) 3 | include([os.m4]) 4 | BR2_LINUX_KERNEL_ZIMAGE=y 5 | BR2_LINUX_KERNEL_DTS_SUPPORT=y 6 | BR2_LINUX_KERNEL_INTREE_DTS_NAME="versatile-pb" 7 | -------------------------------------------------------------------------------- /configs/netbox_os_byron_defconfig.m4: -------------------------------------------------------------------------------- 1 | include([plat-byron.m4]) 2 | include([base.m4]) 3 | include([os.m4]) 4 | BR2_LINUX_KERNEL_ZIMAGE=y 5 | BR2_LINUX_KERNEL_DTS_SUPPORT=y 6 | BR2_LINUX_KERNEL_INTREE_DTS_NAME="versatile-pb" 7 | 8 | dnl Build FIT image for U-Boot, useful on all Byron builds 9 | NETBOX_IMAGE_FIT=y 10 | 11 | -------------------------------------------------------------------------------- /configs/netbox_os_coronet_defconfig.m4: -------------------------------------------------------------------------------- 1 | include([plat-coronet.m4]) 2 | include([base.m4]) 3 | include([os.m4]) 4 | 5 | dnl Linux insists on building an uImage as part of "make all", 6 | dnl which requires mkimage. 7 | BR2_PACKAGE_HOST_UBOOT_TOOLS=y 8 | BR2_LINUX_KERNEL_ZIMAGE=y 9 | 10 | dnl Build FIT image for U-Boot, useful on all Envoy builds 11 | NETBOX_IMAGE_FIT=y 12 | -------------------------------------------------------------------------------- /configs/netbox_os_dagger_defconfig.m4: -------------------------------------------------------------------------------- 1 | include([plat-dagger.m4]) 2 | include([base.m4]) 3 | BR2_PIC_PIE=y 4 | include([os.m4]) 5 | 6 | dnl Linux insists on building an uImage as part of "make all", 7 | dnl which requires mkimage. 8 | BR2_PACKAGE_HOST_UBOOT_TOOLS=y 9 | BR2_LINUX_KERNEL_ZIMAGE=y 10 | 11 | dnl Build FIT image for U-Boot, useful on all Envoy builds 12 | NETBOX_IMAGE_FIT=y 13 | -------------------------------------------------------------------------------- /configs/netbox_os_ember_defconfig.m4: -------------------------------------------------------------------------------- 1 | include([plat-ember.m4]) 2 | include([base.m4]) 3 | include([os.m4]) 4 | 5 | dnl Build FIT image for U-Boot, useful on all Ember builds 6 | NETBOX_IMAGE_FIT=y 7 | 8 | 9 | NETBOX_PLAT_ember=y 10 | -------------------------------------------------------------------------------- /configs/netbox_os_envoy_defconfig.m4: -------------------------------------------------------------------------------- 1 | define([os_rootfs_overlay], $(BR2_EXTERNAL_NETBOX_PATH)/board/$(NETBOX_PLAT)/rootfs) 2 | include([plat-envoy.m4]) 3 | include([base.m4]) 4 | include([os.m4]) 5 | 6 | dnl Copy DTS files from kernel, keep vendor prefix directory 7 | BR2_LINUX_KERNEL_DTS_SUPPORT=y 8 | BR2_LINUX_KERNEL_INTREE_DTS_NAME="marvell/armada-3720-espressobin marvell/armada-3720-espressobin-emmc marvell/armada-3720-espressobin-v7 marvell/armada-3720-espressobin-v7-emmc marvell/armada-8040-mcbin marvell/armada-8040-mcbin-singleshot" 9 | BR2_LINUX_KERNEL_DTB_KEEP_DIRNAME=y 10 | BR2_LINUX_KERNEL_DTB_OVERLAY_SUPPORT=y 11 | 12 | dnl Needed for Espressobin SD card 13 | BR2_TARGET_ROOTFS_EXT2=y 14 | BR2_TARGET_ROOTFS_EXT2_4=y 15 | BR2_TARGET_ROOTFS_EXT2_SIZE="120M" 16 | 17 | dnl Build FIT image for U-Boot, useful on all Envoy builds 18 | NETBOX_IMAGE_FIT=y 19 | -------------------------------------------------------------------------------- /configs/netbox_os_zero_defconfig.m4: -------------------------------------------------------------------------------- 1 | include([plat-zero.m4]) 2 | include([base.m4]) 3 | include([os.m4]) 4 | BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y 5 | dnl Disable host openssl for now, fails in release builds 6 | dnl BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y 7 | 8 | dnl Used to create an .iso image with isolinux for the GNS3 appliance and live CD/USB 9 | BR2_TARGET_ROOTFS_ISO9660=y 10 | BR2_TARGET_ROOTFS_ISO9660_BOOT_MENU="$(BR2_EXTERNAL_NETBOX_PATH)/board/zero/isolinux.cfg" 11 | BR2_TARGET_ROOTFS_ISO9660_HYBRID=y 12 | BR2_TARGET_SYSLINUX=y 13 | BR2_TARGET_SYSLINUX_ISOLINUX=y 14 | BR2_TARGET_SYSLINUX_MBR=y 15 | BR2_TARGET_SYSLINUX_C32="dmi.c32 libcom32.c32 libgpl.c32 liblua.c32 libutil.c32 lua.c32 menu.c32 syslinux.c32" 16 | -------------------------------------------------------------------------------- /doc/igmp-seminar/README.md: -------------------------------------------------------------------------------- 1 | LAN w/ IGMP Snooping 2 | ==================== 3 | 4 | Source files from demo at seminar on IGMP/MLD snooping and the Linux 5 | 5.15+ bridge. The setup is based around [Qeneth][] for testing a 6 | topology of devices and NetBox, which is the base OS that each node in 7 | the topology runs, and which has [querierd][] integrated. 8 | 9 | After building NetBox, generating the Qeneth topology from the source in 10 | this directory, and starting up. Each node need to be tweaked slightly 11 | from the default NetBox setup: 12 | 13 | * `/etc/hostname` change to reflect the node name 14 | * `/etc/network/interfaces` change to use static address for `vlan1` 15 | * `/etc/querierd.conf` changed query interval to 12 sec (optional) 16 | 17 | Other worthwhile information is available in the blog connected to the 18 | seminar: 19 | 20 | 21 | Setup 22 | ----- 23 | 24 | To set up and run the demo: 25 | 26 | 1. Clone https://github.com/wkz/qeneth 27 | 2. Extract this tarball in `qeneth/`: tar xf lan.tar.xz 28 | 3. Start the demo: `cd lan/ && ../qeneth start` 29 | 4. Set up host side networking from same directory: `./net.sh` 30 | 5. Connect to the console of each node: 31 | * `../qeneth console querier` 32 | * `../qeneth console switch1` 33 | * `../qeneth console switch2` 34 | 35 | Inspect each node's `/etc/network/interfaces` file, it shows a preset 36 | with static IP addresses, with `querierd` as the lowest, `.200`, to 37 | ensure it is the elected querier. 38 | 39 | Also, in the same file, notice the `pre-up` command for `iface vlan1`: 40 | 41 | pre-up bridge vlan global set vid 1 dev br0 mcast_snooping 1 \ 42 | mcast_querier 1 mcast_igmp_version 3 mcast_mld_version 2 43 | 44 | This is what enables multicast snooping (IGMP and MLD) on VLAN 1, proxy 45 | querier, and sets the initial IGMP version used. The default version is 46 | 2 and 1, respectively, for legacy reasons -- which we do not want for 47 | standards compliance. 48 | 49 | Check what's going on in the system, try the following commands: 50 | 51 | * `show spanning-tree` 52 | * `show ip igmp` 53 | 54 | > **Note:** NetBox comes with a few helper scripts; `help` and `show` 55 | > being the two most prominent ones. They are just wrappers for other 56 | > programs, so see each for details. 57 | 58 | The `show ip igmp` command is just a wrapper for `querierctl`, which has 59 | several options. To ease migration from legacy systems,, and aid with 60 | testing, there is a special command `querierctl -p show compat detail` 61 | that can be useful. 62 | 63 | 64 | Bridge vs querierd 65 | ------------------ 66 | 67 | Currently in NetBox there are two steps to enable IGMP snooping, first, 68 | as shown above, enable the bridge snooping and proxy querier -- which 69 | works perfectly fine without querierd. Second, start `querierd`. 70 | 71 | In NetBox we've chosen to enable the per-VLAN IGMP/MLD snooping on VLAN 72 | 1 and start `querierd` with an `/etc/querired.conf` that enables it on 73 | interface `vlan1`. As soon as the daemon has started it assumes the 74 | role as querier in the node itself, this because the bridge code only 75 | uses source IP 0.0.0.0 (proxy querier) and never wins an election. So 76 | if the node is alone on the network `querierd` will become the elected 77 | IGMP querier. 78 | 79 | 80 | Testing 81 | ------- 82 | 83 | Since all nodes have a rather high value for their IP address, change 84 | the IP address of `switch1` to `.100` and see what happens. 85 | 86 | Check with `querierctl show` to see verify that all nodes now have 87 | agreed on a new elected querier (`.100`) on the LAN. 88 | 89 | Drop the IP address of `switch1` and verify that all nodes decrement the 90 | querier timeout and eventually `.200` re-assume the querier role. 91 | 92 | To verify that the bridge filtering works as intended, you can use the 93 | [nemesis][] program to inject IGMP reports on the host-connected tap 94 | intefaces: sw1 and sw2. From the host run: 95 | 96 | sudo nemesis igmp -v -p 22 -S 192.168.2.20 -g 225.1.2.3 -D 225.1.2.3 -d sw1 97 | 98 | Or call `sudo ./join.sh` from the same sub-directory as before which 99 | sends a join on both sw1 and sw2. 100 | 101 | Verify that all devices from the querier down to the switch connected to 102 | the host interface which sent the report have registered the membership. 103 | 104 | Like the case with the new querier timing out, above, the memberships 105 | also time out after a while (see the RFC) 106 | 107 | [nemesis]: https://github.com/libnet/nemesis/ 108 | [Qeneth]: https://github.com/wkz/qeneth 109 | [querierd]: https://github.com/westermo/querierd 110 | -------------------------------------------------------------------------------- /doc/igmp-seminar/join.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Joins groups on sw1 and sw2 3 | # requires CAP_NET_RAW or sudo 4 | 5 | nemesis igmp -v -p 22 -S 192.168.2.21 -g 225.1.2.3 -D 225.1.2.3 -d sw1 6 | nemesis igmp -v -p 22 -S 192.168.2.22 -g 225.1.2.4 -D 225.1.2.4 -d sw2 7 | 8 | 9 | -------------------------------------------------------------------------------- /doc/igmp-seminar/net.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Bring up host level networking, requires CAP_NET_ADMIN or sudo 3 | 4 | 5 | ip link set up sw1 6 | ip link set up sw2 7 | 8 | ip addr add 192.168.2.21/24 dev sw1 9 | ip addr add 192.168.2.22/24 dev sw2 10 | 11 | -------------------------------------------------------------------------------- /doc/igmp-seminar/topology.dot.in: -------------------------------------------------------------------------------- 1 | # 2 | # eth1:switch1:eth0 <--> eth0:querier:eth1 <--> eth0:switch2:eth1 3 | # ^ ^ 4 | # | | 5 | # '---------------------> sw1:host:sw2 <---------------------' 6 | # 7 | graph "my-network" { 8 | node [shape=record]; 9 | qn_template="netbox-os-zero"; 10 | qn_append="quiet"; 11 | 12 | querier [label="querier | { eth0 | eth1 }"]; 13 | switch1 [label="switch | { eth0 | eth1 }"]; 14 | switch2 [label="switch | { eth0 | eth1 }"]; 15 | 16 | querier:eth0 -- switch1:eth0; 17 | querier:eth1 -- switch2:eth0; 18 | 19 | host:"sw1" -- switch1:eth1; 20 | host:"sw2" -- switch2:eth1; 21 | } 22 | 23 | -------------------------------------------------------------------------------- /dts/Makefile: -------------------------------------------------------------------------------- 1 | ifeq ($(PLAT),) 2 | $(error "Platform not set.") 3 | endif 4 | 5 | # Unfortunately this is not always the same as ARCH 6 | karch-basis := arm 7 | karch-byron := arm 8 | karch-coronet := powerpc 9 | karch-dagger := arm 10 | karch-envoy := arm64 11 | karch-ember := arm64 12 | karch-zero := x86_64 13 | karch := $(karch-$(PLAT)) 14 | 15 | default-board := $(default-board-$(PLAT)) 16 | 17 | kernel-dts := $(LINUX_DIR)/arch/$(karch)/boot/dts 18 | board-dts := $(wildcard $(PLAT)/*/device-tree.dts) 19 | board-dtb := $(board-dts:.dts=.dtb) 20 | target-dtb := $(board-dtb:$(PLAT)/%/device-tree.dtb=$(DESTDIR)/boot/%/device-tree.dtb) 21 | board-deps := $(wildcard include/common/*.dtsi) \ 22 | $(wildcard include/common/*.h) \ 23 | $(wildcard include/$(PLAT)/*.dtsi) \ 24 | $(wildcard include/$(PLAT)/*.h) 25 | 26 | default-dtb := $(DESTDIR)/boot/default/device-tree.dtb 27 | install-dtb := $(target-dtb) $(if $(default-board),$(default-dtb)) 28 | 29 | inc := include $(LINUX_DIR)/include $(kernel-dts) 30 | ifeq ($(PLAT),coronet) 31 | inc += $(kernel-dts)/fsl 32 | endif 33 | 34 | all: $(board-dtb) 35 | 36 | %.dtb: %.dts $(board-deps) 37 | cpp -nostdinc -undef -x assembler-with-cpp $(addprefix -I,$(inc)) $< \ 38 | | dtc -I dts -O dtb $(addprefix -i ,$(inc)) -o $@ 39 | 40 | install: $(install-dtb) 41 | 42 | $(default-dtb): 43 | mkdir -p $(@D) && ln -sf ../$(default-board)/device-tree.dtb $@ 44 | 45 | $(DESTDIR)/boot/%/device-tree.dtb: $(PLAT)/%/device-tree.dtb 46 | install -D $< $@ 47 | 48 | 49 | .PHONY: all install 50 | -------------------------------------------------------------------------------- /dts/basis/0000-default/device-tree.dts: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | / { 6 | model = "wmo,L210-F2G"; 7 | }; 8 | 9 | &usbotg { 10 | status = "disabled"; 11 | }; 12 | -------------------------------------------------------------------------------- /dts/byron/0000-default/device-tree.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | 3 | #include "at91-sam9x60ek.dts" 4 | 5 | -------------------------------------------------------------------------------- /dts/byron/0001-sam9x/device-tree.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | 3 | #include "at91-sam9x60ek.dts" 4 | 5 | -------------------------------------------------------------------------------- /dts/byron/0002-sama5/device-tree.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | 3 | #include "at91-sama5d27_som1_ek.dts" 4 | 5 | -------------------------------------------------------------------------------- /dts/coronet/0000-default/device-tree.dts: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | / { 4 | model = "wmo,coronet"; 5 | }; 6 | -------------------------------------------------------------------------------- /dts/coronet/0001-viper-tbn/device-tree.dts: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | / { 4 | model = "wmo,Viper-TBN"; 5 | }; 6 | -------------------------------------------------------------------------------- /dts/coronet/0002-viper-212a/device-tree.dts: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | / { 4 | model = "wmo,Viper-212A"; 5 | }; 6 | 7 | &agate { 8 | ports { 9 | /* ethX2/3 use two-pair M12 connector */ 10 | port@0 { max-speed = <100>; }; 11 | port@4 { max-speed = <100>; }; 12 | }; 13 | }; 14 | -------------------------------------------------------------------------------- /dts/coronet/0003-viper-220a/device-tree.dts: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | / { 4 | model = "wmo,Viper-220A"; 5 | }; 6 | 7 | &agate { 8 | ports { 9 | /* All ports use two-pair M12 connectors */ 10 | port@0 { max-speed = <100>; }; 11 | port@1 { max-speed = <100>; }; 12 | port@2 { max-speed = <100>; }; 13 | port@3 { max-speed = <100>; }; 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /dts/dagger/0000-default/device-tree.dts: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: (GPL-2.0+ OR MIT) 2 | /* 3 | * Device Tree file for Westermo Needle 4 | * 5 | * Copyright (C) 2021 Westermo Network Technologies 6 | * 7 | * Based on armada-xp-db-xc3-24g4xg.dts 8 | * 9 | * Note: this Device Tree assumes that the bootloader has remapped the 10 | * internal registers to 0xf1000000 (instead of the default 11 | * 0xd0000000). The 0xf1000000 is the default used by the recent, 12 | * DT-capable, U-Boot bootloaders provided by Marvell. Some earlier 13 | * boards were delivered with an older version of the bootloader that 14 | * left internal registers mapped at 0xd0000000. If you are in this 15 | * situation, you should either update your bootloader (preferred 16 | * solution) or the below Device Tree should be adjusted. 17 | */ 18 | 19 | /dts-v1/; 20 | #include 21 | #include "armada-xp-98dx3336.dtsi" 22 | 23 | / { 24 | model = "Needle"; 25 | compatible = "wmo,needle", "marvell,armadaxp-98dx3336", "marvell,armada-370-xp"; 26 | 27 | memory { 28 | device_type = "memory"; 29 | reg = <0 0x00000000 0 0x40000000>; /* 1 GB */ 30 | }; 31 | 32 | watchdog { 33 | compatible = "linux,wdt-gpio"; 34 | gpios = <&gpio0 6 GPIO_ACTIVE_LOW>; 35 | hw_algo = "toggle"; 36 | hw_margin_ms = <250>; 37 | pinctrl-0 = <&watchdog_pins>; 38 | pinctrl-names = "default"; 39 | always-running; 40 | }; 41 | }; 42 | 43 | &L2 { 44 | arm,parity-enable; 45 | marvell,ecc-enable; 46 | }; 47 | 48 | &uart0 { 49 | status = "okay"; 50 | }; 51 | 52 | &i2c0 { 53 | clock-frequency = <100000>; 54 | status = "okay"; 55 | }; 56 | 57 | &spi0 { 58 | status = "okay"; 59 | 60 | boot_flash: spi-flash@0 { 61 | #address-cells = <1>; 62 | #size-cells = <1>; 63 | compatible = "n25q256a", "jedec,spi-nor"; 64 | reg = <0>; /* Chip select 0 */ 65 | spi-max-frequency = <20000000>; 66 | m25p,fast-read; 67 | }; 68 | }; 69 | 70 | &pinctrl { 71 | watchdog_pins: watchdog-pins { 72 | marvell,pins = "mpp6"; 73 | marvell,function = "gpo"; 74 | }; 75 | }; 76 | -------------------------------------------------------------------------------- /dts/ember/0000-default/device-tree.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | 3 | #include "microchip/sparx5.dtsi" 4 | #include 5 | 6 | &cpu0 { 7 | enable-method = "spin-table"; 8 | cpu-release-addr = <0x0 0x0000fff8>; 9 | }; 10 | 11 | &cpu1 { 12 | enable-method = "spin-table"; 13 | cpu-release-addr = <0x0 0x0000fff8>; 14 | }; 15 | 16 | / { 17 | model = "Ember"; 18 | 19 | gpio-restart { 20 | compatible = "gpio-restart"; 21 | gpios = <&gpio 37 GPIO_ACTIVE_LOW>; 22 | priority = <200>; 23 | }; 24 | 25 | psci { 26 | status = "disabled"; 27 | }; 28 | }; 29 | 30 | &spi0 { 31 | pinctrl-0 = <&si2_pins>; 32 | pinctrl-names = "default"; 33 | status = "okay"; 34 | spi@0 { 35 | compatible = "spi-mux"; 36 | mux-controls = <&mux>; 37 | #address-cells = <1>; 38 | #size-cells = <0>; 39 | reg = <0>; /* CS0 */ 40 | system_flash: spi-flash@9 { 41 | compatible = "jedec,spi-nor"; 42 | spi-max-frequency = <8000000>; 43 | reg = <0x9>; /* SPI */ 44 | spi-tx-bus-width = <4>; 45 | spi-rx-bus-width = <4>; 46 | #address-cells = <1>; 47 | #size-cells = <1>; 48 | }; 49 | }; 50 | }; 51 | 52 | &uart0 { 53 | status = "okay"; 54 | }; 55 | 56 | &uart1 { 57 | status = "okay"; 58 | }; 59 | 60 | &i2c0 { 61 | status = "okay"; 62 | }; 63 | 64 | 65 | &gpio { 66 | i2cmux_pins_i: i2cmux-pins-i { 67 | pins = "GPIO_35", "GPIO_36", 68 | "GPIO_50", "GPIO_51"; 69 | function = "twi_scl_m"; 70 | output-low; 71 | }; 72 | i2cmux_s29: i2cmux-0 { 73 | pins = "GPIO_35"; 74 | function = "twi_scl_m"; 75 | output-high; 76 | }; 77 | i2cmux_s30: i2cmux-1 { 78 | pins = "GPIO_36"; 79 | function = "twi_scl_m"; 80 | output-high; 81 | }; 82 | i2cmux_s31: i2cmux-2 { 83 | pins = "GPIO_50"; 84 | function = "twi_scl_m"; 85 | output-high; 86 | }; 87 | i2cmux_s32: i2cmux-3 { 88 | pins = "GPIO_51"; 89 | function = "twi_scl_m"; 90 | output-high; 91 | }; 92 | }; 93 | 94 | &sgpio1 { 95 | status = "okay"; 96 | microchip,sgpio-port-ranges = <24 31>; 97 | gpio@0 { 98 | ngpios = <64>; 99 | }; 100 | gpio@1 { 101 | ngpios = <64>; 102 | }; 103 | }; 104 | 105 | &mdio0 { 106 | status = "ok"; 107 | phy0: ethernet-phy@0 { 108 | reg = <0>; 109 | }; 110 | phy1: ethernet-phy@1 { 111 | reg = <1>; 112 | }; 113 | phy2: ethernet-phy@2 { 114 | reg = <2>; 115 | }; 116 | phy3: ethernet-phy@3 { 117 | reg = <3>; 118 | }; 119 | phy4: ethernet-phy@4 { 120 | reg = <4>; 121 | }; 122 | phy5: ethernet-phy@5 { 123 | reg = <5>; 124 | }; 125 | phy6: ethernet-phy@6 { 126 | reg = <6>; 127 | }; 128 | phy7: ethernet-phy@7 { 129 | reg = <7>; 130 | }; 131 | phy8: ethernet-phy@8 { 132 | reg = <8>; 133 | }; 134 | phy9: ethernet-phy@9 { 135 | reg = <9>; 136 | }; 137 | phy10: ethernet-phy@10 { 138 | reg = <10>; 139 | }; 140 | phy11: ethernet-phy@11 { 141 | reg = <11>; 142 | }; 143 | }; 144 | 145 | &switch { 146 | ethernet-ports { 147 | #address-cells = <1>; 148 | #size-cells = <0>; 149 | 150 | port1: port@0 { 151 | reg = <0>; 152 | label = "eth1"; 153 | microchip,bandwidth = <1000>; 154 | phys = <&serdes 13>; 155 | phy-handle = <&phy0>; 156 | phy-mode = "qsgmii"; 157 | }; 158 | port2: port@1 { 159 | reg = <1>; 160 | label = "eth2"; 161 | microchip,bandwidth = <1000>; 162 | phys = <&serdes 13>; 163 | phy-handle = <&phy1>; 164 | phy-mode = "qsgmii"; 165 | }; 166 | port3: port@2 { 167 | reg = <2>; 168 | label = "eth3"; 169 | microchip,bandwidth = <1000>; 170 | phys = <&serdes 13>; 171 | phy-handle = <&phy2>; 172 | phy-mode = "qsgmii"; 173 | }; 174 | port4: port@3 { 175 | reg = <3>; 176 | label = "eth4"; 177 | microchip,bandwidth = <1000>; 178 | phys = <&serdes 13>; 179 | phy-handle = <&phy3>; 180 | phy-mode = "qsgmii"; 181 | }; 182 | port5: port@4 { 183 | reg = <4>; 184 | label = "eth5"; 185 | microchip,bandwidth = <1000>; 186 | phys = <&serdes 14>; 187 | phy-handle = <&phy4>; 188 | phy-mode = "qsgmii"; 189 | }; 190 | port6: port@5 { 191 | reg = <5>; 192 | label = "eth6"; 193 | microchip,bandwidth = <1000>; 194 | phys = <&serdes 14>; 195 | phy-handle = <&phy5>; 196 | phy-mode = "qsgmii"; 197 | }; 198 | port7: port@6 { 199 | reg = <6>; 200 | label = "eth7"; 201 | microchip,bandwidth = <1000>; 202 | phys = <&serdes 14>; 203 | phy-handle = <&phy6>; 204 | phy-mode = "qsgmii"; 205 | }; 206 | port8: port@7 { 207 | reg = <7>; 208 | label = "eth8"; 209 | microchip,bandwidth = <1000>; 210 | phys = <&serdes 14>; 211 | phy-handle = <&phy7>; 212 | phy-mode = "qsgmii"; 213 | }; 214 | port9: port@8 { 215 | reg = <8>; 216 | label = "eth9"; 217 | microchip,bandwidth = <1000>; 218 | phys = <&serdes 15>; 219 | phy-handle = <&phy8>; 220 | phy-mode = "qsgmii"; 221 | }; 222 | port10: port@9 { 223 | reg = <9>; 224 | label = "eth10"; 225 | microchip,bandwidth = <1000>; 226 | phys = <&serdes 15>; 227 | phy-handle = <&phy9>; 228 | phy-mode = "qsgmii"; 229 | }; 230 | port11: port@10 { 231 | reg = <10>; 232 | label = "eth11"; 233 | microchip,bandwidth = <1000>; 234 | phys = <&serdes 15>; 235 | phy-handle = <&phy10>; 236 | phy-mode = "qsgmii"; 237 | }; 238 | port12: port@11 { 239 | reg = <11>; 240 | label = "eth12"; 241 | microchip,bandwidth = <1000>; 242 | phys = <&serdes 15>; 243 | phy-handle = <&phy11>; 244 | phy-mode = "qsgmii"; 245 | }; 246 | }; 247 | }; 248 | 249 | &axi { 250 | uio0: vcoreiii_switch@600000000 { 251 | compatible = "microchip,uio_sparx5_irqmux"; 252 | reg = <0x6 0x00000000 0x12000000>; 253 | reg-names = "origin1_2"; 254 | status = "okay"; 255 | }; 256 | }; 257 | 258 | #include 259 | -------------------------------------------------------------------------------- /dts/ember/0001-sparx5-135-emmc/device-tree.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | 3 | #include "microchip/sparx5.dtsi" 4 | #include 5 | 6 | &cpu0 { 7 | enable-method = "spin-table"; 8 | cpu-release-addr = <0x0 0x0000fff8>; 9 | }; 10 | 11 | &cpu1 { 12 | enable-method = "spin-table"; 13 | cpu-release-addr = <0x0 0x0000fff8>; 14 | }; 15 | 16 | / { 17 | gpio-restart { 18 | compatible = "gpio-restart"; 19 | gpios = <&gpio 37 GPIO_ACTIVE_LOW>; 20 | priority = <200>; 21 | }; 22 | 23 | psci { 24 | status = "disabled"; 25 | }; 26 | }; 27 | 28 | &spi0 { 29 | pinctrl-0 = <&si2_pins>; 30 | pinctrl-names = "default"; 31 | status = "okay"; 32 | spi@0 { 33 | compatible = "spi-mux"; 34 | mux-controls = <&mux>; 35 | #address-cells = <1>; 36 | #size-cells = <0>; 37 | reg = <0>; /* CS0 */ 38 | system_flash: spi-flash@9 { 39 | compatible = "jedec,spi-nor"; 40 | spi-max-frequency = <8000000>; 41 | reg = <0x9>; /* SPI */ 42 | spi-tx-bus-width = <4>; 43 | spi-rx-bus-width = <4>; 44 | #address-cells = <1>; 45 | #size-cells = <1>; 46 | }; 47 | }; 48 | }; 49 | 50 | &uart0 { 51 | status = "okay"; 52 | }; 53 | 54 | &uart1 { 55 | status = "okay"; 56 | }; 57 | 58 | &i2c0 { 59 | status = "okay"; 60 | }; 61 | 62 | 63 | &gpio { 64 | i2cmux_pins_i: i2cmux-pins-i { 65 | pins = "GPIO_35", "GPIO_36", 66 | "GPIO_50", "GPIO_51"; 67 | function = "twi_scl_m"; 68 | output-low; 69 | }; 70 | i2cmux_s29: i2cmux-0 { 71 | pins = "GPIO_35"; 72 | function = "twi_scl_m"; 73 | output-high; 74 | }; 75 | i2cmux_s30: i2cmux-1 { 76 | pins = "GPIO_36"; 77 | function = "twi_scl_m"; 78 | output-high; 79 | }; 80 | i2cmux_s31: i2cmux-2 { 81 | pins = "GPIO_50"; 82 | function = "twi_scl_m"; 83 | output-high; 84 | }; 85 | i2cmux_s32: i2cmux-3 { 86 | pins = "GPIO_51"; 87 | function = "twi_scl_m"; 88 | output-high; 89 | }; 90 | }; 91 | 92 | &sgpio1 { 93 | status = "okay"; 94 | microchip,sgpio-port-ranges = <24 31>; 95 | gpio@0 { 96 | ngpios = <64>; 97 | }; 98 | gpio@1 { 99 | ngpios = <64>; 100 | }; 101 | }; 102 | 103 | &mdio0 { 104 | status = "ok"; 105 | phy0: ethernet-phy@0 { 106 | reg = <0>; 107 | }; 108 | phy1: ethernet-phy@1 { 109 | reg = <1>; 110 | }; 111 | phy2: ethernet-phy@2 { 112 | reg = <2>; 113 | }; 114 | phy3: ethernet-phy@3 { 115 | reg = <3>; 116 | }; 117 | phy4: ethernet-phy@4 { 118 | reg = <4>; 119 | }; 120 | phy5: ethernet-phy@5 { 121 | reg = <5>; 122 | }; 123 | phy6: ethernet-phy@6 { 124 | reg = <6>; 125 | }; 126 | phy7: ethernet-phy@7 { 127 | reg = <7>; 128 | }; 129 | phy8: ethernet-phy@8 { 130 | reg = <8>; 131 | }; 132 | phy9: ethernet-phy@9 { 133 | reg = <9>; 134 | }; 135 | phy10: ethernet-phy@10 { 136 | reg = <10>; 137 | }; 138 | phy11: ethernet-phy@11 { 139 | reg = <11>; 140 | }; 141 | }; 142 | 143 | &switch { 144 | ethernet-ports { 145 | #address-cells = <1>; 146 | #size-cells = <0>; 147 | 148 | port1: port@0 { 149 | reg = <0>; 150 | label = "eth1"; 151 | microchip,bandwidth = <1000>; 152 | phys = <&serdes 13>; 153 | phy-handle = <&phy0>; 154 | phy-mode = "qsgmii"; 155 | }; 156 | port2: port@1 { 157 | reg = <1>; 158 | label = "eth2"; 159 | microchip,bandwidth = <1000>; 160 | phys = <&serdes 13>; 161 | phy-handle = <&phy1>; 162 | phy-mode = "qsgmii"; 163 | }; 164 | port3: port@2 { 165 | reg = <2>; 166 | label = "eth3"; 167 | microchip,bandwidth = <1000>; 168 | phys = <&serdes 13>; 169 | phy-handle = <&phy2>; 170 | phy-mode = "qsgmii"; 171 | }; 172 | port4: port@3 { 173 | reg = <3>; 174 | label = "eth4"; 175 | microchip,bandwidth = <1000>; 176 | phys = <&serdes 13>; 177 | phy-handle = <&phy3>; 178 | phy-mode = "qsgmii"; 179 | }; 180 | port5: port@4 { 181 | reg = <4>; 182 | label = "eth5"; 183 | microchip,bandwidth = <1000>; 184 | phys = <&serdes 14>; 185 | phy-handle = <&phy4>; 186 | phy-mode = "qsgmii"; 187 | }; 188 | port6: port@5 { 189 | reg = <5>; 190 | label = "eth6"; 191 | microchip,bandwidth = <1000>; 192 | phys = <&serdes 14>; 193 | phy-handle = <&phy5>; 194 | phy-mode = "qsgmii"; 195 | }; 196 | port7: port@6 { 197 | reg = <6>; 198 | label = "eth7"; 199 | microchip,bandwidth = <1000>; 200 | phys = <&serdes 14>; 201 | phy-handle = <&phy6>; 202 | phy-mode = "qsgmii"; 203 | }; 204 | port8: port@7 { 205 | reg = <7>; 206 | label = "eth8"; 207 | microchip,bandwidth = <1000>; 208 | phys = <&serdes 14>; 209 | phy-handle = <&phy7>; 210 | phy-mode = "qsgmii"; 211 | }; 212 | port9: port@8 { 213 | reg = <8>; 214 | label = "eth9"; 215 | microchip,bandwidth = <1000>; 216 | phys = <&serdes 15>; 217 | phy-handle = <&phy8>; 218 | phy-mode = "qsgmii"; 219 | }; 220 | port10: port@9 { 221 | reg = <9>; 222 | label = "eth10"; 223 | microchip,bandwidth = <1000>; 224 | phys = <&serdes 15>; 225 | phy-handle = <&phy9>; 226 | phy-mode = "qsgmii"; 227 | }; 228 | port11: port@10 { 229 | reg = <10>; 230 | label = "eth11"; 231 | microchip,bandwidth = <1000>; 232 | phys = <&serdes 15>; 233 | phy-handle = <&phy10>; 234 | phy-mode = "qsgmii"; 235 | }; 236 | port12: port@11 { 237 | reg = <11>; 238 | label = "eth12"; 239 | microchip,bandwidth = <1000>; 240 | phys = <&serdes 15>; 241 | phy-handle = <&phy11>; 242 | phy-mode = "qsgmii"; 243 | }; 244 | }; 245 | }; 246 | 247 | &axi { 248 | uio0: vcoreiii_switch@600000000 { 249 | compatible = "microchip,uio_sparx5_irqmux"; 250 | reg = <0x6 0x00000000 0x12000000>; 251 | reg-names = "origin1_2"; 252 | status = "okay"; 253 | }; 254 | }; 255 | 256 | #include 257 | -------------------------------------------------------------------------------- /dts/envoy/0001-imx8mn-peridot/device-tree.dts: -------------------------------------------------------------------------------- 1 | /dts-v1/; 2 | 3 | #include "freescale/imx8mn-ddr4-evk.dts" 4 | 5 | &fec1 { 6 | 7 | /* We're connected to a switch sending DSA tagged packets, so 8 | the FEC classifier will never queue anything on the AVB 9 | queues. */ 10 | fsl,num-rx-queues = <1>; 11 | 12 | /* Enabling all more than one queue causes intermittent tx 13 | issues detailed here: 14 | https://lore.kernel.org/netdev/20200625085728.9869-1-tobias@waldekranz.com/ 15 | */ 16 | fsl,num-tx-queues = <1>; 17 | }; 18 | 19 | &usbotg1 { 20 | peridot_db: mdio@1 { 21 | reg = <1>; 22 | }; 23 | }; 24 | 25 | #include "common/peridot-db.dtsi" 26 | -------------------------------------------------------------------------------- /dts/include/basis/lynx-power.dtsi: -------------------------------------------------------------------------------- 1 | &i2c1 { 2 | eeprom@53 { 3 | compatible = "eeprom,eeprom"; 4 | reg = <0x53>; 5 | }; 6 | }; 7 | 8 | &cspi1 { 9 | status = "okay"; 10 | pinctrl-names = "default"; 11 | pinctrl-0 = <&pinctrl_cspi1>; 12 | fsl,spi-num-chipselects = <1>; 13 | 14 | iochain: gpio-expander@0 { 15 | compatible = "fairchild,74hc595"; 16 | reg = <0>; 17 | spi-max-frequency = <1000000>; 18 | gpio-controller; 19 | #gpio-cells = <2>; 20 | 21 | /* TODO: Second device is an input register, but 22 | existing driver only supports chaining multiple output 23 | registers. This means we have no way of reading 24 | dc1/dc2 or relay input at the moment. */ 25 | registers-number = <2>; 26 | }; 27 | }; 28 | 29 | &pinctrls { 30 | pinctrl_cspi1: cspi1grp { 31 | fsl,pins = < 32 | MX27_PAD_CSPI1_MISO__CSPI1_MISO 0x0 33 | MX27_PAD_CSPI1_MOSI__CSPI1_MOSI 0x0 34 | MX27_PAD_CSPI1_SCLK__CSPI1_SCLK 0x0 35 | MX27_PAD_CSPI1_SS0__CSPI1_SS0 0x0 36 | >; 37 | }; 38 | }; 39 | 40 | / { 41 | gpio-leds { 42 | frnt-green { 43 | label = "basis:green:frnt"; 44 | gpios = <&iochain 0 GPIO_ACTIVE_LOW>; 45 | default-state = "off"; 46 | }; 47 | frnt-red { 48 | label = "basis:red:frnt"; 49 | gpios = <&iochain 1 GPIO_ACTIVE_LOW>; 50 | default-state = "off"; 51 | }; 52 | rstp-green { 53 | label = "basis:green:rstp"; 54 | gpios = <&iochain 2 GPIO_ACTIVE_LOW>; 55 | default-state = "off"; 56 | }; 57 | rstp-red { 58 | label = "basis:red:rstp"; 59 | gpios = <&iochain 3 GPIO_ACTIVE_LOW>; 60 | default-state = "off"; 61 | }; 62 | usr1-green { 63 | label = "basis:green:usr1"; 64 | gpios = <&iochain 4 GPIO_ACTIVE_LOW>; 65 | default-state = "off"; 66 | }; 67 | usr1-red { 68 | label = "basis:red:usr1"; 69 | gpios = <&iochain 5 GPIO_ACTIVE_LOW>; 70 | default-state = "off"; 71 | }; 72 | }; 73 | }; 74 | -------------------------------------------------------------------------------- /dts/include/common/mv6.h: -------------------------------------------------------------------------------- 1 | #define _mv6_port_common(_index, _reg, _label, _mode) \ 2 | reg = <_reg>; \ 3 | label = _label; \ 4 | local-mac-address = [00 00 00 00 00 00]; \ 5 | phy-mode = _mode 6 | 7 | #define mv6_port(_index, _reg, _label, _phy, _mode) \ 8 | port@_reg { \ 9 | phy-handle = <_phy>; \ 10 | _mv6_port_common(_index, _reg, _label, _mode); \ 11 | } 12 | 13 | #define mv6_label_port(_switch, _index, _reg, _label, _phy, _mode) \ 14 | _switch##_port##_reg: mv6_port(_index, _reg, _label, _phy, _mode) 15 | 16 | #define mv6_port_sfp(_index, _reg, _label, _sfp, _mode) \ 17 | port@_reg { \ 18 | managed = "in-band-status"; \ 19 | sfp = <_sfp>; \ 20 | _mv6_port_common(_index, _reg, _label, _mode); \ 21 | } 22 | 23 | #define mv6_phy(_reg, _speed) \ 24 | ethernet-phy@_reg { \ 25 | reg = <_reg>; \ 26 | interrupts = <_reg IRQ_TYPE_LEVEL_LOW>; \ 27 | max-speed = <_speed>; \ 28 | } 29 | -------------------------------------------------------------------------------- /dts/include/common/peridot-db.dtsi: -------------------------------------------------------------------------------- 1 | /* Marvell Peridot (MV88E6390X) Development Board */ 2 | 3 | &peridot_db { 4 | compatible = "usb1286,1fa4"; 5 | 6 | #address-cells = <1>; 7 | #size-cells = <0>; 8 | 9 | sc0: switch@0 { 10 | compatible = "marvell,mv88e6190"; 11 | status = "ok"; 12 | reg = <0x0>; 13 | 14 | dsa,member = <0 0>; 15 | dsa,num_tx_queues = <8>; 16 | interrupt-controller; 17 | #interrupt-cells = <2>; 18 | 19 | ports { 20 | #address-cells = <1>; 21 | #size-cells = <0>; 22 | 23 | port@0 { 24 | reg = <0x0>; 25 | label = "cpu0"; 26 | ethernet = <&fec1>; 27 | 28 | /* Port0 is connected to a 1518 PHY like 29 | below, but the DSA driver will not handle 30 | this configuration properly. The driver 31 | will configure all CPU/DSA ports as fixed 32 | links; the generic DSA code will then bring 33 | the link down to match phylink's 34 | expectations on initial state. The port 35 | will then be forced down and never come 36 | up. Omitting PHY info will leave it forced 37 | up which, while not Right(tm), does 38 | work. */ 39 | /* phy-handle = <&sc0_phy0>; */ 40 | /* phy-mode = "rgmii"; */ 41 | }; 42 | 43 | port@1 { 44 | reg = <0x1>; 45 | label = "eth1"; 46 | phy-handle = <&sc0_phy1>; 47 | phy-mode = "gmii"; 48 | }; 49 | port@2 { 50 | reg = <0x2>; 51 | label = "eth2"; 52 | phy-handle = <&sc0_phy2>; 53 | phy-mode = "gmii"; 54 | }; 55 | port@3 { 56 | reg = <0x3>; 57 | label = "eth3"; 58 | phy-handle = <&sc0_phy3>; 59 | phy-mode = "gmii"; 60 | }; 61 | port@4 { 62 | reg = <0x4>; 63 | label = "eth4"; 64 | phy-handle = <&sc0_phy4>; 65 | phy-mode = "gmii"; 66 | }; 67 | port@5 { 68 | reg = <0x5>; 69 | label = "eth5"; 70 | phy-handle = <&sc0_phy5>; 71 | phy-mode = "gmii"; 72 | }; 73 | port@6 { 74 | reg = <0x6>; 75 | label = "eth6"; 76 | phy-handle = <&sc0_phy6>; 77 | phy-mode = "gmii"; 78 | }; 79 | port@7 { 80 | reg = <0x7>; 81 | label = "eth7"; 82 | phy-handle = <&sc0_phy7>; 83 | phy-mode = "gmii"; 84 | }; 85 | port@8 { 86 | reg = <0x8>; 87 | label = "eth8"; 88 | phy-handle = <&sc0_phy8>; 89 | phy-mode = "gmii"; 90 | }; 91 | }; 92 | 93 | mdio { 94 | #address-cells = <1>; 95 | #size-cells = <0>; 96 | interrupt-parent = <&sc0>; 97 | 98 | sc0_phy1: ethernet-phy@1 { reg = <1>; }; 99 | sc0_phy2: ethernet-phy@2 { reg = <2>; }; 100 | sc0_phy3: ethernet-phy@3 { reg = <3>; }; 101 | sc0_phy4: ethernet-phy@4 { reg = <4>; }; 102 | sc0_phy5: ethernet-phy@5 { reg = <5>; }; 103 | sc0_phy6: ethernet-phy@6 { reg = <6>; }; 104 | sc0_phy7: ethernet-phy@7 { reg = <7>; }; 105 | sc0_phy8: ethernet-phy@8 { reg = <8>; }; 106 | }; 107 | 108 | mdioe { 109 | compatible = "marvell,mv88e6xxx-mdio-external"; 110 | #address-cells = <1>; 111 | #size-cells = <0>; 112 | interrupt-parent = <&sc0>; 113 | 114 | sc0_phy0: ethernet-phy@0 { reg = <0>; }; 115 | }; 116 | 117 | }; 118 | }; 119 | -------------------------------------------------------------------------------- /dts/include/common/system-flash/128M-dual.dtsi: -------------------------------------------------------------------------------- 1 | &system_flash { 2 | partition@0 { 3 | /* 1.5M */ 4 | reg = <0x0000000 0x0180000>; 5 | label = "Bootloader"; 6 | }; 7 | partition@180000 { 8 | /* 0.5M */ 9 | reg = <0x0180000 0x0080000>; 10 | label = "BootConfig"; 11 | }; 12 | partition@200000 { 13 | /* 56M */ 14 | reg = <0x0200000 0x3800000>; 15 | label = "Primary"; 16 | }; 17 | partition@3a00000 { 18 | /* 56M */ 19 | reg = <0x3a00000 0x3800000>; 20 | label = "Secondary"; 21 | }; 22 | partition@7200000 { 23 | /* 15M */ 24 | reg = <0x7200000 0x0e00000>; 25 | label = "Config"; 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /dts/include/common/system-flash/32M-dual.dtsi: -------------------------------------------------------------------------------- 1 | &system_flash { 2 | partition@0 { 3 | /* 512k */ 4 | reg = <0x0000000 0x0080000>; 5 | label = "Bootloader"; 6 | }; 7 | partition@80000 { 8 | /* 12.5M */ 9 | reg = <0x0080000 0x0c80000>; 10 | label = "Primary"; 11 | }; 12 | partition@d00000 { 13 | /* 12.5M */ 14 | reg = <0x0d00000 0x0c80000>; 15 | label = "Secondary"; 16 | }; 17 | partition@1980000 { 18 | /* 6.4M */ 19 | reg = <0x1980000 0x0640000>; 20 | label = "Config"; 21 | }; 22 | partition@1fc0000 { 23 | /* 256k */ 24 | reg = <0x1fc0000 0x0040000>; 25 | label = "BootConfig"; 26 | }; 27 | }; 28 | -------------------------------------------------------------------------------- /dts/include/common/system-flash/32M-single.dtsi: -------------------------------------------------------------------------------- 1 | &system_flash { 2 | partition@0 { 3 | /* 512k */ 4 | reg = <0x0000000 0x0080000>; 5 | label = "Bootloader"; 6 | }; 7 | partition@80000 { 8 | /* 25M */ 9 | reg = <0x0080000 0x1900000>; 10 | label = "Primary"; 11 | }; 12 | partition@1980000 { 13 | /* 6.4M */ 14 | reg = <0x1980000 0x0640000>; 15 | label = "Config"; 16 | }; 17 | partition@1fc0000 { 18 | /* 256k */ 19 | reg = <0x1fc0000 0x0040000>; 20 | label = "BootConfig"; 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /dts/include/coronet/a-common.dtsi: -------------------------------------------------------------------------------- 1 | #include "base.dtsi" 2 | 3 | &fm1mac4 { 4 | status = "okay"; 5 | }; 6 | 7 | &watchdog { 8 | gpios = <&gpio0 16 0>; 9 | }; 10 | -------------------------------------------------------------------------------- /dts/include/coronet/a12-cpu.dtsi: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "a-common.dtsi" 4 | 5 | &mdio0 { 6 | agate: switch@4 { 7 | compatible = "marvell,mv88e6085"; 8 | reg = <0x4>; 9 | 10 | dsa,member = <0 0>; 11 | dsa,num_tx_queues = <8>; 12 | 13 | interrupts = <2 1 0 0>; 14 | interrupt-parent = <&mpic>; 15 | interrupt-controller; 16 | #interrupt-cells = <2>; 17 | 18 | ports { 19 | #address-cells = <0x1>; 20 | #size-cells = <0x0>; 21 | 22 | dsa0d: port@5 { 23 | reg = <0x5>; 24 | label = "dsa"; 25 | link = <&dsa1u>; 26 | phy-mode = "rgmii-id"; 27 | 28 | fixed-link { 29 | speed = <1000>; 30 | full-duplex; 31 | }; 32 | }; 33 | 34 | port@6 { 35 | reg = <0x6>; 36 | label = "cpu0"; 37 | ethernet = <&fm1mac4>; 38 | phy-mode = "rgmii-id"; 39 | 40 | fixed-link { 41 | speed = <1000>; 42 | full-duplex; 43 | }; 44 | }; 45 | 46 | mv6_port(0, 0, "ethX2" , &aphy0, "gmii"); 47 | mv6_port(1, 1, "ethX12", &aphy1, "gmii"); 48 | mv6_port(2, 2, "ethX8" , &aphy2, "gmii"); 49 | mv6_port(3, 3, "ethX4" , &aphy3, "gmii"); 50 | mv6_port(4, 4, "ethX3" , &aphy4, "gmii"); 51 | }; 52 | 53 | mdio { 54 | #address-cells = <0x1>; 55 | #size-cells = <0x0>; 56 | interrupt-parent = <&agate>; 57 | 58 | aphy0: mv6_phy(0, 1000); 59 | aphy1: mv6_phy(1, 1000); 60 | aphy2: mv6_phy(2, 1000); 61 | aphy3: mv6_phy(3, 1000); 62 | aphy4: mv6_phy(4, 1000); 63 | }; 64 | }; 65 | 66 | opal: switch@1 { 67 | compatible = "marvell,mv88e6085"; 68 | reg = <0x1>; 69 | 70 | dsa,member = <0 1>; 71 | dsa,num_tx_queues = <4>; 72 | 73 | interrupts = <3 1 0 0>; 74 | interrupt-parent = <&mpic>; 75 | interrupt-controller; 76 | #interrupt-cells = <2>; 77 | 78 | ports { 79 | #address-cells = <1>; 80 | #size-cells = <0>; 81 | 82 | dsa1u: port@a { 83 | reg = <0xa>; 84 | label = "dsa"; 85 | link = <&dsa0d>; 86 | phy-mode = "rgmii"; 87 | 88 | fixed-link { 89 | speed = <1000>; 90 | full-duplex; 91 | }; 92 | }; 93 | 94 | mv6_port(0, 0, "ethX1" , &ophy0, "mii"); 95 | mv6_port(1, 1, "ethX5" , &ophy1, "mii"); 96 | mv6_port(2, 2, "ethX6" , &ophy2, "mii"); 97 | mv6_port(3, 3, "ethX7" , &ophy3, "mii"); 98 | mv6_port(4, 4, "ethX9" , &ophy4, "mii"); 99 | mv6_port(5, 5, "ethX10", &ophy5, "mii"); 100 | mv6_port(6, 6, "ethX11", &ophy6, "mii"); 101 | }; 102 | 103 | mdio { 104 | #address-cells = <1>; 105 | #size-cells = <0>; 106 | interrupt-parent = <&opal>; 107 | 108 | ophy0: mv6_phy(0, 100); 109 | ophy1: mv6_phy(1, 100); 110 | ophy2: mv6_phy(2, 100); 111 | ophy3: mv6_phy(3, 100); 112 | ophy4: mv6_phy(4, 100); 113 | ophy5: mv6_phy(5, 100); 114 | ophy6: mv6_phy(6, 100); 115 | }; 116 | }; 117 | }; 118 | -------------------------------------------------------------------------------- /dts/include/coronet/a20-cpu.dtsi: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "a-common.dtsi" 4 | 5 | &mdio0 { 6 | agate: switch@4 { 7 | compatible = "marvell,mv88e6085"; 8 | reg = <0x4>; 9 | 10 | dsa,member = <0 0>; 11 | dsa,num_tx_queues = <8>; 12 | 13 | interrupts = <2 1 0 0>; 14 | interrupt-parent = <&mpic>; 15 | interrupt-controller; 16 | #interrupt-cells = <2>; 17 | 18 | ports { 19 | #address-cells = <0x1>; 20 | #size-cells = <0x0>; 21 | 22 | dsa02: port@4 { 23 | reg = <0x4>; 24 | label = "dsa"; 25 | link = <&dsa20>; 26 | phy-mode = "sgmii"; 27 | 28 | fixed-link { 29 | speed = <1000>; 30 | full-duplex; 31 | }; 32 | }; 33 | 34 | dsa01: port@5 { 35 | reg = <0x5>; 36 | label = "dsa"; 37 | link = <&dsa10>; 38 | phy-mode = "rgmii-id"; 39 | 40 | fixed-link { 41 | speed = <1000>; 42 | full-duplex; 43 | }; 44 | }; 45 | 46 | port@6 { 47 | reg = <0x6>; 48 | label = "cpu0"; 49 | ethernet = <&fm1mac4>; 50 | phy-mode = "rgmii-id"; 51 | 52 | fixed-link { 53 | speed = <1000>; 54 | full-duplex; 55 | }; 56 | }; 57 | 58 | mv6_port(0, 0, "ethX6" , &aphy0, "gmii"); 59 | mv6_port(1, 1, "ethX7" , &aphy1, "gmii"); 60 | mv6_port(2, 2, "ethX14", &aphy2, "gmii"); 61 | mv6_port(3, 3, "ethX8" , &aphy3, "gmii"); 62 | }; 63 | 64 | mdio { 65 | #address-cells = <0x1>; 66 | #size-cells = <0x0>; 67 | interrupt-parent = <&agate>; 68 | 69 | aphy0: mv6_phy(0, 100); 70 | aphy1: mv6_phy(1, 100); 71 | aphy2: mv6_phy(2, 100); 72 | aphy3: mv6_phy(3, 100); 73 | }; 74 | }; 75 | 76 | opal1: switch@1 { 77 | compatible = "marvell,mv88e6085"; 78 | reg = <0x1>; 79 | 80 | dsa,member = <0 1>; 81 | dsa,num_tx_queues = <4>; 82 | 83 | interrupts = <3 1 0 0>; 84 | interrupt-parent = <&mpic>; 85 | interrupt-controller; 86 | #interrupt-cells = <2>; 87 | 88 | ports { 89 | #address-cells = <1>; 90 | #size-cells = <0>; 91 | 92 | dsa10: port@a { 93 | reg = <0xa>; 94 | label = "dsa"; 95 | link = <&dsa01 &dsa20>; 96 | phy-mode = "rgmii"; 97 | 98 | fixed-link { 99 | speed = <1000>; 100 | full-duplex; 101 | }; 102 | }; 103 | 104 | mv6_port(0, 0, "ethX5" , &o1phy0, "mii"); 105 | mv6_port(1, 1, "ethX11", &o1phy1, "mii"); 106 | mv6_port(2, 2, "ethX12", &o1phy2, "mii"); 107 | mv6_port(3, 3, "ethX13", &o1phy3, "mii"); 108 | mv6_port(4, 4, "ethX17", &o1phy4, "mii"); 109 | mv6_port(5, 5, "ethX18", &o1phy5, "mii"); 110 | mv6_port(6, 6, "ethX19", &o1phy6, "mii"); 111 | mv6_port(7, 7, "ethX20", &o1phy7, "mii"); 112 | }; 113 | 114 | mdio { 115 | #address-cells = <1>; 116 | #size-cells = <0>; 117 | interrupt-parent = <&opal1>; 118 | 119 | o1phy0: mv6_phy(0, 100); 120 | o1phy1: mv6_phy(1, 100); 121 | o1phy2: mv6_phy(2, 100); 122 | o1phy3: mv6_phy(3, 100); 123 | o1phy4: mv6_phy(4, 100); 124 | o1phy5: mv6_phy(5, 100); 125 | o1phy6: mv6_phy(6, 100); 126 | o1phy7: mv6_phy(7, 100); 127 | }; 128 | }; 129 | 130 | opal2: switch@3 { 131 | compatible = "marvell,mv88e6085"; 132 | reg = <0x3>; 133 | 134 | dsa,member = <0 2>; 135 | dsa,num_tx_queues = <4>; 136 | 137 | interrupts = <0 1 0 0>; 138 | interrupt-parent = <&mpic>; 139 | interrupt-controller; 140 | #interrupt-cells = <2>; 141 | 142 | ports { 143 | #address-cells = <1>; 144 | #size-cells = <0>; 145 | 146 | dsa20: port@a { 147 | reg = <0xa>; 148 | label = "dsa"; 149 | link = <&dsa02 &dsa10>; 150 | phy-mode = "sgmii"; 151 | 152 | fixed-link { 153 | speed = <1000>; 154 | full-duplex; 155 | }; 156 | }; 157 | 158 | mv6_port(0, 0, "ethX2" , &o2phy0, "mii"); 159 | mv6_port(1, 1, "ethX4" , &o2phy1, "mii"); 160 | mv6_port(2, 2, "ethX1" , &o2phy2, "mii"); 161 | mv6_port(3, 3, "ethX3" , &o2phy3, "mii"); 162 | mv6_port(4, 4, "ethX10", &o2phy4, "mii"); 163 | mv6_port(5, 5, "ethX9" , &o2phy5, "mii"); 164 | mv6_port(6, 6, "ethX15", &o2phy6, "mii"); 165 | mv6_port(7, 7, "ethX16", &o2phy7, "mii"); 166 | }; 167 | 168 | mdio { 169 | #address-cells = <1>; 170 | #size-cells = <0>; 171 | interrupt-parent = <&opal2>; 172 | 173 | o2phy0: mv6_phy(0, 100); 174 | o2phy1: mv6_phy(1, 100); 175 | o2phy2: mv6_phy(2, 100); 176 | o2phy3: mv6_phy(3, 100); 177 | o2phy4: mv6_phy(4, 100); 178 | o2phy5: mv6_phy(5, 100); 179 | o2phy6: mv6_phy(6, 100); 180 | o2phy7: mv6_phy(7, 100); 181 | }; 182 | }; 183 | }; 184 | -------------------------------------------------------------------------------- /dts/include/coronet/tbn-chan0-rgmii.dtsi: -------------------------------------------------------------------------------- 1 | &fm1mac4 { 2 | status = "okay"; 3 | }; 4 | 5 | &mdio0 { 6 | switch@4 { 7 | ports { 8 | port@0 { 9 | reg = <0x0>; 10 | label = "cpu0"; 11 | ethernet = <&fm1mac4>; 12 | phy-mode = "rgmii-id"; 13 | 14 | /* TO_CPU frames from device 0, port 15 | 8, will have a DSA tag where the two 16 | first bytes are 00 40. The T1023's 17 | hardware parser mistakenly thinks this 18 | is an 802.3 length field and drops 19 | them if the real length does not 20 | match. So we force the tag format to 21 | Ethertyped DSA which, while not 22 | officially supported, does work. */ 23 | dsa-tag-protocol = "edsa"; 24 | 25 | fixed-link { 26 | speed = <1000>; 27 | full-duplex; 28 | }; 29 | }; 30 | }; 31 | }; 32 | }; 33 | -------------------------------------------------------------------------------- /dts/include/coronet/tbn-chan0-sgmii.dtsi: -------------------------------------------------------------------------------- 1 | &fm1mac1 { 2 | status = "okay"; 3 | }; 4 | 5 | &mdio0 { 6 | switch@4 { 7 | ports { 8 | port@9 { 9 | reg = <0x9>; 10 | label = "cpu0"; 11 | ethernet = <&fm1mac1>; 12 | phy-mode = "2500base-x"; 13 | 14 | fixed-link { 15 | speed = <2500>; 16 | full-duplex; 17 | }; 18 | }; 19 | }; 20 | }; 21 | }; 22 | -------------------------------------------------------------------------------- /dts/include/coronet/tbn-cpu.dtsi: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "base.dtsi" 4 | #include "tbn-chan0-rgmii.dtsi" 5 | 6 | &mdio0 { 7 | peridot: switch@4 { 8 | compatible = "marvell,mv88e6190"; 9 | reg = <0x4>; 10 | 11 | dsa,member = <0 0>; 12 | dsa,num_tx_queues = <8>; 13 | 14 | interrupts = <2 1 0 0>; 15 | interrupt-parent = <&mpic>; 16 | interrupt-controller; 17 | #interrupt-cells = <2>; 18 | 19 | ports { 20 | #address-cells = <0x1>; 21 | #size-cells = <0x0>; 22 | 23 | mv6_port(1, 1, "ethX3", &phy1, "gmii"); 24 | mv6_port(2, 2, "ethX4", &phy2, "gmii"); 25 | mv6_port(3, 3, "ethX8", &phy3, "gmii"); 26 | mv6_port(4, 4, "ethX6", &phy4, "gmii"); 27 | mv6_port(5, 5, "ethX7", &phy5, "gmii"); 28 | mv6_port(6, 6, "ethX5", &phy6, "gmii"); 29 | mv6_port(7, 7, "ethX2", &phy7, "gmii"); 30 | mv6_port(8, 8, "ethX1", &phy8, "gmii"); 31 | }; 32 | 33 | mdio { 34 | #address-cells = <0x1>; 35 | #size-cells = <0x0>; 36 | interrupt-parent = <&peridot>; 37 | 38 | phy1: mv6_phy(1, 1000); 39 | phy2: mv6_phy(2, 1000); 40 | phy3: mv6_phy(3, 1000); 41 | phy4: mv6_phy(4, 1000); 42 | phy5: mv6_phy(5, 1000); 43 | phy6: mv6_phy(6, 1000); 44 | phy7: mv6_phy(7, 1000); 45 | phy8: mv6_phy(8, 1000); 46 | }; 47 | }; 48 | }; 49 | 50 | &soc { 51 | relay-ctrl { 52 | compatible = "wmo,relay-ctrl"; 53 | bypass-relay { 54 | relay-gpio = <&gpio1 5 GPIO_ACTIVE_LOW>; 55 | phy-handle = <&phy3>, <&phy4>, <&phy5>, <&phy6>; 56 | led-trigger-inverted; 57 | }; 58 | }; 59 | }; 60 | 61 | &watchdog { 62 | gpios = <&gpio1 8 0>; 63 | }; 64 | -------------------------------------------------------------------------------- /external.desc: -------------------------------------------------------------------------------- 1 | name: NETBOX 2 | desc: NetBox 3 | -------------------------------------------------------------------------------- /external.mk: -------------------------------------------------------------------------------- 1 | include $(sort $(wildcard $(BR2_EXTERNAL_NETBOX_PATH)/package/*/*.mk)) 2 | -------------------------------------------------------------------------------- /package/Config.in: -------------------------------------------------------------------------------- 1 | source "$BR2_EXTERNAL_NETBOX_PATH/package/brist/Config.in" 2 | source "$BR2_EXTERNAL_NETBOX_PATH/package/factory/Config.in" 3 | source "$BR2_EXTERNAL_NETBOX_PATH/package/finit/Config.in" 4 | source "$BR2_EXTERNAL_NETBOX_PATH/package/mdnsd-finit/Config.in" 5 | source "$BR2_EXTERNAL_NETBOX_PATH/package/libnsh/Config.in" 6 | source "$BR2_EXTERNAL_NETBOX_PATH/package/mcjoin/Config.in" 7 | source "$BR2_EXTERNAL_NETBOX_PATH/package/nemesis/Config.in" 8 | source "$BR2_EXTERNAL_NETBOX_PATH/package/querierd/Config.in" 9 | source "$BR2_EXTERNAL_NETBOX_PATH/package/skeleton-init-finit/Config.in" 10 | source "$BR2_EXTERNAL_NETBOX_PATH/package/westermo-dts/Config.in" 11 | -------------------------------------------------------------------------------- /package/brist/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_BRIST 2 | bool "brist - BRIdge Self Test" 3 | select BR2_PACKAGE_SOCAT 4 | select BR2_PACKAGE_TCPDUMP 5 | select BR2_PACKAGE_IPROUTE2 6 | help 7 | Brist is a standalone, easy to use, portable framework to 8 | verify the capabilities of the Linux bridge. Emphasis on 9 | portable. It should be possible to run on a full-blown Linux 10 | distribution, but it must be possible to run on limited 11 | embedded systems. 12 | 13 | Brist is written in POSIX shell script, with some scent of 14 | awk, and uses tools like socat, ping, and tcpdump to do its 15 | bidding. For some tests nemesis is used, but when it is not 16 | available, those tests are skipped. 17 | 18 | https://github.com/westermo/brist/ 19 | -------------------------------------------------------------------------------- /package/brist/brist.hash: -------------------------------------------------------------------------------- 1 | # From https://github.com/westermo/brist/releases/ 2 | sha256 71da960a8e30507573dd07f9ff802a3b4094113dfc84177e2ee0d040a5db8990 brist-1.1.tar.gz 3 | 4 | # Locally calculated 5 | sha256 01814c5406d6365c8da6ec3f3c67055f1adbf4a67e2852bf6ea9068ea28df2f0 LICENSE 6 | 7 | -------------------------------------------------------------------------------- /package/brist/brist.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # brist 4 | # 5 | ################################################################################ 6 | 7 | BRIST_VERSION = 1.1 8 | BRIST_SOURCE = brist-$(BRIST_VERSION).tar.gz 9 | BRIST_SITE = https://github.com/westermo/brist/releases/download/$(BRIST_VERSION) 10 | BRIST_LICENSE = MIT 11 | BRIST_LICENSE_FILES = LICENSE 12 | 13 | define BRIST_INSTALL_TARGET_CMDS 14 | $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) prefix=/usr DESTDIR="$(TARGET_DIR)" install 15 | chmod +x $(TARGET_DIR)/usr/lib/brist/brist.sh 16 | endef 17 | 18 | $(eval $(generic-package)) 19 | -------------------------------------------------------------------------------- /package/factory/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_FACTORY 2 | bool "factory" 3 | help 4 | Simple factory reset program/login-shell for instructing the 5 | system to factory reset itself, and reboot. 6 | 7 | The program is made to run as SUID root to be able to tell the 8 | system to reboot. Sufficient care has been taken to make the 9 | factory program as secure as possible. With the worst possible 10 | eftect to only be abused to reboot the system. 11 | -------------------------------------------------------------------------------- /package/factory/factory.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # factory 4 | # 5 | ################################################################################ 6 | FACTORY_VERSION = 1.0 7 | FACTORY_LICENSE = MIT 8 | FACTORY_SITE_METHOD = local 9 | FACTORY_SITE = $(BR2_EXTERNAL_NETBOX_PATH)/src/factory 10 | FACTORY_INSTALL_STAGING = YES 11 | 12 | define FACTORY_BUILD_CMDS 13 | $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \ 14 | LDLIBS="$(TARGET_LDFLAGS)" 15 | endef 16 | 17 | define FACTORY_INSTALL_TARGET_CMDS 18 | $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \ 19 | DESTDIR="$(TARGET_DIR)" install 20 | endef 21 | 22 | $(eval $(generic-package)) 23 | -------------------------------------------------------------------------------- /package/finit/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_FINIT 2 | bool "finit" 3 | depends on BR2_USE_MMU # fork() 4 | select BR2_PACKAGE_LIBITE 5 | select BR2_PACKAGE_LIBUEV 6 | select BR2_PACKAGE_SKELETON_INIT_FINIT # before BR2_INIT_FINIT support 7 | help 8 | The original Asus EeePC fastinit clone, on steroids. With process 9 | supervision, plugin support, and more! 10 | 11 | https://github.com/troglobit/finit 12 | 13 | if BR2_PACKAGE_FINIT 14 | 15 | config BR2_PACKAGE_FINIT_ADVANCED 16 | bool "Advanced options" 17 | default n 18 | help 19 | Take extra care to verify the resulting system behavior when 20 | changing these option(s). They are marked advanced for the 21 | very reason that they may brick your system! 22 | 23 | if BR2_PACKAGE_FINIT_ADVANCED 24 | 25 | config BR2_PACKAGE_FINIT_CUSTOM_FSTAB 26 | string "Custom /etc/fstab" 27 | help 28 | In certain use-cases, e.g., embedded systems with a secondary 29 | partition, or when testing in factory production, users may 30 | want to mount system partitions from an fstab file other than 31 | /etc/fstab. 32 | 33 | This setting allows changing the default fstab Finit looks for. 34 | It can be set to any file in fstab format, even the emtpy string 35 | in case you do not want a default fstab. 36 | 37 | To select a different fstab at boot time, use the following kernel 38 | command line option. Remeber the -- separator for kernel options 39 | and options destined for PID 1. 40 | 41 | finit.fstab=/etc/fstab.alt 42 | 43 | endif 44 | 45 | config BR2_PACKAGE_FINIT_INITCTL_GROUP 46 | string "Group for /run/finit/socket" 47 | default "wheel" 48 | help 49 | On systems with multiple administrators, set the group 50 | to their shared UNIX group, usually "wheel", to allow 51 | them to start/stop services and reboot the system. 52 | 53 | config BR2_PACKAGE_FINIT_KEVENTD 54 | bool "finit-keventd" 55 | default n 56 | help 57 | Build bundled finit-keventd, which monitors kernel events 58 | for AC power status and generates sys/pwr/fail condition. 59 | This is a new feature in Finit v4.1 and is still very much 60 | in an experimental state. 61 | 62 | For lxc/docker application builds you do not need this. 63 | 64 | config BR2_PACKAGE_FINIT_WATCHDOG 65 | bool "finit-watchdogd" 66 | default n 67 | help 68 | Build bundled finit-watchdogd, which provides a simplistic 69 | watchdog daemon that runs in the background, kicking the 70 | systemd default /dev/watchdog to prevent reboot. This is 71 | useful in very small systems where its grownup old cousin 72 | watchdogd cannot be used. 73 | 74 | For lxc/docker application builds you do not need this. 75 | 76 | if BR2_PACKAGE_FINIT_WATCHDOG 77 | 78 | config BR2_PACKAGE_FINIT_WATCHDOG_DEV 79 | string "watchdog device" 80 | default "/dev/watchdog" 81 | help 82 | Device node to use for finit-watchdogd. The default is 83 | usually sufficient, but some systems have more than one. 84 | 85 | endif 86 | 87 | config BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG 88 | bool "hotplug plugin (mdev/udev)" 89 | help 90 | By default, Finit builds and launches its hotplug plugin. 91 | It is responsible for detecting and starting the mdev tool, 92 | or udevd daemon. The former exists in many BusyBox based 93 | systems and is called for "cold plugging". The latter has 94 | many various incarnations and is mostly used for desktop 95 | systems. 96 | 97 | For lxc/docker application builds you do not need this. 98 | 99 | config BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS 100 | bool "hook scripts" 101 | default n 102 | help 103 | Adds a run-parts(8) script runner for Finit hook points. When 104 | enabled, it allows extending and customizing the boot process 105 | and do early boot debugging long before regular services are 106 | available. 107 | 108 | For example, say that you want to enable some kernel tracing 109 | before modules are loaded. With hook-scripts, you can just 110 | drop in a shell script in /libexec/finit/hook/mount/all/ that 111 | will poke the right control files in tracefs. 112 | 113 | config BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD 114 | bool "Scan /etc/modules-load.d" 115 | help 116 | Scans /etc/modules-load.d for modules to load. 117 | 118 | For lxc/docker application builds you do not need this. 119 | 120 | config BR2_PACKAGE_FINIT_PLUGIN_MODPROBE 121 | bool "Coldplug modules using modalias magic" 122 | help 123 | Coldplug modules using modalias magic. Everything is 124 | handled automatically based on device trees and their 125 | matching kernel modules. 126 | 127 | For lxc/docker application builds you do not need this. 128 | 129 | config BR2_PACKAGE_FINIT_PLUGIN_RTC 130 | bool "RTC plugin" 131 | help 132 | By default, Finit builds and launches its RTC plugin. It is 133 | responsible for restoring the system clock from the RTC clock 134 | at boot, and saving the system clock to RTC at reboot. 135 | 136 | For lxc/docker application builds you do not need this. 137 | 138 | config BR2_PACKAGE_FINIT_PLUGIN_TTY 139 | bool "TTY plugin" 140 | help 141 | Automatically resart tty services that are plugged in. 142 | 143 | For lxc/docker application builds you do not need this. 144 | 145 | config BR2_PACKAGE_FINIT_PLUGIN_URANDOM 146 | bool "/dev/urandom plugin" 147 | help 148 | By default, Finit builds and launches its urandom plugin. It 149 | is responsible for seeding /dev/urandom from a previously saved 150 | seed at boot, and saving a seed at reboot. 151 | 152 | For lxc/docker application builds you do not need this. 153 | 154 | endif 155 | -------------------------------------------------------------------------------- /package/finit/finit.hash: -------------------------------------------------------------------------------- 1 | sha256 b6a0a2f98c860cf9fe5dfe7e3601d922957ad7880ae29919176ab960b7b96e70 finit-4.12.tar.gz 2 | sha256 abdb9adbbc1faacc35c80bc2974c7d6b842e3e50b066d688385b5d21be86206f LICENSE 3 | 4 | # No hash for git snapshots: 5 | #none none finit-099672f.tar.gz 6 | -------------------------------------------------------------------------------- /package/finit/finit.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # finit 4 | # 5 | ################################################################################ 6 | 7 | FINIT_VERSION = 4.12 8 | FINIT_SITE = https://github.com/troglobit/finit/releases/download/$(FINIT_VERSION) 9 | FINIT_LICENSE = MIT 10 | FINIT_LICENSE_FILES = LICENSE 11 | FINIT_INSTALL_STAGING = YES 12 | FINIT_DEPENDENCIES = host-pkgconf libite libuev 13 | FINIT_INSTALL_STAGING = YES 14 | FINIT_D = $(TARGET_DIR)/etc/finit.d 15 | 16 | # Create configure script using autoreconf when building from git 17 | #FINIT_VERSION = 099672f 18 | #FINIT_SITE = git://github.com/troglobit/finit.git 19 | FINIT_AUTORECONF = YES 20 | #FINIT_DEPENDENCIES += host-automake host-autoconf host-libtool 21 | 22 | # Buildroot defaults to /usr for both prefix and exec-prefix, this we 23 | # must override because we want to install into /sbin and /bin for the 24 | # finit and initctl programs, respectively. The expected plugin path is 25 | # /lib/finit/ and scripts in /libexec, both are set by --exec-prefix. 26 | # The localstatedir is set to the correct system path by Buildroot, so 27 | # no override necessary there. 28 | FINIT_CONF_OPTS = \ 29 | --prefix=/usr \ 30 | --exec-prefix= \ 31 | --disable-doc \ 32 | --disable-contrib \ 33 | --with-group=$(BR2_PACKAGE_FINIT_INITCTL_GROUP) 34 | 35 | ifeq ($(BR2_PACKAGE_FINIT_ADVANCED),y) 36 | ifneq ($(BR2_PACKAGE_FINIT_CUSTOM_FSTAB),) 37 | FINIT_CONF_OPTS += --with-fstab=$(BR2_PACKAGE_FINIT_CUSTOM_FSTAB) 38 | else 39 | FINIT_CONF_OPTS += --without-fstab 40 | endif 41 | endif 42 | 43 | ifeq ($(BR2_PACKAGE_FINIT_KEVENTD),y) 44 | FINIT_CONF_OPTS += --with-keventd 45 | else 46 | FINIT_CONF_OPTS += --without-keventd 47 | endif 48 | 49 | ifeq ($(BR2_PACKAGE_FINIT_WATCHDOG),y) 50 | FINIT_CONF_OPTS += --with-watchdog=$(BR2_PACKAGE_FINIT_WATCHDOG_DEV) 51 | else 52 | FINIT_CONF_OPTS += --without-watchdog 53 | endif 54 | 55 | ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_HOTPLUG),y) 56 | FINIT_CONF_OPTS += --enable-hotplug-plugin 57 | else 58 | FINIT_CONF_OPTS += --disable-hotplug-plugin 59 | endif 60 | 61 | ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_HOOK_SCRIPTS),y) 62 | FINIT_CONF_OPTS += --enable-hook-scripts-plugin 63 | else 64 | FINIT_CONF_OPTS += --disable-hook-scripts-plugin 65 | endif 66 | 67 | ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_MODULES_LOAD),y) 68 | FINIT_CONF_OPTS += --enable-modules-load-plugin 69 | else 70 | FINIT_CONF_OPTS += --disable-modules-load-plugin 71 | endif 72 | 73 | ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_MODPROBE),y) 74 | FINIT_CONF_OPTS += --enable-modprobe-plugin 75 | else 76 | FINIT_CONF_OPTS += --disable-modprobe-plugin 77 | endif 78 | 79 | ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_RTC),y) 80 | FINIT_CONF_OPTS += --enable-rtc-plugin 81 | else 82 | FINIT_CONF_OPTS += --disable-rtc-plugin 83 | endif 84 | 85 | ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_TTY),y) 86 | FINIT_CONF_OPTS += --enable-tty-plugin 87 | else 88 | FINIT_CONF_OPTS += --disable-tty-plugin 89 | endif 90 | 91 | ifeq ($(BR2_PACKAGE_FINIT_PLUGIN_URANDOM),y) 92 | FINIT_CONF_OPTS += --enable-urandom-plugin 93 | else 94 | FINIT_CONF_OPTS += --disable-urandom-plugin 95 | endif 96 | 97 | ifneq ($(SKELETON_INIT_COMMON_HOSTNAME),) 98 | FINIT_CONF_OPTS += --with-hostname="$(SKELETON_INIT_COMMON_HOSTNAME)" 99 | endif 100 | 101 | # Disable/Enable features depending on other packages 102 | ifeq ($(BR2_PACKAGE_ALSA_UTILS),y) 103 | FINIT_CONF_OPTS += --enable-alsa-utils-plugin 104 | else 105 | FINIT_CONF_OPTS += --disable-alsa-utils-plugin 106 | endif 107 | 108 | ifeq ($(BR2_PACKAGE_DBUS),y) 109 | FINIT_CONF_OPTS += --enable-dbus-plugin 110 | else 111 | FINIT_CONF_OPTS += --disable-dbus-plugin 112 | endif 113 | 114 | ifeq ($(BR2_PACKAGE_XORG7),y) 115 | FINIT_CONF_OPTS += --enable-x11-common-plugin 116 | else 117 | FINIT_CONF_OPTS += --disable-x11-common-plugin 118 | endif 119 | 120 | $(eval $(autotools-package)) 121 | -------------------------------------------------------------------------------- /package/libnsh/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_LIBNSH 2 | bool "libnsh" 3 | select BR2_PACKAGE_NETSNMP 4 | select BR2_PACKAGE_NETSNMP_SERVER 5 | select BR2_PACKAGE_NETSNMP_ENABLE_MIBS 6 | help 7 | This is libnsh, the "Net-SNMP helper C-library". It provides 8 | a slightly simpler and more user-friendly API wrapper around 9 | net-snmp. 10 | 11 | If developing a subagent, you probably want to enable the 12 | "agentx" module in BR2_PACKAGE_NETSNMP_WITH_MIB_MODULES 13 | as well. 14 | 15 | https://github.com/westermo/libnsh 16 | -------------------------------------------------------------------------------- /package/libnsh/libnsh.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # libnsh 4 | # 5 | ################################################################################ 6 | 7 | LIBNSH_VERSION = 0.4 8 | LIBNSH_PKGNAME = libnsh 9 | LIBNSH_SITE = https://github.com/westermo/$(LIBNSH_PKGNAME)/releases/download/v$(LIBNSH_VERSION) 10 | LIBNSH_INSTALL_STAGING = YES 11 | LIBNSH_LICENSE = MIT 12 | LIBNSH_LICENSE_FILES = LICENSE 13 | LIBNSH_DEPENDENCIES = host-pkgconf netsnmp 14 | LIBNSH_INSTALL_STAGING = YES 15 | 16 | $(eval $(autotools-package)) 17 | -------------------------------------------------------------------------------- /package/mcjoin/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_MCJOIN 2 | bool "mcjoin" 3 | help 4 | Simple and easy-to-use tool for testing multicast: 5 | - a multicast generator (server) 6 | - a multicast data sink (client) 7 | - support for join/send to one or more groups 8 | - support for both ASM (*,G) and SSM (S,G) 9 | - support for both IPv4 & IPv6 10 | 11 | https://github.com/troglobit/mcjoin 12 | -------------------------------------------------------------------------------- /package/mcjoin/mcjoin.hash: -------------------------------------------------------------------------------- 1 | sha256 feaf5c7eef884ba98bbc20bbeba133fb6c5ee6c9251dbe05531788094014abda mcjoin-2.12.tar.gz 2 | sha256 3ef2afdb478d713edb86e5d911c698ce1d3ad65568b135c8faeca9cc0860b584 LICENSE 3 | -------------------------------------------------------------------------------- /package/mcjoin/mcjoin.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # mcjoin 4 | # 5 | ################################################################################ 6 | 7 | MCJOIN_VERSION = 2.12 8 | MCJOIN_SOURCE = mcjoin-$(MCJOIN_VERSION).tar.gz 9 | MCJOIN_SITE = https://github.com/troglobit/mcjoin/releases/download/v$(MCJOIN_VERSION) 10 | MCJOIN_LICENSE = ISC 11 | MCJOIN_LICENSE_FILES = LICENSE 12 | MCJOIN_INSTALL_STAGING = YES 13 | 14 | $(eval $(autotools-package)) 15 | -------------------------------------------------------------------------------- /package/mdnsd-finit/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_MDNSD_FINIT 2 | bool mdnsd-finit 3 | select BR2_PACKAGE_AVAHI 4 | help 5 | Advertises the initial $(HOSTNAME).local and network.local with Avahi. 6 | -------------------------------------------------------------------------------- /package/mdnsd-finit/mdnsd-finit.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # mdnsd-finit 4 | # 5 | ################################################################################ 6 | 7 | MDNSD_FINIT_VERSION = 0.12 8 | MDNSD_FINIT_SITE = 9 | MDNSD_FINIT_SOURCE = 10 | MDNSD_FINIT_LICENSE = ISC 11 | MDNSD_FINIT_LICENSE_FILES = LICENSE 12 | MDNSD_FINIT_DEPENDENCIES = host-pkgconf avahi 13 | MDNSD_FINIT_INSTALL_STAGING = YES 14 | 15 | define MDNSD_FINIT_INSTALL_FINIT_SVC 16 | @echo "#### MDNSD_INSTALL_FINIT_SVC" 17 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_NETBOX_PATH)/package/mdnsd-finit/mdnsd-finit.svc \ 18 | $(FINIT_D)/available/mdnsd.conf 19 | endef 20 | MDNSD_FINIT_POST_INSTALL_TARGET_HOOKS += MDNSD_FINIT_INSTALL_FINIT_SVC 21 | 22 | $(eval $(generic-package)) 23 | -------------------------------------------------------------------------------- /package/mdnsd-finit/mdnsd-finit.svc: -------------------------------------------------------------------------------- 1 | # Launch mDNS-SD daemon 2 | service [2345789] /usr/sbin/mdnsd -sn -- mDNS-SD daemon 3 | -------------------------------------------------------------------------------- /package/nemesis/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_NEMESIS 2 | bool "nemesis" 3 | depends on BR2_USE_MMU # fork() 4 | select BR2_PACKAGE_LIBNET 5 | help 6 | A command-line network packet crafting and injection utility. 7 | Key features: 8 | - ARP/RARP, DNS, ETHERNET, ICMP, IGMP, IP, OSPF, RIP, TCP and UDP 9 | - Layer 2 or Layer 3 injection on UNIX-like systems 10 | - Layer 2 injection (only) on Windows systems 11 | - Packet payload from file 12 | - IP and TCP options from file 13 | 14 | https://github.com/libnet/nemesis 15 | -------------------------------------------------------------------------------- /package/nemesis/nemesis.hash: -------------------------------------------------------------------------------- 1 | sha256 c480570284ba86aa8643eac0d582aaedaeaefa4773b7d0ac9549e4f42c40e78a nemesis-1.8.tar.gz 2 | sha256 777cab338a486c8bdf7c983085751476fcdcf1c4cfc62ccd2bb16c636bd7a944 LICENSE 3 | -------------------------------------------------------------------------------- /package/nemesis/nemesis.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # nemesis 4 | # 5 | ################################################################################ 6 | 7 | NEMESIS_VERSION = 1.8 8 | NEMESIS_SOURCE = nemesis-$(NEMESIS_VERSION).tar.gz 9 | NEMESIS_SITE = https://github.com/libnet/nemesis/releases/download/v$(NEMESIS_VERSION) 10 | NEMESIS_LICENSE = BSD-3-Clause 11 | NEMESIS_LICENSE_FILES = LICENSE 12 | NEMESIS_DEPENDENCIES = libnet 13 | NEMESIS_INSTALL_STAGING = YES 14 | 15 | $(eval $(autotools-package)) 16 | -------------------------------------------------------------------------------- /package/querierd/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_QUERIERD 2 | bool "querierd" 3 | help 4 | A bridge helper daemon for sending multicast queries. 5 | 6 | https://github.com/westermo/querierd 7 | -------------------------------------------------------------------------------- /package/querierd/querierd.conf: -------------------------------------------------------------------------------- 1 | # /etc/querierd.conf: default NetBox configuration 2 | 3 | # Query interval can be [1,1024], default 125. Recommended not go below 10 4 | #query-interval 125 5 | 6 | # The interval inside the query-interval that clients should respond 7 | #query-response-interval 10 8 | 9 | # Last member query interval [1,1024], default 1. The igmp-robustness 10 | # setting controls the last member query count. 11 | #query-last-member-interval 1 12 | 13 | # Querier's robustness can be [2,10], default 2. Recommended to use 2 14 | #robustness 2 15 | 16 | # Controls the "other querier present interval", used to detect when an 17 | # elected querier stops sending queries. Leave this commented-out, it 18 | # is only available to override particular use-cases and interip with 19 | # devices that do not follow the RFC. When commented out, the timeout 20 | # is calculated from the query interval and robustness according to RFC. 21 | #router-timeout 255 22 | 23 | # IP Option Router Alert is enabled by default, for interop with stacks 24 | # that hard-code the length of the IP header 25 | #no router-alert 26 | 27 | # Enable and one of the IGMP versions to use at startup, with fallback 28 | # to older versions if older clients appear. 29 | iface vlan1 enable igmpv3 30 | #iface vlan2 enable igmpv3 31 | #iface vlan3 enable igmpv3 32 | -------------------------------------------------------------------------------- /package/querierd/querierd.hash: -------------------------------------------------------------------------------- 1 | sha256 b425e5d9db3e87a5e4d6dd3887f4378202e07aaf2304412f5c1fb0589ab625dc querierd-0.10.tar.gz 2 | sha256 834f45ed282fd010f354ecc0a50538af519a1cfcc4d2866de3be06982fa9ed29 LICENSE 3 | -------------------------------------------------------------------------------- /package/querierd/querierd.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # querierd 4 | # 5 | ################################################################################ 6 | 7 | QUERIERD_VERSION = 0.10 8 | QUERIERD_SITE = \ 9 | https://github.com/westermo/querierd/releases/download/v$(QUERIERD_VERSION) 10 | QUERIERD_LICENSE = BSD-3-Clause 11 | QUERIERD_LICENSE_FILES = LICENSE 12 | QUERIERD_INSTALL_STAGING = YES 13 | 14 | define QUERIERD_INSTALL_CONFIG 15 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_NETBOX_PATH)/package/querierd/querierd.conf \ 16 | $(TARGET_DIR)/etc/ 17 | endef 18 | QUERIERD_POST_INSTALL_TARGET_HOOKS += QUERIERD_INSTALL_CONFIG 19 | 20 | define QUERIERD_INSTALL_FINIT_SVC 21 | $(INSTALL) -D -m 0644 $(BR2_EXTERNAL_NETBOX_PATH)/package/querierd/querierd.svc \ 22 | $(FINIT_D)/available/querierd.conf 23 | endef 24 | 25 | QUERIERD_POST_INSTALL_TARGET_HOOKS += QUERIERD_INSTALL_FINIT_SVC 26 | 27 | $(eval $(autotools-package)) 28 | -------------------------------------------------------------------------------- /package/querierd/querierd.svc: -------------------------------------------------------------------------------- 1 | # Launch IGMP querier daemon 2 | service [2345789] env:-/etc/default/querierd /usr/sbin/querierd -sn $QUERIERD_ARGS -- IGMP querier daemon 3 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_SKELETON_INIT_FINIT 2 | bool 3 | select BR2_PACKAGE_HAS_SKELETON 4 | select BR2_PACKAGE_SKELETON_INIT_COMMON 5 | 6 | config BR2_PACKAGE_PROVIDES_SKELETON 7 | default "skeleton-init-finit" if BR2_PACKAGE_SKELETON_INIT_FINIT 8 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton-init-finit.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # skeleton-init-finit 4 | # 5 | ################################################################################ 6 | 7 | # The skeleton can't depend on the toolchain, since all packages depends on the 8 | # skeleton and the toolchain is a target package, as is skeleton. 9 | # Hence, skeleton would depends on the toolchain and the toolchain would depend 10 | # on skeleton. 11 | SKELETON_INIT_FINIT_ADD_TOOLCHAIN_DEPENDENCY = NO 12 | SKELETON_INIT_FINIT_ADD_SKELETON_DEPENDENCY = NO 13 | SKELETON_INIT_FINIT_TMPFILE := $(shell mktemp) 14 | SKELETON_INIT_FINIT_DEPENDENCIES = skeleton-init-common 15 | 16 | # Enable when BR2_INIT_FINT 17 | #SKELETON_INIT_FINIT_PROVIDES = skeleton 18 | 19 | # Prefer Finit built-in getty unless options are set, squash zero baudrate 20 | define SKELETON_INIT_FINIT_GETTY 21 | if [ -z "$(SYSTEM_GETTY_OPTIONS)" ]; then \ 22 | if [ $(SYSTEM_GETTY_BAUDRATE) -eq 0 ]; then \ 23 | SYSTEM_GETTY_BAUDRATE=""; \ 24 | fi; \ 25 | echo "tty [12345789] $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_TERM) noclear"; \ 26 | else \ 27 | echo "tty [12345789] /sbin/getty -L $(SYSTEM_GETTY_OPTIONS) $(SYSTEM_GETTY_BAUDRATE) $(SYSTEM_GETTY_PORT) $(SYSTEM_GETTY_TERM)"; \ 28 | fi 29 | endef 30 | 31 | define SKELETON_INIT_FINIT_SET_GENERIC_GETTY 32 | $(SKELETON_INIT_FINIT_GETTY) > $(SKELETON_INIT_FINIT_TMPFILE) 33 | grep -qxF "`cat $(SKELETON_INIT_FINIT_TMPFILE)`" $(FINIT_D)/available/getty.conf \ 34 | || cat $(SKELETON_INIT_FINIT_TMPFILE) >> $(FINIT_D)/available/getty.conf 35 | rm $(SKELETON_INIT_FINIT_TMPFILE) 36 | ln -sf ../available/getty.conf $(FINIT_D)/enabled/getty.conf 37 | endef 38 | SKELETON_INIT_FINIT_TARGET_FINALIZE_HOOKS += SKELETON_INIT_FINIT_SET_GENERIC_GETTY 39 | 40 | # Dropbear SSH 41 | ifeq ($(BR2_PACKAGE_DROPBEAR),y) 42 | define SKELETON_INIT_FINIT_SET_DROPBEAR 43 | ln -sf ../available/dropbear.conf $(FINIT_D)/enabled/dropbear.conf 44 | endef 45 | SKELETON_INIT_FINIT_TARGET_FINALIZE_HOOKS += SKELETON_INIT_FINIT_SET_DROPBEAR 46 | endif 47 | 48 | # Enable Busybox syslogd unless sysklogd is enabled 49 | ifeq ($(BR2_PACKAGE_SYSKLOGD),y) 50 | define SKELETON_INIT_FINIT_SET_SYSLOGD 51 | ln -sf ../available/sysklogd.conf $(FINIT_D)/enabled/sysklogd.conf 52 | endef 53 | else 54 | define SKELETON_INIT_FINIT_SET_SYSLOGD 55 | ln -sf ../available/syslogd.conf $(FINIT_D)/enabled/syslogd.conf 56 | endef 57 | endif 58 | SKELETON_INIT_FINIT_TARGET_FINALIZE_HOOKS += SKELETON_INIT_FINIT_SET_SYSLOGD 59 | 60 | # Watchdogd 61 | ifeq ($(BR2_PACKAGE_WATCHDOGD),y) 62 | define SKELETON_INIT_FINIT_SET_WATCHDOGD 63 | ln -sf ../available/watchdogd.conf $(FINIT_D)/enabled/watchdogd.conf 64 | endef 65 | SKELETON_INIT_FINIT_TARGET_FINALIZE_HOOKS += SKELETON_INIT_FINIT_SET_WATCHDOGD 66 | endif 67 | 68 | # Workaround, should be in ifupdown-scripts package 69 | ifeq ($(BR2_PACKAGE_IFUPDOWN_SCRIPTS),y) 70 | define SKELETON_INIT_FINIT_IFUPDOWN_WORKAROUND 71 | $(IFUPDOWN_SCRIPTS_PREAMBLE) 72 | $(IFUPDOWN_SCRIPTS_LOCALHOST) 73 | $(IFUPDOWN_SCRIPTS_DHCP) 74 | endef 75 | SKELETON_INIT_FINIT_TARGET_FINALIZE_HOOKS += SKELETON_INIT_FINIT_IFUPDOWN_WORKAROUND 76 | endif 77 | 78 | 79 | ifeq ($(BR2_TARGET_GENERIC_REMOUNT_ROOTFS_RW),y) 80 | # Uncomment /dev/root entry in fstab to allow Finit to remount it rw 81 | define SKELETON_INIT_FINIT_ROOT_RO_OR_RW 82 | $(SED) '\:^#[[:blank:]]*/dev/root[[:blank:]]:s/^# //' $(TARGET_DIR)/etc/fstab 83 | endef 84 | else 85 | # Comment out /dev/root entry to prevent Finit from remounting it rw 86 | define SKELETON_INIT_FINIT_ROOT_RO_OR_RW 87 | $(SED) '\:^/dev/root[[:blank:]]:s/^/# /' $(TARGET_DIR)/etc/fstab 88 | endef 89 | endif 90 | 91 | define SKELETON_INIT_FINIT_INSTALL_TARGET_CMDS 92 | $(call SYSTEM_RSYNC,$(SKELETON_INIT_FINIT_PKGDIR)/skeleton,$(TARGET_DIR)) 93 | mkdir -p $(TARGET_DIR)/home 94 | mkdir -p $(TARGET_DIR)/srv 95 | mkdir -p $(TARGET_DIR)/var 96 | [ -L $(TARGET_DIR)/var/run ] || ln -s ../run $(TARGET_DIR)/var/run 97 | $(SKELETON_INIT_FINIT_ROOT_RO_OR_RW) 98 | endef 99 | 100 | $(eval $(generic-package)) 101 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/default/gdbserver: -------------------------------------------------------------------------------- 1 | # TCP connection 2 | #GDBSERVER_ARGS="--multi :1235" 3 | 4 | # Qemu debug console 5 | GDBSERVER_ARGS="--multi /dev/hvc1" 6 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/default/querierd: -------------------------------------------------------------------------------- 1 | # -i NAME :: Set daemon identity (syslog, .conf, .sock, .pid, etc.) 2 | # -l LVL :: Log level 3 | QUERIERD_ARGS="" 4 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/default/sysklogd: -------------------------------------------------------------------------------- 1 | # -m0 :: Disable periodic syslog MARK entries 2 | # -s :: Enable secure mode, don't listen to remote logs 3 | # -r 1M:5 :: Log rotation every 1 MiB and keep 5 rotated ones 4 | SYSLOGD_ARGS="-m0 -s -r 1M:5" 5 | 6 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.conf: -------------------------------------------------------------------------------- 1 | # /etc/finit.conf: Buildroot defaults 2 | # See /etc/finit.d/available/*.conf and `initctl list` for other services 3 | 4 | ## Runlevel to start after bootstrap, runlevel 'S' 5 | # Default is 2 6 | #runlevel 2 7 | 8 | ## Bootstrap services and tasks 9 | # Can be listed here or in /etc/finit.d/*.conf 10 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/dnsmasq.conf: -------------------------------------------------------------------------------- 1 | service [2345] dnsmasq -k -- DHCP/DNS proxy 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/dropbear.conf: -------------------------------------------------------------------------------- 1 | # Launch SSH daemon dropbear, see telnetd.conf for inetd example 2 | # 3 | # : dropbear does not honor SIGHUP. 4 | # -R: Create hostkeys if needed. 5 | # -F: Run in foreground. 6 | service [2345] dropbear -R -F -- SSH daemon 7 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/gdbserver.conf: -------------------------------------------------------------------------------- 1 | service [123456789] env:-/etc/default/gdbserver gdbserver $GDBSERVER_ARGS -- GDB Server 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/getty.conf: -------------------------------------------------------------------------------- 1 | # This is a console auto-detect for the built-in getty. It matches 2 | # ttyS0, ttyAMA0, or ttymxc0 depending on the system. 3 | #tty [12345] @console 115200 noclear 4 | 5 | # For board bringup or debug purposes the `nologin` flag can be used 6 | # to bypass the login prompt and get a shell directly. 7 | #tty [12345] @console noclear nologin 8 | 9 | # Alternatively you can run on the exact TTY device 10 | #tty [12345] /dev/ttyS0 115200 noclear 11 | #tty [12345] /dev/ttyAMA0 115200 noclear vt220 12 | 13 | # Example using an external getty, here from BusyBox 14 | #tty [12345] /sbin/getty -L 115200 ttyAMA0 vt100 nowait 15 | #tty [12345] /sbin/getty -L 115200 @console vt100 noclear 16 | 17 | # Allow login on ttyUSB0, for systems with no dedicated console port 18 | #tty [12345] /dev/ttyUSB0 115200 noclear 19 | 20 | # Automatically generated from Buildroot menuconfig 21 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/inadyn.conf: -------------------------------------------------------------------------------- 1 | service [2345] inadyn -ns -t 30 -- DDNS client 2 | 3 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/inetd.conf: -------------------------------------------------------------------------------- 1 | # Busybox inetd uses /etc/inetd.conf, example: 2 | # nntp stream tcp nowait news /usr/sbin/leafnode 3 | service [2345] inetd -f -- Internet super server 4 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/isisd.conf: -------------------------------------------------------------------------------- 1 | service [2345] log:null isisd -A 127.0.0.1 -u root -g root -- IS-IS daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/lldpd.conf: -------------------------------------------------------------------------------- 1 | service [2345] env:-/etc/default/lldpd lldpd -d $LLDPD_ARGS -- LLDP daemon (IEEE 802.1ab) 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/mini-snmpd.conf: -------------------------------------------------------------------------------- 1 | service [2345] /usr/sbin/mini-snmpd -sn -- Mini snmpd 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/mstpd.conf: -------------------------------------------------------------------------------- 1 | sysv name:mstpd [23456789] pid:!/run/mstpd.pid bridge-stp br0 -- MSTP daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/ntpd.conf: -------------------------------------------------------------------------------- 1 | # Wait for the system to have a default route before starting 2 | service [2345] log ntpd -n -l -I eth0 -- NTP daemon 3 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/ospf6d.conf: -------------------------------------------------------------------------------- 1 | service [2345] log:null ospf6d -A 127.0.0.1 -u root -g root -- OSPF IPv6 daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/ospfd.conf: -------------------------------------------------------------------------------- 1 | service [2345] log:null ospfd -A 127.0.0.1 -u root -g root -- OSPF daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/querierd.conf: -------------------------------------------------------------------------------- 1 | service [2345789] env:-/etc/default/querierd querierd -sn $QUERIERD_ARGS -- Multicast query daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/ripd.conf: -------------------------------------------------------------------------------- 1 | service [2345] log:null ripd -A 127.0.0.1 -u root -g root -- RIP daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/ripng.conf: -------------------------------------------------------------------------------- 1 | service [2345] log:null ripngd -A 127.0.0.1 -u root -g root -- RIP IPv6 daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/smcroute.conf: -------------------------------------------------------------------------------- 1 | service [2345] smcrouted -ns -- Static multicast routing daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/ssdp-responder.conf: -------------------------------------------------------------------------------- 1 | service [2345] ssdpd -ns -- SSDP Responder 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/sysklogd.conf: -------------------------------------------------------------------------------- 1 | service name:sysklogd [S123456789] env:-/etc/default/sysklogd syslogd -F $SYSLOGD_ARGS -- System log daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/syslogd.conf: -------------------------------------------------------------------------------- 1 | # BusyBox syslogd + klogd 2 | 3 | # We want syslogd to always run, never be stopped, regardless of runlevel 4 | # so it can send to any remote syslog server the user has set up. 5 | service [S123456789] syslogd -n -s 512 -b 3 -t -- System log daemon 6 | 7 | # klogd depends on syslogd, but BusyBox syslogd doesn't create a PID file to sync with 8 | service [S123456789] klogd -n -- Kernel log daemon 9 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/telnetd.conf: -------------------------------------------------------------------------------- 1 | service [2345] :23 telnetd -F -p 23 -- Telnet daemon on port 23 2 | service [2345] :2323 telnetd -F -p 2323 -- Telnet daemon on port 2323 3 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/watchdogd.conf: -------------------------------------------------------------------------------- 1 | # Finit has a built-in watchdog daemon that starts very early 2 | # to take care of the hand-over from any bootloader. Therefore 3 | # watchdogd does not need to start until the default runlevel. 4 | service [123456789] watchdogd -xns -- System watchdog daemon 5 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/available/zebra.conf: -------------------------------------------------------------------------------- 1 | service [2345] pid:!/run/quagga/zebra.pid zebra -A 127.0.0.1 -u root -g root -- Zebra routing daemon 2 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/finit.d/enabled/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/package/skeleton-init-finit/skeleton/etc/finit.d/enabled/.empty -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/etc/fstab: -------------------------------------------------------------------------------- 1 | # 2 | /dev/root / auto rw,noauto 0 1 3 | tmpfs /tmp tmpfs mode=1777 0 0 4 | -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/var/cache/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/package/skeleton-init-finit/skeleton/var/cache/.empty -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/var/lib/misc/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/package/skeleton-init-finit/skeleton/var/lib/misc/.empty -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/var/lock/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/package/skeleton-init-finit/skeleton/var/lock/.empty -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/var/log/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/package/skeleton-init-finit/skeleton/var/log/.empty -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/var/run: -------------------------------------------------------------------------------- 1 | ../run -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/var/spool/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/package/skeleton-init-finit/skeleton/var/spool/.empty -------------------------------------------------------------------------------- /package/skeleton-init-finit/skeleton/var/tmp/.empty: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/package/skeleton-init-finit/skeleton/var/tmp/.empty -------------------------------------------------------------------------------- /package/westermo-dts/Config.in: -------------------------------------------------------------------------------- 1 | config BR2_PACKAGE_WESTERMO_DTS 2 | bool "westermo-dts" 3 | default y if NETBOX_TYPE_OS 4 | depends on BR2_LINUX_KERNEL 5 | select BR2_PACKAGE_HOST_DTC 6 | help 7 | Devicetrees for switches and routers from Westermo. 8 | 9 | https://www.westermo.com/products/ethernet-switches 10 | -------------------------------------------------------------------------------- /package/westermo-dts/westermo-dts.mk: -------------------------------------------------------------------------------- 1 | ################################################################################ 2 | # 3 | # westermo-dts 4 | # 5 | ################################################################################ 6 | 7 | WESTERMO_DTS_VERSION = local 8 | WESTERMO_DTS_LICENSE = MIT 9 | WESTERMO_DTS_DEPENDENCIES = host-dtc linux 10 | WESTERMO_DTS_SITE_METHOD = local 11 | WESTERMO_DTS_SITE = $(BR2_EXTERNAL_NETBOX_PATH)/dts 12 | 13 | define WESTERMO_DTS_BUILD_CMDS 14 | $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \ 15 | PLAT=$(NETBOX_PLAT) ARCH=$(ARCH) LINUX_DIR="$(LINUX_DIR)" 16 | endef 17 | 18 | define WESTERMO_DTS_INSTALL_TARGET_CMDS 19 | $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \ 20 | PLAT=$(NETBOX_PLAT) DESTDIR="$(TARGET_DIR)" install 21 | endef 22 | 23 | $(eval $(generic-package)) 24 | -------------------------------------------------------------------------------- /patches/busybox/1.37.0/logger-i.patch: -------------------------------------------------------------------------------- 1 | --- a/sysklogd/logger.c 2022-02-27 23:26:19.010990329 +0100 2 | +++ b/sysklogd/logger.c 2022-02-27 23:29:31.312225302 +0100 3 | @@ -21,9 +21,10 @@ 4 | //kbuild:lib-$(CONFIG_LOGGER) += syslogd_and_logger.o 5 | 6 | //usage:#define logger_trivial_usage 7 | -//usage: "[-s] [-t TAG] [-p PRIO] [MESSAGE]" 8 | +//usage: "[-i] [-s] [-t TAG] [-p PRIO] [MESSAGE]" 9 | //usage:#define logger_full_usage "\n\n" 10 | //usage: "Write MESSAGE (or stdin) to syslog\n" 11 | +//usage: "\n -i Log PID of logger to system log" 12 | //usage: "\n -s Log to stderr as well as the system log" 13 | //usage: "\n -t TAG Log using the specified tag (defaults to user name)" 14 | //usage: "\n -p PRIO Priority (number or FACILITY.LEVEL pair)" 15 | @@ -105,10 +106,12 @@ 16 | str_t = uid2uname_utoa(geteuid()); 17 | 18 | /* Parse any options */ 19 | - opt = getopt32(argv, "p:st:", &str_p, &str_t); 20 | + opt = getopt32(argv, "p:st:i", &str_p, &str_t); 21 | 22 | if (opt & 0x2) /* -s */ 23 | i |= LOG_PERROR; 24 | + if (opt & 0x8) /* -i */ 25 | + i |= LOG_PID; 26 | //if (opt & 0x4) /* -t */ 27 | openlog(str_t, i, 0); 28 | i = LOG_USER | LOG_NOTICE; 29 | -------------------------------------------------------------------------------- /patches/finit/4.7/disable-unused-hotplug-options.patch: -------------------------------------------------------------------------------- 1 | Index: finit-4.7/system/10-hotplug.conf.in 2 | =================================================================== 3 | --- finit-4.7.orig/system/10-hotplug.conf.in 4 | +++ finit-4.7/system/10-hotplug.conf.in 5 | @@ -18,26 +18,26 @@ 6 | # change the contents any way you like, it can even be empty. 7 | 8 | # Check for systemd-udevd and eudev, if we find both, we opt for the latter. 9 | -service nowarn [S12345789] cgroup.system name:udevd notify:none pid:udevd log /lib/systemd/systemd-udevd -- Device event daemon (udev) 10 | -service nowarn [S12345789] cgroup.system name:udevd notify:none pid:udevd log udevd -D -- Device event daemon (udev) 11 | +#service nowarn [S12345789] cgroup.system name:udevd notify:none pid:udevd log /lib/systemd/systemd-udevd -- Device event daemon (udev) 12 | +#service nowarn [S12345789] cgroup.system name:udevd notify:none pid:udevd log udevd -D -- Device event daemon (udev) 13 | 14 | # Wait for udevd to start, then trigger coldplug events and module loading. 15 | # The last 'settle' call waits for it to finalize processing all uevents. 16 | -run nowarn if:udevd cgroup.init :1 [S] log udevadm settle -t 0 -- 17 | -run nowarn if:udevd cgroup.init :2 [S] log udevadm control --reload -- 18 | -run nowarn if:udevd cgroup.init :3 [S] log udevadm trigger -c add -t devices -- Requesting device events 19 | -run nowarn if:udevd cgroup.init :4 [S] log udevadm trigger -c add -t subsystems -- Requesting subsystem events 20 | -run nowarn if:udevd cgroup.init :5 [S] log udevadm settle -t 30 -- Waiting for udev to finish 21 | +#run nowarn if:udevd cgroup.init :1 [S] log udevadm settle -t 0 -- 22 | +#run nowarn if:udevd cgroup.init :2 [S] log udevadm control --reload -- 23 | +#run nowarn if:udevd cgroup.init :3 [S] log udevadm trigger -c add -t devices -- Requesting device events 24 | +#run nowarn if:udevd cgroup.init :4 [S] log udevadm trigger -c add -t subsystems -- Requesting subsystem events 25 | +#run nowarn if:udevd cgroup.init :5 [S] log udevadm settle -t 30 -- Waiting for udev to finish 26 | 27 | # If udevd is not available, check for mdevd. Unlike plain 'mdev -df', the 28 | # mdevd-coldplug process exits when mdevd has completed. So the condition 29 | # (same as for plain mdev below) can be relied on as a 30 | # barrier for services that, e.g., need to probe for switchcore ports or PHYs 31 | # that require firmware loading before they show up. 32 | -service nowarn conflict:udevd,mdev cgroup.init notify:none if:!udevd \ 33 | - [S12345789] notify:s6 mdevd -O 4 -D %n -- Device event daemon (mdevd) 34 | -run nowarn conflict:udevd,mdev cgroup.init name:coldplug \ 35 | - [S] mdevd-coldplug -- Cold plugging system 36 | +#service nowarn conflict:udevd,mdev cgroup.init notify:none if:!udevd \ 37 | +# [S12345789] notify:s6 mdevd -O 4 -D %n -- Device event daemon (mdevd) 38 | +#run nowarn conflict:udevd,mdev cgroup.init name:coldplug \ 39 | +# [S] mdevd-coldplug -- Cold plugging system 40 | 41 | # If neither udevd or mdevd are available, fall back to mdev. The new daemon 42 | # mode calls `mdev -s` internally but does not create a PID file when that is 43 | -------------------------------------------------------------------------------- /patches/finit/4.7/dont-remount-ro-root-on-shutdown.patch: -------------------------------------------------------------------------------- 1 | --- a/src/sig.c 2 | +++ b/src/sig.c 3 | @@ -371,7 +371,8 @@ 4 | sync(); 5 | run("mount -n -o remount,ro -t dummytype dummydev /", NULL); 6 | run("mount -n -o remount,ro dummydev /", NULL); 7 | - run("mount -n -o remount,ro /", "mount"); 8 | + if (!ismnt("/proc/mounts", "/", "ro")) 9 | + run("mount -n -o remount,ro /", "mount"); 10 | 11 | /* Call mdadm to mark any RAID array(s) as clean before halting. */ 12 | mdadm_wait(); 13 | -------------------------------------------------------------------------------- /patches/finit/4.7/integration-remap-syslog-events.patch: -------------------------------------------------------------------------------- 1 | 2 | This is a WeOS integration patch. As such it must never be upstreamed, because we are 3 | changing a behavior of an upstream component to fit WeOS specific requirements and any 4 | legacy needs we might have. 5 | 6 | In this case the exact format of the below log messages are: 7 | 8 | 1. Encoded as regexps in Fawlty test logging/security_related_events, and 9 | 2. Conveyed to Bombardier as the format for when they convert syslog to SEDL messages 10 | 11 | In either case we can handle the change, but have opted at this time not to take the 12 | change request notification to the customer. 13 | 14 | -- Joachim Wiberg 15 | 16 | --- a/src/service.c 17 | +++ b/src/service.c 18 | @@ -863,7 +863,7 @@ 19 | } 20 | 21 | if (!svc_is_sysv(svc)) 22 | - logit(LOG_CONSOLE | LOG_NOTICE, "Starting %s[%d]", svc_ident(svc, NULL, 0), pid); 23 | + logit(LOG_CONSOLE | LOG_NOTICE, "Starting %s:%s, PID: %d", basename(svc->cmd), svc->id, pid); 24 | 25 | switch (svc->type) { 26 | case SVC_TYPE_RUN: 27 | @@ -913,7 +913,8 @@ 28 | } 29 | 30 | dbg("%s: Sending SIGKILL to process group %d", nm, svc->pid); 31 | - logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s[%d], sending SIGKILL ...", id, svc->pid); 32 | + logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s:%s, PID: %d, sending SIGKILL ...", 33 | + basename(svc->cmd), svc->id, svc->pid); 34 | if (runlevel != 1) 35 | print_desc("Killing ", svc->desc); 36 | 37 | @@ -1003,7 +1004,8 @@ 38 | } 39 | 40 | dbg("Sending %s to pid:%d name:%s(%s)", sig, svc->pid, id, nm); 41 | - logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s[%d], sending %s ...", id, svc->pid, sig); 42 | + logit(LOG_CONSOLE | LOG_NOTICE, "Stopping %s:%s, PID: %d, sending %s ...", 43 | + basename(svc->cmd), svc->id, svc->pid, sig); 44 | } else { 45 | logit(LOG_CONSOLE | LOG_NOTICE, "Calling '%s stop' ...", cmdline); 46 | } 47 | @@ -1129,8 +1131,8 @@ 48 | print_desc("Restarting ", svc->desc); 49 | 50 | dbg("Sending SIGHUP to PID %d", svc->pid); 51 | - logit(LOG_CONSOLE | LOG_NOTICE, "Restarting %s[%d], sending SIGHUP ...", 52 | - svc_ident(svc, NULL, 0), svc->pid); 53 | + logit(LOG_CONSOLE | LOG_NOTICE, "Restarting %s:%s, PID: %d, sending SIGHUP ...", 54 | + basename(svc->cmd), svc->id, svc->pid); 55 | rc = kill(svc->pid, SIGHUP); 56 | if (rc == -1 && (errno == ESRCH || errno == ENOENT)) { 57 | /* nobody home, reset internal state machine */ 58 | @@ -2210,8 +2212,8 @@ 59 | 60 | /* Peak instability index */ 61 | if (svc->restart_max != -1 && *restart_cnt >= svc->restart_max) { 62 | - logit(LOG_CONSOLE | LOG_WARNING, "Service %s keeps crashing, not restarting.", 63 | - svc_ident(svc, NULL, 0)); 64 | + logit(LOG_CONSOLE | LOG_WARNING, "Service %s:%s keeps crashing, not restarting.", 65 | + basename(svc->cmd), svc->id); 66 | svc_crashing(svc); 67 | *restart_cnt = 0; 68 | svc->restart_tmo = svc->restart_saved; 69 | @@ -2243,8 +2245,8 @@ 70 | timeout = ((*restart_cnt) <= (svc->restart_max / 2)) ? 2000 : 5000; 71 | /* If a longer timeout was specified in the conf, use that instead. */ 72 | svc->restart_tmo = max(svc->restart_tmo, timeout); 73 | - logit(LOG_CONSOLE|LOG_WARNING, "Service %s[%d] died, restarting in %d msec (%d/%d)", 74 | - svc_ident(svc, NULL, 0), svc->oldpid, svc->restart_tmo, *restart_cnt, svc->restart_max); 75 | + logit(LOG_CONSOLE|LOG_WARNING, "Service %s:%s died, restarting in %d msec (%d/%d)", 76 | + basename(svc->cmd), svc->id, svc->restart_tmo, *restart_cnt, svc->restart_max); 77 | 78 | svc_unblock(svc); 79 | service_step(svc); 80 | -------------------------------------------------------------------------------- /patches/finit/4.7/missing-cgroup-warn.patch: -------------------------------------------------------------------------------- 1 | --- a/src/cgroup.c 2 | +++ b/src/cgroup.c 3 | @@ -61,6 +61,7 @@ 4 | 5 | static void cgset(const char *path, char *ctrl, char *prop) 6 | { 7 | + char fpath[PATH_MAX]; 8 | char *val; 9 | 10 | dbg("path %s, ctrl %s, prop %s", path ?: "NIL", ctrl ?: "NIL", prop ?: "NIL"); 11 | @@ -92,6 +93,12 @@ 12 | return; 13 | } 14 | 15 | + snprintf(fpath, sizeof(fpath), "%s/%s.%s", path, ctrl, prop); 16 | + if (!fexist(fpath)) { 17 | + _w("Missing cgroup setting: %s", fpath); 18 | + return; 19 | + } 20 | + 21 | dbg("%s/%s.%s <= %s", path, ctrl, prop, val); 22 | if (fnwrite(val, "%s/%s.%s", path, ctrl, prop)) 23 | err(1, "Failed setting %s/%s.%s = %s", path, ctrl, prop, val); 24 | -------------------------------------------------------------------------------- /patches/iproute2/5.16.0/0001-build-integration-with-Westermo-system.patch: -------------------------------------------------------------------------------- 1 | From af6870437159423d01c69b8ba5b84ac0a2213a76 Mon Sep 17 00:00:00 2001 2 | From: Joachim Wiberg 3 | Date: Wed, 23 Feb 2022 11:01:00 +0100 4 | Subject: [PATCH 1/3] build: integration with Westermo system 5 | 6 | Drop rdma and manuals from default build: 7 | 8 | - rdma doesn't build in v5.16.0, and Westermo doesn't need it atm 9 | - manuals require tool not in Docker build image, and not needed on target 10 | 11 | Signed-off-by: Joachim Wiberg 12 | --- 13 | Makefile | 2 +- 14 | 1 file changed, 1 insertion(+), 1 deletion(-) 15 | 16 | diff --git a/Makefile b/Makefile 17 | index f6214534..c89ec4f1 100644 18 | --- a/Makefile 19 | +++ b/Makefile 20 | @@ -65,7 +65,7 @@ WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2 21 | CFLAGS := $(WFLAGS) $(CCOPTS) -I../include -I../include/uapi $(DEFINES) $(CFLAGS) 22 | YACCFLAGS = -d -t -v 23 | 24 | -SUBDIRS=lib ip tc bridge misc netem genl tipc devlink rdma dcb man vdpa 25 | +SUBDIRS=lib ip tc bridge misc netem genl tipc devlink dcb vdpa 26 | 27 | LIBNETLINK=../lib/libutil.a ../lib/libnetlink.a 28 | LDLIBS += $(LIBNETLINK) 29 | -- 30 | 2.25.1 31 | 32 | -------------------------------------------------------------------------------- /patches/iproute2/5.16.0/0003-iplink_bridge-Add-local_receive-flag.patch: -------------------------------------------------------------------------------- 1 | From 77167de11a1ae3cb1df967a67b061d5ded5c5020 Mon Sep 17 00:00:00 2001 2 | From: Mattias Forsblad 3 | Date: Mon, 28 Feb 2022 08:07:52 +0100 4 | Subject: [PATCH 3/3] iplink_bridge: Add local_receive flag 5 | 6 | The local_receive bridge flag constrols if ingressing packets 7 | will traverse up or not in the bridge. 8 | 9 | Signed-off-by: Mattias Forsblad 10 | --- 11 | include/uapi/linux/if_link.h | 1 + 12 | ip/iplink_bridge.c | 14 ++++++++++++++ 13 | 2 files changed, 15 insertions(+) 14 | 15 | diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h 16 | index 1d4ed60b..ee4dc74c 100644 17 | --- a/include/uapi/linux/if_link.h 18 | +++ b/include/uapi/linux/if_link.h 19 | @@ -479,6 +479,7 @@ enum { 20 | IFLA_BR_VLAN_STATS_PER_PORT, 21 | IFLA_BR_MULTI_BOOLOPT, 22 | IFLA_BR_MCAST_QUERIER_STATE, 23 | + IFLA_BR_LOCAL_RECEIVE, 24 | __IFLA_BR_MAX, 25 | }; 26 | 27 | diff --git a/ip/iplink_bridge.c b/ip/iplink_bridge.c 28 | index c2e63f6e..d2c09dbb 100644 29 | --- a/ip/iplink_bridge.c 30 | +++ b/ip/iplink_bridge.c 31 | @@ -30,6 +30,7 @@ static void print_explain(FILE *f) 32 | fprintf(f, 33 | "Usage: ... bridge [ fdb_flush ]\n" 34 | " [ forward_delay FORWARD_DELAY ]\n" 35 | + " [ local_receive LOCAL_RECEIVE ]\n" 36 | " [ hello_time HELLO_TIME ]\n" 37 | " [ max_age MAX_AGE ]\n" 38 | " [ ageing_time AGEING_TIME ]\n" 39 | @@ -382,6 +383,14 @@ static int bridge_parse_opt(struct link_util *lu, int argc, char **argv, 40 | 41 | addattr8(n, 1024, IFLA_BR_NF_CALL_ARPTABLES, 42 | nf_call_arpt); 43 | + } else if (matches(*argv, "local_receive") == 0) { 44 | + __u8 local_receive; 45 | + 46 | + NEXT_ARG(); 47 | + if (get_u8(&local_receive, *argv, 0)) 48 | + invarg("invalid local_receive", *argv); 49 | + 50 | + addattr8(n, 1024, IFLA_BR_LOCAL_RECEIVE, local_receive); 51 | } else if (matches(*argv, "help") == 0) { 52 | explain(); 53 | return -1; 54 | @@ -430,6 +439,11 @@ static void bridge_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) 55 | "forward_delay %u ", 56 | rta_getattr_u32(tb[IFLA_BR_FORWARD_DELAY])); 57 | 58 | + if (tb[IFLA_BR_LOCAL_RECEIVE]) 59 | + print_uint(PRINT_ANY, "local_receive", 60 | + "local_receive %u ", 61 | + rta_getattr_u8(tb[IFLA_BR_LOCAL_RECEIVE])); 62 | + 63 | if (tb[IFLA_BR_HELLO_TIME]) 64 | print_uint(PRINT_ANY, 65 | "hello_time", 66 | -- 67 | 2.25.1 68 | 69 | -------------------------------------------------------------------------------- /patches/linux/5.16.8/0002-mv88e6390x-cmode-fix.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c 2 | --- a/drivers/net/dsa/mv88e6xxx/port.c 3 | +++ b/drivers/net/dsa/mv88e6xxx/port.c 4 | @@ -488,10 +488,6 @@ 5 | reg &= ~MV88E6XXX_PORT_STS_CMODE_MASK; 6 | reg |= cmode; 7 | 8 | - err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_STS, reg); 9 | - if (err) 10 | - return err; 11 | - 12 | chip->ports[port].cmode = cmode; 13 | 14 | lane = mv88e6xxx_serdes_get_lane(chip, port); 15 | @@ -507,6 +503,13 @@ 16 | if (err) 17 | return err; 18 | } 19 | + 20 | + /* Need to wait until serdes is stable before we set cmode */ 21 | + usleep_range(10000, 20000); 22 | + 23 | + err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_STS, reg); 24 | + if (err) 25 | + return err; 26 | } 27 | 28 | return 0; 29 | 30 | -------------------------------------------------------------------------------- /patches/linux/5.16.8/0003-sparx5-stats-iteration-page-fault.patch: -------------------------------------------------------------------------------- 1 | commit 4090150690c71a47270bd44f497f92ad60a62c9b 2 | Author: Lennart Eriksson 3 | Date: Wed Oct 20 13:07:44 2021 +0200 4 | 5 | drivers: sparx5: Increase a pointer causes page fault on sparx5 6 | 7 | sparx5_get_stats64 gets page fault because stats is increased 8 | in a for loop but since stats is a pointer it should not be 9 | increased like that. 10 | 11 | My guess is that this is a copy-paste error. 12 | 13 | Signed-off-by: Lennart Eriksson 14 | 15 | diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c 16 | index 59783fc46a7b..10b866e9f726 100644 17 | --- a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c 18 | +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c 19 | @@ -1103,7 +1103,7 @@ void sparx5_get_stats64(struct net_device *ndev, 20 | stats->tx_carrier_errors = portstats[spx5_stats_tx_csense_cnt]; 21 | stats->tx_window_errors = portstats[spx5_stats_tx_late_coll_cnt]; 22 | stats->rx_dropped = portstats[spx5_stats_ana_ac_port_stat_lsb_cnt]; 23 | - for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx, ++stats) 24 | + for (idx = 0; idx < 2 * SPX5_PRIOS; ++idx) 25 | stats->rx_dropped += portstats[spx5_stats_green_p0_rx_port_drop 26 | + idx]; 27 | stats->tx_dropped = portstats[spx5_stats_tx_local_drop]; 28 | 29 | -------------------------------------------------------------------------------- /patches/linux/5.16.8/0004-powerpc-qemu-idle.patch: -------------------------------------------------------------------------------- 1 | From cb193171c3f115e9db588e86f81933c91e481374 Mon Sep 17 00:00:00 2001 2 | From: Tobias Waldekranz 3 | Date: Wed, 22 Apr 2020 12:08:42 +0200 4 | Subject: [PATCH] powerpc/e500/qemu-e500: allow core to idle without 5 | busy-waiting 6 | 7 | This means an idle guest won't needlessly consume an entire core on 8 | the host, waiting for work to show up. 9 | 10 | Signed-off-by: Tobias Waldekranz 11 | Signed-off-by: Joachim Wiberg 12 | 13 | --- 14 | arch/powerpc/platforms/85xx/qemu_e500.c | 5 +++++ 15 | 1 file changed, 5 insertions(+) 16 | 17 | diff --git a/arch/powerpc/platforms/85xx/qemu_e500.c b/arch/powerpc/platforms/85xx/qemu_e500.c 18 | index b63a8548366f..58f23927dfda 100644 19 | --- a/arch/powerpc/platforms/85xx/qemu_e500.c 20 | +++ b/arch/powerpc/platforms/85xx/qemu_e500.c 21 | @@ -79,4 +79,9 @@ define_machine(qemu_e500) { 22 | .get_irq = mpic_get_coreint_irq, 23 | .calibrate_decr = generic_calibrate_decr, 24 | .progress = udbg_progress, 25 | +#ifdef CONFIG_PPC64 26 | + .power_save = book3e_idle, 27 | +#else 28 | + .power_save = e500_idle, 29 | +#endif 30 | }; 31 | -- 32 | GitLab 33 | 34 | -------------------------------------------------------------------------------- /patches/linux/5.16.8/0006-mtd-spinor-erase-fix.patch: -------------------------------------------------------------------------------- 1 | diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c 2 | --- a/drivers/mtd/spi-nor/core.c 3 | +++ b/drivers/mtd/spi-nor/core.c 4 | @@ -1331,7 +1331,7 @@ 5 | SPI_MEM_OP_NO_DUMMY, 6 | SPI_MEM_OP_NO_DATA); 7 | 8 | - spi_nor_spimem_setup_op(nor, &op, nor->write_proto); 9 | + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); 10 | 11 | return spi_mem_exec_op(nor->spimem, &op); 12 | } else if (nor->controller_ops->erase) { 13 | 14 | -------------------------------------------------------------------------------- /provides/init.in: -------------------------------------------------------------------------------- 1 | config BR2_INIT_FINIT 2 | bool "Finit" 3 | select BR2_PACKAGE_FINIT 4 | select BR2_PACKAGE_SKELETON_INIT_FINIT if BR2_ROOTFS_SKELETON_DEFAULT 5 | -------------------------------------------------------------------------------- /provides/skeleton.in: -------------------------------------------------------------------------------- 1 | config BR2_ROOTFS_SKELETON_FINIT 2 | bool "Finit services skeleton" 3 | select BR2_PACKAGE_SKELETON_INIT_FINIT 4 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/westermo/netbox/8f2fd0a55a60703255a105a3258018e1cbbda568/screenshot.png -------------------------------------------------------------------------------- /src/factory/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Westermo Network Technologies 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/factory/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS += -Wall -Wextra -Werror 2 | 3 | all: factory 4 | 5 | clean: 6 | -rm factory 7 | 8 | distclean: clean 9 | -rm *~ 10 | 11 | install: 12 | install -D factory $(DESTDIR)/sbin/ 13 | -------------------------------------------------------------------------------- /src/factory/factory.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | 13 | #define RESETME "/mnt/factory-reset.now" 14 | #define touch(f) mknod((f), S_IFREG|0644, 0); 15 | 16 | char rawgetch(void) 17 | { 18 | struct termios saved, c; 19 | char key; 20 | 21 | if (tcgetattr(fileno(stdin), &saved) < 0) 22 | return -1; 23 | 24 | c = saved; 25 | c.c_lflag &= ~ICANON; 26 | c.c_lflag &= ~ECHO; 27 | c.c_cc[VMIN] = 1; 28 | c.c_cc[VTIME] = 0; 29 | 30 | if (tcsetattr(fileno(stdin), TCSANOW, &c) < 0) { 31 | tcsetattr(fileno(stdin), TCSANOW, &saved); 32 | return -1; 33 | } 34 | 35 | key = getchar(); 36 | tcsetattr(fileno(stdin), TCSANOW, &saved); 37 | 38 | return key; 39 | } 40 | 41 | int yorn(const char *prompt) 42 | { 43 | char yorn; 44 | 45 | fputs(prompt, stderr); 46 | 47 | yorn = rawgetch(); 48 | fprintf(stderr, "%c\n", yorn); 49 | if (yorn != 'y' && yorn != 'Y') 50 | return 0; 51 | 52 | return 1; 53 | } 54 | 55 | static int usage(int rc) 56 | { 57 | printf("usage: factory [opts]\n" 58 | "\n" 59 | "Options:\n" 60 | " -h, --help This help text\n" 61 | " -r, --no-reboot Don't reboot. Reboot manually to activate.\n" 62 | " -y, --assume-yes Automatic yes to prompts; assume \"yes\" as answer to all\n" 63 | " prompts and run non-interactively\n" 64 | "\n" 65 | "Note: this program initiates a factory reset by raising a flag and rebooting\n" 66 | " the system. When it comes back up it safely removes all the OverlayFS\n" 67 | " worker/upper directories for /etc, /home, and /var\n"); 68 | 69 | return rc; 70 | } 71 | 72 | static int run(const char *cmd) 73 | { 74 | int status = system(cmd); 75 | int rc; 76 | 77 | rc = WEXITSTATUS(status); 78 | 79 | if (WIFEXITED(status)) 80 | return rc; 81 | 82 | if (WIFSIGNALED(status)) { 83 | if (rc == 0) 84 | rc = 1; /* adjust, we were aborted */ 85 | } 86 | 87 | return rc; 88 | } 89 | 90 | int main(int argc, char *argv[]) 91 | { 92 | struct option long_opts[] = { 93 | { "help", 0, NULL, 'h' }, 94 | { "no-reboot", 0, NULL, 'r' }, 95 | { "assume-yes", 0, NULL, 'y' }, 96 | { NULL, 0, NULL, 0 } 97 | }; 98 | int reboot = 1; 99 | int yes = 0; 100 | char *tty; 101 | int c; 102 | 103 | while ((c = getopt_long(argc, argv, "h?ry", long_opts, NULL)) != EOF) { 104 | switch (c) { 105 | case 'h': 106 | case '?': 107 | return usage(0); 108 | 109 | case 'r': 110 | reboot = 0; 111 | break; 112 | 113 | case 'y': 114 | yes = 1; 115 | break; 116 | 117 | default: 118 | return usage(1); 119 | } 120 | } 121 | 122 | tty = ttyname(STDIN_FILENO); 123 | if (!tty && errno == ENOTTY) 124 | yes = 1; 125 | 126 | if (argv[0][0] == '-' && tty && strcmp(tty, "/dev/console")) 127 | errx(1, "Factory reset only allowed from console login!"); 128 | 129 | if (yes || yorn("Factory reset device, restores /etc, /home, and /var, (y/N)? ")) { 130 | printf("Preparing system for factory reset on next boot ... "); 131 | touch(RESETME); 132 | printf("Done.\n"); 133 | 134 | if (reboot && (yes || yorn("Reboot now to perform reset, (y/N)? "))) 135 | return run("/sbin/reboot"); 136 | 137 | warnx("Remember to reboot the system to perform the factory reset."); 138 | } 139 | 140 | return 0; 141 | } 142 | 143 | /** 144 | * Local Variables: 145 | * indent-tabs-mode: t 146 | * c-file-style: "linux" 147 | * End: 148 | */ 149 | -------------------------------------------------------------------------------- /support/scripts/fitimage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | die() { 4 | echo "$1" >&2 5 | rm -rf $workdir 6 | exit 1 7 | } 8 | 9 | plat=$1 10 | squash=$2 11 | out=$3 12 | opts="" 13 | kernelcomp="gzip" 14 | dtbcomp="gzip" 15 | 16 | case $plat in 17 | basis) 18 | arch="arm" 19 | load="0x20000000" 20 | opts="-E -p 0x1000" 21 | kernelcomp="none" 22 | dtbcomp="none" 23 | ;; 24 | byron) 25 | arch="arm" 26 | ;; 27 | coronet) 28 | arch="powerpc" 29 | ;; 30 | dagger) 31 | arch="arm" 32 | ;; 33 | envoy) 34 | arch="arm64" 35 | ;; 36 | ember) 37 | arch="arm64" 38 | load="0x40000000" 39 | opts="-E -p 0x1000" 40 | kernelcomp="none" 41 | dtbcomp="none" 42 | ;; 43 | zero) 44 | arch="x86_64" 45 | kernelcomp="none" 46 | dtbcomp="none" 47 | ;; 48 | *) 49 | arch="$plat" 50 | kernelcomp="none" 51 | dtbcomp="none" 52 | ;; 53 | esac 54 | 55 | workdir=$(mktemp -d) 56 | unsquashfs -f -d $workdir $squash boot || die "Invalid SquashFS" 57 | 58 | kernel=$(echo $workdir/boot/*Image | cut -d\ -f1) 59 | [ "$kernel" ] || die "No kernel found" 60 | 61 | case ${kernelcomp} in 62 | "gzip") 63 | gzip -c -9 ${kernel} > ${workdir}/boot/$(basename ${kernel}).${kernelcomp} 64 | ;; 65 | "xz") 66 | xz --check=crc32 -c ${kernel} > ${workdir}/boot/$(basename ${kernel}).${kernelcomp} 67 | ;; 68 | "zstd") 69 | zstd -19 --stdout ${kernel} > ${workdir}/boot/$(basename ${kernel}).${kernelcomp} 70 | ;; 71 | "none") 72 | ;; 73 | esac 74 | 75 | if [ "${kernelcomp}" != "none" ]; then 76 | kernel=$(echo $workdir/boot/*Image.${kernelcomp} | cut -d\ -f1) 77 | [ "$kernel" ] || die "No kernel found" 78 | fi 79 | 80 | dtbs=$workdir/boot/*/device-tree.dtb 81 | dtbs_default=$(echo ${dtbs} | cut -d "-" -f1 | cut -d "/" -f5) 82 | 83 | # If not specified, set dtbcomp to same method as kernelcomp. 84 | if [ -z "${dtbcomp}" ]; then 85 | dtbcomp=${kernelcomp} 86 | fi 87 | 88 | # mkimage will only align images to 4 bytes, but U-Boot will leave 89 | # both DTB and ramdisk in place when starting the kernel. So we pad 90 | # all components up to a 4k boundary. 91 | truncate -s %4k $kernel $dtbs 92 | 93 | for dtb in $dtbs; do 94 | name=$(basename $(dirname $dtb) | cut -d "-" -f1) 95 | fullname=$(basename $(dirname $dtb)) 96 | filename=$(basename ${dtb}).${dtbcomp} 97 | 98 | case ${dtbcomp} in 99 | "gzip") 100 | gzip -c -9 ${dtb} > ${workdir}/boot/$fullname/$filename 101 | ;; 102 | "xz") 103 | xz --check=crc32 -c ${dtb} > ${workdir}/boot/$fullname/$filename 104 | ;; 105 | "zstd") 106 | zstd -19 --stdout ${dtb} > ${workdir}/boot/$fullname/$filename 107 | ;; 108 | "none") 109 | ;; 110 | esac 111 | 112 | cat <>$workdir/netbox-dtbs.itsi 113 | fdt-$name { 114 | description = "dtb"; 115 | type = "flat_dt"; 116 | arch = "$arch"; 117 | compression = "$dtbcomp"; 118 | data = /incbin/("${workdir}/boot/$fullname/$filename"); 119 | hash { 120 | algo = "sha256"; 121 | }; 122 | }; 123 | EOF 124 | cat <>$workdir/netbox-cfgs.itsi 125 | $name { 126 | description = "$name"; 127 | compatible = "$name"; 128 | kernel = "kernel-1"; 129 | ramdisk = "ramdisk-1"; 130 | fdt = "fdt-$name"; 131 | hash { 132 | algo = "sha256"; 133 | }; 134 | }; 135 | EOF 136 | done 137 | 138 | cat <$workdir/netbox.its 139 | /dts-v1/; 140 | 141 | / { 142 | timestamp = <$(date +%s)>; 143 | description = "${plat^}/Standard"; 144 | creator = "netbox"; 145 | #address-cells = <0x1>; 146 | 147 | images { 148 | kernel-1 { 149 | description = "kernel"; 150 | type = "kernel"; 151 | arch = "$arch"; 152 | os = "linux"; 153 | compression = "$kernelcomp"; 154 | data = /incbin/("$kernel"); 155 | hash { 156 | algo = "sha256"; 157 | }; 158 | }; 159 | 160 | ramdisk-1 { 161 | description = "ramdisk"; 162 | type = "ramdisk"; 163 | os = "linux"; 164 | arch = "$arch"; 165 | compression = "none"; 166 | data = /incbin/("$squash"); 167 | hash { 168 | algo = "sha256"; 169 | }; 170 | }; 171 | 172 | $(cat $workdir/netbox-dtbs.itsi) 173 | }; 174 | 175 | configurations { 176 | default = "$dtbs_default"; 177 | 178 | $(cat $workdir/netbox-cfgs.itsi) 179 | }; 180 | }; 181 | EOF 182 | 183 | mkimage \ 184 | ${opts} \ 185 | -f $workdir/netbox.its $out \ 186 | || die "Unable to create FIT image" 187 | 188 | rm -rf $workdir 189 | 190 | -------------------------------------------------------------------------------- /support/scripts/fitimage_legacy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | die() { 4 | echo "$1" >&2 5 | rm -rf $workdir 6 | exit 1 7 | } 8 | 9 | plat=$1 10 | squash=$2 11 | out=$3 12 | load=0 13 | 14 | case $plat in 15 | basis) 16 | arch="arm" 17 | load="0x20000000" 18 | ;; 19 | byron) 20 | arch="arm" 21 | load="0x20000000" 22 | ;; 23 | coronet) 24 | arch="powerpc" 25 | ;; 26 | dagger) 27 | arch="arm" 28 | ;; 29 | envoy) 30 | arch="arm64" 31 | load="0x40000000" 32 | ;; 33 | ember) 34 | arch="arm64" 35 | load="0x40000000" 36 | ;; 37 | zero) 38 | arch="x86_64" 39 | ;; 40 | *) 41 | arch="$plat" 42 | ;; 43 | esac 44 | 45 | workdir=$(mktemp -d) 46 | unsquashfs -f -d $workdir $squash boot || die "Invalid SquashFS" 47 | 48 | kernel=$(echo $workdir/boot/*Image | cut -d\ -f1) 49 | [ "$kernel" ] || die "No kernel found" 50 | 51 | dtbs=$workdir/boot/*/device-tree.dtb 52 | 53 | # mkimage will only align images to 4 bytes, but U-Boot will leave 54 | # both DTB and ramdisk in place when starting the kernel. So we pad 55 | # all components up to a 4k boundary. 56 | truncate -s %4k $kernel $dtbs 57 | 58 | for dtb in $dtbs; do 59 | name=$(basename $(dirname $dtb)) 60 | 61 | cat <>$workdir/netbox-dtbs.itsi 62 | $name { 63 | description = "$name"; 64 | type = "flat_dt"; 65 | arch = "$arch"; 66 | compression = "none"; 67 | data = /incbin/("$dtb"); 68 | }; 69 | EOF 70 | cat <>$workdir/netbox-cfgs.itsi 71 | $name { 72 | description = "$name"; 73 | kernel = "kernel"; 74 | ramdisk = "ramdisk"; 75 | fdt = "$name"; 76 | }; 77 | EOF 78 | done 79 | 80 | cat <$workdir/netbox.its 81 | /dts-v1/; 82 | 83 | / { 84 | timestamp = <$(date +%s)>; 85 | description = "Netbox ($plat)"; 86 | creator = "netbox"; 87 | #address-cells = <0x1>; 88 | 89 | images { 90 | 91 | kernel { 92 | description = "Linux"; 93 | type = "kernel"; 94 | arch = "$arch"; 95 | os = "linux"; 96 | load = <$load>; 97 | entry = <$load>; 98 | compression = "none"; 99 | data = /incbin/("$kernel"); 100 | }; 101 | 102 | ramdisk { 103 | description = "Netbox"; 104 | type = "ramdisk"; 105 | os = "linux"; 106 | arch = "$arch"; 107 | compression = "none"; 108 | data = /incbin/("$squash"); 109 | }; 110 | 111 | $(cat $workdir/netbox-dtbs.itsi) 112 | 113 | }; 114 | 115 | configurations { 116 | $(cat $workdir/netbox-cfgs.itsi) 117 | }; 118 | }; 119 | EOF 120 | 121 | mkimage \ 122 | -E -p 0x1000 \ 123 | -f $workdir/netbox.its $out \ 124 | || die "Unable to create FIT image" 125 | 126 | rm -rf $workdir 127 | -------------------------------------------------------------------------------- /support/scripts/gns3.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # To be sourced from NetBox common post-image.sh and called for targets 3 | # where .gns3a appliance files are supported. 4 | 5 | gns3a_generate() 6 | { 7 | tmpl=${BR2_EXTERNAL_NETBOX_PATH}/board/common/gns3.tmpl 8 | iso=$1 9 | cfg=$2 10 | out=$3 11 | 12 | # Strip any leading dash if ver is set 13 | VERSION=${ver#-} 14 | 15 | if [ -e "$tmpl" ]; then 16 | if [ -e "${BINARIES_DIR}/config.ext3" ]; then 17 | mv "${BINARIES_DIR}/config.ext3" "$cfg" 18 | cfg_sz=$(stat --printf='%s' "${cfg}") 19 | cfg_md5=$(md5sum "${cfg}" | awk '{print $1}') 20 | fi 21 | if [ "$BR2_TARGET_ROOTFS_ISO9660_HYBRID" = "y" ]; then 22 | iso_sz=$(stat --printf='%s' "${iso}") 23 | iso_md5=$(md5sum "${iso}" | awk '{print $1}') 24 | fi 25 | 26 | sed -e "s#VENDOR_NAME#${NETBOX_VENDOR_NAME}#g" \ 27 | -e "s#VENDOR_DESC#${NETBOX_VENDOR_DESC}#g" \ 28 | -e "s#VENDOR_HOME#${NETBOX_VENDOR_HOME}#g" \ 29 | -e "s#VENDOR_VERSION#${VERSION}#g" \ 30 | -e "s#ROOTFS_FILE#$(basename "${iso}")#g" \ 31 | -e "s#ROOTFS_SIZE#${iso_sz}#g" \ 32 | -e "s#ROOTFS_MD5SUM#${iso_md5}#g" \ 33 | -e "s#ROOTFS_VERSION#${VERSION}#g" \ 34 | -e "s#CONFIG_FILE#$(basename "${cfg}")#g" \ 35 | -e "s#CONFIG_SIZE#${cfg_sz}#g" \ 36 | -e "s#CONFIG_MD5SUM#${cfg_md5}#g" \ 37 | -e "s#CONFIG_VERSION#${VERSION}#g" \ 38 | < "${tmpl}" > "${out}" 39 | fi 40 | } 41 | -------------------------------------------------------------------------------- /support/scripts/image.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Input might be padded, get the real length from the SquashFS header. 4 | sqlen=$(($(dd status=none bs=1 skip=40 count=4 <$1 | od -An -t u4))) 5 | 6 | # Un-pad 7 | cp $1 $2 8 | truncate -s $sqlen $2 9 | 10 | # Sum it, put each sum-byte on its own line. 11 | sum=$(sha1sum $2 | cut -d" " -f 1 | fold -w 2) 12 | 13 | # Append the sum-bytes in binary form. 14 | for byte in $sum; do 15 | printf "\x$byte" >>$2 16 | done 17 | 18 | # Re-pad 19 | truncate -s %4K $2 20 | -------------------------------------------------------------------------------- /support/scripts/qemu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | qemucfg="${BINARIES_DIR}/qemu.cfg" 4 | 5 | qemucfg_generate() 6 | { 7 | img=$1 8 | dir="" 9 | [ -n "$2" ] && dir="$2/" 10 | 11 | QEMU_ARCH="" 12 | case $BR2_ARCH in 13 | powerpc) 14 | QEMU_ARCH=ppc64 15 | QEMU_NIC=rtl8139 16 | QEMU_SCSI=virtio-scsi-pci 17 | QEMU_MACH="ppce500 -smp 2 -watchdog i6300esb -cpu e5500 -rtc clock=host" 18 | ;; 19 | arm) 20 | QEMU_ARCH=$BR2_ARCH 21 | QEMU_NIC=virtio-net-pci 22 | QEMU_SCSI=virtio-scsi-pci 23 | if [ "$BR2_cortex_a9" = "y" ]; then 24 | QEMU_MACH="virt,highmem=off -watchdog i6300esb" 25 | else 26 | QEMU_MACH="versatilepb -watchdog i6300esb -dtb ${dir}versatile-pb.dtb" 27 | fi 28 | ;; 29 | aarch64) 30 | QEMU_ARCH=$BR2_ARCH 31 | QEMU_NIC=virtio-net-pci 32 | QEMU_SCSI=virtio-scsi-pci 33 | QEMU_MACH="virt -cpu cortex-a53 -watchdog i6300esb -rtc clock=host" 34 | ;; 35 | x86_64) 36 | QEMU_ARCH=$BR2_ARCH 37 | QEMU_NIC=virtio-net-pci 38 | QEMU_SCSI=virtio-scsi-pci 39 | QEMU_MACH="q35,accel=kvm -smp 2 -watchdog i6300esb -cpu host -enable-kvm -rtc clock=host" 40 | ;; 41 | *) 42 | ;; 43 | esac 44 | 45 | # When calling `make run`, this is all the env. that utils/qemu get 46 | cat < $qemucfg 47 | # Westermo NetBox target emulation using Qemu 48 | NETBOX_PLAT=$NETBOX_PLAT 49 | NETBOX_VENDOR_ID=$NETBOX_VENDOR_ID 50 | QEMU_ARCH=$QEMU_ARCH 51 | QEMU_MACH="$QEMU_MACH" 52 | QEMU_NIC=$QEMU_NIC 53 | QEMU_SCSI=$QEMU_SCSI 54 | 55 | QEMU_KERNEL=${dir}*Image 56 | EOF 57 | 58 | if [ "$BR2_TARGET_ROOTFS_SQUASHFS" = "y" ]; then 59 | echo "QEMU_INITRD=$img" >>$qemucfg 60 | elif [ "$BR2_TARGET_ROOTFS_EXT2" = "y" ]; then 61 | echo "QEMU_DISK=$img" >>$qemucfg 62 | fi 63 | 64 | echo >>$qemucfg 65 | if [ "$BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE" = "y" ]; then 66 | echo "QEMU_SYSTEM_PATH=$HOST_DIR/bin" >>$qemucfg 67 | fi 68 | } 69 | -------------------------------------------------------------------------------- /utils/diffdefconfig: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Helper script to show what settings have been removed, changed, or 3 | # added using menuconfig. The idea is for it to serve as a guidance 4 | # to the manual update of the m4 includes. 5 | 6 | nm=$(basename "$0") 7 | cfg=$1 8 | 9 | if [ -z "$cfg" ] || [ ! -f "$cfg" ] || [ "$1" = "-h" ]; then 10 | echo "Usage: $nm path/to/.config" 11 | exit 1 12 | fi 13 | 14 | defcfg=$(grep BR2_DEFCONFIG "$cfg") 15 | eval "$defcfg" 16 | 17 | fn=$(basename "$BR2_DEFCONFIG") 18 | if [ -z "$BR2_DEFCONFIG" ]; then 19 | echo "Cannot find your BR2_DEFCONFIG in $cfg, is this a new defconfig?" 20 | echo "If it is, you need to compose the configs/$fn.m4 manually." 21 | exit 1 22 | fi 23 | 24 | orig=$(mktemp /tmp/netbox-orig-defconfig.XXXXXX) 25 | next=$(mktemp /tmp/netbox-next-defconfig.XXXXXX) 26 | 27 | gendefconfig -d configs -i include "$fn.m4" | awk 'NF' | sort > "$orig" 28 | make --silent update-defconfig > /dev/null 29 | sort "configs/$fn" > "$next" 30 | 31 | # Redirecting to stderr in case the user wants to save the output to a 32 | # file without all the extra boilerplate. 33 | diff -u0 "$orig" "$next" | sed 's,'"$orig"','"$fn (current)"',; s,'"$next"','"$fn (new)"',; /@@.*/d' >&2 34 | rm -f "$orig" "$next" "configs/$fn" 35 | 36 | echo "_________________________________________________________________________" 37 | echo "\e[1mNOTE:\e[0m" 38 | echo " The results are only indicative, not absolute. E.g., even though" 39 | echo " IPROUTE2, TCPDUMP, and SOCAT are deselected because of BRIST deps" 40 | echo " these packages are core NetBox OS packages and should always be in" 41 | echo " the default list in os.m4 -- we do *not* want them to be removed" 42 | echo " if we one day disable BRIST" 43 | echo 44 | echo " Also, be careful with toolchain settings, the Buildroot defaults" 45 | echo " may change over time, so better be explicit here too." 46 | echo 47 | -------------------------------------------------------------------------------- /utils/gendefconfig: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This script assumes the location of the file 'defs.m4', which is used 3 | # to set up defaults for m4 and possibly local variables. 4 | 5 | inc="" 6 | def=$(dirname "$0")/../configs/include/defs.m4 7 | 8 | usage() 9 | { 10 | echo "Usage: $(basename "$0") [opts] foo_defonfig.m4" 11 | echo 12 | echo " -d dir Base directory for foo_defconfig.m4 files" 13 | echo " -h This help text" 14 | echo " -i dir Include directory, multiple -i allowed" 15 | echo 16 | echo "M4FLAGS Optional environment variable for extra m4 args." 17 | echo "M4PATH Instead of '-i dir' to define include paths." 18 | 19 | exit "$1" 20 | } 21 | 22 | fail() 23 | { 24 | echo "$@" 25 | exit 1 26 | } 27 | 28 | # shellcheck disable=SC2086 29 | generate() 30 | { 31 | cat $def "$1" | m4 $inc - 32 | } 33 | 34 | while [ "$1" != "" ]; do 35 | case $1 in 36 | -d) 37 | cd "$2" || fail "Failed changing to directory $2!" 38 | shift 39 | ;; 40 | -h) 41 | usage 0 42 | ;; 43 | -i) 44 | inc="$inc -I $2" 45 | shift 46 | ;; 47 | *) 48 | break 49 | esac 50 | shift 51 | done 52 | 53 | generate "$1" 54 | -------------------------------------------------------------------------------- /utils/mkversion: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | FN="" 3 | WC="." 4 | 5 | while [ "$1" != "" ]; do 6 | case $1 in 7 | -f) 8 | FN=$1 9 | ;; 10 | *) 11 | break 12 | esac 13 | shift 14 | done 15 | [ -n "$1" ] && WC=$1 16 | 17 | # Only show branch if not 'master', releases from master are considered 18 | # mainline/official and need no further caveats. 19 | git_branch_name() 20 | { 21 | branch=`git branch 2>/dev/null |grep \* |sed 's/\* \(.\+\)/\1/'` 22 | if [ -n "$branch" ] ; then 23 | echo "$branch/"; 24 | fi 25 | } 26 | 27 | print_version() 28 | { 29 | if [ -n "$FN" ]; then 30 | printf $1 | tr '/' '-' 31 | else 32 | printf $1 33 | fi 34 | } 35 | 36 | cd $WC 37 | VERSION=`git describe --tags --dirty 2>/dev/null` 38 | if [ x"$VERSION" = x ]; then 39 | VERSION=9.99 40 | fi 41 | 42 | # Are we are building an official release from master, do not print branchname. 43 | # Check if top commit is the tag, to support -betaXX etc. 44 | git describe --always --dirty --tags 2>/dev/null | grep "[0-9]\+\.[0-9]\+-r[0-9]\+" >/dev/null 45 | if [ $? -eq 0 -a -n "$RELEASE" ]; then 46 | print_version $VERSION 47 | else 48 | if [ -z "$VERSION" ]; then 49 | VERSION=`git describe --dirty --long |sed 's/heads\/\(.*\)/\1/'` 50 | print_version $VERSION 51 | else 52 | print_version "${git_branch_name}"$VERSION 53 | fi 54 | fi 55 | 56 | cd - >/dev/null 57 | exit 0 58 | --------------------------------------------------------------------------------