summaryrefslogtreecommitdiffstats
path: root/rbutil/mkimxboot
AgeCommit message (Collapse)AuthorFilesLines
2020-10-18sbtools: Change crypto wrapper implementation to C.Dominik Riebeling1-3/+1
There's nothing C++ left. Change-Id: I98d8406215287c02b56029ed7c0e2b0e645bbcf1
2020-10-18sbtools: convert crypto to libtomcrypt.Dominik Riebeling1-15/+18
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-18imxtools: Replace use of "byte" with its underlying uint8_t.Dominik Riebeling1-1/+1
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
2019-01-25Fix host build of mkimxboot, mknwzboot, nwztools, and rbutil with crypto++Solomon Peachy1-2/+10
Necessary to get working builds on my Fedora 29 system. Change-Id: Ia6232427c959629ade9a85fc412738f688facedb
2017-11-05mkimxboot: small fixes and display a human readable errorAmaury Pouly3-2/+25
Change-Id: I9362b62351925aef5b14656635875123942fe7e4
2017-06-24mkimxboot: fix compilation issues with crypto libCástor Muñoz1-1/+7
Change-Id: Ic81583dc7e872d332cbd4fd87143579cceeda484
2017-01-16imxtools/sbtools: switch SHA1 implementation to Crypto++Amaury Pouly1-1/+1
The current implementation was custom and super slow. Since we use Crypto++ anyway, we might as well get use a good implementation. Change-Id: I761ad7401653471e54000e1c2bc3d9882378112f
2017-01-16imxtools/sbtools: switch AES implementation to Crypto++Amaury Pouly1-1/+2
Instead of having our own copy of the AES code, use a good library to do that. Crypto++ is well-maintained, supports a lot of ciphers, works on many OSes, and is optimized for many architectures. Change-Id: I7d7d24b47993206d7338c5f9bac8bbdd3915a667
2017-01-16imxtools/sbtools: rework cryptographyAmaury Pouly1-1/+1
It was a mess, a mix of crypto_* and cbc_mac calls. I made everything call crypto functions, and also separate key setup from cryptographic operations, this will be useful to speed up the code in the upcoming commits. Drop support for "usbotp" key, since the crypto code for that was never mainlined and we can always get the keys from a device as long as we have code execution (using the DCP debug registers). Change-Id: I7aa24d12207ffb744225d1b9cc7cb1dc7281dd22
2017-01-16imxtools: rework key/IV overriding logicAmaury Pouly1-4/+0
The overriding of the IV and real key should be the exception, there is no need to manually set them to false. Change-Id: Id66754f20a79aa5c1a991839345d1242e0aa587d
2017-01-02mkimxboot: add NWZ-E380 firmware 1.00.200Amaury Pouly1-0/+5
Change-Id: I0c949a464a0e5880d1215db571aac402ca81eae9
2017-01-02mkimxboot: implement firmware unpatchingAmaury Pouly1-3/+95
Change-Id: Idfd68c06f89cdef8e95865e3ff177a6daa072c1a
2017-01-02imxtools: completely rework patching logic to prepare unpatchingAmaury Pouly3-178/+211
The old code was working but a mess to maintain. The new code is cleaner and always simpler handling of all the different options. Extraction of the OF is no longer a standalone function but just one particular output type. This commit prepares the ground for firmware "unpatching" (aka OF extraction from patched OF). The patching code itself did not change so this commit should still produce the exact same images as before. Change-Id: I3840793d4b78b8435e38c08f558840925085ead1
2017-01-02mkimxboot: add the concept of soft MD5 sumAmaury Pouly3-3/+187
Change-Id: I7e83218ce0dccc1f4c4a7a6bb9c1df00dacf260b
2016-12-19mkimxboot: don't forget to pass model if given on command lineAmaury Pouly1-0/+1
Change-Id: I1d20b38ff5b0f337d9a2eef6e2e1d6c170aabce7
2016-12-12imx233: add capability to boot OF or updater instead of RockboxAmaury Pouly5-156/+292
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-09-22imx233: fix dualboot, forgot a fileAmaury Pouly1-0/+22
Change-Id: I8d5817d75f76a201c3a8b76db0d1e11f71548179
2016-09-22imx233: fix dualboot stubsAmaury Pouly1-21/+21
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-05-25mkimxboot: remove code for NWZ-370/380Amaury Pouly3-41/+42
Since the stub code is shared with NWZ-360, it enables the pullup for the hold button, but the NWZ-370/380 doesn't have a hold button so don't compile this code in, it could potentially have unexpected effets or increase consumption Change-Id: I28c8aa40fc7f9373593ff105fb6df557a6f57ccd
2016-05-25mkimxboot: make cross compiler for dualboot stubs overridableAmaury Pouly1-4/+4
Change-Id: I90d2048f622b355eae7091e536b940b2ac828583
2015-03-08mkimxboot: fix usage messageAmaury Pouly1-1/+1
Change-Id: I7a7a2c56c434525ac242f447dd8bb287d5fc69eb
2015-01-11Limit more variables to file scopeThomas Jarosch1-1/+1
Change-Id: I30219d626316776eb73b4205d63376fa3dbc6361
2014-06-30Compile imxtools as gnu99 standard.Dominik Riebeling1-1/+2
With current MinGW using c99 as standard the compiler causes problems with some types. Use gnu99 standard instead which doesn't do this. Change-Id: I731f58025645ae88ac226593a2b2a62140285ee8
2014-02-10mkimxboot: don't forget to select LRADC source before readingAmaury Pouly3-37/+47
Change-Id: I3435857f48580d7b3bf9363a2eed96738fbda69a
2014-01-21mkimxboot: tool can now recreate a stub to recover from very low batteryAmaury Pouly6-50/+212
Several devices, including the Fuze+ have great trouble recovering from very low battery states, even in the presence of USB power. This is partly due to buggy Sigmatel boot stubs and Rockbox bootloader doing unsafe power operations on boot (should be fixed soon). In such a state, it is impossible to boot either the OF and Rockbox, so only the recovery mode is available. With this commit, mkimxboot can now create a very small stub which only does one thing but does it well: setup charging to recover from any situation. It does not provide a fancy charging screen or whatever, screen will just stay black and the device will slowly charge at ~100mA. When the battery is back to a normal level, just unplug and boot normally. Change-Id: Ib50880af85ed1f4f64a7eed0f2221e73c889c351
2014-01-21mkzenboot: reflect ZEN V target id changeAmaury Pouly1-1/+1
Change-Id: I0bad98b43e1a23c9432f4bdfe78dc77ead7879a8
2014-01-21mkimxboot: fix strange MD5 sum about ZEN X-Fi3Amaury Pouly1-1/+6
This old sum didn't match the US or EU 1.00.25 version and the actual ones were missing. Change-Id: I942641e5f367ab45794cb93a8b26b87962172216
2014-01-21Initial commit for the ZEN X-Fi StyleAmaury Pouly5-2/+33
Change-Id: Ib25a357a7bafd2ef25f273cadff70fafbd8d4661
2013-11-13mkimxboot: add NWZ-E380 1.0.0 firmwareAmaury Pouly1-0/+6
Since E380 is just rebranded E370, mark it as E370 Change-Id: I2eb7dac9ff18a7dbbd26c44b8784207e54f48dd0
2013-10-21Remove useless bracesAmaury Pouly1-2/+0
Change-Id: I88cce98cd8cc04f0245fba8ef30434167df483fc
2013-09-28mkimxboot: add NWZ-E370 1.0.1 firmware (US)Amaury Pouly1-0/+5
Change-Id: I49ddcbe2f5c1c3aabc604b81b89272cf0292e28e
2013-09-26sonynwz: rework dualboot mechanismbootloader_nwze370_v1bootloader_nwze360_v1Amaury Pouly3-15/+117
Now boot to RB if play/pause is pressed during 1 second, and to OF if back is pressed 1 second. Otherwise power off. If hold is on, also power off. In USB and alarm context, always boot and back determines OF vs RB. Change-Id: Ie1d6c971901d6473255461cc7d71a5ee3177ecad
2013-09-26mkimxboot: always clean up dualboot elf filesAmaury Pouly1-2/+3
Change-Id: I80ed1af784aa80bec9fa0b1e9322f25e69672510
2013-09-25Add support for the sony NWZ-E360/E370 to mkimxbootAmaury Pouly6-5/+51
Change-Id: Ied73591326339d22b4f21d311da9e6b1b9c223ed
2013-08-22mkimxboot: fix crashAmaury Pouly1-1/+13
I was too aggressive when converting reads to standard reads, this one is memory based and not file based Change-Id: Ibe7162894cc44cbd79f56cafe7136bda0f76bcdc
2013-08-22mkimxboot: add entry for ZEN X-Fi3 1.00.25e firmwareAmaury Pouly1-0/+9
Change-Id: I2c6cc4003bcc96662211fa066dd9e6e438b7e258
2013-08-21sbtools: more code refactoringAmaury Pouly1-25/+3
Factor all printf method with a unique one defined in misc.h Change-Id: I58fbf8916b76e873a2e6678506d2c8aece7834ec
2013-08-10sbtools: more printf fixingAmaury Pouly1-18/+2
Change-Id: Id617297c196b381fd1c381da3eff4345e3157529
2013-08-06mkimxboot: fix redAmaury Pouly1-4/+3
Change-Id: Id5d27fc00969b6999df665e7182b7ff27bccfacd
2013-08-06mkimxboot: code simplificationAmaury Pouly1-18/+5
Change-Id: Ic16334c262ee5bce3575c306440f7e1de2b247f9
2013-07-07mkimxboot: rewrite dualbootAmaury Pouly6-161/+222
Rewrite dualboot in C code instead of assembly. Also properly handle subtarget and simply Makefile. This should make the dualboot stub more readable and easier to extend. The new code also gracefully handles power up from RTC alarm on imx233. Change-Id: I7c225254b1463a97e76b6cb4de476aa2d2c9d2f9
2013-06-18mkimxboot: add zen style 100/300 firmware to the listAmaury Pouly3-0/+15
The tool cannot produce any firmware yet but it can extract the OF from the installer. Change-Id: I98684b2bf43310443d93b482aa853464f6f87fa8
2013-06-16mkimxboot: factor code, add support for ELF filesAmaury Pouly3-33/+150
Refactor code. This tool can now either load a scrambled rockbox firmware (in which case the model is check against the firmware), or any ELF file. This is useful for example for hwstub which produces a ELF file and still needs to be loaded by producing a SB file. Change-Id: I7aa381b3f6587788d1950793e89ce5608c53cccc
2013-06-15sbtools,mkximboot: fix whitespaceAmaury Pouly1-1/+1
Change-Id: I8d8adb783707172d1aaef302366c240310350ed8
2013-06-15mkimxboot: refactor code, no functional changeAmaury Pouly2-222/+252
The mkimxboot was becoming messy with juge functions and redundant code. Factor reading/writing/loading code into smaller functions. Introduce the concept of rockbox firmware to simplify support of other formats than scramble. Change-Id: I3a61295ca5abca1a0eee8c9e8709c6b8dfa256a6
2013-06-15mkximxboot: fix usage() formattingAmaury Pouly1-10/+10
Change-Id: I2f708e2830168f481018b8d8ce98134e40b4e8f8
2013-05-11Make libtools compile rule more generic.Dominik Riebeling1-4/+0
Create the object - source dependency internally and use a more generic rule for compiling. Removes the need for explicit rules for source files located in a different folder. This adds the limitation for SOURCES and LIBSOURCES to only hold C files. Change-Id: I56f6a4b1e7df36347cd2f54051e072251f456092
2013-03-10mkimxboot: fix usageAmaury Pouly1-1/+1
Change-Id: I049908ac0fe65646906999b7e661a64506bd2594
2013-02-17mkimxtool: increase performance by compiling with O3Amaury Pouly1-1/+1
Change-Id: I3d69801488abec4fbc2a84665614936105f60ad2
2013-01-29mkimxboot: add a switch to force versionAmaury Pouly3-3/+65
Add a switch to override the product and component version of the sb file. This can usually for target like the Zen X-Fi2 where the upader allows to drop any file named firmware.sb and prints the version: by using a funky version the users can check they got it right. This should not be used on the fuze+ or zenxfi3 because the OF prevents downgrade. Also make rbutil always zero out the option structure passed to mkimxboot, this has already created bugs in the past. Change-Id: I175c5def52c40c2132e11300e2f037d60a4f040e