Commit graph

33203 commits

Author SHA1 Message Date
Amaury Pouly
a983859291 imx233: add capability to boot OF or updater instead of Rockbox
This commit adds the necessary code in the dualboot stub (bootloader) to
let rockbox control the boot process. In particular, rockbox can now choose
if the next boot will be normal (boot rockbox or OF on magic key), to OF
or to updater.

The intents (to be added in follow-up commits) are:
1) Let the user more easily reboot to the OF. On some targets it is not trivial,
especially in USB mode.
2) Automatically reboot to updater when the user drop firmware.sb at the root
of the drive (currently, the user needs to do that in OF USB mode)
3) Document this OF magic

Change-Id: I86df651dec048c318c6a22de74abb8c6b41aa9ad
2016-12-12 12:03:08 +01:00
Amaury Pouly
5c50efc9ce hwstub/tools: always run make for the libraries
This ensures that the libs are always up-to-date hopefully.

Change-Id: I790302fcabc91457091006de749b76735fdd510f
2016-12-12 11:53:41 +01:00
Amaury Pouly
8e82839fe2 hwstub: various cleanups
- hwstub load now properly stops reading the log when the device returns a 0
  size buffer instead of STALLing
- add debug output option to hwstub_load
- correctly report transfered size on write error
- add some debug error message in usb code so that some errors can be diagnosed
  more easily
- add a batch mode to hwstub_shell to disable the interactive shell
- increase usb control timeout to 1sec, 100ms was really tight
- cap usb buffer size to ~4000 bytes because libusb has a hardwired limit of
  4096 bytes for control transfers

Change-Id: Id3200ab99ce70a7a3b09ce7faeaafa4a0fac64c7
2016-12-12 11:35:16 +01:00
Franklin Wei
5b52ff2c93 Add myself to COMMITTERS
Change-Id: I1702c3fc8cd282221213251463cff329b5cfb869
2016-12-11 15:59:59 +01:00
Franklin Wei
16e22b5b9f Add tentative new element names, IUPAC approval expected around November
Change-Id: I40adb1adb27894b15d3bc3a2388bd2059e75636e
2016-12-04 18:05:51 +01:00
Amaury Pouly
906a95ccbf rockoxdev.sh: fix compilation of ARM toolchain
This will breaks mips but mips is already super hard to build anyway.

Change-Id: Ia481a22440758fe72a87e2808f4fb8d31c49cb53
2016-12-04 15:11:58 +01:00
Amaury Pouly
bbf4ff2c91 Fix DEBUG build codecs
In DEBUG build, the codec API struct is consider with DEBUG flag in apps/
but without DEBUG flah in rbcodecs/, leading to unmatched structure and horrible
crashes in some cases (mostly encoders). I have no idea why the codecs Makefile
removes the DEBUG flag (maybe for performance reasons?) but it cannot be right.

Change-Id: Idb2c5f66741408ec2939624590fc39c4cf69fc2b
2016-12-03 23:07:32 +01:00
Amaury Pouly
a88f57ec36 nwztools/scripts: mount storage with ext3 instead of ext2
Since ext3 supports ext2, we can support more platforms. Some platforms use ext4
with a very specific set of options, we I haven't encountered those yet so it's
not currently a problem.

Change-Id: Iff87e925a4caa866c6a66b1883ad6baab88c0b8d
2016-11-20 21:36:54 +01:00
Amaury Pouly
ce966d3d28 hwstub/tools: fix compilation of shell against lua5.3
The unsigned function were deprecated and hidden begind a compat flag. Since
they will get removed in the next version, I simply reimplemented them, those
are mostly casts anyway.

Change-Id: Ie5db81d7c8589b1e5e9b45a2a4ed41919aa07387
2016-11-20 21:36:54 +01:00
Amaury Pouly
06502772a8 nwztools/plattools: improve makefile to build images automatically
Change-Id: Ibf17fe523c6ef534368d6f94f43fce5ac0c91caf
2016-11-20 21:36:54 +01:00
Franklin Wei
e7d952db07 remove debug macro
Change-Id: I1bf6ecc5bb5275fd4addd3fdb62a89df441afe81
2016-11-19 13:41:46 -05:00
Franklin Wei
05733649bc XWorld: some fixes
Fixes sound on most platforms, original root cause was bad menu code
as well as DMA callbacks taking too long. Worked around with smaller
chunk sizes. Permanent fix would include moving mixing out of the
callback. Rewrites input with code from rockboy/doom. Cherry-picks a
change from Gregory Montoir's `rawgl' to patch the code wheel
screen. Finally, adds a motion blur filter on select targets.

Change-Id: I8df549c923c5075800c6625c36c8202e53de1d27
2016-11-19 19:17:14 +01:00
Marcin Bukat
deaeb73912 Add KAS for NWZ-E470
Change-Id: I1b8272a486ba2377e5047855acda3f80aa92c232
2016-11-14 20:54:05 +01:00
Amaury Pouly
0c1a96101c nwztools: rework dualboot
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
2016-11-12 22:16:48 +01:00
Amaury Pouly
33856d9ceb nwztool/scsitools: cleanup and add destination changer tool
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
2016-11-11 16:07:14 +01:00
Amaury Pouly
c95e30b75d nwztools/plattools: use player database and rework stuff
Using the database, we can now safely read/write the NVP. I also add more
support for Sony's "display" tool.

Change-Id: I8439fe9bad391c7f29859d99f236781be7983625
2016-11-11 16:07:14 +01:00
Amaury Pouly
44bb2856a5 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
2016-11-11 16:07:14 +01:00
Amaury Pouly
19de536ce2 nwztools/upgtools: cleanup
There is no need to store the key and sig since those are derived from the KAS
anyway.

Change-Id: I228913b1cb32e496db265e9a7aaf3bb4200a9f6b
2016-11-11 16:07:14 +01:00
Marcin Bukat
ba9f405dc4 ATJ hwstub make irq based usb driver work
0e2b490 introduced rework of usb driver which was broken. It was reverted
in f2da975 to restore hwstub functionality on ATJ.

This commit reenables usb rework AND fixes remining issues.
The problem was with 0 length OUT thransfers. Additionally
a few cleanups were made.

Change-Id: I529ea9ad6540509e9287ca7e1cd2b44369b03cbb
2016-11-10 13:57:02 +01:00
Marcin Bukat
f2da975be6 Revert "hwstub: rework usb driver for atj213x"
This reverts commit 0e2b4908d0.

Although I swear it was tested it apparently broke hwstub on atj.
I will need to investigate more whats going on. Revert for now.

Change-Id: I2ff3adf8c72bb0e53be7d81b975382adfb700eab
2016-11-08 08:37:24 +01:00
Amaury Pouly
3b7e7cb535 hwstub_shell: fix a horrible bug
Change-Id: I4ac259e6cd7b707ca725c6ba1c526f5aeed56b71
2016-11-06 21:59:50 +01:00
Szymon Dziok
a2d46868e2 SVG image of the Creative Zen Vision, plus other formats for the manual.
Change-Id: Ib6fa4a71014f718dd05cb754b80156c2e74ca1ea
2016-11-06 18:27:18 +01:00
Amaury Pouly
25bd580509 forgot file
Change-Id: I32e23035a608ee04a69690975ab4bf629a902388
2016-11-06 00:15:08 +01:00
Amaury Pouly
5017babb30 nwztools/plattools: fix black screen issue in dualboot, rework dualboot
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
2016-11-06 00:12:04 +01:00
Amaury Pouly
d492f25c54 nwztools: add preliminary dualboot and dualboot install script
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
2016-11-01 17:09:07 +01:00
Amaury Pouly
b045e4da34 nwztools/upgtools: sanitize series name and add keys
Unify series names: e46x -> 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
2016-10-31 17:51:18 +01:00
Amaury Pouly
0a2290653b nwztools/plattools: rework/clean and add an all-in-one tool
This new tool (all_tools) embeds all the other tools and provides a menu to
choose which one to run.

Change-Id: I0e07864dd46559a7079b0f942c25155e6fa07112
2016-10-31 17:50:16 +01:00
Amaury Pouly
ad9a2d5241 nwztools/plattools: add a tool to change destination and sound pressure
Since the nwz_lib does not have any nvp code yet, it's quite of ugly hack
with hardcoded nvp node (11) for shipment information (shp). Thus I whitelisted
two series (NWZ-E460 and NWZ-A860) which I know for sure use this node ID.

Change-Id: I94c9b0db1f9d7ad764d2aa50576a911e710f25e1
2016-10-28 23:28:25 +02:00
Amaury Pouly
3097239ce6 nwztools/plattools: add device list
This list can map from model id to device name. It was automatically extracted
from Sony's tools. In the future, we will probably generate it from a clean
database containing more useful information.

Change-Id: Ibe580edf25b60bf0bf4aef4a06f40dddd19c5404
2016-10-28 23:27:29 +02:00
Amaury Pouly
281c8d4700 nwztools/scripts: export model id in an environment variable
This is useful because there is no easy way to get it except from Sony's tool,
unless one knows the npv node, but that requires to know the model already...

Change-Id: I202f7cdb2f7cf924cc5bdb53c17e34600d4bf153
2016-10-28 23:25:43 +02:00
Amaury Pouly
37f95f67fe nwztools/upgtools: rewrite keysig brute force search
The new search has two new features:
- it takes advantage of the fact that DES keys are only 56-bit long (and not 64)
- it is now multithreaded
As a proof of concept, I ran it on the A10 series firmware upgrade and was able
to find the key in a few seconds using 4 threads. The search is still limited
to ascii hex passwords (seems to work on all devices I have tried thus far).

Change-Id: Ied080286d2bbdc493a6ceaecaaadba802b429666
2016-10-27 23:06:16 +02:00
Amaury Pouly
794104dd17 nwztools/plattools: switch to BACK key to quit
The power off/option does not exist on some models.

Change-Id: Ifb45293b3b3faa96d9fece2340cbd98299a4a0b7
2016-10-26 20:46:57 +02:00
Amaury Pouly
d42b43c786 nwztools/plattools: add test_power, rework input, add test_ts (touchscreen)
Change-Id: I55ca29627801b5e760d1dbe407d96cd055f659ab
2016-10-26 20:46:57 +02:00
Amaury Pouly
fed083cf06 hwstub: fix compile and linking ordering
Change-Id: I0acd3db2f644f4521da715d4931315bdb7548eae
2016-10-22 15:55:33 +02:00
Amaury Pouly
0b01ca69e0 nwztools/plattools: add adc test
Change-Id: Ic3ef964e8b5cc7b8ca3f02f141e9e4436a4d41db
2016-10-19 18:20:27 +02:00
Amaury Pouly
8d24b62912 nwztools/plattools: add backlight test
Change-Id: I4bef0824eeed54238578d8b24a9845e8602d61af
2016-10-19 17:58:40 +02:00
Amaury Pouly
ba91ff10e8 nwztools: add a new plattools directory with code to run on the device
This is code is intended to development into a library of code for the NWZ that
will be useful to write the "bootloader" on those device. At the same time, it
comes with test programs that are easy to run in firmware upgrade mode and also
provide a great test bench for the library. At the moment, two test programs are
available:
- test_display: simply prints two messages using /usr/bin/lcdmsg
- test_keys: displays input key event

Change-Id: I9d214894ffc9127b528fcdd3eb5d6b61f4e657a7
2016-10-19 17:09:04 +02:00
Amaury Pouly
13d892eef1 nwztools: update makefile and add script
The new script allows the upgrade to execute a file found on the user partition.

Change-Id: I564941d01bcdbae050002e77cb119f3d95ecdc21
2016-10-19 17:09:04 +02:00
Amaury Pouly
eaa1cb3469 fix typo
Change-Id: Ia69e5ff941549ca98b23b40927137bb29876b8f9
2016-10-19 17:09:04 +02:00
Amaury Pouly
21fb5aff39 nwztools: rework upg scripts
The exec_file allows to embed a script/executable and run it on target. It takes
of unpacking, remounting contents rw and redirect output to exec.txt at the root
of the drive. More generally, rework how the makefile works.

Change-Id: Iec719227be96e80701ad8f5398d2d34389f4da9e
2016-10-19 17:09:04 +02:00
Frank Gevaerts
2a2800b528 pdbox: fix bug shown by new gcc warning
Change-Id: Ife308a3090f9bc62f2e98d2d979fdf393c22054d
2016-10-12 16:52:49 +02:00
Sebastian Leonhardt
e6687c11f2 Rockboy: revert FS#11745 patch
William Shipley sent this patch via mailing list. Original Message:
  "There was a patch to rockboy in 2010 that fixed a problem where
  the bottom tile row would be rendered at the top.

  Here's the relevant issue from that time:
  http://www.rockbox.org/tracker/11745

  Note that Stummi openly admits it was a hack, not a true fix.

  Sometime in the 6 years since, the root cause was fixed. Currently,
  rockboy on the Clip+ and other 64px models shows the top of the gb
  screen along the bottom of the display.

  I confirmed that reversing this patch fixes the issue on my own
  Clip+"

I don't have any of the mentioned targets, so someone else has to test.

Change-Id: Id29b78c4ece0af53ba1280029c18b76808a21da2
2016-10-03 18:16:47 +02:00
Szymon Dziok
68d192e722 SA9200: Remove duplicated and misleading define.
Change-Id: I51f61349de8c32eeb70ca1812e7b34823f482f18
2016-10-02 23:42:13 +02:00
Szymon Dziok
a0b79ce7fa HDD16X0/HDD63X0: Enable power status of charging from USB.
Change-Id: I7b1e5e87921ae0770f7783680c3dbcdbf6f257f3
2016-10-02 23:30:30 +02:00
Szymon Dziok
e3deec949d HDD6330: Implement ATA power on/off.
This should fix some errors, panics in some individual cases.

Change-Id: I27ce41f0563378e03371724f8b044404c6e69b76
2016-09-25 23:11:21 +02:00
Amaury Pouly
50c1de7092 Fix makefile not rebuilding rbversion.h in some cases
For example when running make VERSION="bla"

Change-Id: I8f8833f0fb200828346ed0a6842a9340e3653932
2016-09-23 23:03:23 +02:00
Szymon Dziok
92450a9924 Mark Philips GoGear players as stable.
Change-Id: Id1f22488724d3ada5fa6efffc87e444add86400d
2016-09-22 22:34:42 +02:00
Amaury Pouly
1c4373fd1f imx233: fix dualboot, forgot a file
Change-Id: I8d5817d75f76a201c3a8b76db0d1e11f71548179
2016-09-22 21:31:29 +01:00
Amaury Pouly
6e553e315d fix red on stmp<3780
Change-Id: I74f0450e8f42032265b980b95f17b0b05d9dffa5
2016-09-22 21:13:12 +01:00
Amaury Pouly
673ee48675 imx233: fix dualboot stubs
They did not compile anymore after the register hearder rework. This change
only fixes the syntax, the generated binaries are exactly identical.

Change-Id: Iec2347aa3deb1ddfe2ca36f0db1e481c4e2d329c
2016-09-22 21:03:31 +01:00