<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rockbox/utils/nwztools, branch working</title>
<subtitle>My Rockbox tree</subtitle>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/'/>
<entry>
<title>Add KAS for NWZ-E470</title>
<updated>2016-11-14T19:54:05+00:00</updated>
<author>
<name>Marcin Bukat</name>
<email>marcin.bukat@gmail.com</email>
</author>
<published>2016-11-14T19:54:05+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=deaeb73912c1bb9fd4d3498e59d1789761f3e322'/>
<id>deaeb73912c1bb9fd4d3498e59d1789761f3e322</id>
<content type='text'>
Change-Id: I1b8272a486ba2377e5047855acda3f80aa92c232
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I1b8272a486ba2377e5047855acda3f80aa92c232
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztools: rework dualboot</title>
<updated>2016-11-12T21:16:48+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-12T21:16:48+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=0c1a96101cdfc778dbffa7ceffea5765ffd4d1bd'/>
<id>0c1a96101cdfc778dbffa7ceffea5765ffd4d1bd</id>
<content type='text'>
The new code gets closer to an actual bootloader:
- it provides a menu with three options: Sony, Rockox, tools with icons (and
  extracts the Sony logo from the NVP)
- the dualboot install script now creates a symlink from /.rockbox to
  /contents/.rockox which is necessary to run rockbox
- more text drawing / framebuffer functions
In the long run, we will move this under bootloader/ and rbutil/ and also use
firmware/ drawing facilities, at the moment we use OF display program which
is slow and creates some flickering.
The logo extraction/placement code was tested with resolution 240x320 and I
guessed some reasonable values for 240x400, but those will probably need some
tweaking.

Change-Id: I0319be902d21a7d33c1dee0fffdb4797065dbf8a
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The new code gets closer to an actual bootloader:
- it provides a menu with three options: Sony, Rockox, tools with icons (and
  extracts the Sony logo from the NVP)
- the dualboot install script now creates a symlink from /.rockbox to
  /contents/.rockox which is necessary to run rockbox
- more text drawing / framebuffer functions
In the long run, we will move this under bootloader/ and rbutil/ and also use
firmware/ drawing facilities, at the moment we use OF display program which
is slow and creates some flickering.
The logo extraction/placement code was tested with resolution 240x320 and I
guessed some reasonable values for 240x400, but those will probably need some
tweaking.

Change-Id: I0319be902d21a7d33c1dee0fffdb4797065dbf8a
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztool/scsitools: cleanup and add destination changer tool</title>
<updated>2016-11-11T15:07:14+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-11T15:04:15+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=33856d9ceb6df817c4f40f42bfcf9ee9fa188848'/>
<id>33856d9ceb6df817c4f40f42bfcf9ee9fa188848</id>
<content type='text'>
Now that we have a nice database of player index, the scsitool becomes more
useful and supports a lot more players. I did some general cleanup of the code,
though eventually it would be nice to really split it into a library and a CLI.
The SCSI vendor command allow to read but also write most NVP nodes. Since there
seems to a demand to change destination and sound pressure settings on device,
I implement this feature in the tool. I do not plan to allow arbitrary NVP
writes because this could easily brick the device. Changing the destination
should be safe, but as usual, use at your own risks.

Change-Id: Iff4e8cc3ac97b965c1df849051c5fd373756cda5
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that we have a nice database of player index, the scsitool becomes more
useful and supports a lot more players. I did some general cleanup of the code,
though eventually it would be nice to really split it into a library and a CLI.
The SCSI vendor command allow to read but also write most NVP nodes. Since there
seems to a demand to change destination and sound pressure settings on device,
I implement this feature in the tool. I do not plan to allow arbitrary NVP
writes because this could easily brick the device. Changing the destination
should be safe, but as usual, use at your own risks.

Change-Id: Iff4e8cc3ac97b965c1df849051c5fd373756cda5
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztools/plattools: use player database and rework stuff</title>
<updated>2016-11-11T15:07:14+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-11T15:01:14+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=c95e30b75d75b674f0d645b7c41377bbd0511213'/>
<id>c95e30b75d75b674f0d645b7c41377bbd0511213</id>
<content type='text'>
Using the database, we can now safely read/write the NVP. I also add more
support for Sony's "display" tool.

Change-Id: I8439fe9bad391c7f29859d99f236781be7983625
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Using the database, we can now safely read/write the NVP. I also add more
support for Sony's "display" tool.

Change-Id: I8439fe9bad391c7f29859d99f236781be7983625
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztools/database: add database of information on Sony NWZ linux players</title>
<updated>2016-11-11T15:07:14+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-11T14:40:56+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=44bb2856a59be53ef5ede154a39c54a59b1cc6d0'/>
<id>44bb2856a59be53ef5ede154a39c54a59b1cc6d0</id>
<content type='text'>
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
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztools/upgtools: cleanup</title>
<updated>2016-11-11T15:07:14+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-11T14:32:09+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=19de536ce2f3c8066ca5be9b570f72e5c1e88342'/>
<id>19de536ce2f3c8066ca5be9b570f72e5c1e88342</id>
<content type='text'>
There is no need to store the key and sig since those are derived from the KAS
anyway.

Change-Id: I228913b1cb32e496db265e9a7aaf3bb4200a9f6b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There is no need to store the key and sig since those are derived from the KAS
anyway.

Change-Id: I228913b1cb32e496db265e9a7aaf3bb4200a9f6b
</pre>
</div>
</content>
</entry>
<entry>
<title>forgot file</title>
<updated>2016-11-05T23:15:08+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-05T23:15:08+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=25bd580509eb9a8e36d37acec93cfec97f3821b8'/>
<id>25bd580509eb9a8e36d37acec93cfec97f3821b8</id>
<content type='text'>
Change-Id: I32e23035a608ee04a69690975ab4bf629a902388
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Change-Id: I32e23035a608ee04a69690975ab4bf629a902388
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztools/plattools: fix black screen issue in dualboot, rework dualboot</title>
<updated>2016-11-05T23:12:04+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-05T23:12:04+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=5017babb307122d8567ca78a5721e96c4d7ff8f2'/>
<id>5017babb307122d8567ca78a5721e96c4d7ff8f2</id>
<content type='text'>
Sony added extensions to the frambuffer interface. It is important to take them
into account since the OF uses them and might leave the framebuffer in an
unusual state which would make the dualboot not display anything. Also rework
the dualboot code so that it can boot rockbox (not doing anything at the moment),
display all tools or boot the OF.

Change-Id: Ia0f589c9ec8558f375270841503c0964aff07f0b
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Sony added extensions to the frambuffer interface. It is important to take them
into account since the OF uses them and might leave the framebuffer in an
unusual state which would make the dualboot not display anything. Also rework
the dualboot code so that it can boot rockbox (not doing anything at the moment),
display all tools or boot the OF.

Change-Id: Ia0f589c9ec8558f375270841503c0964aff07f0b
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztools: add preliminary dualboot and dualboot install script</title>
<updated>2016-11-01T16:09:07+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-11-01T16:04:26+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=d492f25c54b4134fd6632156efee07670ab4004f'/>
<id>d492f25c54b4134fd6632156efee07670ab4004f</id>
<content type='text'>
At the moment, the script install_duaboot does the following:
- rename SpiderApp to SpiderApp.of (unless it already exists)
- install payload as SpiderApp
- fixes permissions
Since SpiderApp is the main app, it will execute instead of the OF.
The current dualboot code (dualboot.c) is still a preliminary but the current
version displays an "all tools" menu to choose for. When exitting the menu
using BACK, it will run the OF.

With the modifications made by the install script, it should not be possible
to break the device. In the worst case scenario, the dualboot code crashes
and it restarted by the sysmgrd, or hangs. A safe way to recover is to plug
the USB cable and reset the device: the system manager will then start the
USB app and one can reflash the device if necessary.

Change-Id: Id9edab0347538ad2a8651a28aea7fd083feaa626
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
At the moment, the script install_duaboot does the following:
- rename SpiderApp to SpiderApp.of (unless it already exists)
- install payload as SpiderApp
- fixes permissions
Since SpiderApp is the main app, it will execute instead of the OF.
The current dualboot code (dualboot.c) is still a preliminary but the current
version displays an "all tools" menu to choose for. When exitting the menu
using BACK, it will run the OF.

With the modifications made by the install script, it should not be possible
to break the device. In the worst case scenario, the dualboot code crashes
and it restarted by the sysmgrd, or hangs. A safe way to recover is to plug
the USB cable and reset the device: the system manager will then start the
USB app and one can reflash the device if necessary.

Change-Id: Id9edab0347538ad2a8651a28aea7fd083feaa626
</pre>
</div>
</content>
</entry>
<entry>
<title>nwztools/upgtools: sanitize series name and add keys</title>
<updated>2016-10-31T16:51:18+00:00</updated>
<author>
<name>Amaury Pouly</name>
<email>amaury.pouly@gmail.com</email>
</author>
<published>2016-10-31T16:51:18+00:00</published>
<link rel='alternate' type='text/html' href='https://www.franklinwei.com/cgit/rockbox/commit/?id=b045e4da34165a878c7acc9a82e76b447fe992a7'/>
<id>b045e4da34165a878c7acc9a82e76b447fe992a7</id>
<content type='text'>
Unify series names: e46x -&gt; e460 to be consistent with Sony' name. Add keys
for various players that were cracked using upgtools. The real KAS would need
to be extracted from a target but at least we can open/create firmware upgrades.

Change-Id: Id23a10e10170d7f6330c6699bf205c4df5ddebfe
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Unify series names: e46x -&gt; e460 to be consistent with Sony' name. Add keys
for various players that were cracked using upgtools. The real KAS would need
to be extracted from a target but at least we can open/create firmware upgrades.

Change-Id: Id23a10e10170d7f6330c6699bf205c4df5ddebfe
</pre>
</div>
</content>
</entry>
</feed>
