From a826b009306fc0c8046b7b81894c96564cfda67c Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sun, 24 Oct 2021 21:11:51 +0800 Subject: [PATCH] Add tool to list OpenWrt architectures and targets --- tools/list-openwrt.sh | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tools/list-openwrt.sh diff --git a/tools/list-openwrt.sh b/tools/list-openwrt.sh new file mode 100644 index 0000000000..c93a3ab7da --- /dev/null +++ b/tools/list-openwrt.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# $version can be 21.02 or 19.07. +version=19.07.7 +if [ ! -d /tmp/openwrt ]; then + cd /tmp + git clone https://github.com/openwrt/openwrt.git + cd openwrt +fi +cd /tmp/openwrt +git -c advice.detachedHead=false checkout v$version +export TOPDIR=$PWD +cd target/linux +>targets.git +for target in *; do + [ -d $target ] || continue + subtargets=$(make -C $target --no-print-directory DUMP=1 TARGET_BUILD=1 val.SUBTARGETS 2>/dev/null) + [ "$subtargets" ] || subtargets=generic + for subtarget in $subtargets; do + echo $(make -C $target --no-print-directory DUMP=1 TARGET_BUILD=1 SUBTARGET=$subtarget 2>/dev/null | egrep '^(Target:|Target-Arch-Packages:)' | cut -d: -f2) >>targets.git + done +done + +targets=$(curl -s https://downloads.openwrt.org/releases/$version/targets/ | grep 'targets.sdk +for target in $targets; do + subtargets=$(curl -s https://downloads.openwrt.org/releases/$version/targets/$target/ | grep '>targets.sdk + done +done + +cat >parse-targets.py <