summaryrefslogtreecommitdiff
path: root/utils/nwztools/database/nvp
diff options
context:
space:
mode:
authorIgor Skochinsky <skochinsky@gmail.com>2017-04-03 15:13:46 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2017-04-25 11:24:24 +1000
commit03dd4b92be7dcd5c8ab06da3810887060e06abd5 (patch)
treed18b5e7748a08f75891e832e1687154490fd5b36 /utils/nwztools/database/nvp
parentf1c8d63a762acdcb29f30d17617e531fdb555af4 (diff)
downloadrockbox-03dd4b92be7dcd5c8ab06da3810887060e06abd5.tar.gz
rockbox-03dd4b92be7dcd5c8ab06da3810887060e06abd5.zip
nwztools/database: misc improvements
* make gen_db.py work on Windows/Python 2 - use hashlib module instead of md5sum, also don't rely on / for file path matching - don't use 'file' for a variable name * fix parse_nvp_header.sh for older kernels pre-emmc kernel sources use a slightly different #define format; adjust regexp to catch it. * add nwz-x1000 series NVP layout (from icx1087_nvp.h) some new tags have no description, alas the driver doesn't have them :/ * minor fixes to nvp/README fixed typos/wording Change-Id: I77d8c2704be2f2316e32aadcfd362df7102360d4
Diffstat (limited to 'utils/nwztools/database/nvp')
-rw-r--r--utils/nwztools/database/nvp/README39
-rw-r--r--utils/nwztools/database/nvp/nwz-x1000.txt82
-rwxr-xr-xutils/nwztools/database/nvp/parse_nvp_header.sh7
-rwxr-xr-xutils/nwztools/database/nvp/parse_nvp_nodes.sh5
4 files changed, 111 insertions, 22 deletions
diff --git a/utils/nwztools/database/nvp/README b/utils/nwztools/database/nvp/README
index cb403291c8..5ff18513d7 100644
--- a/utils/nwztools/database/nvp/README
+++ b/utils/nwztools/database/nvp/README
@@ -1,38 +1,39 @@
1The NVP map varies a lot from players to players, it is inconceivable to build 1The NVP map varies a lot from players to players, it is inconceivable to build
2it by hand. The approach taken is to extract it from the kernel of each player. 2it by hand. The approach taken is to extract it from the kernel of each player.
3Since Sony provides the kernel of all players, it is 'only' a matter of 3Since Sony provides the kernel of all players, it is 'only' a matter of
4downloading all of them. A bit of back story on the NVP: it is non-volatile 4downloading all of them. A bit of background on the NVP: it is non-volatile
5area of the flash that is divided in regions and then "sectors" (unrelated to 5partition of the flash that is divided in regions and then "zones".
6hard drive sectors). Each "sector" stores the data of a "node". The ABI 6Each "zone" stores the data of a "node". The ABI
7between the NVP driver and the userspace is an index: the userspace gives the 7between the NVP driver and the userspace is an index: the userspace gives the
8index of a node, and then drives looksup its table to see where it is and what 8index of a node, and then drives looks up its table to see where it is and what
9is its size. The index map changes over time so Sony introduces standard "names" 9is its size. The index map changes over time so Sony introduces standard "names"
10for its entries, those are 3-letters acronym (for example "fup" or "bti" or "shp") 10for its entries, those are 3-letters acronym (for example "fup" or "bti" or "shp")
11that have a corresponding index. For some reason, the driver also contains a 11that have a corresponding index. Sometimes the driver also contains a
12description of the nodes, in english (so "bti" stands for "boot image"). 12description of the nodes, in English (e.g. "bti" stands for "boot image").
13 13
14parse_nvp_header.sh 14parse_nvp_header.sh
15=================== 15===================
16 16
17This script is given a file name, a kernel directory or a kernel tgz and it will 17This script takes a header filename, a kernel directory or a kernel tgz and will
18try to extract the mapping automatically. It produces a list of pairs 18try to extract the mapping automatically. It produces a list of pairs
19 <node>,<name> 19 <node>,<name>
20where <node> is the index of the node (that's the only thing that is usable on 20where <node> is the index of the node (that's the only thing that is usable on
21a running device) and <name> is the standard name of the node. Note that is 21a running device) and <name> is the standard name of the node. The output should
22some kind of acronym (like 'fup') and the description needs to be generated 22be written to <series name>.txt
23separatly (see other section). 23Note that <name> is an acronym (like 'fup') and the description needs to be generated
24separately (see nvprool section).
24 25
25parse_all_nvp_headers.sh 26parse_all_nvp_headers.sh
26======================== 27========================
27 28
28This scripts expects a directory to have the following structure: 29This script expects a directory to have the following structure:
29 dir/ 30 dir/
30 nwz-a10/ 31 nwz-a10/
31 linux-kernel-*.tgz 32 linux-kernel-*.tgz
32 nwz-e460/ 33 nwz-e460/
33 linxu-kernel-*.tgz 34 linux-kernel-*.tgz
34 ... 35 ...
35Each sudirectory must the series name (as used in ../series.txt) and the kernel 36Each sudirectory must be the series name (as used in ../series.txt) and the kernel
36must be a tgz (end in .tgz and not .tar.gz) of the form linux-kernel-*.tgz. Usually 37must be a tgz (end in .tgz and not .tar.gz) of the form linux-kernel-*.tgz. Usually
37the variable bit will be the version but some kernels have unknown versions. It 38the variable bit will be the version but some kernels have unknown versions. It
38will then run parse_nvp_header.sh on each of them and store the result in a 39will then run parse_nvp_header.sh on each of them and store the result in a
@@ -43,24 +44,24 @@ NOTE: the kernel can be symlinks to other files
43nvptool 44nvptool
44======= 45=======
45 46
46The kernel headers do no contain the description of the nvp node names. 47The kernel headers do not contain descriptions of the nvp node names.
47This one can be extract from the icx_nvp[_emmc].ko driver on target using complicated 48They can be extracted from the icx_nvp[_emmc].ko driver on target using complicated
48elf parsing done by nvptool. Technically nvptoo can find much more information 49elf parsing done by nvptool. Technically nvptool can discover much more information
49like the node -> humanname mapping as well and the actual sector on the disk but 50like the node -> human name mapping as well and the actual zone in the flash but
50since we can already extract it easily from the headers, we only extract description 51since we can already extract it easily from the headers, we only extract description
51names from it. 52names from it.
52 53
53parse_all_nvp_nodes.sh 54parse_all_nvp_nodes.sh
54====================== 55======================
55 56
56This scripts expects a directory to have the following structure: 57This script expects a directory to have the following structure:
57 dir/ 58 dir/
58 nwz-a10/ 59 nwz-a10/
59 rootfs.tgz 60 rootfs.tgz
60 nwz-e460/ 61 nwz-e460/
61 rootfs.tgz 62 rootfs.tgz
62 ... 63 ...
63Each sudirectory must the series name (as used in ../series.txt) and the rootfs 64Each sudirectory must be the series name (as used in ../series.txt) and the rootfs
64must be a tar. It will then extract the relevant icx_nvp driver from it and run 65must be a tar. It will then extract the relevant icx_nvp driver from it and run
65nvptool on it to produce a file called nodes-<series name>.txt 66nvptool on it to produce a file called nodes-<series name>.txt
66 67
diff --git a/utils/nwztools/database/nvp/nwz-x1000.txt b/utils/nwztools/database/nvp/nwz-x1000.txt
new file mode 100644
index 0000000000..ab0f7fb872
--- /dev/null
+++ b/utils/nwztools/database/nvp/nwz-x1000.txt
@@ -0,0 +1,82 @@
1app,0
2bti,1
3hdi,2
4cng,3
5ser,4
6dg0,5
7dg1,6
8dcc,7
9mdl,8
10fup,9
11bok,10
12shp,11
13dba,12
14dbv,13
15tr0,14
16tr1,15
17mid,16
18tst,17
19gty,18
20fui,19
21lbi,20
22dor,21
23edw,22
24ubp,23
25syi,24
26var,25
27pcd,26
28dbs,27
29rnd,28
30ufn,29
31sdp,30
32ncp,31
33kas,32
34pnc,33
35rtc,34
36bpr,35
37e00,36
38e01,37
39e02,38
40e03,39
41e04,40
42e05,41
43e06,42
44e07,43
45e08,44
46e09,45
47e10,46
48e11,47
49e12,48
50e13,49
51e14,50
52e15,51
53e16,52
54e17,53
55e18,54
56e19,55
57e20,56
58e21,57
59e22,58
60e23,59
61e24,60
62e25,61
63e26,62
64e27,63
65e28,64
66e29,65
67e30,66
68e31,67
69clv,68
70slp,69
71ipt,70
72ep0,71
73ep1,72
74ep2,73
75ep3,74
76pts,75
77skt,76
78mac,77
79apd,78
80blf,79
81hld,80
82skd,81
diff --git a/utils/nwztools/database/nvp/parse_nvp_header.sh b/utils/nwztools/database/nvp/parse_nvp_header.sh
index 8baab3c9eb..ee2be93516 100755
--- a/utils/nwztools/database/nvp/parse_nvp_header.sh
+++ b/utils/nwztools/database/nvp/parse_nvp_header.sh
@@ -66,13 +66,16 @@ else
66 >&2 echo "Analyzing $FILE" 66 >&2 echo "Analyzing $FILE"
67fi 67fi
68 68
69# old format: #define ICX1087_NVP_NODE_APP "/dev/icx1087_nvp/0"
70# new format: #define ICX_NVP_NODE_APP ICX_NVP_NODE_BASE "0"
71
69cat "$FILE" | awk ' \ 72cat "$FILE" | awk ' \
70BEGIN { \ 73BEGIN { \
71 expr = "#define[[:space:]]+ICX_NVP_NODE_([[:alnum:]]+)[[:space:]]+ICX_NVP_NODE_BASE[[:space:]]*\"([[:digit:]]+)\""; \ 74 expr = "#define[[:space:]]+ICX[[:digit:]]*_NVP_NODE_([[:alnum:]]+)[[:space:]]+(ICX_NVP_NODE_BASE[[:space:]]*\"|\"/dev.*_nvp/)([[:digit:]]+)\"";
72} \ 75} \
73{ \ 76{ \
74 if($0 ~ expr) \ 77 if($0 ~ expr) \
75 { \ 78 { \
76 print(tolower(gensub(expr, "\\1,\\2", "g", $0))); 79 print(tolower(gensub(expr, "\\1,\\3", "g", $0)));
77 } \ 80 } \
78}' 81}'
diff --git a/utils/nwztools/database/nvp/parse_nvp_nodes.sh b/utils/nwztools/database/nvp/parse_nvp_nodes.sh
index 456a707e5d..8fc4367a8f 100755
--- a/utils/nwztools/database/nvp/parse_nvp_nodes.sh
+++ b/utils/nwztools/database/nvp/parse_nvp_nodes.sh
@@ -4,6 +4,9 @@
4# parse_nodes.sh /path/to/rootfs/dir output_file 4# parse_nodes.sh /path/to/rootfs/dir output_file
5# parse_nodes.sh /path/to/rootfs.tgz output_file 5# parse_nodes.sh /path/to/rootfs.tgz output_file
6# 6#
7if [ -z "$NVP_LOG" ]; then
8 NVP_LOG=/dev/null
9fi
7if [ "$#" -lt 2 ]; then 10if [ "$#" -lt 2 ]; then
8 >&2 echo "usage: parse_header.sh /path/to/icx_nvp.ko|/path/to/rootfs/dir|/path/to/rootfs.tgz output_file" 11 >&2 echo "usage: parse_header.sh /path/to/icx_nvp.ko|/path/to/rootfs/dir|/path/to/rootfs.tgz output_file"
9 exit 1 12 exit 1
@@ -56,4 +59,4 @@ else
56 >&2 echo "Analyzing $FILE" 59 >&2 echo "Analyzing $FILE"
57fi 60fi
58 61
59./nvptool -x "$FILE" -o "$OUTPUT" >/dev/null 62./nvptool -x "$FILE" -o "$OUTPUT" >"$NVP_LOG"