nwztools/database: add database of information on Sony NWZ linux players

There must be an evil genius in Sony's Walkman division. Someone who made sure
that each model is close enough to the previous one so that little code is needed
but different enough so that an educated guess is not enough.

Each linux-based Sony player has a model ID (mid) which is a 32-bit integer.
I was able to extract a list of all model IDs and the correspoding name of
the player (see README). This gives us 1) a nice list of all players (because
NWZ-A729 vs NWZ-A729B, really Sony?) 2) an easy way to find the name of player
programatically. It seems that the lower 8-bit of the model ID gives the storage
size but don't bet your life on it. The remaining bytes seem to follow some kind
of pattern but there are exceptions.

From this list, I was able to build a list of all Sony's series (up to quite
recent one). The only safe way to build that is by hand, with a list of series,
each series having a list of model IDs. The notion of series is very important
because all models in a series share the same firmware.

A very important concept on Sony's players is the NVP, an area of the flash
that stores data associated with keys. The README contains more information but
basically this is where is record the model ID, the destination, the boot flags,
the firmware upgrade flags, the boot image, the DRM keys, and a lot of other stuff.
Of course Sony decided to slightly tweak the index of the keys regularly over time
which means that each series has a potentially different map, and we need this map
to talk to the NVP driver. Fortunately, Sony distributes the kernel for all its
players and they contain a kernel header with this information. I wrote a script
to unpack kernel sources and parse this header, producing a bunch of nw-*.txt
files, included in this commit. This map is very specific though: it maps Sony's
3-letter names (bti) to indexes (1). This is not very useful without the
decription (bti = boot image) and its size (262144). This information is harder
to come by, and is only stored in one place: if icx_nvp_emmc.ko drivers, found
on the device. Fortunately, Sony distributes a number of firmware upgrade, that
contain the rootfs, than once extracted contain this driver. The driver is a
standard ELF files with symbols. I wrote a parsing tool (nvptool) that is able
to extract this information from the drivers. Using that, I produced a bunch
of nodes-nw*.txt files. A reasonable assumption is that nodes meaning and
size do not change over time (bti is always the boot image and is always
262144 bytes), so by merging a few of those file, we can get a complete picture
(note that some nodes that existed in older player do not exists anymore so
we really need to merge several ones from different generations).

The advantage of storing all this information in plain text files, is that it
now makes it easy to parse it and produce whatever format we want to use it.
I wrote a python script that parses all this mess and produces a C file and
header with all this information (nwz_db.{c,h}).

Change-Id: Id790581ddd527d64418fe9e4e4df8e0546117b80
This commit is contained in:
Amaury Pouly 2016-11-11 15:40:56 +01:00
parent 19de536ce2
commit 44bb2856a5
38 changed files with 5118 additions and 0 deletions

View file

@ -0,0 +1,62 @@
This file explains how the database was created an how to update it.
Model list
==========
The model list (models.txt) was extract from Sony's mptapp on target. This is
most probably the only reliable way of getting model IDs. It cannot be done
automatically but it is easy to locate the list using a tool like IDA. It is
basically a long list of the following structure:
struct model_info_t
{
const char *name;
uin32_t mid;
};
Once identified, it is easy to copy it to a file and grep/sed/awk it to produce
the textual list. It depends on which tool you use. I decided to keep this list
because it is an easy format to produce and parse. For consistency, I decided
to use upper case for the model name and lower case for mid. Keep this when
you modify the list to keep the diff minimal.
IMPORTANT NOTE: some players have more than one model ID (ie same name) !!
FORMAT (models.txt): list of pairs <mid>,<name> where <name> is upper case
human name of the player and <mid> is the lower-case hex value of the model ID.
Series list
===========
The original series list was semi-automatically generated. Unfortunately, Sony
does not use a 100% regular naming scheme. It is thus simpler to modify it by
hand for newer models. To keep consistency, the generator script will make sure
that the series list only refers to device in the model list and that no device
in the model list is not refered to.
FORMAT (series.txt): list of <codename>,<name>,<mid1>,<mid2>,... where <codename>
is the (Rockbox-only) codename of the series (that should match what other tools
use, like upgtools), always in lower case; where <name> is the humand name of the
series, and <midX> is the list of models in the series (given by model IDs because
name are not uniques).
Advise on tooling
=================
The format of the file was carefully chosen to be easy to use and produce. It
avoids uses spaces are separators because it breaks easily. The "," separator
is a good match in this case and shouldn't pose a problem. In most tools, changing
the separator is easy. For example with awk, you can use the
-F ","
option, or define in the preamble with
BEGIN { FS = ","; }
. Other tools have similar constructs.
NVPs
====
See nvps/README
gen_db.py
=========
This script generates the database (nwz_db.{c,h}) from the various textual files.
The output must NOT be touched by hand.

View file

@ -0,0 +1,8 @@
echo "duplicates in models.txt:"
MODELS=$(cat models.txt | awk -F ',' '{ print($1) }' | sort)
echo "$MODELS" | uniq -d
echo "duplicates in series.txt:"
SERIES_MODELS=$(cat series.txt | awk '{ n=split($0,a,","); for(i=3;i<=n;i++) if(length(a[i]) != 0) print(a[i]); }' | sort)
echo "$SERIES_MODELS" | uniq -d
echo "diff between models.txt and series.txt:"
diff <(echo "$MODELS") <(echo "$SERIES_MODELS")

317
utils/nwztools/database/gen_db.py Executable file
View file

@ -0,0 +1,317 @@
#!/usr/bin/python3
import glob
import os
import re
import subprocess
# parse models.txt
g_models = []
with open('models.txt') as fp:
for line in fp:
# we unpack and repack 1) to make the format obvious 2) to catch errors
mid,name = line.rstrip().split(",")
g_models.append({'mid': int(mid, 0), 'name': name})
# parse series.txt
g_series = []
with open('series.txt') as fp:
for line in fp:
# we unpack and repack 1) to make the format obvious 2) to catch errors
arr = line.rstrip().split(",")
codename = arr[0]
name = arr[1]
models = arr[2:]
# handle empty list
if len(models) == 1 and models[0] == "":
models = []
models = [int(mid,0) for mid in models]
g_series.append({'codename': codename, 'name': name, 'models': models})
# parse all maps in nvp/
# since most nvps are the same, what we actually do is to compute the md5sum hash
# of all files, to identify groups and then each entry in the name is in fact the
# hash, and we only parse one file per hash group
g_hash_nvp = dict() # hash -> nvp
g_nvp_hash = dict() # codename -> hash
HASH_SIZE=6
map_files = glob.glob('nvp/nw*.txt')
for line in subprocess.run(["md5sum"] + map_files, stdout = subprocess.PIPE).stdout.decode("utf-8").split("\n"):
if len(line.rstrip()) == 0:
continue
hash, file = line.rstrip().split()
codename = re.search('nvp/(.*)\.txt', file).group(1)
hash = hash[:HASH_SIZE]
# only keep one file
if not (hash in g_hash_nvp):
g_hash_nvp[hash] = set()
g_hash_nvp[hash].add(codename);
g_nvp_hash[codename] = hash
# we have some file nodes (nodes-*) but not necessarily for all series
# so for each hash group, try to find at least one
for hash in g_hash_nvp:
# look at all codename and see if we can find one with a node file
node_codename = ""
for codename in g_hash_nvp[hash]:
if os.path.isfile("nvp/nodes-%s.txt" % codename):
node_codename = codename
break
# if we didn't find one, we just keep the first one
# otherwise keep the one we found
if node_codename == "":
node_codename = g_hash_nvp[hash].pop()
g_hash_nvp[hash] = node_codename
# for each entry in g_hash_nvp, replace the file name by the actual table
# that we parse, and compute all nvp names at the same time
g_nvp_names = set() # set of all nvp names
g_nvp_desc = dict() # name -> set of all description of a node
g_nvp_size = dict() # name -> set of all possible sizes of a node
for hash in g_hash_nvp:
codename = g_hash_nvp[hash]
# extract codename from file
# parse file
map = dict()
with open("nvp/%s.txt" % codename) as fp:
for line in fp:
# we unpack and repack 1) to make the format obvious 2) to catch errors
name,index = line.rstrip().split(",")
# convert node to integer but be careful of leading 0 (ie 010 is actually
# 10 in decimal, it is not in octal)
index = int(index, 10)
map[index] = name
g_nvp_names.add(name)
# parse node map if any
node_map = dict()
if os.path.isfile("nvp/nodes-%s.txt" % codename):
with open("nvp/nodes-%s.txt" % codename) as fp:
for line in fp:
# we unpack and repack 1) to make the format obvious 2) to catch errors
index,size,desc = line.rstrip().split(",")
# convert node to integer but be careful of leading 0 (ie 010 is actually
# 10 in decimal, it is not in octal)
index = int(index, 10)
desc = desc.rstrip()
node_map[index] = {'size': size, 'desc': desc}
# compute final nvp
nvp = dict()
for index in map:
size = 0
desc = ""
name = map[index]
if index in node_map:
size = node_map[index]["size"]
desc = node_map[index]["desc"]
nvp[name] = index
if not (name in g_nvp_desc):
g_nvp_desc[name] = set()
if len(desc) != 0:
g_nvp_desc[name].add(desc)
if not (name in g_nvp_size):
g_nvp_size[name] = set()
if size != 0:
g_nvp_size[name].add(size)
g_hash_nvp[hash] = nvp
#
# generate header
#
header_begin = \
"""\
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \\
* \/ \/ \/ \/ \/
*
* Copyright (C) 2016 Amaury Pouly
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __NWZ_DB_H__
#define __NWZ_DB_H__
/** /!\ This file was automatically generated, DO NOT MODIFY IT DIRECTLY /!\ */
/* List of all known NVP nodes */
enum nwz_nvp_node_t
{
"""
header_end = \
"""\
NWZ_NVP_COUNT /* Number of nvp nodes */
};
/* Invalid NVP index */
#define NWZ_NVP_INVALID -1 /* Non-existent entry */
/* Number of models */
#define NWZ_MODEL_COUNT %s
/* Number of series */
#define NWZ_SERIES_COUNT %s
/* NVP node info */
struct nwz_nvp_info_t
{
const char *name; /* Sony's name: "bti" */
unsigned long size; /* Size in bytes */
const char *desc; /* Description: "bootloader image" */
};
/* NVP index map (nwz_nvp_node_t -> index) */
typedef int nwz_nvp_index_t[NWZ_NVP_COUNT];
/* Model info */
struct nwz_model_info_t
{
unsigned long mid; /* Model ID: first 4 bytes of the NVP mid entry */
const char *name; /* Human name: "NWZ-E463" */
};
/* Series info */
struct nwz_series_info_t
{
const char *codename; /* Rockbox codename: nwz-e460 */
const char *name; /* Human name: "NWZ-E460 Series" */
int mid_count; /* number of entries in mid_list */
unsigned long *mid; /* List of model IDs */
/* Pointer to a name -> index map, nonexistent entries map to NWZ_NVP_INVALID */
nwz_nvp_index_t *nvp_index;
};
/* List of all NVP entries, indexed by nwz_nvp_node_t */
extern struct nwz_nvp_info_t nwz_nvp[NWZ_NVP_COUNT];
/* List of all models, sorted by increasing values of model ID */
extern struct nwz_model_info_t nwz_model[NWZ_MODEL_COUNT];
/* List of all series */
extern struct nwz_series_info_t nwz_series[NWZ_SERIES_COUNT];
#endif /* __NWZ_DB_H__ */
"""
with open("nwz_db.h", "w") as fp:
fp.write(header_begin)
# generate list of all nvp nodes
for name in sorted(g_nvp_names):
# create comment to explain the meaning, gather several meaning together
# if there are more than one
explain = ""
if name in g_nvp_desc:
explain = " | ".join(list(g_nvp_desc[name]))
# overwrite desc set with a single string for later
g_nvp_desc[name] = explain
fp.write(" NWZ_NVP_%s, /* %s */\n" % (name.upper(), explain))
fp.write(header_end % (len(g_models), len(g_series)))
#
# generate tables
#
impl_begin = \
"""\
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \\
* \/ \/ \/ \/ \/
*
* Copyright (C) 2016 Amaury Pouly
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
/** /!\ This file was automatically generated, DO NOT MODIFY IT DIRECTLY /!\ */
#include "nwz_db.h"
struct nwz_model_info_t nwz_model[NWZ_MODEL_COUNT] =
{
"""
def by_mid(model):
return model["mid"]
def by_name(nvp_entry):
return nvp_entry["name"]
def codename_to_c(codename):
return re.sub('[^a-zA-Z0-9]', '_', codename, 0)
with open("nwz_db.c", "w") as fp:
fp.write(impl_begin)
# generate model list (sort by mid)
for model in sorted(g_models, key = by_mid):
fp.write(" { %s, \"%s\" },\n" % (hex(model["mid"]), model["name"]))
fp.write("};\n")
# generate nvps
for hash in g_hash_nvp:
nvp = g_hash_nvp[hash]
fp.write("\nstatic int nvp_index_%s[NWZ_NVP_COUNT] =\n" % hash)
fp.write("{\n")
for name in sorted(g_nvp_names):
index = "NWZ_NVP_INVALID"
if name in nvp:
index = nvp[name]
fp.write(" [NWZ_NVP_%s] = %s,\n" % (name.upper(), index))
fp.write("};\n")
# generate nvp info
fp.write("\nstruct nwz_nvp_info_t nwz_nvp[NWZ_NVP_COUNT] =\n")
fp.write("{\n")
for name in sorted(g_nvp_names):
size = 0
if name in g_nvp_size:
size_set = g_nvp_size[name]
if len(size_set) == 0:
size = 0
elif len(size_set) == 1:
size = next(iter(size_set))
else:
print("Warning: nvp node \"%s\" has several possible sizes: %s"
% (name, size_set))
size = 0
desc = ""
if name in g_nvp_desc:
desc = g_nvp_desc[name]
fp.write(" [NWZ_NVP_%s] = { \"%s\", %s, \"%s\" },\n" % (name.upper(),
name, size, desc))
fp.write("};\n")
# generate list of models for each series
for series in g_series:
c_codename = codename_to_c(series["codename"])
list = [hex(mid) for mid in series["models"]]
limit = 3
c_list = ""
while len(list) != 0:
if len(list) <= limit:
c_list = c_list + ", ".join(list)
list = []
else:
c_list = c_list + ", ".join(list[:limit]) + ",\n "
list = list[limit:]
limit = 6
fp.write("\nstatic unsigned long models_%s[] = { %s };\n" % (c_codename, c_list))
# generate series list
fp.write("\nstruct nwz_series_info_t nwz_series[NWZ_SERIES_COUNT] =\n{\n")
for series in g_series:
name = series["name"]
codename = series["codename"]
c_codename = codename_to_c(codename)
nvp = "0"
if codename in g_nvp_hash:
nvp = "&nvp_index_%s" % g_nvp_hash[codename]
fp.write(" { \"%s\", \"%s\", %s, models_%s, %s },\n" % (codename,
name, len(series["models"]), c_codename, nvp))
fp.write("};\n")

View file

@ -0,0 +1,181 @@
0x10000,NWZ-A815
0x10001,NWZ-A816
0x10002,NWZ-A818
0x1000000,NW-S615F
0x1000001,NW-S616F
0x1010000,NW-S715F
0x1010001,NW-S716F
0x1010002,NW-S718F
0x1020000,NWZ-S615F
0x1020001,NWZ-S616F
0x1020002,NWZ-S618F
0x1030000,NWZ-S515
0x1030001,NWZ-S516
0x1040000,NWZ-S715F
0x1040001,NWZ-S716F
0x1040002,NWZ-S718F
0x2000001,NW-A916
0x2000002,NW-A918
0x2000004,NW-A919
0x3000001,NWZ-A826
0x3000002,NWZ-A828
0x3000004,NWZ-A829
0x3010001,NW-A826
0x3010002,NW-A828
0x3010004,NW-A829
0x3020001,NWZ-A726B
0x3020002,NWZ-A728B
0x3020004,NWZ-A729B
0x3030001,NWZ-A726
0x3030002,NWZ-A728
0x3030004,NWZ-A729
0x4000001,NW-S636F
0x4000002,NW-S638F
0x4000004,NW-S639F
0x4010001,NW-S736F
0x4010002,NW-S738F
0x4010004,NW-S739F
0x4020001,NWZ-S636F
0x4020002,NWZ-S638F
0x4020004,NWZ-S639F
0x4030001,NWZ-S736F
0x4030002,NWZ-S738F
0x4030004,NWZ-S739F
0x5000002,NW-X1040
0x5000004,NW-X1050
0x5000005,NW-X1060
0x5010002,NWZ-NONAME
0x5010004,NWZ-NONAME
0x5010005,NWZ-NONAME
0x5020002,NWZ-X1040
0x5020004,NWZ-X1050
0x5020005,NWZ-X1060
0x5040002,NWZ-X1041
0x5040004,NWZ-X1051
0x5040005,NWZ-X1061
0x6010002,NW-S644
0x6010004,NW-S645
0x6010005,NW-S646
0x6020002,NWZ-S744
0x6020004,NWZ-S745
0x6020005,NWZ-S746
0x6030002,NW-S744
0x6030004,NW-S745
0x6030005,NW-S746
0x7000004,NWZ-A845
0x7000005,NWZ-A846
0x7000006,NWZ-A847
0x7010004,NW-A845
0x7010005,NW-A846
0x7010006,NW-A847
0x9000002,NW-S754
0x9000004,NW-S755
0x9000005,NW-S756
0x8000000,NW-E052
0x8000001,NW-E053
0x8000002,NW-E054
0xb000001,NWZ-E453
0xb000002,NWZ-E454
0xb000004,NWZ-E455
0xc000001,NWZ-E353
0xc000002,NWZ-E354
0xc000004,NWZ-E355
0xd000001,NWZ-E553
0xd000002,NWZ-E554
0xd000004,NWZ-E555
0xd000005,NWZ-E556
0xe000004,NWZ-A855
0xe000005,NWZ-A856
0xe000006,NWZ-A857
0xf000002,NWZ-S754
0xf000004,NWZ-S755
0x10000000,NWZ-E052
0x10000001,NWZ-E053
0x11000001,NW-A863
0x11000002,NW-A864
0x11000004,NW-A865
0x11000005,NW-A866
0x11000006,NW-A867
0x11010001,NWZ-A863
0x11010002,NWZ-A864
0x11010004,NWZ-A865
0x11010005,NWZ-A866
0x11010006,NWZ-A867
0x11020001,NWZ-A863
0x11020002,NWZ-A864
0x11020004,NWZ-A865
0x11020005,NWZ-A866
0x11020006,NWZ-A867
0x12000001,NW-S763
0x12000002,NW-S764
0x12000004,NW-S765
0x12000005,NW-S766
0x12000006,NW-S767
0x12010001,NWZ-S763
0x12010002,NWZ-S764
0x12010004,NWZ-S765
0x12010005,NWZ-S766
0x12010006,NWZ-S767
0x13000001,NWZ-E463
0x13000002,NWZ-E464
0x13000004,NWZ-E465
0x14000000,NW-E062
0x14000001,NW-E063
0x14000002,NW-E064
0x14000004,NW-E065
0x14000005,NW-E066
0x15000001,NWZ-E473
0x15000002,NWZ-E474
0x15000004,NWZ-E475
0x15000005,NWZ-E476
0x15010001,NWZ-E573
0x15010002,NWZ-E574
0x15010004,NWZ-E575
0x15010005,NWZ-E576
0x16000001,NW-S773
0x16000002,NW-S774
0x16000004,NW-S775
0x16000005,NW-S776
0x16010001,NWZ-S773
0x16010002,NWZ-S774
0x16010004,NWZ-S775
0x16010005,NWZ-S776
0x19000001,NW-S783
0x19000002,NW-S784
0x19000004,NW-S785
0x19000005,NW-S786
0x19010001,NW-E083
0x19010002,NW-E084
0x19010004,NW-E085
0x19010005,NW-E086
0x19020001,NWZ-E583
0x19020002,NWZ-E584
0x19020004,NWZ-E585
0x19020005,NWZ-E586
0x1a000001,NW-A13
0x1a000002,NW-A14
0x1a000004,NW-A15
0x1a000005,NW-A16
0x1a000006,NW-A17
0x1a010001,NWZ-A13
0x1a010002,NWZ-A14
0x1a010004,NWZ-A15
0x1a010005,NWZ-A16
0x1a010006,NWZ-A17
0x1b000001,NW-S13
0x1b000002,NW-S14
0x1b000004,NW-S15
0x1b000005,NW-S16
0x1b000006,NW-S17
0x1c000001,NW-ZX103
0x1c000002,NW-ZX104
0x1c000004,NW-ZX105
0x1c000005,NW-ZX106
0x1c000006,NW-ZX107
0x1c000007,NW-ZX100
0x1d000001,NW-A23
0x1d000002,NW-A24
0x1d000004,NW-A25
0x1d000005,NW-A26
0x1d000006,NW-A27
0x1d000007,NW-A28

View file

@ -0,0 +1,26 @@
DEFINES=
CC=gcc
CXX=g++
LD=g++
PROFILE=
CFLAGS=-g $(PROFILE) -std=c99 -W -Wall $(DEFINES) `xml2-config --cflags`
CXXFLAGS=-g $(PROFILE) -W -Wall $(DEFINES) `xml2-config --cflags`
LDFLAGS=$(PROFILE) `xml2-config --libs`
BINS=nvptool
all: $(BINS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
nvptool: nvptool.o
$(LD) -o $@ $^ $(LDFLAGS)
clean:
rm -fr *.o
veryclean:
rm -rf $(BINS)

View file

@ -0,0 +1,67 @@
The NVP map varies a lot from players to players, it is inconceivable to build
it by hand. The approach taken is to extract it from the kernel of each player.
Since Sony provides the kernel of all players, it is 'only' a matter of
downloading all of them. A bit of back story on the NVP: it is non-volatile
area of the flash that is divided in regions and then "sectors" (unrelated to
hard drive sectors). Each "sector" stores the data of a "node". The ABI
between the NVP driver and the userspace is an index: the userspace gives the
index of a node, and then drives looksup its table to see where it is and what
is its size. The index map changes over time so Sony introduces standard "names"
for its entries, those are 3-letters acronym (for example "fup" or "bti" or "shp")
that have a corresponding index. For some reason, the driver also contains a
description of the nodes, in english (so "bti" stands for "boot image").
parse_nvp_header.sh
===================
This script is given a file name, a kernel directory or a kernel tgz and it will
try to extract the mapping automatically. It produces a list of pairs
<node>,<name>
where <node> is the index of the node (that's the only thing that is usable on
a running device) and <name> is the standard name of the node. Note that is
some kind of acronym (like 'fup') and the description needs to be generated
separatly (see other section).
parse_all_nvp_headers.sh
========================
This scripts expects a directory to have the following structure:
dir/
nwz-a10/
linux-kernel-*.tgz
nwz-e460/
linxu-kernel-*.tgz
...
Each sudirectory must the series name (as used in ../series.txt) and the kernel
must be a tgz (end in .tgz and not .tar.gz) of the form linux-kernel-*.tgz. Usually
the variable bit will be the version but some kernels have unknown versions. It
will then run parse_nvp_header.sh on each of them and store the result in a
file called <series name>.txt
NOTE: the kernel can be symlinks to other files
nvptool
=======
The kernel headers do no contain the description of the nvp node names.
This one can be extract from the icx_nvp[_emmc].ko driver on target using complicated
elf parsing done by nvptool. Technically nvptoo can find much more information
like the node -> humanname mapping as well and the actual sector on the disk but
since we can already extract it easily from the headers, we only extract description
names from it.
parse_all_nvp_nodes.sh
======================
This scripts expects a directory to have the following structure:
dir/
nwz-a10/
rootfs.tgz
nwz-e460/
rootfs.tgz
...
Each sudirectory must the series name (as used in ../series.txt) and the rootfs
must be a tar. It will then extract the relevant icx_nvp driver from it and run
nvptool on it to produce a file called nodes-<series name>.txt
NOTE: the rootfs can be symlinks to other files

View file

@ -0,0 +1,89 @@
1,4,system information
2,32,u-boot password
3,4,firmware update flag
4,4,beep ok flag
5,4,hold mode
6,16,rtc alarm
7,64,model id
8,5,product code
9,16,serial number
10,8,update file name
11,64,key and signature
12,32,ship information
13,4,test mode flag
14,4,getty mode flag
15,16,fm parameter
16,64,sound driver parameter
17,64,noise cancel driver parameter
18,512,bluetooth pskey
77,4,wifi protected setup
85,4,battery calibration
19,2048,bluetooth parameter
20,512,btmw factory pair info
21,512,btmw factory scdb
22,4,btmw log mode flag
78,4,application debug mode flag
79,4,browser log mode flag
80,4,time out to sleep
81,4,europe vol regulation flag
82,4,function information
83,4,service id
84,4,marlin key
86,4,MSC only mode flag
89,4,SD Card export flag
23,704,aad/empr key
24,160,aad icv
25,520,empr icv
26,4,key mode (debug/release)
27,64,random data
28,8224,slacker id file
29,64,starfish id
30,33024,marlin device key
31,20,secure clock
32,16,slacker time
33,64,marlin time
34,16384,EKB 0
35,16384,EKB 1
36,1024,EMPR 0
37,1024,EMPR 1
38,1024,EMPR 2
39,1024,EMPR 3
40,1024,EMPR 4
41,1024,EMPR 5
42,1024,EMPR 6
43,1024,EMPR 7
44,1024,EMPR 8
45,1024,EMPR 9
46,1024,EMPR 10
47,1024,EMPR 11
48,1024,EMPR 12
49,1024,EMPR 13
50,1024,EMPR 14
51,1024,EMPR 15
52,1024,EMPR 16
53,1024,EMPR 17
54,1024,EMPR 18
55,1024,EMPR 19
56,1024,EMPR 20
57,1024,EMPR 21
58,1024,EMPR 22
59,1024,EMPR 23
60,1024,EMPR 24
61,1024,EMPR 25
62,1024,EMPR 26
63,1024,EMPR 27
64,1024,EMPR 28
65,1024,EMPR 29
66,1024,EMPR 30
67,1024,EMPR 31
68,4,color variation
69,4,speaker ship info
70,8,middleware parameter
71,4,quick shutdown flag
72,262144,boot image
73,262144,hold image
74,262144,low battery image
75,262144,update image
76,262144,update error image
87,262144,precharge image
88,262144,dead battery image

View file

@ -0,0 +1,89 @@
1,4,system information
2,32,u-boot password
3,4,firmware update flag
4,4,beep ok flag
5,4,hold mode
6,16,rtc alarm
7,64,model id
8,5,product code
9,16,serial number
10,8,update file name
11,64,key and signature
12,32,ship information
13,4,test mode flag
14,4,getty mode flag
15,16,fm parameter
16,64,sound driver parameter
17,64,noise cancel driver parameter
18,512,bluetooth pskey
77,4,wifi protected setup
85,4,battery calibration
19,2048,bluetooth parameter
20,512,btmw factory pair info
21,512,btmw factory scdb
22,4,btmw log mode flag
78,4,application debug mode flag
79,4,browser log mode flag
80,4,time out to sleep
81,4,europe vol regulation flag
82,4,function information
83,4,service id
84,4,marlin key
86,4,MSC only mode flag
89,4,SD Card export flag
23,704,aad/empr key
24,160,aad icv
25,520,empr icv
26,4,key mode (debug/release)
27,64,random data
28,8224,slacker id file
29,64,starfish id
30,33024,marlin device key
31,20,secure clock
32,16,slacker time
33,64,marlin time
34,16384,EKB 0
35,16384,EKB 1
36,1024,EMPR 0
37,1024,EMPR 1
38,1024,EMPR 2
39,1024,EMPR 3
40,1024,EMPR 4
41,1024,EMPR 5
42,1024,EMPR 6
43,1024,EMPR 7
44,1024,EMPR 8
45,1024,EMPR 9
46,1024,EMPR 10
47,1024,EMPR 11
48,1024,EMPR 12
49,1024,EMPR 13
50,1024,EMPR 14
51,1024,EMPR 15
52,1024,EMPR 16
53,1024,EMPR 17
54,1024,EMPR 18
55,1024,EMPR 19
56,1024,EMPR 20
57,1024,EMPR 21
58,1024,EMPR 22
59,1024,EMPR 23
60,1024,EMPR 24
61,1024,EMPR 25
62,1024,EMPR 26
63,1024,EMPR 27
64,1024,EMPR 28
65,1024,EMPR 29
66,1024,EMPR 30
67,1024,EMPR 31
68,4,color variation
69,4,speaker ship info
70,8,middleware parameter
71,4,quick shutdown flag
72,262144,boot image
73,262144,hold image
74,262144,low battery image
75,262144,update image
76,262144,update error image
87,262144,precharge image
88,262144,dead battery image

View file

@ -0,0 +1,89 @@
24,4,system information
23,32,u-boot password
9,4,firmware update flag
10,4,beep ok flag
34,16,rtc alarm
80,4,hold mode
16,64,model id
4,16,serial number
11,32,ship information
68,4,color variation
26,5,product code
29,8,update file name
32,64,key and signature
17,4,test mode flag
18,4,getty mode flag
70,4,disable iptable flag
30,64,sound driver parameter
31,64,noise cancel driver parameter
77,6,wifi mac address
75,4,wifi protected setup
82,16,fm parameter
83,4,speaker ship info
84,4,mass storage class mode
25,4,exception monitor mode
27,4,battery calibration
86,512,bluetooth pskey
5,4096,application parameter
7,20,secure clock
12,160,aad icv
13,520,empr key
76,16,slacker time
21,4,key mode (debug/release)
71,64,marlin time
72,16384,marlin crl
89,512,btmw factory pair info
88,512,btmw factory scdb
87,4,btmw log mode flag
85,4,europe vol regulation flag
8,8,middleware parameter
22,4,quick shutdown flag
69,4,time out to sleep
78,4,application debug mode flag
79,4,browser log mode flag
3,704,aad key
28,64,wmt key
81,8224,slacker id file
73,33024,marlin device key
33,64,starfish id
35,2048,bluetooth address
14,16384,EKB 0
15,16384,EKB 1
74,24576,marlin user key
36,1024,EMPR 0
37,1024,EMPR 1
38,1024,EMPR 2
39,1024,EMPR 3
40,1024,EMPR 4
41,1024,EMPR 5
42,1024,EMPR 6
43,1024,EMPR 7
44,1024,EMPR 8
45,1024,EMPR 9
46,1024,EMPR 10
47,1024,EMPR 11
48,1024,EMPR 12
49,1024,EMPR 13
50,1024,EMPR 14
51,1024,EMPR 15
52,1024,EMPR 16
53,1024,EMPR 17
54,1024,EMPR 18
55,1024,EMPR 19
56,1024,EMPR 20
57,1024,EMPR 21
58,1024,EMPR 22
59,1024,EMPR 23
60,1024,EMPR 24
61,1024,EMPR 25
62,1024,EMPR 26
63,1024,EMPR 27
64,1024,EMPR 28
65,1024,EMPR 29
66,1024,EMPR 30
67,1024,EMPR 31
1,262144,boot image
2,262144,hold image
20,262144,low battery image
19,262144,update image
6,262144,update error image

View file

@ -0,0 +1,78 @@
24,4,system information
23,32,u-boot password
9,4,firmware update flag
10,4,beep ok flag
34,16,rtc alarm
80,4,hold mode
16,64,model id
4,16,serial number
11,32,ship information
68,4,color variation
26,5,product code
29,8,update file name
32,64,key and signature
17,4,test mode flag
18,4,getty mode flag
70,4,disable iptable flag
30,64,sound driver parameter
31,64,noise cancel driver parameter
77,6,wifi mac address
75,4,wifi protected setup
82,16,fm parameter
83,4,speaker ship info
84,4,mass storage class mode
25,4,exception monitor mode
5,4096,application parameter
35,2048,bluetooth parameter
8,8,middleware parameter
22,4,quick shutdown flag
69,4,time out to sleep
78,4,application debug mode flag
79,4,browser log mode flag
7,20,secure clock
3,704,aad key
12,160,aad icv
13,520,empr key
28,64,random data
76,16,slacker time
21,4,key mode (debug/release)
81,8224,slacker id file
14,16384,EKB 0
15,16384,EKB 1
36,1024,EMPR 0
37,1024,EMPR 1
38,1024,EMPR 2
39,1024,EMPR 3
40,1024,EMPR 4
41,1024,EMPR 5
42,1024,EMPR 6
43,1024,EMPR 7
44,1024,EMPR 8
45,1024,EMPR 9
46,1024,EMPR 10
47,1024,EMPR 11
48,1024,EMPR 12
49,1024,EMPR 13
50,1024,EMPR 14
51,1024,EMPR 15
52,1024,EMPR 16
53,1024,EMPR 17
54,1024,EMPR 18
55,1024,EMPR 19
56,1024,EMPR 20
57,1024,EMPR 21
58,1024,EMPR 22
59,1024,EMPR 23
60,1024,EMPR 24
61,1024,EMPR 25
62,1024,EMPR 26
63,1024,EMPR 27
64,1024,EMPR 28
65,1024,EMPR 29
66,1024,EMPR 30
67,1024,EMPR 31
1,262144,boot image
2,262144,hold image
20,262144,low battery image
19,262144,update image
6,262144,update error image

View file

@ -0,0 +1,89 @@
24,4,system information
23,32,u-boot password
9,4,firmware update flag
10,4,beep ok flag
34,16,rtc alarm
80,4,hold mode
16,64,model id
4,16,serial number
11,32,ship information
68,4,color variation
26,5,product code
29,8,update file name
32,64,key and signature
17,4,test mode flag
18,4,getty mode flag
70,4,disable iptable flag
30,64,sound driver parameter
31,64,noise cancel driver parameter
77,6,wifi mac address
75,4,wifi protected setup
82,16,fm parameter
83,4,speaker ship info
84,4,mass storage class mode
25,4,exception monitor mode
27,4,battery calibration
86,512,bluetooth pskey
5,4096,application parameter
7,20,secure clock
12,160,aad icv
13,520,empr key
76,16,slacker time
21,4,key mode (debug/release)
71,64,marlin time
72,16384,marlin crl
89,512,btmw factory pair info
88,512,btmw factory scdb
87,4,btmw log mode flag
85,4,europe vol regulation flag
8,8,middleware parameter
22,4,quick shutdown flag
69,4,time out to sleep
78,4,application debug mode flag
79,4,browser log mode flag
3,704,aad key
28,64,wmt key
81,8224,slacker id file
73,33024,marlin device key
33,64,starfish id
35,2048,bluetooth address
14,16384,EKB 0
15,16384,EKB 1
74,24576,marlin user key
36,1024,EMPR 0
37,1024,EMPR 1
38,1024,EMPR 2
39,1024,EMPR 3
40,1024,EMPR 4
41,1024,EMPR 5
42,1024,EMPR 6
43,1024,EMPR 7
44,1024,EMPR 8
45,1024,EMPR 9
46,1024,EMPR 10
47,1024,EMPR 11
48,1024,EMPR 12
49,1024,EMPR 13
50,1024,EMPR 14
51,1024,EMPR 15
52,1024,EMPR 16
53,1024,EMPR 17
54,1024,EMPR 18
55,1024,EMPR 19
56,1024,EMPR 20
57,1024,EMPR 21
58,1024,EMPR 22
59,1024,EMPR 23
60,1024,EMPR 24
61,1024,EMPR 25
62,1024,EMPR 26
63,1024,EMPR 27
64,1024,EMPR 28
65,1024,EMPR 29
66,1024,EMPR 30
67,1024,EMPR 31
1,262144,boot image
2,262144,hold image
20,262144,low battery image
19,262144,update image
6,262144,update error image

View file

@ -0,0 +1,88 @@
1,4,system information
2,32,u-boot password
3,4,firmware update flag
4,4,beep ok flag
5,4,hold mode
6,16,rtc alarm
7,64,model id
8,5,product code
9,16,serial number
10,8,update file name
11,64,key and signature
12,32,ship information
13,4,test mode flag
14,4,getty mode flag
15,16,fm parameter
16,64,sound driver parameter
17,64,noise cancel driver parameter
18,512,bluetooth pskey
77,4,wifi protected setup
85,4,battery calibration
19,2048,bluetooth parameter
20,512,btmw factory pair info
21,512,btmw factory scdb
22,4,btmw log mode flag
78,4,application debug mode flag
79,4,browser log mode flag
80,4,time out to sleep
81,4,europe vol regulation flag
82,4,function information
83,4,service id
84,4,marlin key
86,4,MSC only mode flag
23,704,aad/empr key
24,160,aad icv
25,520,empr icv
26,4,key mode (debug/release)
27,64,random data
28,8224,slacker id file
29,64,starfish id
30,33024,marlin device key
31,20,secure clock
32,16,slacker time
33,64,marlin time
34,16384,EKB 0
35,16384,EKB 1
36,1024,EMPR 0
37,1024,EMPR 1
38,1024,EMPR 2
39,1024,EMPR 3
40,1024,EMPR 4
41,1024,EMPR 5
42,1024,EMPR 6
43,1024,EMPR 7
44,1024,EMPR 8
45,1024,EMPR 9
46,1024,EMPR 10
47,1024,EMPR 11
48,1024,EMPR 12
49,1024,EMPR 13
50,1024,EMPR 14
51,1024,EMPR 15
52,1024,EMPR 16
53,1024,EMPR 17
54,1024,EMPR 18
55,1024,EMPR 19
56,1024,EMPR 20
57,1024,EMPR 21
58,1024,EMPR 22
59,1024,EMPR 23
60,1024,EMPR 24
61,1024,EMPR 25
62,1024,EMPR 26
63,1024,EMPR 27
64,1024,EMPR 28
65,1024,EMPR 29
66,1024,EMPR 30
67,1024,EMPR 31
68,4,color variation
69,4,speaker ship info
70,8,middleware parameter
71,4,quick shutdown flag
72,262144,boot image
73,262144,hold image
74,262144,low battery image
75,262144,update image
76,262144,update error image
87,262144,precharge image
88,262144,dead battery image

View file

@ -0,0 +1,89 @@
1,4,system information
2,32,u-boot password
3,4,firmware update flag
4,4,beep ok flag
5,4,hold mode
6,16,rtc alarm
7,64,model id
8,5,product code
9,16,serial number
10,8,update file name
11,64,key and signature
12,32,ship information
13,4,test mode flag
14,4,getty mode flag
15,16,fm parameter
16,64,sound driver parameter
17,64,noise cancel driver parameter
18,512,bluetooth pskey
77,4,wifi protected setup
85,4,battery calibration
19,2048,bluetooth parameter
20,512,btmw factory pair info
21,512,btmw factory scdb
22,4,btmw log mode flag
78,4,application debug mode flag
79,4,browser log mode flag
80,4,time out to sleep
81,4,europe vol regulation flag
82,4,function information
83,4,service id
84,4,marlin key
86,4,MSC only mode flag
89,4,SD Card export flag
23,704,aad/empr key
24,160,aad icv
25,520,empr icv
26,4,key mode (debug/release)
27,64,random data
28,8224,slacker id file
29,64,starfish id
30,33024,marlin device key
31,20,secure clock
32,16,slacker time
33,64,marlin time
34,16384,EKB 0
35,16384,EKB 1
36,1024,EMPR 0
37,1024,EMPR 1
38,1024,EMPR 2
39,1024,EMPR 3
40,1024,EMPR 4
41,1024,EMPR 5
42,1024,EMPR 6
43,1024,EMPR 7
44,1024,EMPR 8
45,1024,EMPR 9
46,1024,EMPR 10
47,1024,EMPR 11
48,1024,EMPR 12
49,1024,EMPR 13
50,1024,EMPR 14
51,1024,EMPR 15
52,1024,EMPR 16
53,1024,EMPR 17
54,1024,EMPR 18
55,1024,EMPR 19
56,1024,EMPR 20
57,1024,EMPR 21
58,1024,EMPR 22
59,1024,EMPR 23
60,1024,EMPR 24
61,1024,EMPR 25
62,1024,EMPR 26
63,1024,EMPR 27
64,1024,EMPR 28
65,1024,EMPR 29
66,1024,EMPR 30
67,1024,EMPR 31
68,4,color variation
69,4,speaker ship info
70,8,middleware parameter
71,4,quick shutdown flag
72,262144,boot image
73,262144,hold image
74,262144,low battery image
75,262144,update image
76,262144,update error image
87,262144,precharge image
88,262144,dead battery image

View file

@ -0,0 +1,754 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2016 Amaury Pouly
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <cstdio>
#include <stdint.h>
#include <cstdlib>
#include <cstring>
#include <getopt.h>
#include <cstdarg>
#include <string>
#include <fstream>
#include <elf.h>
bool g_verbose = false;
bool g_unsafe = false;
uint8_t *read_file(const std::string& path, size_t& size)
{
std::ifstream fin(path.c_str(), std::ios::binary);
if(!fin)
{
printf("Error: cannot open '%s'\n", path.c_str());
return 0;
}
fin.seekg(0, std::ios::end);
size = fin.tellg();
fin.seekg(0, std::ios::beg);
uint8_t *buf = new uint8_t[size];
fin.read((char *)buf, size);
return buf;
}
bool write_file(const std::string& path, uint8_t *buf, size_t size)
{
std::ofstream fout(path.c_str(), std::ios::binary);
if(!fout)
{
printf("Error: cannot open '%s'\n", path.c_str());
return false;
}
fout.write((char *)buf, size);
fout.close();
return true;
}
/* ELF code */
uint8_t *g_elf_buf;
size_t g_elf_size;
Elf32_Shdr *g_elf_symtab;
Elf32_Shdr *g_elf_symtab_strtab;
Elf32_Shdr *g_elf_shstrtab;
Elf32_Ehdr *elf_ehdr()
{
return (Elf32_Ehdr *)g_elf_buf;
}
#define NTH_SHDR_OFF(n) \
(elf_ehdr()->e_shoff + elf_ehdr()->e_shentsize * (n))
Elf32_Shdr *elf_shdr(size_t index)
{
if(index >= elf_ehdr()->e_shnum)
{
printf("Warning: section index is out of bounds\n");
return nullptr;
}
return (Elf32_Shdr *)(g_elf_buf + NTH_SHDR_OFF(index));
}
size_t elf_shnum()
{
return elf_ehdr()->e_shnum;
}
const char *elf_get_str(Elf32_Shdr *strtab, Elf32_Word index)
{
/* sanity checks */
if(strtab->sh_type != SHT_STRTAB)
{
printf("Warning: string access to a non-string-table section\n");
return nullptr;
}
if(strtab->sh_offset + strtab->sh_size > g_elf_size)
{
printf("Warning: string table section does not fit in the file\n");
return nullptr;
}
if(index >= strtab->sh_size)
{
printf("Warning: string access to string table is out of bounds\n");
return nullptr;
}
char *buf = (char *)(g_elf_buf + strtab->sh_offset);
if(buf[strtab->sh_size - 1] != 0)
{
printf("Warning: string table is not zero terminated\n");
return nullptr;
}
return buf + index;
}
const char *elf_get_section_name(size_t index)
{
Elf32_Shdr *shdr = elf_shdr(index);
return shdr ? elf_get_str(g_elf_shstrtab, shdr->sh_name) : nullptr;
}
const char *elf_get_symbol_name(Elf32_Sym *sym)
{
if(ELF32_ST_TYPE(sym->st_info) == STT_SECTION)
return elf_get_section_name(sym->st_shndx);
else
return elf_get_str(g_elf_symtab_strtab, sym->st_name);
}
Elf32_Sym *elf_get_symbol_by_name(const char *name)
{
Elf32_Sym *sym = (Elf32_Sym *)(g_elf_buf + g_elf_symtab->sh_offset);
size_t nr_syms = g_elf_symtab->sh_size / sizeof(Elf32_Sym);
for(size_t i = 0; i < nr_syms; i++)
{
const char *s = elf_get_symbol_name(&sym[i]);
if(s != nullptr && strcmp(name, s) == 0)
return &sym[i];
}
return nullptr;
}
Elf32_Sym *elf_get_symbol_by_address(size_t shndx, Elf32_Word address)
{
Elf32_Sym *sym = (Elf32_Sym *)(g_elf_buf + g_elf_symtab->sh_offset);
size_t nr_syms = g_elf_symtab->sh_size / sizeof(Elf32_Sym);
for(size_t i = 0; i < nr_syms; i++)
{
if(sym[i].st_shndx == shndx && sym[i].st_value == address)
return &sym[i];
}
return nullptr;
}
Elf32_Sym *elf_get_symbol_by_index(size_t index)
{
Elf32_Sym *sym = (Elf32_Sym *)(g_elf_buf + g_elf_symtab->sh_offset);
size_t nr_syms = g_elf_symtab->sh_size / sizeof(Elf32_Sym);
if(index >= nr_syms)
return nullptr;
return &sym[index];
}
void *elf_get_section_ptr(size_t shndx, Elf32_Word address, size_t size)
{
Elf32_Shdr *shdr = elf_shdr(shndx);
if(shdr == nullptr)
return nullptr;
if(address + size > shdr->sh_size)
return nullptr;
if(shdr->sh_offset + shdr->sh_size > g_elf_size)
return nullptr;
return g_elf_buf + shdr->sh_offset + address;
}
/* make sure the string has a final zero in the section, optionally check characters
* are printable */
const char *elf_get_string_ptr_safe(size_t shndx, Elf32_Word offset, bool want_print = true)
{
Elf32_Shdr *shdr = elf_shdr(shndx);
if(shdr == nullptr)
return nullptr;
/* address must be in the section */
if(offset >= shdr->sh_size)
return nullptr;
/* determine maximum size */
size_t max_sz = shdr->sh_size - offset;
const char *ptr = (const char *)(g_elf_buf + shdr->sh_offset + offset);
for(size_t i = 0; i < max_sz; i++)
{
if(ptr[i] == 0) /* found final 0, everything is fine */
return ptr;
if(want_print && !isprint(ptr[i]))
return nullptr;
}
return nullptr;
}
size_t elf_find_reloc_section(size_t shndx)
{
/* find the relocation section */
for(size_t i = 0; i < elf_ehdr()->e_shnum; i++)
{
Elf32_Shdr *shdr = elf_shdr(i);
if(shdr->sh_type != SHT_REL && shdr->sh_type != SHT_RELA)
continue;
if(shdr->sh_info != shndx)
continue;
return i;
}
return 0;
}
void *elf_get_symbol_ptr(Elf32_Sym *sym, size_t size)
{
/* NOTE: also works for STT_SECTION since offset will be 0 */
return elf_get_section_ptr(sym->st_shndx, sym->st_value, size);
}
/* take the position of a 32-bit address in the section and apply relocation if
* any */
void *elf_reloc_addr32(size_t shndx, Elf32_Word offset)
{
/* read value */
uint32_t *val = (uint32_t *)elf_get_section_ptr(shndx, offset, 4);
if(val == nullptr)
return 0; /* invalid */
/* find reloc section if any */
size_t relshndx = elf_find_reloc_section(shndx);
if(relshndx == 0)
return g_elf_buf + *val; /* no relocation applies */
Elf32_Shdr *shdr = elf_shdr(relshndx);
/* find relocation that applies */
if(shdr->sh_type == SHT_RELA)
{
printf("Warning: unsupported RELA relocation type\n");
return 0;
}
Elf32_Rel *rel = (Elf32_Rel *)elf_get_section_ptr(relshndx, 0, shdr->sh_size);
if(rel == nullptr)
{
printf("Warning: invalid relocation section\n");
return 0;
}
size_t sym_count = shdr->sh_size / sizeof(Elf32_Rel);
for(size_t i = 0; i < sym_count; i++)
{
/* for relocatable files, r_offset is the offset in the section */
if(rel[i].r_offset != offset)
continue;
/* find symbol, ignore shdr->sh_link and assume it is g_elf_symtab
* since the file should have only one symbol table anyway */
Elf32_Sym *sym = elf_get_symbol_by_index(ELF32_R_SYM(rel[i].r_info));
/* found it! */
if(g_verbose)
{
printf("[section %zu (%s) offset %#x reloc val %#x type %d sym %d (%s)]\n",
shndx, elf_get_section_name(shndx), offset, *val,
ELF32_R_TYPE(rel[i].r_info), ELF32_R_SYM(rel[i].r_info),
sym ? elf_get_symbol_name(sym) : "<undef>");
}
/* apply reloc */
if(ELF32_R_TYPE(rel[i].r_info) == R_ARM_ABS32)
{
if(sym == nullptr)
{
printf("Warning: R_ARM_ABS32 reloc with invalid symbol reference\n");
return 0;
}
return *val + (uint8_t *)elf_get_symbol_ptr(sym, 0);
}
else
{
printf("Warning: unsupported relocation type %d\n", ELF32_R_TYPE(rel[i].r_info));
return 0;
}
}
/* no reloc applies */
if(g_verbose)
{
printf("[section %zu (%s) offset %#x no reloc found]\n", shndx,
elf_get_section_name(shndx), offset);
}
return g_elf_buf + *val; /* no relocation applies */
}
size_t elf_map_virt_addr(uint32_t address, Elf32_Word& out_off)
{
/* for relocatable file, this is trivial */
for(size_t i = 0; i < elf_ehdr()->e_shnum; i++)
{
Elf32_Shdr *shdr = elf_shdr(i);
if(shdr->sh_offset <= address && address < shdr->sh_offset + shdr->sh_size)
{
out_off = address - shdr->sh_offset;
if(g_verbose)
{
printf("[map %#x to section %zi (%s) at %#x]\n", address, i,
elf_get_section_name(i), out_off);
}
return i;
}
}
return 0; /* section 0 is always invalid */
}
size_t elf_map_ptr(void *ptr, Elf32_Word& out_off)
{
uint32_t addr = (uint32_t)((uint8_t *)ptr - g_elf_buf);
return elf_map_virt_addr(addr, out_off);
}
/* same as elf_reloc_addr32 but find section automatically from pointer */
void *elf_reloc_addr32_ptr(uint32_t *val)
{
Elf32_Word off;
size_t sec = elf_map_ptr((void *)val, off);
/* if it does not belong to any section, don't do anything */
if(sec == 0)
{
printf("Warning: reloc addr pointer not in any section\n");
return g_elf_buf + *val;
}
return elf_reloc_addr32(sec, off);
}
Elf32_Sym *elf_get_symbol_by_ptr(void *ptr)
{
Elf32_Word off;
size_t sec = elf_map_ptr(ptr, off);
return sec ? elf_get_symbol_by_address(sec, off) : nullptr;
}
/* check if a string is safe */
bool elf_is_str_ptr_safe(const char *str)
{
Elf32_Word name_off;
/* find the section it belongs to */
size_t name_shndx = elf_map_ptr((void *)str, name_off);
if(name_shndx == 0)
return false;
/* check the string fit in the section */
return elf_get_string_ptr_safe(name_shndx, name_off) != nullptr;
}
bool elf_is_ptr_safe(void *ptr, size_t sz)
{
Elf32_Word ptr_off;
/* find the section it belongs to */
size_t ptr_shndx = elf_map_ptr((void *)ptr, ptr_off);
if(ptr_shndx == 0)
return false;
/* check the string fit in the section */
return elf_get_section_ptr(ptr_shndx, ptr_off, sz) != nullptr;
}
bool elf_init()
{
if(g_elf_size < sizeof(Elf32_Ehdr))
{
printf("Invalid ELF file: too small\n");
return false;
}
Elf32_Ehdr *ehdr = elf_ehdr();
if(ehdr->e_ident[EI_MAG0] != ELFMAG0 ||
ehdr->e_ident[EI_MAG1] != ELFMAG1 ||
ehdr->e_ident[EI_MAG2] != ELFMAG2 ||
ehdr->e_ident[EI_MAG3] != ELFMAG3)
{
printf("Invalid ELF file: invalid ident\n");
return false;
}
/* we only support relocatable files */
if(ehdr->e_type != ET_REL)
{
printf("Unsupported ELF file: this is not a relocatable file\n");
return false;
}
if(ehdr->e_ident[EI_CLASS] != ELFCLASS32 || ehdr->e_machine != EM_ARM)
{
printf("Unsupported ELF file: this is not a 32-bit ARM ELF file\n");
return false;
}
/* go through sections */
if(ehdr->e_shoff == 0)
{
printf("Invalid ELF file: no sections\n");
return false;
}
if(ehdr->e_shentsize < sizeof(Elf32_Shdr))
{
printf("Invalid ELF file: section entry size too small\n");
return false;
}
if(NTH_SHDR_OFF(ehdr->e_shnum) > g_elf_size)
{
printf("Invalid ELF file: sections header does not fit in the file\n");
return false;
}
for(size_t i = 0; i < ehdr->e_shnum; i++)
{
Elf32_Shdr *shdr = (Elf32_Shdr *)(g_elf_buf + NTH_SHDR_OFF(i));
if(shdr->sh_type == SHT_SYMTAB)
g_elf_symtab = shdr;
}
/* handle symbol table */
if(g_elf_symtab)
{
if(g_elf_symtab->sh_offset + g_elf_symtab->sh_size > g_elf_size)
{
printf("Invalid ELF file: symtab does not file in the file\n");
return false;
}
g_elf_symtab_strtab = elf_shdr(g_elf_symtab->sh_link);
if(g_elf_symtab_strtab == nullptr)
{
printf("Invalid ELF file: symtab's strtab is not valid\n");
}
if(g_elf_symtab_strtab->sh_type != SHT_STRTAB)
{
printf("Invalid ELF file: symtab's strtab is not a string table\n");
return false;
}
}
/* handle section string table */
if(ehdr->e_shstrndx != SHN_UNDEF)
{
g_elf_shstrtab = elf_shdr(ehdr->e_shstrndx);
if(g_elf_shstrtab == nullptr)
{
printf("Invalid ELF file: section string table is invalid\n");
return false;
}
}
return true;
}
/* main code */
void usage()
{
printf("usage: nvptool [options] inputs...\n");
printf("options:\n");
printf(" -h/--help Display help\n");
printf(" -x/--extract Extract nvp map from icx_nvp_emmc.ko\n");
printf(" -o/--output Set output file\n");
printf(" -v/--verbose Enable debug output\n");
printf(" -u/--unsafe Perform potentially unsafe operations\n");
exit(1);
}
struct zone_info_v1_t
{
uint32_t node;
uint32_t start;
uint32_t count;
uint32_t size;
uint32_t semaphore[4]; /* a 16-byte structure, useless for us */
uint32_t name; /* pointer to string */
} __attribute__((packed));
struct zone_info_v2_t
{
uint32_t node;
uint32_t start;
uint32_t count;
uint32_t size;
uint32_t semaphore[3]; /* a 12-byte structure, useless for us */
uint32_t name; /* pointer to string */
} __attribute__((packed));
struct area_info_v1_t
{
uint32_t type; /* 1 = large, 2 = small */
uint32_t zoneinfo; /* pointer to zone_info_t[] */
uint32_t zonecount;
uint32_t semaphore[4]; /* a 16-byte structure, useless for us */
uint32_t name; /* pointer to string */
} __attribute__((packed));
struct area_info_v2_t
{
uint32_t type; /* 1 = large, 2 = small */
uint32_t zoneinfo; /* pointer to zone_info_t[] */
uint32_t zonecount;
uint32_t semaphore[3]; /* a 16-byte structure, useless for us */
uint32_t name; /* pointer to string */
} __attribute__((packed));
int guess_version(void *area_info_ptr)
{
/* the "semaphore" part is always filled with zeroes, so simply check if there
* are 3 or 4 of them */
area_info_v1_t *ai_v1 = (area_info_v1_t *)area_info_ptr;
if(ai_v1->semaphore[3] == 0)
return 1; /* v1: semaphore has 4 fields */
else
return 2; /* v2: semaphore has 3 fields */
}
int do_extract(const char *output, int argc, char **argv)
{
if(argc != 1)
{
printf("You need to specify exactly one input file to extract from.\n");
return 3;
}
FILE *fout = NULL;
if(output)
{
fout = fopen(output, "w");
if(fout == NULL)
{
printf("Cannot open output file '%s'\n", output);
return 4;
}
}
/* read elf file */
g_elf_buf = read_file(argv[0], g_elf_size);
if(g_elf_buf == nullptr)
{
printf("Cannot open input file '%s'\n", argv[0]);
return 1;
}
if(!elf_init())
{
printf("This is not a valid ELF file\n");
return 1;
}
if(g_elf_symtab == nullptr)
{
printf("This ELF file does not have a symbol table\n");
return 1;
}
/* look for symbol 'AreaInfo' */
Elf32_Sym *sym_AreaInfo = elf_get_symbol_by_name("AreaInfo");
if(sym_AreaInfo == nullptr)
{
printf("Cannot find symbol 'AreaInfo'\n");
return 1;
}
printf("AreaInfo:\n");
if(g_verbose)
{
printf("[%u bytes at address %#x in section %u (%s)]\n",
(unsigned)sym_AreaInfo->st_size, (unsigned)sym_AreaInfo->st_value,
(unsigned)sym_AreaInfo->st_shndx, elf_get_section_name(sym_AreaInfo->st_shndx));
}
/* guess version */
int ver = guess_version(elf_get_symbol_ptr(sym_AreaInfo, sizeof(area_info_v1_t)));
if(g_verbose)
printf("[guessed version: %d]\n", ver);
size_t sizeof_area_info = (ver == 1) ? sizeof(area_info_v1_t) : sizeof(area_info_v2_t);
size_t sizeof_zone_info = (ver == 1) ? sizeof(zone_info_v1_t) : sizeof(zone_info_v2_t);
/* sanity check AreaInfo */
size_t area_count = sym_AreaInfo->st_size / sizeof_area_info;
if(!g_unsafe && (sym_AreaInfo->st_size % sizeof_area_info) != 0)
{
printf("AreaInfo size (%u) is a not a multiple of area_info_t size (%zu).\n",
(unsigned)sym_AreaInfo->st_size, sizeof_area_info);
printf("Use unsafe option to override this check\n");
return 1;
}
area_info_v1_t *AreaInfo_v1 = (area_info_v1_t *)elf_get_symbol_ptr(sym_AreaInfo,
sym_AreaInfo->st_size);
area_info_v2_t *AreaInfo_v2 = (area_info_v2_t *)AreaInfo_v1;
if(AreaInfo_v1 == nullptr)
{
printf("Symbol does not point to a valid address\n");
return 1;
}
for(size_t i = 0; i < area_count; i++)
{
uint32_t type;
uint32_t *zoneinfo_ptr;
uint32_t zonecount;
uint32_t *name_ptr;
if(ver == 1)
{
type = AreaInfo_v1[i].type;
zoneinfo_ptr = &AreaInfo_v1[i].zoneinfo;
zonecount = AreaInfo_v1[i].zonecount;
name_ptr = &AreaInfo_v1[i].name;
}
else
{
type = AreaInfo_v2[i].type;
zoneinfo_ptr = &AreaInfo_v2[i].zoneinfo;
zonecount = AreaInfo_v2[i].zonecount;
name_ptr = &AreaInfo_v2[i].name;
}
if(g_verbose)
{
printf(" [type=%u info=%#x count=%u name=%#x]\n", type, *zoneinfo_ptr,
zonecount, *name_ptr);
}
/* translate name address */
const char *name = (const char *)elf_reloc_addr32_ptr(name_ptr);
if(name == nullptr || !elf_is_str_ptr_safe(name))
{
printf(" Entry name is not a string\n");
continue;
}
/* skip reserved entries */
if(*zoneinfo_ptr == 0)
{
printf(" %s\n", name);
continue;
}
/* relocate the zoneinfo pointer */
void *Zone = elf_reloc_addr32_ptr(zoneinfo_ptr);;
if(Zone == nullptr)
{
printf(" %s\n", name);
printf(" Zone info pointer is not valid\n");
continue;
}
/* in safe mode, make sure the zone info pointer is a symbol */
Elf32_Sym *zoneinfo_sym = elf_get_symbol_by_ptr((void *)Zone);
const char *zoneinfo_sym_name = "<no symbol>";
if(zoneinfo_sym)
zoneinfo_sym_name = elf_get_symbol_name(zoneinfo_sym);
printf(" %s (%s)\n", name, zoneinfo_sym_name);
if(!g_unsafe && !zoneinfo_sym)
{
printf(" Zone info pointer does not correspond to any symbol.\n");
printf(" Use unsafe option to override this check\n");
continue;
}
/* if we have the symbol, make sure the claimed size match */
if(!g_unsafe && zoneinfo_sym)
{
if(zoneinfo_sym->st_size != sizeof_zone_info * zonecount)
{
printf(" Zone info symbol size (%u) does not match expected size (%zu)\n",
(unsigned)zoneinfo_sym->st_size, sizeof_zone_info * zonecount);
printf(" Use unsafe option to override this check\n");
continue;
}
}
/* sanity check */
if(!elf_is_ptr_safe((void *)Zone, sizeof_zone_info * zonecount))
{
printf(" Zone info pointer is not valid\n");
continue;
}
/* read zone */
zone_info_v1_t *Zone_v1 = (zone_info_v1_t *)Zone;
zone_info_v2_t *Zone_v2 = (zone_info_v2_t *)Zone;
for(size_t j = 0; j < zonecount; j++)
{
uint32_t node, start, count, size;
uint32_t *name_ptr;
if(ver == 1)
{
node = Zone_v1[j].node;
start = Zone_v1[j].start;
count = Zone_v1[j].count;
size = Zone_v1[j].size;
name_ptr = &Zone_v1[j].name;
}
else
{
node = Zone_v2[j].node;
start = Zone_v2[j].start;
count = Zone_v2[j].count;
size = Zone_v2[j].size;
name_ptr = &Zone_v2[j].name;
}
if(g_verbose)
{
printf(" [node=%u start=%#x count=%u size=%u name=%#x]\n",
node, start, count, size, *name_ptr);
}
/* translate name address */
const char *name = (const char *)elf_reloc_addr32_ptr(name_ptr);
if(name == nullptr || !elf_is_str_ptr_safe(name))
{
printf(" Entry name is not a string\n");
continue;
}
printf(" %s: node %03u, size %u\n", name, node, size);
if(fout)
fprintf(fout, "%u,%u,%s\n", node, size, name);
}
}
if(fout)
fclose(fout);
/* success */
return 0;
}
int main(int argc, char **argv)
{
const char *output = NULL;
bool extract = false;
if(argc <= 1)
usage();
while(1)
{
static struct option long_options[] =
{
{"help", no_argument, 0, 'h'},
{"extract", no_argument, 0, 'x'},
{"output", required_argument, 0, 'o'},
{"verbose", no_argument, 0, 'v'},
{"unsafe", no_argument, 0, 'u'},
{0, 0, 0, 0}
};
int c = getopt_long(argc, argv, "hxo:vu", long_options, NULL);
if(c == -1)
break;
switch(c)
{
case -1:
break;
case 'h':
usage();
break;
case 'o':
output = optarg;
break;
case 'x':
extract = true;
break;
case 'v':
g_verbose = true;
break;
case 'u':
g_unsafe = true;
break;
default:
abort();
}
}
if(extract)
return do_extract(output, argc - optind, argv + optind);
printf("You need to specify an operation. Run nvptool -h for help\n");
return 1;
}

View file

@ -0,0 +1,92 @@
dbg,000
syi,001
ubp,002
fup,003
prk,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
nvr,077
she,084
btc,085
ins,089
ctr,090
sku,091
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mso,086
cng,023
lyr,024
dbv,025
fur,026
ums,027
skd,028
ups,029
mdk,030
fvi,031
mac,032
fpi,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
rbt,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
pci,087
dbi,088

View file

@ -0,0 +1,90 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
btc,027
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
sfi,033
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
mtm,071
mcr,072
mdk,073
muk,074
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084
vrt,085
psk,086
bml,087
bfd,088
bfp,089

View file

@ -0,0 +1,89 @@
dbg,000
syi,001
ubp,002
fup,003
bok,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
pts,077
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mlk,084
mso,086
cng,023
dba,024
dbv,025
dor,026
rnd,027
skd,028
sfi,029
mdk,030
dcc,031
skt,032
mtm,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
mdl,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
btc,085
pci,087
dbi,088

View file

@ -0,0 +1,89 @@
dbg,000
syi,001
ubp,002
fup,003
bok,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
pts,077
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mlk,084
mso,086
cng,023
dba,024
dbv,025
dor,026
rnd,027
skd,028
sfi,029
mdk,030
dcc,031
skt,032
mtm,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
mdl,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
btc,085
pci,087
dbi,088

View file

@ -0,0 +1,90 @@
dbg,000
syi,001
ubp,002
fup,003
bok,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
pts,077
btc,085
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mlk,084
mso,086
sdc,089
cng,023
dba,024
dbv,025
dor,026
rnd,027
skd,028
sfi,029
mdk,030
dcc,031
skt,032
mtm,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
mdl,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
pci,087
dbi,088

View file

@ -0,0 +1,90 @@
dbg,000
syi,001
ubp,002
fup,003
bok,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
pts,077
btc,085
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mlk,084
mso,086
sdc,089
cng,023
dba,024
dbv,025
dor,026
rnd,027
skd,028
sfi,029
mdk,030
dcc,031
skt,032
mtm,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
mdl,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
pci,087
dbi,088

View file

@ -0,0 +1,79 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084

View file

@ -0,0 +1,90 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
btc,027
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
sfi,033
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
mtm,071
mcr,072
mdk,073
muk,074
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084
vrt,085
psk,086
bml,087
bfd,088
bfp,089

View file

@ -0,0 +1,79 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084

View file

@ -0,0 +1,79 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084

View file

@ -0,0 +1,90 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
btc,027
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
sfi,033
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
mtm,071
mcr,072
mdk,073
muk,074
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084
vrt,085
psk,086
bml,087
bfd,088
bfp,089

View file

@ -0,0 +1,87 @@
dbg,000
syi,001
ubp,002
fup,003
bok,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
pts,077
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mlk,084
mso,086
cng,023
dba,024
dbv,025
dor,026
rnd,027
skd,028
sfi,029
mdk,030
dcc,031
skt,032
mtm,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
mdl,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
btc,085

View file

@ -0,0 +1,89 @@
dbg,000
syi,001
ubp,002
fup,003
bok,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
pts,077
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mlk,084
mso,086
cng,023
dba,024
dbv,025
dor,026
rnd,027
skd,028
sfi,029
mdk,030
dcc,031
skt,032
mtm,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
mdl,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
btc,085
pci,087
dbi,088

View file

@ -0,0 +1,90 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
btc,027
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
sfi,033
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
mtm,071
mcr,072
mdk,073
muk,074
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084
vrt,085
psk,086
bml,087
bfd,088
bfp,089

View file

@ -0,0 +1,90 @@
dbg,000
syi,001
ubp,002
fup,003
bok,004
hld,005
rtc,006
mid,007
pcd,008
ser,009
ufn,010
kas,011
shp,012
tst,013
gty,014
fmp,015
sdp,016
ncp,017
psk,018
pts,077
btc,085
bpr,019
bfp,020
bfd,021
bml,022
apd,078
blf,079
slp,080
vrt,081
fni,082
sid,083
mlk,084
mso,086
sdc,089
cng,023
dba,024
dbv,025
dor,026
rnd,027
skd,028
sfi,029
mdk,030
dcc,031
skt,032
mtm,033
tr0,034
tr1,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
sps,069
mdl,070
edw,071
bti,072
hdi,073
lbi,074
fui,075
eri,076
pci,087
dbi,088

View file

@ -0,0 +1,90 @@
dbg,000
bti,001
hdi,002
cng,003
ser,004
app,005
eri,006
dcc,007
mdl,008
fup,009
bok,010
shp,011
dba,012
dbv,013
tr0,014
tr1,015
mid,016
tst,017
gty,018
fui,019
lbi,020
dor,021
edw,022
ubp,023
syi,024
exm,025
pcd,026
cgp,027
rnd,028
ufn,029
sdp,030
ncp,031
kas,032
sfi,033
rtc,034
bpr,035
e00,036
e01,037
e02,038
e03,039
e04,040
e05,041
e06,042
e07,043
e08,044
e09,045
e10,046
e11,047
e12,048
e13,049
e14,050
e15,051
e16,052
e17,053
e18,054
e19,055
e20,056
e21,057
e22,058
e23,059
e24,060
e25,061
e26,062
e27,063
e28,064
e29,065
e30,066
e31,067
clv,068
slp,069
ipt,070
mtm,071
mcr,072
mdk,073
muk,074
pts,075
skt,076
mac,077
apd,078
blf,079
hld,080
skd,081
fmp,082
sps,083
msc,084
vrt,085
psk,086
bml,087
bfd,088
bfp,089

View file

@ -0,0 +1,33 @@
#
# usage: parse_all_nvp_headers /path/to/directory
#
# the expected structure is:
# nwz-*/<kernel>
# nw-*/<kernel/
# where <kernel> must be of the form
# linux-kernel-*.tgz
#
if [ "$#" -lt 1 ]; then
>&2 echo "usage: parse_all_nvp_header.sh /path/to/directory"
exit 1
fi
# list interesting directories
for dir in `find "$1" -maxdepth 1 -name "nw-*" -or -name "nwz-*"`
do
# extract codename
codename=`basename "$dir"`
# only consider linux based targets
if [ -e "$dir/not_linux" ]; then
#echo "$codename: not linux based"
continue
fi
# check if we can find a kernel
kernel_tgz=`find "$dir" -maxdepth 1 -name "linux-kernel-*.tgz"`
if [ "$kernel_tgz" == "" ]; then
echo "$codename: no kernel found"
continue
fi
echo "$codename: found kernel `basename $kernel_tgz`"
./parse_nvp_header.sh "$kernel_tgz" > "$codename.txt"
done

View file

@ -0,0 +1,32 @@
#
# usage: parse_all_nvp_nodes /path/to/directory
#
# the expected structure is:
# nwz-*/rootfs.tar
# nwz-*/rootfs.tar
#
if [ "$#" -lt 1 ]; then
>&2 echo "usage: parse_all_nvp_header.sh /path/to/directory"
exit 1
fi
# list interesting directories
for dir in `find "$1" -maxdepth 1 -name "nw-*" -or -name "nwz-*"`
do
# extract codename
codename=`basename "$dir"`
# only consider linux based targets
if [ -e "$dir/not_linux" ]; then
#echo "$codename: not linux based"
continue
fi
# check if we can find a rootfs
rootfs_tgz="$dir/rootfs.tgz"
if [ ! -e "$rootfs_tgz" ]; then
echo "$codename: no rootfs found"
continue
fi
echo "$codename: found rootfs `basename $rootfs_tgz`"
./parse_nvp_nodes.sh "$rootfs_tgz" "nodes-$codename.txt"
done

View file

@ -0,0 +1,77 @@
# usage
# parse_header.sh /path/to/icx_nvp.h
# parse_header.sh /path/to/linux/source [file]
# parse_header.sh /path/to/linux.tgz [file]
# the optional argument is an additional filter when there are several matches
# and is an argument to grep
#
if [ "$#" -lt 1 ]; then
>&2 echo "usage: parse_header.sh /path/to/icx_nvp.h|/path/to/kernel/source|/path/to/kernel.tgz [filter]"
exit 1
fi
FILE="$1"
IN_TGZ="0"
FILTER="$2"
# for directories, list all files
if [ -d "$FILE" ]; then
LIST=`find "$FILE"`
else
# otherwise try un unpack it using tar, to see if it's an archive
LIST=`tar -tzf "$FILE"`
if [ "$?" == 0 ]; then
IN_TGZ="1"
TGZ="$FILE"
else
# assume the input is just the right file
LIST="$FILE"
fi
fi
# apply user filter
if [ "$FILTER" != "" ]; then
LIST=`echo "$LIST" | grep "$FILTER"`
fi
# if file contains icx_nvp_emmc.h, we want that
if [ "`echo "$LIST" | grep "icx_nvp_emmc.h" | wc -l`" = "1" ]; then
LIST=`echo "$LIST" | grep "icx_nvp_emmc.h"`
else
LIST=`echo "$LIST" | grep 'icx[[:digit:]]*_nvp[[:alpha:]_]*.h'`
fi
LIST_CNT=`echo "$LIST" | wc -l`
if [ "$LIST_CNT" = "0" ]; then
>&2 echo "No icx nvp file found"
exit 1
elif [ "$LIST_CNT" != "1" ]; then
>&2 echo "Several matches for icx nvp:"
>&2 echo "$LIST"
exit 1
else
FILE="$LIST"
fi
# if file is in archive, we need to extract it
if [ "$IN_TGZ" = "1" ]; then
>&2 echo "Extracting $FILE from $TGZ"
TMP=`mktemp`
tar -Ozxf "$TGZ" "$FILE" > $TMP
if [ "$?" != 0 ]; then
>&2 echo "Extraction failed"
exit 1
fi
FILE="$TMP"
else
>&2 echo "Analyzing $FILE"
fi
cat "$FILE" | awk ' \
BEGIN { \
expr = "#define[[:space:]]+ICX_NVP_NODE_([[:alnum:]]+)[[:space:]]+ICX_NVP_NODE_BASE[[:space:]]*\"([[:digit:]]+)\""; \
} \
{ \
if($0 ~ expr) \
{ \
print(tolower(gensub(expr, "\\1,\\2", "g", $0)));
} \
}'

View file

@ -0,0 +1,58 @@
# usage
# parse_nodes.sh /path/to/icx_nvp_emmc.ko output_file
# parse_nodes.sh /path/to/rootfs/dir output_file
# parse_nodes.sh /path/to/rootfs.tgz output_file
#
if [ "$#" -lt 2 ]; then
>&2 echo "usage: parse_header.sh /path/to/icx_nvp.ko|/path/to/rootfs/dir|/path/to/rootfs.tgz output_file"
exit 1
fi
FILE="$1"
IN_TGZ="0"
OUTPUT="$2"
# for directories, list all files
if [ -d "$FILE" ]; then
LIST=`find "$FILE"`
else
# otherwise try un unpack it using tar, to see if it's an archive
LIST=`tar -tzf "$FILE"`
if [ "$?" == 0 ]; then
IN_TGZ="1"
TGZ="$FILE"
else
# assume the input is just the right file
LIST="$FILE"
fi
fi
# look for icx_nvp_emmc.ko
LIST=`echo "$LIST" | grep "icx[[:digit:]]*_nvp[[:alpha:]_]*.ko"`
LIST_CNT=`echo "$LIST" | wc -l`
if [ "$LIST" == "" ]; then
>&2 echo "No icx nvp file found"
exit 1
elif [ "$LIST_CNT" != "1" ]; then
>&2 echo "Several matches for icx nvp:"
>&2 echo "$LIST"
exit 1
else
FILE="$LIST"
fi
# if file is in archive, we need to extract it
if [ "$IN_TGZ" = "1" ]; then
>&2 echo "Extracting $FILE from $TGZ"
TMP=`mktemp`
tar -Ozxf "$TGZ" "$FILE" > $TMP
if [ "$?" != 0 ]; then
>&2 echo "Extraction failed"
exit 1
fi
FILE="$TMP"
else
>&2 echo "Analyzing $FILE"
fi
./nvptool -x "$FILE" -o "$OUTPUT" >/dev/null

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,185 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2016 Amaury Pouly
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __NWZ_DB_H__
#define __NWZ_DB_H__
/** /!\ This file was automatically generated, DO NOT MODIFY IT DIRECTLY /!\ */
/* List of all known NVP nodes */
enum nwz_nvp_node_t
{
NWZ_NVP_APD, /* application debug mode flag */
NWZ_NVP_APP, /* application parameter */
NWZ_NVP_BFD, /* btmw factory scdb */
NWZ_NVP_BFP, /* btmw factory pair info */
NWZ_NVP_BLF, /* browser log mode flag */
NWZ_NVP_BML, /* btmw log mode flag */
NWZ_NVP_BOK, /* beep ok flag */
NWZ_NVP_BPR, /* bluetooth address | bluetooth parameter */
NWZ_NVP_BTC, /* battery calibration */
NWZ_NVP_BTI, /* boot image */
NWZ_NVP_CGP, /* */
NWZ_NVP_CLV, /* color variation */
NWZ_NVP_CNG, /* aad/empr key | aad key */
NWZ_NVP_CTR, /* */
NWZ_NVP_DBA, /* aad icv */
NWZ_NVP_DBG, /* */
NWZ_NVP_DBI, /* dead battery image */
NWZ_NVP_DBV, /* empr icv | empr key */
NWZ_NVP_DCC, /* secure clock */
NWZ_NVP_DOR, /* key mode (debug/release) */
NWZ_NVP_E00, /* EMPR 0 */
NWZ_NVP_E01, /* EMPR 1 */
NWZ_NVP_E02, /* EMPR 2 */
NWZ_NVP_E03, /* EMPR 3 */
NWZ_NVP_E04, /* EMPR 4 */
NWZ_NVP_E05, /* EMPR 5 */
NWZ_NVP_E06, /* EMPR 6 */
NWZ_NVP_E07, /* EMPR 7 */
NWZ_NVP_E08, /* EMPR 8 */
NWZ_NVP_E09, /* EMPR 9 */
NWZ_NVP_E10, /* EMPR 10 */
NWZ_NVP_E11, /* EMPR 11 */
NWZ_NVP_E12, /* EMPR 12 */
NWZ_NVP_E13, /* EMPR 13 */
NWZ_NVP_E14, /* EMPR 14 */
NWZ_NVP_E15, /* EMPR 15 */
NWZ_NVP_E16, /* EMPR 16 */
NWZ_NVP_E17, /* EMPR 17 */
NWZ_NVP_E18, /* EMPR 18 */
NWZ_NVP_E19, /* EMPR 19 */
NWZ_NVP_E20, /* EMPR 20 */
NWZ_NVP_E21, /* EMPR 21 */
NWZ_NVP_E22, /* EMPR 22 */
NWZ_NVP_E23, /* EMPR 23 */
NWZ_NVP_E24, /* EMPR 24 */
NWZ_NVP_E25, /* EMPR 25 */
NWZ_NVP_E26, /* EMPR 26 */
NWZ_NVP_E27, /* EMPR 27 */
NWZ_NVP_E28, /* EMPR 28 */
NWZ_NVP_E29, /* EMPR 29 */
NWZ_NVP_E30, /* EMPR 30 */
NWZ_NVP_E31, /* EMPR 31 */
NWZ_NVP_EDW, /* quick shutdown flag */
NWZ_NVP_ERI, /* update error image */
NWZ_NVP_EXM, /* exception monitor mode */
NWZ_NVP_FMP, /* fm parameter */
NWZ_NVP_FNI, /* function information */
NWZ_NVP_FPI, /* */
NWZ_NVP_FUI, /* update image */
NWZ_NVP_FUP, /* firmware update flag */
NWZ_NVP_FUR, /* */
NWZ_NVP_FVI, /* */
NWZ_NVP_GTY, /* getty mode flag */
NWZ_NVP_HDI, /* hold image */
NWZ_NVP_HLD, /* hold mode */
NWZ_NVP_INS, /* */
NWZ_NVP_IPT, /* disable iptable flag */
NWZ_NVP_KAS, /* key and signature */
NWZ_NVP_LBI, /* low battery image */
NWZ_NVP_LYR, /* */
NWZ_NVP_MAC, /* wifi mac address */
NWZ_NVP_MCR, /* marlin crl */
NWZ_NVP_MDK, /* marlin device key */
NWZ_NVP_MDL, /* middleware parameter */
NWZ_NVP_MID, /* model id */
NWZ_NVP_MLK, /* marlin key */
NWZ_NVP_MSC, /* mass storage class mode */
NWZ_NVP_MSO, /* MSC only mode flag */
NWZ_NVP_MTM, /* marlin time */
NWZ_NVP_MUK, /* marlin user key */
NWZ_NVP_NCP, /* noise cancel driver parameter */
NWZ_NVP_NVR, /* */
NWZ_NVP_PCD, /* product code */
NWZ_NVP_PCI, /* precharge image */
NWZ_NVP_PRK, /* */
NWZ_NVP_PSK, /* bluetooth pskey */
NWZ_NVP_PTS, /* wifi protected setup */
NWZ_NVP_RBT, /* */
NWZ_NVP_RND, /* wmt key | random data */
NWZ_NVP_RTC, /* rtc alarm */
NWZ_NVP_SDC, /* SD Card export flag */
NWZ_NVP_SDP, /* sound driver parameter */
NWZ_NVP_SER, /* serial number */
NWZ_NVP_SFI, /* starfish id */
NWZ_NVP_SHE, /* */
NWZ_NVP_SHP, /* ship information */
NWZ_NVP_SID, /* service id */
NWZ_NVP_SKD, /* slacker id file */
NWZ_NVP_SKT, /* slacker time */
NWZ_NVP_SKU, /* */
NWZ_NVP_SLP, /* time out to sleep */
NWZ_NVP_SPS, /* speaker ship info */
NWZ_NVP_SYI, /* system information */
NWZ_NVP_TR0, /* EKB 0 */
NWZ_NVP_TR1, /* EKB 1 */
NWZ_NVP_TST, /* test mode flag */
NWZ_NVP_UBP, /* u-boot password */
NWZ_NVP_UFN, /* update file name */
NWZ_NVP_UMS, /* */
NWZ_NVP_UPS, /* */
NWZ_NVP_VRT, /* europe vol regulation flag */
NWZ_NVP_COUNT /* Number of nvp nodes */
};
/* Invalid NVP index */
#define NWZ_NVP_INVALID -1 /* Non-existent entry */
/* Number of models */
#define NWZ_MODEL_COUNT 181
/* Number of series */
#define NWZ_SERIES_COUNT 36
/* NVP node info */
struct nwz_nvp_info_t
{
const char *name; /* Sony's name: "bti" */
unsigned long size; /* Size in bytes */
const char *desc; /* Description: "bootloader image" */
};
/* NVP index map (nwz_nvp_node_t -> index) */
typedef int nwz_nvp_index_t[NWZ_NVP_COUNT];
/* Model info */
struct nwz_model_info_t
{
unsigned long mid; /* Model ID: first 4 bytes of the NVP mid entry */
const char *name; /* Human name: "NWZ-E463" */
};
/* Series info */
struct nwz_series_info_t
{
const char *codename; /* Rockbox codename: nwz-e460 */
const char *name; /* Human name: "NWZ-E460 Series" */
int mid_count; /* number of entries in mid_list */
unsigned long *mid; /* List of model IDs */
/* Pointer to a name -> index map, nonexistent entries map to NWZ_NVP_INVALID */
nwz_nvp_index_t *nvp_index;
};
/* List of all NVP entries, indexed by nwz_nvp_node_t */
extern struct nwz_nvp_info_t nwz_nvp[NWZ_NVP_COUNT];
/* List of all models, sorted by increasing values of model ID */
extern struct nwz_model_info_t nwz_model[NWZ_MODEL_COUNT];
/* List of all series */
extern struct nwz_series_info_t nwz_series[NWZ_SERIES_COUNT];
#endif /* __NWZ_DB_H__ */

View file

@ -0,0 +1,36 @@
nwz-a10,NWZ-A10 Series,0x1a000001,0x1a000002,0x1a000004,0x1a000005,0x1a000006,0x1a010001,0x1a010002,0x1a010004,0x1a010005,0x1a010006
nwz-a20,NW-A20 Series,0x1d000001,0x1d000002,0x1d000004,0x1d000005,0x1d000006,0x1d000007
nw-a30,NW-A30 Series,
nwz-a720,NWZ-A720 Series,0x3030001,0x3030002,0x3030004,0x3020001,0x3020002,0x3020004
nwz-a810,NWZ-A810 Series,0x10000,0x10001,0x10002
nwz-a820,NWZ-A820 Series,0x3010001,0x3010002,0x3010004,0x3000001,0x3000002,0x3000004
nwz-a840,NWZ-A840 Series,0x7010004,0x7010005,0x7010006,0x7000004,0x7000005,0x7000006
nwz-a850,NWZ-A850 Series,0xe000004,0xe000005,0xe000006
nwz-a860,NWZ-A860 Series,0x11000001,0x11000002,0x11000004,0x11000005,0x11000006,0x11010001,0x11010002,0x11010004,0x11010005,0x11010006,0x11020001,0x11020002,0x11020004,0x11020005,0x11020006
nw-a910,NW-A910 Series,0x2000001,0x2000002,0x2000004
nwz-e050,NWZ-E050 Series,0x8000000,0x8000001,0x8000002,0x10000000,0x10000001
nw-e060,NW-E060 Series,0x14000000,0x14000001,0x14000002,0x14000004,0x14000005
nw-e080,NW-E080 Series,0x19010001,0x19010002,0x19010004,0x19010005
nwz-e350,NWZ-E350 Series,0xc000001,0xc000002,0xc000004
nwz-e450,NWZ-E450 Series,0xb000001,0xb000002,0xb000004
nwz-e460,NWZ-E460 Series,0x13000001,0x13000002,0x13000004
nwz-e470,NWZ-E470 Series,0x15000001,0x15000002,0x15000004,0x15000005
nwz-e550,NWZ-E550 Series,0xd000001,0xd000002,0xd000004,0xd000005
nwz-e570,NWZ-E570 Series,0x15010001,0x15010002,0x15010004,0x15010005
nwz-e580,NWZ-E580 Series,0x19020001,0x19020002,0x19020004,0x19020005
nw-s10,NW-S10 Series,0x1b000001,0x1b000002,0x1b000004,0x1b000005,0x1b000006
nwz-s510,NWZ-S510 Series,0x1030000,0x1030001
nwz-s610,NWZ-S610 Series,0x1000000,0x1000001,0x1020000,0x1020001,0x1020002
nwz-s630,NWZ-S630 Series,0x4000001,0x4000002,0x4000004,0x4020001,0x4020002,0x4020004
nw-s640,NW-S640 Series,0x6010002,0x6010004,0x6010005
nwz-s710,NWZ-S710 Series,0x1010000,0x1010001,0x1010002,0x1040000,0x1040001,0x1040002
nwz-s730,NWZ-S730 Series,0x4010001,0x4010002,0x4010004,0x4030001,0x4030002,0x4030004
nwz-s740,NWZ-S740 Series,0x6030002,0x6030004,0x6030005,0x6020002,0x6020004,0x6020005
nwz-s750,NWZ-S740 Series,0x9000002,0x9000004,0x9000005,0xf000002,0xf000004
nwz-s760,NWZ-S740 Series,0x12000001,0x12000002,0x12000004,0x12000005,0x12000006,0x12010001,0x12010002,0x12010004,0x12010005,0x12010006
nwz-s770,NWZ-S770 Series,0x16000001,0x16000002,0x16000004,0x16000005,0x16010001,0x16010002,0x16010004,0x16010005
nw-s780,NW-S780 Series,0x19000001,0x19000002,0x19000004,0x19000005
nwz-x1000,NWZ-X1000 Series,0x5000002,0x5000004,0x5000005,0x5020002,0x5040002,0x5020004,0x5040004,0x5020005,0x5040005
nw-zx100,NW-ZX100 Series,0x1c000007,0x1c000001,0x1c000002,0x1c000004,0x1c000005,0x1c000006
nwz-zx2,NW-ZX2,
nwz-noname,NONAME,0x5010002,0x5010004,0x5010005