layerscape: update build guide in README
[openwrt/staging/kaloz.git] / package / network / utils / layerscape / restool / patches / 0004-scripts-use-restool-full-path-option.patch
1 From 09f840049d155fa4b681ece749feeff9a269ecde Mon Sep 17 00:00:00 2001
2 From: Ioana Ciornei <ioana.ciornei@nxp.com>
3 Date: Tue, 24 Oct 2017 16:29:45 +0000
4 Subject: [PATCH 04/12] scripts: use restool --full-path option
5
6 Instead of constructing the the full path container list by
7 hand use the restool option newly added.
8
9 Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
10 ---
11 scripts/ls-main | 54 +++++++-----------------------------------------------
12 1 file changed, 7 insertions(+), 47 deletions(-)
13
14 diff --git a/scripts/ls-main b/scripts/ls-main
15 index ea0df92..72f6c77 100755
16 --- a/scripts/ls-main
17 +++ b/scripts/ls-main
18 @@ -73,7 +73,6 @@
19 ##
20
21 shopt -s extglob
22 -shopt -s lastpipe
23
24 # Intercept the Ctrl+C command but do not interrupt execution
25 trap ' ' INT
26 @@ -87,11 +86,6 @@ root_c=
27 # Type of endpoint object
28 toe=
29
30 -containers=()
31 -# Full path containers
32 -fpc=()
33 -idx=0
34 -
35 SYS_DPRC="/sys/bus/fsl-mc/drivers/fsl_mc_dprc"
36
37 set -e
38 @@ -220,42 +214,6 @@ get_container() {
39 echo $(echo "$i" | sed "s/\(dprc.[0-9]*\/\)*//g")
40 }
41
42 -build_fpc_list() {
43 - $restool dprc list |
44 - while IFS= read -r line
45 - do
46 - containers+=("$line")
47 - done
48 -
49 - for i in "${containers[@]}"
50 - do
51 - cnt=$(count_spaces "$i")
52 -
53 - if [ "$cnt" -gt 0 ]; then
54 - # Get index of the upper level container
55 - idx2=$((idx-1))
56 - crt_ct="$i"
57 -
58 - while [ "$idx2" -ge 0 ]
59 - do
60 - cntp=$(count_spaces "${containers[idx2]}")
61 -
62 - if [ "$cntp" -lt "$cnt" ]; then
63 - upc=$(echo "${containers[idx2]}" | sed "s/ *$//")
64 - crt_ct=$upc"/""$(echo $crt_ct | sed 's/ *$//')"
65 - fi
66 - idx2=$((idx2-1))
67 - done
68 -
69 - fpc+=($crt_ct)
70 - else
71 - fpc+=("$i")
72 - fi
73 -
74 - idx=$((idx+1))
75 - done
76 -}
77 -
78 get_label() {
79 # Retrieve the type of the object
80 too=$(echo "$1" | sed "s/\(\.[0-9]*\)\(\.[0-9]*\)*$//g")
81 @@ -897,9 +855,9 @@ process_addni() {
82 }
83
84 process_listni() {
85 - build_fpc_list
86 -
87 - for i in "${fpc[@]}"
88 + dprc_list="$($restool dprc list --full-path)"
89 + echo "${dprc_list}" |
90 + while read -r i
91 do
92 crt_c=$(get_container "$i")
93 $restool dprc show "$crt_c" | grep dpni |
94 @@ -948,10 +906,12 @@ process_listni() {
95 }
96
97 process_listmac() {
98 - build_fpc_list
99 + dprc_list="$($restool dprc list --full-path)"
100
101 - for i in "${fpc[@]}"
102 + echo "${dprc_list}" |
103 + while read -r i
104 do
105 +
106 crt_c=$(get_container "$i")
107 $restool dprc show "$crt_c" | grep dpmac |
108 while IFS= read -r line
109 --
110 2.14.1
111