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
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
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
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
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
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
I was too aggressive when converting reads to standard reads, this
one is memory based and not file based
Change-Id: Ibe7162894cc44cbd79f56cafe7136bda0f76bcdc
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
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
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
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
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
The previous dualboot scheme had a major flow: it needed to hold
menu to boot OF but the X-Fi2 boot in recovery mode with menu!
It was possible but very trick to enter the OF with USB plugged.
This code provides a new scheme:
- no USB plugged: boot to OF when menu is pressed
- USB plugged: boot to OF when power is pressed
Change-Id: Ia6e76d3ada1f67137b727daa050cf6c77afbbfb9
mkimxboot requires passing a structure which got extended with another field.
This wasn't adjusted in Rockbox Utility, causing an out of bound access to an
array, which results in a segfault.
Change-Id: I0252849ed0b41f1d8804537c053debc9b0ecd08d
Only boot to rockbox if the power button is hold sufficiently long.
For consistency, use the same mechanism as the OF:
- read PSWITCH 550000 times
- boot if PSWITCH=1 at least 400000 out of 550000 times
Only apply the delay if Volume Down is not hold,
so that the OF and RB delay don't cumulate.
Change-Id: I1e8a4cd108c56bf784fcf1c320f7a001ef161701