Commit graph

1274 commits

Author SHA1 Message Date
Aidan MacDonald
65aa9ce570 x1000: more CPM register definitions
Change-Id: Ie6fa343a65a6bd19e578664b10bac771289ed0b3
2021-07-08 16:01:38 +00:00
James Buren
3831051c47 mknkboot: optimize verifyfirm
The checksum only needs to be calculated once. A small oversight on
my initial implementation.

Change-Id: Ie23faf36f5add7ed7f146769b604dbd8204c2605
2021-06-17 15:30:51 +00:00
Aidan MacDonald
89f4064743 x1000: Extend CPM registers for dual boot
Change-Id: I283834a653506fd95ff8b56897e5f3afaf375cf5
2021-06-14 20:45:14 +01:00
James Buren
a90ef8195b mknkboot/beastpatcher: implement basic firmware validation
This imports the MD5 code used by other utilities and creates
a function for checking the provided NK.bin against known original
firmware checksums. Integration into mknkboot and beastpatcher is
also added.

For the sake of consistency with beastpatcher, mknkboot had its
printf statements rewrote to print to stderr like beastpatcher
does.

Change-Id: I0e52271d8d627a5b02302ab5cd1da2815b7cec1e
2021-06-12 06:32:08 +00:00
James Buren
fe9bcd0468 beastpatcher: fix some minor issues
This mainly fixes some compiler warnings and makes it
work with mingw64.

Change-Id: Iabd13b5bed3427869ae78ceeb7e2255e68a6f7bd
2021-06-11 19:32:55 +00:00
James Buren
ab0f23c4b1 sendfirm: fix some minor issues
This patches some compile warnings and also makes it work correctly
with modern mingw64.

Change-Id: I8cd292bc989ae04bbaa1d7149d58d6d833a51c0a
2021-06-11 19:32:35 +00:00
Aidan MacDonald
2066465b78 FiiO M3K: minor fixes
- Drop obsolete NAND patch script (it's simpler to use 'dd' directly)
- Remove an outdated comment
- Fix missing 'void' in a function definition
- Reset the poweroff timer when we poke the backlight

Change-Id: I752624386f30ac95f41a731d2b6be837e12275a9
2021-06-01 00:26:20 +01:00
Aidan MacDonald
f63edb52ef x1000: refactor AIC initialization
Have pcm-x1000 handle most work, so target's audiohw code touches
only the relevant settings.

Change-Id: Icf3d1b7ca428ac50a5a16ecec39ed8186ac5ae13
2021-05-30 19:17:50 +00:00
Aidan MacDonald
f64e8dc33c x1000: Complete the register definitions
I think this covers everything now, although some fields are missing
enum values. Those can be added in if and when they are needed.

Change-Id: Ib1a94ba9c9a5949b6a038f8c1a49786823fae58f
2021-05-29 16:34:32 +01:00
Aidan MacDonald
75cb8ba8a4 FiiO M3K/X1000: add USB support
This only required a minor patch to the usb-designware driver due
to DMA requiring physical addresses -- on the X1000, these differ
from virtual addresses so we have to do the usual conversion.

Both the mass storage and HID drivers work, but there are a few
issues so this can't be considered 100% stable yet.

- Mass storage might not be detected properly on insertion,
  and USB has to be replugged before it shows up
- HID driver may occasionally panic or hang the machine

Change-Id: Ia3ce7591d5928ec7cbca7953abfef01bdbd873ef
2021-04-21 18:31:55 +00:00
Aidan MacDonald
3ec66893e3 New port: FiiO M3K on bare metal
Change-Id: I7517e7d5459e129dcfc9465c6fbd708619888fbe
2021-03-28 00:01:37 +00:00
James Buren
018372bf39 usb: implement macro for initializing USB strings
This uses the new unicode string literal feature that is available
now to greatly simplify the initialization of these special string
types. This makes them much more readable at a quick glance.

Change-Id: Iad8b49aa763486608e3bb7e83fb8abfb48ce0a7b
2021-03-25 13:26:03 -05:00
Aidan MacDonald
73cee8f177 Add RegGen-NG tool and definitions for Ingenic X1000
Change-Id: Ib9ec35c068e1cff8dcf120a13cfe3f5f58908a95
2021-03-02 00:36:01 +00:00
Aidan MacDonald
13c7f482ce Add ingenic_tools/usbboot utility
This is essentially an expanded version of jz4760_tools/usbboot,
able to support both X1000 and JZ4760 CPUs and easily extended to
handle other Ingenic CPUs using the same boot protocol.

Change-Id: I70ce3acc3531d65390c6bbae4d2b3352140acf0a
2021-02-28 02:52:56 +00:00
Aidan MacDonald
b8945734f5 Make headergen_v2's output include what it uses
Change-Id: Ie9790faac44c33a170bc2dc39d706575cefa0f2f
2021-02-27 22:02:31 +00:00
Dominik Riebeling
65d0867a25 rbutil: Add option to langstat to pass git hash.
Don't always operate on the remote head, instead default to the local
HEAD, and allow passing a hash to use for calculating statistics.

Change-Id: I420308e66769689c1dfac56e19058b097a0533a2
2021-01-02 21:31:20 +01:00
Dominik Riebeling
ff7e8b4293 deploy: Update sources list for Rockbox Utility.
Change-Id: If23a2ee8056b124500e385a9d973dfbddbc32e02
2020-11-22 18:30:01 +01:00
William Wilgus
47e1f96427 Bugfix Backlight_init should be called after lcd_init
the rest..

Change-Id: I50585ba2191aa8134de3045b1445859b27503a68
2020-11-13 13:57:39 -05:00
Amaury Pouly
235cdeca73 qeditor: add better fallback mecanism for icons
Change-Id: Ib87406c95fc6c579f108b81246350d12de428ba4
2020-11-04 13:14:42 +00:00
Dominik Riebeling
1058ed5b25 tomcrypt: Set target macOS version.
Make sure the target version isn't the default one so it also runs on
older macOS version than the current one.

Change-Id: Ib3517c97eee23ce1648e644ffc9daba2d1e7b599
2020-10-31 19:20:36 +01:00
Dominik Riebeling
1801dcc999 rbutil: Fix native Windows build for tools.
- When make on Windows finds sh.exe it will try to use that. We use
  cmd.exe calls when detecting Windows, so make sure we use cmd.exe as
  shell.
- Add missing Windows compatibility to tomcrypt Makefile.

Change-Id: Iaef133ca27472a5ddf449174d540983f15c66aea
2020-10-21 21:33:39 +02:00
Amaury Pouly
08513103c6 nwzstools: add NW-A820 nvp nodes
Change-Id: Iab79eb0c9b0bbf8fb7622f5630f385d56878507a
2020-10-18 22:34:16 +02:00
Dominik Riebeling
a05d061aa3 rbutil: Pass isysroot to rbutil libs on macOS.
On macOS we pass the full path to the compiler. On recent versions this
causes the compiler to not find its SDK path, this needs to get passed
via the isysroot option.

Change-Id: Iea2820e1755cc80e12691119dfa31d70938ea511
2020-10-18 19:16:27 +02:00
Dominik Riebeling
d097742155 sbtools: Change crypto wrapper implementation to C.
There's nothing C++ left.

Change-Id: I98d8406215287c02b56029ed7c0e2b0e645bbcf1
2020-10-18 19:08:32 +02:00
Dominik Riebeling
2037b837f8 sbtools: convert crypto to libtomcrypt.
Replace the use of crypto++ with tomcrypt, which is much smaller and C.
This gets rid of various build issues for systems that don't ship
crypo++ (i.e. everything except Linux.)

Change-Id: Ic0799e17b94935c71b14765cf9a2a7ea2b0adc7a
2020-10-18 19:08:32 +02:00
Dominik Riebeling
815b289cb3 imxtools: Replace use of "byte" with its underlying uint8_t.
libtomcrypt uses a macro "byte" which conflicts with this type. Since
the underlying type is uint8_t and there's no real benefit from using a
custom type use the actual underlying type.

Change-Id: I982c9b8bdcb657b99fa645a5235303af7afda25b
2020-10-18 19:08:32 +02:00
Dominik Riebeling
387a45923c utils: Add Makefile for our copy of libtomcrypt.
Change-Id: I6b9ffe86b9e78b494a3a9211d6e79bb81c9fb6d4
2020-10-18 19:08:32 +02:00
Dominik Riebeling
caa9d9c1c5 utils: Add (partial) libtomcrypt.
Add the parts of libtomcrypt that we're about to use.

Change-Id: I0adc1d7d1f4833e7bb3ed53b9a4d9a85977cfb8b
2020-10-18 19:08:32 +02:00
Amaury Pouly
df8b817c96 nwztools/scsitool: fix incorrect declaration in header file
Change-Id: I10727311db4747a66b3ae7f72a92a64cc99dfc82
2020-10-15 23:03:15 +02:00
Amaury Pouly
4e89e0e0ea nwztools: fix wrongly generate MD5 files
When generating the MD5 using -z index,name the tool would add the entry but
forgot to increase the file size, hence truncating the file.

Change-Id: Ibd3c594722ab46350cda60d158666fe34a96e922
2020-10-11 16:20:45 +02:00
Amaury Pouly
fcdfeb2a45 nwztools: re-implement MD5 on Windows
I forgot to fixup the windows up and missed it because of conditional
compilation

Change-Id: I526c765b9d56508815941ecb9b9dbac7ea407cf0
2020-10-11 14:10:12 +02:00
Amaury Pouly
e371dee4a3 nwztool: fix computation
It turns out the calculation gives the right result for the wrong reason, this
fixes it.

Change-Id: I36053c8993b5ae1e85380da59546ffade265fb3f
2020-10-11 13:08:03 +02:00
Amaury Pouly
8ce60c54f7 nwztools/upgtool: add support for MD5
When compressing, it is possible to tell the tool to add an entry to the MD5
file (index 1), it is still necessary to give an empty file for that index.
To do so, pass the option "-z idx,name" insteas of "-z idx". This will create
an entry of the form "size md5 name". For instance "-z 6,system.img".
When decompressing, if one passes "-z idx,name" instead of "-z idx", the tool
will decompress and check against the value in the MD5 file.

Change-Id: Ifb945f6121644ae9105265d2d83ce6067301c5b2
2020-10-11 13:08:03 +02:00
Amaury Pouly
7cba599106 nwztool/upgtools: add NW-A55 and DMP-Z1 KAS, reorganize list
Change-Id: I24bc6b15c954540cfa9b4f176ecbf817b1b641e7
2020-10-11 13:08:03 +02:00
Amaury Pouly
1b5e824405 nwztool/upgtool: add support for compression
To decompress some output file(s), simply pass -z <idx> where idx is the index
of the file to decompress, starting from 0. For example
  upgtool -e NW_WM_FW.UPG -o tmp/ -m nw-wm1a -z 6 -z 7
to decompress files 6 and 7. To compress file, use the same options:
  upgtool -c NW_WM_FW.UPG -m nw-wm1a -z 2 script.sh md5sum.txt system.img

Change-Id: I1ef0b3e02c98e58154f1a959fb1ad70ad2ce6500
2020-10-11 13:08:03 +02:00
Amaury Pouly
1f338f7078 nwztools/upgtools: add support for windows
In order to avoid the crypto++ mess, the code uses the Windows Cryptography API,
which is standard. There is also some makefile magic to cross-compile:
  make PREFIX=i686-w64-mingw32- EXE_EXT=.exe
I selected the option so that it should statically link supports libraries used
by gcc (slsj and libwinpthread).

Change-Id: Iaf07da23afe81ed217fb3921ce13367c5441514d
2020-10-11 13:08:03 +02:00
Amaury Pouly
05fa8fc343 scsitools: typo
Change-Id: I0f4e5b6c5e88a1ae49102e6f6fc6f8c86cb63959
2020-10-11 13:08:03 +02:00
Amaury Pouly
53d2742a48 nwztools: add support for new UPG format on post-WM1/A30 devices
The new code supports reading and writing UPG files. I kept the old keysig
search code but it only supports the old format (the new format has too long
keys anyway). Since we now have to support two types of encryption(DES and AES),
I reorganized the crypto routines and clean-up some code.

Change-Id: Ie9be220ec2431ec6d0bd11699fa0493b62e1cec2
2020-10-11 13:08:03 +02:00
Amaury Pouly
cda16f9439 scsitools: const correctness and add "get_dnk_nvp all" subcommand.
Change-Id: Ic5cb3dfa3be684f31a2c55a3cb7d45cfe8c65b25
2020-10-11 13:08:03 +02:00
Amaury Pouly
76fbb33adf nwztools: fix MW-WM1/A30 KAS, fix KAS length
Split WM1A/WM1Z because they don't have the same KAS. On newer devices, the KAS
is actually 64 bytes, not 60. The strange thing is that "get_dnk_nvp kas" returns
60 bytes whereas "get_dnk_prop kas" returns 64, not sure why.

Change-Id: I944d3d838209ba58388439af0cdf5d7c74f1f7fc
2020-10-11 13:08:03 +02:00
Solomon Peachy
ec413f7692 jz4760: Heavily rework USB driver to add working DMA support
* DMA Bulk IN (ie our TX) results in sequential transfers 33-68% faster.
 * DMA Bulk OUT (ie RX) is mostly stripped out due to complete brokenness.
 * Interrupt and control endpoints remain PIO-driven.

Other improvements:

1) Use consistent endpoint references (no magic numbers)
2) Greatly enhanced logging
3) DMA support can be compiled out completely
4) Setting lockswitch will disable all DMA operations at runtime
5) Much more robust error checking and recovery

Change-Id: I57b82e655e55ced0dfe289e379b0b61d8fe443b4
2020-09-17 11:26:04 -04:00
Dominik Riebeling
db350ac3e2 themeeditor: Get revision info from git.
We're not using svn anymore. This isn't used, but at least try to get
the right value.

Change-Id: I66e726d28b504a0f15d5b6497a02963243ba466a
2020-09-04 19:08:54 +02:00
Dominik Riebeling
6810d83686 themeeditor: Update targetdb.
Change-Id: Iec78635b46e08a508a20048a14687f3be830ad63
2020-09-03 19:14:11 +02:00
Dominik Riebeling
93bb14c877 themeeditor: Make NSIS script work with mxe.
Change-Id: I592a28f64f88c4ec0d1c4f45aeb8148ac2bc7d9b
2020-09-03 19:09:43 +02:00
Dominik Riebeling
fa330c109d themeeditor: Make it compile with current Qt5.
- Replace use of obsolete members with their replacements.
- Fix type issue that requires explicitly creating the right object now.
- Update project file to work with Qt5.

Change-Id: I3af2b1520796e977e58c0a01e165c77c469a23b9
2020-09-03 18:45:48 +02:00
Dominik Riebeling
ff38666a19 themeeditor: Fix download URL for targetdb.
We're not using svn anymore since long.

Change-Id: I408b1c59dfaafe1e403b0fa49b912862b68c72f8
2020-09-03 18:45:48 +02:00
Dominik Riebeling
3ff7dc75a1 themeeditor: Fix menu Quit entry not working.
Change-Id: Ib527b4b4a7b450dee713dea93eaf93d85c0d4bfd
2020-09-03 18:45:48 +02:00
Dominik Riebeling
6f92c498c4 beastpatcher: don't hardcode lib paths.
Let the linker find libmtp / libusb. Also don't insist on linking them
statically -- current Debian doesn't have a static libmtp.
Set STATIC to force linking statically.

Change-Id: I3ce9cea832705c87f08054435eadf9f169afedb2
2020-08-05 23:48:43 +02:00
Dominik Riebeling
a9c7bc7c9a deploy: Simplify retrieving CPU count.
The multiprocessing module is part of Python since 2.6, so no need to do
an extra check here.

Change-Id: If1c223edf9f04b6de8fdf757ba00f79897783a53
2020-07-26 09:56:20 +02:00
Solomon Peachy
dcdf2713f6 Python3-related fixes in some of our scripts
Change-Id: I8acbe43e3f27e51159a7a78fcc361476d7406cbb
2020-07-09 14:39:27 +00:00
Lorenzo Miori
92a529b4d1 Samsung YP-R1: fix OF boot shortcut
ypr1 target should switch back to OF by pressing volume down,
since volume up is already mapped to the early/safe mode.

Change-Id: I18c4deed2c8982dbee18b081ecc59b970c654473
2020-07-07 17:52:17 +00:00
Lorenzo Miori
2dd6633d71 ypr0 - ypr1: dynamically move rockbox executable
This trivial patch wants to exploit /tmp filesystem to place
Rockbox executable. Why that? It will be then possible to
easily unlock & umount the storage partition, in order to provide
Rockbox itself a mean for RAW storage access. In turn, this will
allow a Rockbox-handled USB Mass Storage support, as well as other
goodies (storage info is one I can think of).

It takes way less than a second so it doesn't hurt boot time.
Moreover, YPR0/YPR1 targets have plenty (64MB) of RAM, so
the humble half meg executable won't hurt at all.

Change-Id: Ibc9d9a40712e924c8e19cfd7c62189b182f0401a
2020-07-07 17:51:41 +00:00
Lorenzo Miori
3016d74c5a Samsung YP-R0: remove deprecated kernel module
This patch removes the deprecated kernel module to manage
the fm-radio chip on the ypr0 target.
http://gerrit.rockbox.org/r/#/c/1594/ implements the interface to
the i2c bus by using the i2c-dev kernel driver, no need for
additional complexity.

Change-Id: I0d09e2e9d1714b3cb8a72b3d79a91602a627cc90
2020-07-07 16:51:05 +00:00
Dominik Riebeling
a686dbfaa4 sbtools: Avoid calling pkg-config on each compiler invocation.
Only expand pkg-config calls once by making the compiler flags simply
expanded variables. Makes things more predicable and slightly faster.

Change-Id: Ie2ed066f205a95ec8a7708cefeb29e9989815db6
2020-06-21 09:07:17 +02:00
Dominik Riebeling
9b4e6ef7b3 deploy: Support Python3.
Change-Id: Iff92a1f6a918f7da80f26f1a9ca02a6f6f082b7d
2020-06-13 20:11:53 +02:00
Dominik Riebeling
440791105a deploy: Fix various style issues.
Fix various pylint issues and some python3 compatibility.

Change-Id: I2c35ccc5ad2d0902c229f9de57912cf6d5a83ece
2020-06-13 20:11:48 +02:00
Dominik Riebeling
aefbc13e19 deploy: Add missing Windows system libraries to known list.
Building with mxe failed due to the toolchain (and Qt5) introducing
dependencies to system libraries we don't know about. Commit 3083abeb95
thus ignored the actual problem. Revert that and instead add the missing
system libraries to the list of known libraries.

Change-Id: I29ac296765e580b751d3d906d58ab563d05efde2
2020-06-13 20:11:43 +02:00
Solomon Peachy
2434b6ca25 misc: Remove all 'twiki' references in favor of up-to-date 'wiki' links.
(This migration happened over a decade ago!)

Change-Id: Ib396414a16f2d763e549af49e3f3b03047dab49c
2020-06-07 01:38:55 +00:00
Amaury Pouly
fba4df5d6d nwztools/scsitool: add command to write NVP
Change-Id: I4a7a9688af1abb14de82013703f3a02b4644d5ed
2020-05-27 23:39:06 +02:00
Amaury Pouly
c75dbaae25 nwztool/scsitool: add brute-forced kas
Change-Id: I692b06c7c456bfa4395aa2aa848fdc664bd203d4
2020-05-17 20:21:13 +02:00
Amaury Pouly
47104e9e51 nwztools/scsitool: add preliminary code to decode SCSI requests
This can be useful to quickly device usb traces

Change-Id: I843fbd5280f11686ea810b44ffb1414e844ebcf9
2020-05-17 20:21:13 +02:00
Amaury Pouly
e3532b1667 nwztools/scsitool: fix compile issue with some version of cryptopp
Change-Id: Ia20f0142a2b08bddd61a0056f49c8e4c9ed49caa
2020-05-17 20:21:12 +02:00
Amaury Pouly
ae6a49638b nwztools/scsitool: add more NVP properties
At least newer devices support more NVP properties in a device-independent
numbering. Many are supported but I just added two useful ones

Change-Id: I57926de7f0dd364b46a57ca8d48a5c4d4f20402b
2020-05-17 20:21:12 +02:00
Amaury Pouly
f86723716c nwztools/scsitool: add alternative firmware upgrade command
Newer devices seem to require flags 0x00 where older devices wanted 0x80, now
try both variants

Change-Id: Ifeee641052857c66c1b64860d7309a235021a168
2020-05-17 20:21:12 +02:00
Amaury Pouly
1686093e78 nwztools/scsitool: tweak output
Change-Id: I43c5101502f3d2c34296b510b738276fd74f9b3d
2020-05-17 20:21:12 +02:00
Solomon Peachy
9eba95d625 FS13192: rbutil: Fix linking error on Fedora 32 beta
Change-Id: I350553db037ad9f65aced3f974afeaeee3fe822a
2020-03-29 18:57:08 +02:00
Amaury Pouly
05a40ab07c scsi: add support for listing devices on Windows
Change-Id: I963028c6017796152a201791c078f672bf84a40a
2020-01-29 13:27:18 +01:00
Amaury Pouly
392db31d90 sonynwz/scsitools: fix string buffer size
Change-Id: I8997e7c3791b805a70a30cd1209a69b7afbec1e7
2020-01-29 13:26:42 +01:00
Amaury Pouly
44fb7f384e sonynwz/scsitools: add NWZ-S610 series
Change-Id: I8977e1bcc805df463f7b08f11be889368db4eab2
2020-01-29 13:25:56 +01:00
Amaury Pouly
ee15e45224 nwztool/scsitool: rewrite device detection on linux to make it simpler
Change-Id: I8f393a53ea64c82f05e437923bcba05aa8a7a75c
2020-01-12 23:12:18 +01:00
Amaury Pouly
9e94a5eadc nwztools/scsitool: fix out of buffer access
Change-Id: Ib2c25dd21d39fda026e008950a805f032c916a72
2020-01-12 23:11:59 +01:00
Amaury Pouly
fbad457339 nwztools/scsitools: simplify code and enable O2
Change-Id: Ic14bc5ff643c9cf4c6380b4c34999d704c65e460
2020-01-12 21:42:23 +01:00
Amaury Pouly
d6c9303c75 sonynwz/scsitools: add support for NW-A56
Change-Id: I07e57218638ef62c0e4bf92833add6c3ba7bdcd8
2020-01-12 17:59:02 +01:00
Franklin Wei
3083abeb95 deploy-rbutil.py: allow zipball building to proceed if no DLLs are found
This helps with MXE static builds, which were failing because no DLLs were
found.

Change-Id: Id3fcdf9a7682a9ecb6a5892415077bf16e8b24cb
2019-11-14 19:42:06 -05:00
Franklin Wei
b2fb095ab5 rbutil: include nwztools source in release tarball
Change-Id: Ic6d998441fb532a914eea2838fdc0d196f930bb2
2019-11-10 19:56:50 -05:00
Franklin Wei
a5f228eee2 rbutil: fix windows cross compile (via M cross environment)
This fixes a couple of issues when cross-compiling for windows:
 - lib builds (i.e. mks5lboot) were overriding the cross CC/CXX with the
   native CC, producing incompatible binaries.
 - Qt made the accessibility plugin part of the core library, so we no
   longer need to import it.

Change-Id: I9d884aee62dfa51d3624a3fa9b99c23b3b375f20
2019-11-09 20:54:57 -05:00
Amaury Pouly
4ed5727654 nwztools: fix Makefile
Seems like newer versions of mingw will sponteanously add a .exe suffix to
the output path if it doesn't have one, for example mingw-gcc -o scsitool bla
will actually create scsitool.exe and of course this breaks my release script.
Fix this by explicitely adding the .exe to avoid any problem

Change-Id: Ic8019b968b532b2ca612ba0c03977a96c22cee01
2019-04-22 23:45:33 +02:00
Amaury Pouly
063ff294a2 nwztools: add DMP-Z1 to the database
This is one of those fancy gold-plated devices. Of course it breaks my scripts
that were nicely expecting every device to start with NW.

Change-Id: I161320f620f65f4f92c2650d192b26a9831eeb9d
2019-04-22 23:45:33 +02:00
Solomon Peachy
07084f62c4 Fix host build of mkimxboot, mknwzboot, nwztools, and rbutil with crypto++
Necessary to get working builds on my Fedora 29 system.

Change-Id: Ia6232427c959629ade9a85fc412738f688facedb
2019-01-25 12:58:18 +01:00
Amaury Pouly
c1194aedb0 sonynwz: add NW-ZX300G nvp info
There is something weird going on: the Sony website has two different entries:
- NW-ZX300/NW-ZX300A/NW-A45/NW-A47/NW-A45HN/NW-A46HN
- NW-ZX300,NW-ZX300A update(20181004)/NW-ZX300G
with slightly different nvp entries, but it is impossible to tell whether
an NW-ZX300(A) belong to one or the other. Since the diff is very small,
I am adding this as nw-zx300g but treat all devices as nz-zx300 since the
destination node is the same and that is the main usage of the tool anyway.

Change-Id: I3dc2fdec52650f938d568bed578184f6bc43d130
2018-11-30 15:37:10 +01:00
Amaury Pouly
110e3b43a0 sonynwz: add NW-A57 and NW-ZX300G to the database
Change-Id: I9bbfa56c5b2d79568de5443f1098d724c4beda6a
2018-11-30 15:37:10 +01:00
Amaury Pouly
4c318057f6 nwzstools/scsitool: try to guess series if possible
If the model is not known (ie model ID in the database) but another device from
the same series is known, then the database information probably applies and
one can use the "force" option -s to tell the tool to ignore the model ID.
Automatically print such advice when the series can be guessed.

Change-Id: I6bcc7aa29693df8c3d7d8e709ece7cea650be717
2018-11-30 15:37:10 +01:00
Amaury Pouly
da752d0084 nwztools/scsitool: add experimental command to list Sony devices
Change-Id: Ic4f382667c5c84514be661d36032c47fb8f92e75
2018-11-30 15:37:10 +01:00
Amaury Pouly
e01248efcd rbscsi: add experimental API to list connected SCSI devices
For now it is only implemented on linux using /sys scanning

Change-Id: Ifdfe7564e6e8d0307ae6ddc53e49bb9aaf5a8268
2018-11-30 15:37:10 +01:00
Amaury Pouly
4365437159 Indentation fix
Change-Id: Ia0f96dd27c520cf2bfec4765619f53eaffee3e20
2018-11-30 15:37:10 +01:00
Amaury Pouly
110fd2cae6 Add the NWZ-A844 to the database
For some reason even Sony didn't have it in its list...

Change-Id: I26de6071e5887cc7c6ebb695ea333c7b3d1b50db
2018-11-30 15:37:10 +01:00
Amaury Pouly
0120ecd651 sonynwz: add nvp map for NW-A50 series
Change-Id: I49f3399552721e515cc01021c2e0aa28c781ec28
2018-10-29 15:10:24 +01:00
Amaury Pouly
8a4cb5e619 sonynwz: add NW-A55 to database
Change-Id: I59861119c59490f586b3c6ed32a1c41df8b3d365
2018-10-29 13:29:39 +01:00
Marcin Bukat
734be0d6aa MIPS: fix memset()
swr/swl instructions used for word aligning were wrong. This
made memset() terribly broken. I can't imagine how it went
uncaught for soooo long. Spotted by Solomon Peachy.

I run unit tests for alignments 0,1,2,3
size 1, 2, 3, 4, 5, 63, 64, 65, 127, 128, 129;
and fill pattern 0x00 and other (since 0 is special case in this
implementation).

Change-Id: I513a10734335fe97734c10ab5a6c3e3fb3f4687a
2018-09-07 09:43:05 +02:00
Amaury Pouly
11437662c4 nwztools/scsitool: fix completely stupid code
Change-Id: I3771388d24fe5fa249dcb40b231d7a4e06d3c3c8
2018-01-13 19:12:43 +01:00
Amaury Pouly
4d988d43d8 nwztools/scsitool: print clearer message when nvp info is incomplete
Change-Id: I13b20b88b35e825da929a31e71ff42d68a79f131
2018-01-13 12:18:01 +01:00
Amaury Pouly
6c856c412a Add information for NWZ-S630 and NWZ-S730
Change-Id: I4c48c9a8d862eaf67ec27c1c13b9b7f1fb204fc0
2018-01-13 12:07:21 +01:00
Amaury Pouly
0d794c0c06 sonynwz: Add NVP information for NWZ-A810
Change-Id: I37671ddf15ee1a4b469f97fe06ec86249ff9ce60
2018-01-07 23:24:58 +01:00
Amaury Pouly
ec4fa0333c hwstub: add code to dump STMP rom
Change-Id: I083024662f3c085f7bcd2f85b0a68de85725b0f3
2017-11-12 14:14:30 +01:00
Amaury Pouly
dd6b8427f9 hwstub: expose read/write functions
Previously only atomic read/write 8/16/32 were exposed. But it is useful to
be able to read a whole buffer at once, this is more efficient than N times
read8.

Change-Id: I06e331641e1ab1f74c0e16e8c432eafb398e8e6d
2017-11-12 14:13:21 +01:00
Amaury Pouly
df0edba18e hwstub: fix horrible bug
It's a wonder it worked, basically any big transfer returned garbage

Change-Id: Ic2b2fc1805423c70db8eac40692ba842c72462ab
2017-11-12 14:12:44 +01:00
Amaury Pouly
07d3b3c1fb nwztools/scsitools: print device list when listing series
Change-Id: Ic46c724c5d89a775dc20853410c8fe6f0ff9a4c8
2017-11-01 12:43:33 +01:00
Amaury Pouly
62f0ba1c30 nwztools: add NW-A46 to the database
Change-Id: I85dc2080e0be07ff689384c0445f4f1595baf4ac
2017-11-01 12:43:33 +01:00
Amaury Pouly
7807934a27 atjboottool: document more header fields and crypto code
The encryption definitely uses some standard elliptic curve encryption over
binary fields (163 and 233 bits, standard polynomials). It is still unclear
how this is used in the actual encryption, the key authentification and
derivation do not look standard.

Change-Id: I6b9180ff7e6115e1dceca8489e986a02a9ea6fc9
2017-10-26 18:17:59 +01:00
Amaury Pouly
819d3ee02e nwztools: add NW-A45
Change-Id: I75a7723498564ee73c3682391582e354ad672fd7
2017-10-24 17:47:28 +01:00
Amaury Pouly
2ae792c2f5 nwztools: add NW-ZX300A
Change-Id: I8b311ed6b48b92b9ecf4fb25c19119cfb2d5beb1
2017-10-24 11:46:19 +01:00
Amaury Pouly
e441c2696d nwztools/upgtools: make the tool print the whole kas, not just 16 bytes
Change-Id: I9daca9148b7aaea905a765dfeb95faf6fb7198b1
2017-10-22 15:35:10 +02:00
Amaury Pouly
7e42e90294 atjboottool: add support for FwuTail
Change-Id: Ib01a2ff92294dd0bb59439c23f26bc31eafa4a39
2017-10-20 23:57:58 +02:00
Amaury Pouly
6e79c4cb7c nwztools: add KAS for NW-A40 series
Change-Id: I6e22ba0a58eb62dcc9f2025ee7233f5afae1bbec
2017-10-20 19:46:35 +02:00
Amaury Pouly
1eab18c9e4 nwztools/scsitools: don't try to get nodes when we don't know about the device
Change-Id: Id35671f1e039a94e2b319262e4faa51d73f12afd
2017-10-17 13:34:54 +02:00
Amaury Pouly
9a8a52cb07 nwztools/scsitool: slightly rework of help_us and help
Now print list of devices immediately even if the rest of the command line
is empty (ie 'scsitool -s ?' works, whereas before one would need an actual
device to even get a list). Add more information in the help_us command:
print kas, lyr and fpi.

Change-Id: Icfeeaeebe28c774a74ca54661357fafa25c3d114
2017-10-17 13:05:58 +02:00
Amaury Pouly
6922323466 sonynwz: add NW-A47 to the database and regenerate nwz_db.{c,h}
Change-Id: I6331a48a4d336348e90a32cf151427b29eeedb2b
2017-10-17 13:05:11 +02:00
Amaury Pouly
5af813c5b7 nwztools: add NW-ZX300 KAS, extracted from a device
Now this is very weird, is it yet another format/encryption?

Change-Id: I119dec1e6d636a99508fb1394de27237ca3ab814
2017-10-07 22:01:00 +02:00
Amaury Pouly
0fbd93b7e6 nwztools/scsitools: fix database
I forgot to add the NW-ZX300 to its series

Change-Id: I78fd9440492e1868b887f6a2e137d4d0c2ff199a
2017-10-07 18:44:30 +02:00
Amaury Pouly
7eb240a288 Add Sony NW-ZX300 model id to database
Change-Id: I8e7a14b86408c52cbd4a059e2db6a9c9d0966fc6
2017-10-07 12:45:48 +02:00
Amaury Pouly
2f3801be34 fix typo
Change-Id: Ic357f82d61cc0004ac6193fa9dbbc90976042574
2017-10-06 18:31:11 +02:00
Amaury Pouly
d9da4833a7 nwztools/scsitool: various improvements
The tool now provides more useful information for developers when the device
is not supported. Is also has a new verb "help_us" that also prints all this
information (notably the device info and model ID).

Change-Id: I04baec8fff23eb83a0408add6296b5d42e9aa8e7
2017-10-06 12:10:40 +02:00
Amaury Pouly
698779e3e8 sonynwz: add nvp nodes for NW-A40/ZX300, various fixes for tools
We still miss the model IDS for those device so scsitool won't be able to
recognize them automatically.

Change-Id: I17ae0f0d95c011cea8e289def63c7673b6c4b667
2017-10-06 12:10:33 +02:00
Amaury Pouly
ea679de837 atjboottool: put afi and fw code in its own files
Change-Id: I16347ebee0f82d5fdf32f5aa8f955c07fe148eba
2017-09-29 18:22:30 +02:00
Amaury Pouly
95c32a505a atjboottool: split fwu code into its own file
Slightly cleanup the code by removing the old and dangerous --force option.

Change-Id: I776633a9924797fcd509b8b80623bcd64b391672
2017-09-29 17:56:04 +02:00
Amaury Pouly
5f4de5bf48 nwztools/scsitools: make do_fw_upgrade output less confusing
Change-Id: If616e646aeddf20aa3cee79a821a420d9102c708
2017-09-19 21:53:52 +02:00
Amaury Pouly
99cc8f8802 upgtools: fix bug in brute force search
DES ignores the parity bit of each byte (making the 64-bit key really 56-bit),
but the current code skipped the parity bit of each half-byte, thus missing
some keys.

Change-Id: Ia523ebb944e458905b7de1742df151df22166150
2017-09-19 15:30:37 +02:00
Amaury Pouly
127e6bbfdd Add support for the NWZ-E350
Strangely it has the SAME encryption key as the E450. Either they didn't bother
changing it or more likely they have exactly the same internals and a slightly
different case.

Change-Id: I39ab88845b3e40db34160c2e61dde421f391df44
2017-09-17 23:47:49 +02:00
Marcin Bukat
8b744571c0 ATJ hwstub: Add cache coherency
All the hard work was done by pamaury. I simply added proper
defines.

Change-Id: Ib374eea7cd20f35518ad8a68d771c57c54ae01ca
2017-09-15 21:44:59 +02:00
Amaury Pouly
e6de6c107e qeditor: add workaround for c++11 in qt4, suggest to use qt5
Change-Id: Iad7b8fd171d57228796a68cb3406914213b91926
2017-09-06 20:45:34 +02:00
Amaury Pouly
1d121e8c08 Initial commit for the Sony NWZ linux port
SUPPORTED SERIES:
- NWZ-E450
- NWZ-E460
- NWZ-E470
- NWZ-E580
- NWZ-A10

NOTES:
- bootloader makefile convert an extra font to be installed alongside the bootloader
  since sysfont is way too small
- the toolsicon bitmap comes from the Oxygen iconset
- touchscreen driver is untested

TODO:
- implement audio routing driver (pcm is handled by pcm-alsa)
- fix playback: it crashes on illegal instruction in DEBUG builds
- find out why the browser starts at / instead of /contents
- implement radio support
- implement return to OF for usb handling
- calibrate battery curve (NB: of can report a battery level on a 0-5 scale but
  probabl don't want to use that ?)
- implement simulator build (we need a nice image of the player)
- figure out if we can detect jack removal

POTENTIAL TODOS:
- try to build a usb serial gadget and gdbserver

Change-Id: Ic77d71e0651355d47cc4e423a40fb64a60c69a80
2017-09-05 21:42:12 +02:00
Amaury Pouly
e2271ed75e qeditor: fix compile error and some comments
Change-Id: I157c83fea8173adc53254f15aa49e41ee1ba7549
2017-08-28 22:52:29 +02:00
Amaury Pouly
d1ca2e45e9 atjboottool: cleanup and add support for atj2127
Several people asked me recently how to decrypt atj2127 firmware. Someone
posted on github (https://github.com/nfd/atj2127decrypt) a decrypt utility
clearly reverse engineered from some unknown source. The code is an absolute
horror but I concluded that ATJ changed very little between ATJ213x and ATJ2127
so I added support for the ATJ2127, credit to this github code that I stole
and rewrite (code was under MIT licence). At the same time do some small code
cleanups.
Note that there is not 100% sure way that I know to distinguish between the
two firmware types, so the code tries to do an educated guess to detect
ATJ2127. If this does not work, use --atj21217 option. Also note that contrary
to the github tool that decrypts and unpack in one go, this tool only does one
step at once. So first decrypt: HEX -> AFI, then unpack AFI -> files.
I also added for a different version of AFI. Based on AFI files I have, there
are, I think, two versions: the "old" ones (pre-ATJ213x) and "new" ones. The
tool only supported the new one but for some reason the ATJ2127 uses the old
ones without a mostly empty header. Strangely, even this mostly empty header
does not seem to follow the old layout as reverse engineered by the s1mp3
project (https://sourceforge.net/p/s1mp3/code/HEAD/tree/trunk/s1fwx/heads.h),
so in fact there might be three versions. In any case, only the header is
different, the rest of the file is identical so at the moment I just don't
print any header info for "old" files.

Change-Id: I1de61e64f433f6cacd239cd3c1ba469b9bb12442
2017-07-30 14:32:12 +02:00
Amaury Pouly
37a945d203 nwztools/scsitool: add a command to query multiple nvp nodes at once
Change-Id: I89fed904b282a202bc845b08f4c8d1200a49636d
2017-06-18 23:16:18 +02:00
Amaury Pouly
91ede1ea08 nwztools/scsitool: fix devinfo, add dhp
The devinfo request returned the raw data, now the tool prints the various
fields. Also add support for the dhp (destination/headphones/color ...): this
one is untested because it's only supported starting from A10 or A20. There is
still a problem with the dpcc prop: although it should work for DEVINFO, it does
not, despite the fact that the get_dev_info command works and is internally (on
the Sony) translated into a dpcc request. I keep the code just in case.

Change-Id: I5aa8ef4afb0b11d3c0ddfa3d38f3e737ee1aff66
2017-06-18 13:37:26 +02:00
Amaury Pouly
8d5dcd395d nwztools/scsitool: print error on check sense
The detailled error message is only printed if -d switch is on command line,
otherwise there is no error message which is wrong so fix that.

Change-Id: I397541c467940e9b290ee8d4ae704368b1ce132b
2017-06-18 13:35:42 +02:00
Amaury Pouly
e9bb9a25ad nwztools: add KAS for NW-S10 (brute-forced using upgtool)
Change-Id: Ia37818faee29130ffe3690c83f85a39bd35637e0
2017-06-13 21:03:03 +02:00
Amaury Pouly
cd812218ab nwztools: add nvp description for NW-S10 series
Change-Id: Id6a6e51288f4ff24c0063b6c16b74109211e63c0
2017-06-13 20:41:43 +02:00
Amaury Pouly
28c3f6b4d3 Add NW-A36 and NW-A37 model IDs, based on the A30 service manual.
I am unsure about the names of the player, the manual says A36HN and A37HN but
at the same time there is a A35 and A35HN with the same ID, and Sony does not
usually put the "HN" in its device list.

Change-Id: Idbf32970aa334b30f1b8947a78b8eebd524b193b
2017-06-05 16:17:13 -05:00
Igor Skochinsky
03dd4b92be nwztools/database: misc improvements
* make gen_db.py work on Windows/Python 2

- use hashlib module instead of md5sum, also don't rely on / for file path
matching
- don't use 'file' for a variable name

* fix parse_nvp_header.sh for older kernels

pre-emmc kernel sources use a slightly different #define format; adjust
regexp to catch it.

* add nwz-x1000 series NVP layout (from icx1087_nvp.h)

some new tags have no description, alas the driver doesn't have
them :/

*  minor fixes to nvp/README

fixed typos/wording

Change-Id: I77d8c2704be2f2316e32aadcfd362df7102360d4
2017-04-25 11:24:24 +10:00
Igor Skochinsky
f1c8d63a76 nwztools/upgtools: misc fixes
* added KAS for nwz-x1000 (extracted from an NWZ-X1060 via "get_dnk_nvp kas")

* hint that -o is needed when extracting

Change-Id: Ic91c448aa058a22c8ddcae54726f628f7cf60f6b
2017-04-25 11:23:57 +10:00
Amaury Pouly
88dd2026c4 nwztools/upgtools: add key for NWZ-A840
Change-Id: I0a191db1970e64b5ced518c68861392ba342404f
2017-04-25 11:22:08 +10:00
Amaury Pouly
15e66a5b19 nwztools: small cleanups
Change-Id: I4fde020ca0556a84d051f9b5e46f49ee1241266e
2017-04-25 11:21:54 +10:00
Amaury Pouly
1597c4fe34 scsi: don't make the linux lib depend on a library header file
The code dependend on the sg_lib header being present, remove this dependency
so that we only need public headers.

Change-Id: I69398453635135deb33e2adf67f15ddb80e4ba16
2017-04-03 15:02:19 +02:00
Amaury Pouly
d052f13999 nwztools/script: fix dump_rootfs.sh to handle ext4
Change-Id: I04bd7599a58669df96dfd018a2ab0e3d53e06694
2017-02-04 17:20:09 +01:00
Amaury Pouly
2ea0ccb6c5 regtools/qeditor: replace deprecated QStyleOptionViewItemV4
...by QStyleOptionViewItem. Yes Qt got it right, in 5.7 they deprecated
QStyleOptionViewItemV4 and recommend using QStyleOptionViewItem which contains
less fields except on newer Qt where it contains all fields. Hopefully it still
works on Qt>4.x for a large enough value of x.

Change-Id: I013c383d2424b04c1c0745f0d7b1d5e62a29d324
2017-02-04 17:19:50 +01:00
Amaury Pouly
2a3a6bb4b3 regtools/qeditor: compute RAM size
Change-Id: I7bfb5cc25bc3dc55f379b2319b20dc9510434de0
2017-02-04 17:19:20 +01:00
Amaury Pouly
fa5324bbbb regtools/qeditor: enable imx233 analysers for imx233
The clock structure is identical, and the EMI are the same.
Also fix SSP clock, it was broken on imx233 as well.

Change-Id: I25ec66059b00b1a456ef2f02131d225082536c0a
2017-02-04 17:18:59 +01:00
Amaury Pouly
fafb770ca5 regtools/soc_desc: fix bug in library
Because a node ref is at root doesn't make it valid, check that soc is valid
otherwise we return garbage.

Change-Id: I6e5befc959dc670ab39a87484e87af6d90be7726
2017-02-04 17:18:37 +01:00
Amaury Pouly
6f0f1193e5 regtools: add new tool list/find/describe registers
Change-Id: I2d93d24bd421e1a2ea6d27b8f7cfd17311e6d458
2017-02-04 17:18:13 +01:00
Amaury Pouly
a1d1832049 hwstub: be more quiet about register description loading failure
Change-Id: I0edbb838022b71485179edec7361a6c554a1ab11
2017-01-24 15:34:20 +01:00
Amaury Pouly
30ac37b20b hwstub: fix memory leak in net backend
Change-Id: I98bef5aa0c518e698c42761d02899adde8bc4aca
2017-01-24 15:34:20 +01:00
Amaury Pouly
fdb98c258f hwstub/jz4760b: add lua code to probe for ei/di and ext instructions
Add lua code to check whether ei/di and ext instructions are supported. This
is unclear since xburst is somewhere between mips32r1 and mips32r2. Details
results are below, but in summary: they don't work (ei has no effect, di/ext
cause illegal instruction exceptions)

> ./hwstub_shell -q -b -e 'require("jz/misc"); JZ.misc.enable_sram()' \
  -f lua/xburst.lua -e "XBURST.test_ext_inst(0xb32d0000)"
[...]
Selecting soc jz4760b. Redirecting HW to hwstub.soc.jz4760b
  data: d7168acf
error: lua/xburst.lua:209: call failed
trapped exception in call

> ./hwstub_shell -q -b -e 'require("jz/misc"); JZ.misc.enable_sram()' \
  -f lua/xburst.lua -e "XBURST.test_ei_di_inst(0xb32d0000)"
[...]
Selecting soc jz4760b. Redirecting HW to hwstub.soc.jz4760b
Testing ei
  Test SR
    Enable interrupts with CP0
    SR: 0x1
    Disable interrupts with CP0
    SR: 0x0
  Test ei/di
    Enable interrupts with ei
    SR: 0x0
    Disable interrupts with di
error: lua/xburst.lua:244: call failed
trapped exception in call

Change-Id: I2e162b5dd5e70488bcd8b58f3ca401a3ecab3c4b
2017-01-24 15:34:20 +01:00
Amaury Pouly
9bb6050d40 hwstub: rewrite exception catching
Since we can catch exceptions like data aborts on read/write, it takes very
little to also catch exceptions in calls. When extending this with the catching
of illegal instructions, the call instruction now becomes much more robust and
also for address and instruction probing. Since we can catch several types of
exception, rename set_data_abort_jmp to set_exception_jmp. At the same time,
simplify the logic in read/write request handlers. Also fix a bug in ARM
jump code: it was using
  stmia r1, {..., pc}
as if pc would get current pc + 8 but this is actually implementation defined
on older ARMs (typically pc + 12) and deprecated on newer ARMs, so rewrite the
code avoid that. The set_exception_jmp() function now also reports the exception
type.

Change-Id: Icd0dd52d2456b361b27c4776be09c3d13528ed93
2017-01-24 15:34:19 +01:00
Amaury Pouly
f3cce72269 hwstub/jz460b: implement exception recovery
Now that we now that jz4760b implements EBASE, we can use it to rebase
exceptions to use a k1seg address, that maps to the physical address of the
TCSM0. It requires to enable HAB1 to have this translation. This most the most
inefficient way to access tighly coupled memory ever, but it works.

Change-Id: I894ca929c9835696102eb2fef44b06e6eaf96d44
2017-01-24 15:34:19 +01:00
Amaury Pouly
07bc348c91 hwstub: add tool to dump memory regions (such as ROM, RAM, or peripherals)
Although this case be done with hwstub_shell, this is common enough to deserve
its own tool.

Change-Id: I9253e40850f37257464548a3acefb14ea083841d
2017-01-24 15:34:19 +01:00
Amaury Pouly
f4091be1d3 hwstub: small fixes to argument processing and usage()
Change-Id: I3daa5e0c3fa2e7eab6a3d75b4c8aa66254d72f3c
2017-01-24 15:34:05 +01:00
Amaury Pouly
9851849ae6 hwstub/jz4760b: build packtools automatically if neeeded
Change-Id: I543e405bf75868d0f7509a35e08fe31ed253e0e6
2017-01-24 15:31:05 +01:00
Amaury Pouly
8934169666 hwstub: add verbose mode to make
Use make V=1 to print all commands

Change-Id: I28bd4151178413f10ddab292f1d582a9d019f5ea
2017-01-24 15:31:05 +01:00
Amaury Pouly
eadba57d53 hwstub: fix long transfers failing because of control xfer size of libusb
libusb limits control transfer sizes to 4k, see diff for details.

Change-Id: Id2e638010274009ea641d06e9040a8b9ab9d54a9
2017-01-24 15:31:05 +01:00