Commit graph

725 commits

Author SHA1 Message Date
Marcin Bukat
776fe2ad9c rk27xx: boot Rockbox on USB wake when it can write the NAND
The bootloader starts the OF when the player is woken by plugging in
USB, because the OF was the only firmware that could give the host
write access to the internal flash. A build with FTL_ALLOW_WRITE
can do that itself, so boot Rockbox there and leave the OF to a held
key. Builds without it keep the old behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I74af2f8c56436a3f7c9ad97d1b1638469807f0dc
2026-10-07 22:20:18 +02:00
Marcin Bukat
406a28cc6a rk27xx: boot the OF when it asked for a reboot
Before the original firmware resets itself, e.g. at the end of a
firmware update, it stores a boot mode in an undocumented GPIO1
register that keeps its value over the reset. The NAND bootloader
reads it to decide whether to boot at all, then starts our
bootloader, which chose Rockbox or the OF from the buttons alone, so
an OF that restarted itself came back up as Rockbox.

Rockbox never writes the register and it reads 0 after power-on, so
boot the OF whenever it is set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: I22a98cafad48f66302a8401c9df847a073675a58
2026-10-07 18:09:15 +02:00
neofright
4b8ea97fa9 Support ROCKBOX_DIR in HibyOS hosted bootloader
Currently if you want to compile a bootloader like so:

$ ../tools/configure --rbdir=/.rockbox.aigoerosq --target=aigoerosq --type=b

This won't work because the bootloader is hard coded to look for the rockbox Linux binary in /.rockbox/rockbox.erosq regardless of what is specified by '--rbdir'.

This commit adds support for ROCKBOX_DIR in the hosted HibyOS bootloaders.

After compiling, they can be installed with adb via (for example):

adb push build/bootloader.erosq /usr/bin/bootloader.erosq

Change-Id: Ic4ceb75107f608beacfd497998a11a5874e87ac1
2026-10-05 19:42:58 -04:00
Solomon Peachy
34368013c1 h1x0/h3x0: Get rid of redundant cut-down bidi_l2v() function
The one in the main bidi.c is already cut-down for bootloader builds

Change-Id: I4465419393b0eda91fb69bd4c3353f7c31e1e98d
2026-09-29 10:16:26 -04:00
Marcin Bukat
98f162b212 New target: Samsung YP-CP3 (rk27xx)
Scaffolding for a port, starting from the rk27xx generic target: configure
entry 146 (target id 117, model number 132), config/samsungypcp3.h, and
firmware/target/arm/rk27xx/ypcp3/.

- LCD: the rk27xx LCD interface (lcdif-rk27xx.c) with this panel's init
  sequence, from RE. See g#1050. Looks like SPFD5420A 18-bit bus,
  400x240 landscape. It differs from the generic panel's sequence in the
  gamma curve and in not writing VCOM_HV1.

- Backlight: PD4 / PWM0 with the generic board's timing, which the hwstub
  work found to be the same.

- Storage: the microSD slot. Card detect is PC7, active low,
  as on the generic board.

- Keys: the YP-R0's key set - five-way yog, Back, Menu, Rec/User, Power -
  so the target uses SAMSUNG_YPR0_PAD and its keymaps. Eight keys sit on
  two resistor ladders on the LSADC, found in the original firmware and
  measured on a unit:
      channel 1   up 158, down 295, select 435, left 561, right 687
      channel 2   menu 155, back 292, user 431
  each key owning half a step either side of its reading;
  power is GPIO C1, active high.

Builds as firmware and as bootloader. Status 3 (unusable) in builds.pm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Change-Id: Iff4984023415f341ca7507af6b5b2b551201e953
2026-09-29 08:53:27 +02:00
neofright
f5076456fe Fix path bug in bootloader/hibyos_linux.c
run_file() joins /mnt/sd_0 and the filename without a /, so /bin/sh cannot open any script and always returns 2.

The path bug has been fixed and the buffer size adjusted and freed after execution.

GPT 6 Sol did the work. I'm just the meat proxy.

Change-Id: I644a773b2bd707e0ee2d8c70c91b7a6075cf2622
2026-09-27 22:03:30 +01:00
Solomon Peachy
bdbbb753c5 ipod6gboot: Silence build warning introduced in af2a3b74f4
(ipod6g doesn't utilize the QR Code stuff used by the nano3g)

Change-Id: I99c9e565b5a4c7212662eab097f1bae2f4ed0ea4
2026-09-24 15:46:23 -04:00
Vencislav Atanasov
af2a3b74f4 ipodnano3g: Show a QR code if the NAND is not supported
Currently, the link points to the unofficial bootloader builds and installation instructions by freemyipod.org, but it can be changed at any time by the rockbox.org website maintainer.

Co-authored-by: ChatGPT-5.6 Luna
Change-Id: I05a78a6540ebcc0e03a1f12f5d765e69e68af00c
2026-09-24 14:29:36 -04:00
Solomon Peachy
4e4198af7a fix red in c6abf3382a -- iriver h1xx bootloader
Change-Id: Id81dc1e89941ddc1102e60138907c0d07fa9f538
2026-09-23 14:17:24 -04:00
Aidan MacDonald
c6abf3382a firmware: move iriver flash helper functions into target tree
Move the iriver-specific functions for detecting flashed
Rockbox/OF images into system-iriver.c and remove the
HAVE_FLASHED_ROCKBOX define which is now redundant (all
targets using system-iriver.c enable it).

Copyright attribution on the new system-iriver.h header
is a best guess from Git history.

Change-Id: If1933f881a63fd517162ab9ca8f4a3007b997739
2026-09-23 13:44:45 -04:00
Andrew Rice
e4c010be98 ipodnano3g: NAND check image for validating other chips
Rockbox only drives NAND parts proven on hardware, and this tree has one
model to prove them on. This is the image that lets an owner of another
Nano 3G supply what validating theirs takes: a bootloader built with
-DNAND_CHECK and run from DFU, which never touches the NOR flash or
writes to the NAND.

Testing evidence: firmware/target/arm/s5l8702/ipodnano3g/TESTING.md.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Change-Id: I46328b69f8011337790f35a195de97b5bcf347a5
2026-09-19 21:26:45 -04:00
Andrew Rice
34a18e7616 ipodnano3g: NAND driver, FTL and storage
The Nano 3G keeps everything behind the S5L8702 flash controller and
Apple's FTL ("Whimory"), and nand-nano3g.c was a stub, so the port had
no storage at all. This is the flash driver, the FTL and the wiring that
makes the NAND Rockbox's disk. The three are one change because neither
half is usable without the other: the driver alone cannot see a
filesystem, and the FTL alone has nothing to drive.

Testing evidence: firmware/target/arm/s5l8702/ipodnano3g/TESTING.md.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Change-Id: Ib04a991489ff3a1a63cd55552e4a8d7ec7a5fc8c
2026-09-19 20:08:03 -04:00
Aidan MacDonald
3a57f2f721 Add "rbfs" prefix to native filesystem functions
Most of the churn here occurs because 'filesize' is one of
the redefined filesystem functions, but some of the structs
used by the native FS code also include a 'filesize' member
variable which gets renamed by the macro in some but not all
source files.

It's easier to rename 'filesize()' to 'ffilesize()' rather
than try to clean up the macro mess or renaming the struct
members.

There is weirdness with root_realpath() which now breaks on
native builds because it was assumed to be unprefixed there.
dir_get_info() was unprefixed everywhere but this just seems
inconsistent; make it follow the FS_PREFIX() convention too.

Change-Id: Ic3700c6234ea45f32679c1a8429d70fdb8f4088a
2026-09-17 16:22:31 -04:00
Michael McAllister
f349e85154 ingenic: move the drivers the X1000 shares with other SoCs
Pure file move, in preparation for a second Ingenic SoC.

  dma, gpio, i2c, installer, kernel, nand and the SPL NAND backend
  move from target/mips/ingenic_x1000/ to target/mips/ingenic/

Drivers that cannot move as whole files, because part of each is
genuinely X1000-specific, are left alone for now: msc, uart, sfc, the
debug menu and the OST helpers in system-x1000.c.

Verified as a no-op: built at target 246 --type=b before and after from
the same source path, bootloader.bin is byte-identical, and every moved
file's object has the same instruction stream under its new name.
Builds clean with no warnings for targets 246, 260 and 247, both
--type=n and --type=b.

Change-Id: I9f67c23384df49b8c4554d695b772bcd54a4e32f
Co-Authored-By: Claude Opus 5
2026-09-01 11:37:21 -04:00
Jerry Shen
51d7d56803 ap80max: New hosted port
HibyOS-based target: keymaps, LED, powermgmt, bootloader and sim support,
plus cabbiev2 for the new 360x640x16 screen. Opus 5 helped w/ debugging
and the initial scaffolding.

Updated name to FB_STRIDE_MISMATCH, added simulator bmp and specs.

Change-Id: If797ac6581cf75d9d1fcf36e615ee03cf6f905d6
2026-08-13 17:55:06 -07:00
Gilad Schnurmacher
b5d512c409 iriver H300: fix remote-hold boot entry
Holding HOLD on the remote while powering on was incorrectly
detected as a bootloader mode entry request because remote_type()
was not yet initialized. Add sleep(HZ/8) after lcd_remote_init()
and re-check remote_button_hold() only if a remote is detected.

Fixes erratic bootloader entry on remote-connected H300.

Change-Id: Ic042cf5ff40713e93b2096d4ee48d7e1001ce4a5
2026-07-31 09:08:06 -04:00
William Wilgus
513365713a [FixRed] sonybootloader has a glyphcache but no open_pathfmt
Change-Id: Iaf8522d4a72f78da26434b60757fe3421a3622f2
2026-06-09 02:01:29 -04:00
Solomon Peachy
d54b9e6f8d chore: Get rid of *all* vestigal CVS '$Id:$' tags
Change-Id: I35c13a9768c582e4851aa252dd3ea5c89f760c8c
2026-06-01 16:01:18 -04:00
mojyack
e75e9d22fa bootloader: rk27xx: fix duplicate symbol error in enter_rkusb
since it's a static function, it may be inlined.
use local labels to fix duplicate-symbol errors.

Change-Id: Icba6e6876077e874ab5cfcdc3c774acb663356a1
2026-05-26 11:42:53 -04:00
mojyack
127428e32d bootloader: ipodnano2g: fix mcr/mrc usage for clang
Change-Id: I0e328c2d0d4243783cbede843a6451c45f5ba914
2026-05-16 12:01:36 -04:00
Aidan MacDonald
5a236963e4 misc: get rid of unused LOADADDRESS define in makefiles
Change-Id: I990aaca9b0b8230efba09c87ace2430fbfa29b74
2026-03-05 20:11:07 +00:00
Solomon Peachy
9057154fff mrobe500: Allow bootloader build without HAVE_BOOTLOADER_USB_MODE
I'm leaving it enabled because that's clearly the intent
of the bootloader, but at least there's now an easy path to disabling it
if so desired.

Change-Id: I4f4ecc9a453d376f92e411e0544b587fe4b4c864
2026-02-07 10:48:22 -05:00
Aidan MacDonald
58b186d6de Remove Creative Zen Vision and Vision:M ports
They haven't seen development activity for the better part
of two decades and apparently were never able to even boot
to Rockbox, although the Rockbox bootloader could load the
original firmware.

Change-Id: I5cfa5909c21feaf2825aa685a05e78044b893a13
2026-02-06 07:31:54 -05:00
Aidan MacDonald
19af7131e2 echoplayer: allow enabling system debug in normal builds
Allow toggling the system debug state from the debug menu
in Rockbox, or by holding a button combo at boot, so that
an SWD/JTAG debugger can be attached to normal non-debug
builds without too much hassle.

Change-Id: Iee47ef916ade2e5ec1094a63c68e48f1b27b0bbb
2026-02-06 07:09:32 -05:00
Aidan MacDonald
ebd273832d Remove Mini2440 and Lyre prototype 1 ports
Both targets were part of the (presumably dead) Lyre project
and no longer build. The Mini2440 was much more complete than
the Lyre and doesn't seem terribly difficult to fix up to the
point where it at least builds, if someone still cares -- but
given it is a dev board in a box, it's unlikely it ever saw
much use.

Change-Id: I09745379d28db69ea9aaf77f0a62b049884260e1
2026-02-04 08:56:04 -05:00
Aidan MacDonald
53862c7eed Remove Sansa View port
It doesn't seem to have been functional ever and currently
doesn't build; eg. the last commit to the LCD driver added
a syntax error, and there's some duplicate functions between
mmu-armv6.S and system-pp502x.c. Doesn't seem worth the
effort to fix.

Change-Id: I82b5bec3ed9686f28aedbe283818af792b96daf4
2026-02-03 22:04:41 +00:00
Aidan MacDonald
1a33d7990a Remove Meizu M3/M6SL/M6SP and Samsung YP-S3 ports
These targets haven't seen any changes since 2008-09
have bitrotted to the point they don't compile anymore.
With only internal NAND flash for storage which doesn't
seem to have ever been accessible from Rockbox, they've
never been usable and there's probably not much point
keeping them around any more.

Change-Id: I2fc63da20682b439126672065ae013044cb2d1c4
2026-02-03 16:32:56 +00:00
Solomon Peachy
8baeeda23f x1000: Bootloader now probes for the ONFI flash header at multiple addesses
The location (and number of pages) is apparently manufacturer-dependent.
here are some known so far:

Winbond:    page 1
gigadevice: page 4

This info is only queried/dumped when explicitly requested for debug
purposes.

Change-Id: Icc4f9c0d4f2cc9097b2295c8f42a22aab392d0d5
2026-02-03 07:01:10 -05:00
Solomon Peachy
3a68848099 erosqnative: Rename bootloader entries for stock firmware / recovery
"Aigo Player" => "Hiby Player"
"Aigo Recovery" => "HibyOS Recovery"

All four (so far) brandings of the "erosq/k" family utilize the same
HibyOS+HibyPlayer platform.  This platform is additionally shared by
nearly all X1000-based devices.

...So let's call it what it is.

Change-Id: I986ed202ad0ca13b0650be87cf5b612c9648e571
2026-02-02 08:27:43 -05:00
Solomon Peachy
e1d10c938a config: Targets must opt-in to bootloader USB storage support
ie by only using HAVE_BOOTLOADER_USB_MODE, instead of blanket-enabling
USB_ENABLE_STORAGE for numerous SoC families

Change-Id: Ief433a1d693876072779e714883438c0012ba2e0
2026-01-27 07:36:40 -05:00
mojyack
1951c17e0b pass event data to usb_acknowledge
add second argument to usb_acknowledge.
it can be used for more appropriate connection tracking that does not
rely on timeout in the future.

Change-Id: I8a44366b7c7a1f944524c4ba8ecd6d9673746a65
2026-01-26 19:47:09 -05:00
Aidan MacDonald
d5506dfa22 echoplayer: implement boot from debugger
Add a 'make start' target which starts Rockbox using a
debugger. This only works to load the main binary, but
makes it much faster to test changes that don't affect
plugins/codecs.

Because SDRAM isn't accessible at reset and the main
binary is usually too big to fit in SRAM, the bootloader
must be flashed first before Rockbox can be loaded in
this way.

The boot protocol involves GDB writing a check pattern
to SRAM while the CPU is held in reset. The bootloader
detects the pattern and takes a breakpoint, by which
time SDRAM is accessible; GDB can then upload a binary
ELF image (copied as a raw file, since the ELF will be
loaded using RB's ELF loader) and leave the breakpoint
to continue booting.

From there the bootloader can load the ELF binary from
memory, exactly like a normal SD card boot.

Change-Id: I4eb971b4162ea422e38660455cfa0958cefaa18d
2026-01-26 08:55:01 -05:00
Aidan MacDonald
603c5bb2be echoplayer: load Rockbox from SD card in bootloader
To avoid problems with SDMMC DMA not being able to
access all SRAMs equally, the ELF binary is loaded
at the top of SDRAM and then copied into place.

Change-Id: Icf16d02bc15605539cbe781dd27709225abca8f9
2026-01-25 19:51:56 -05:00
Aidan MacDonald
0f5c42122c echoplayer: implement bootloader power on/off logic
On the Echo R1, the main regulator is enabled primarily by
the power button and USB input, and secondarily by the CPU's
own output pins (cpu_power_on signal or RTC alarm output).

From a user perspective, the player should appear to power
up and down only if the power button is long pressed, which
must be implemented in software. These logical power states
are called "active" and "inactive" in the bootloader.

Going from inactive to active will attempt to boot Rockbox
unless a button (d-pad down) is held to enter bootloader
USB mode instead. Going from active to inactive will shut
down the player. The bootloader will also automatically
shut down after a short timeout, if USB is not plugged in.

In the inactive state, the player is supposed to enumerate
over USB so it can negotiate a charging current, but should
otherwise appear "off". In particular it shouldn't expose
mass storage or even power up the SD card, nor power up the
LCD/backight. This isn't implemented yet, because there's
no way to dynamically change USB configurations (eg. going
from active to inactive should trigger re-enumeration to
switch to charge only mode). To avoid surprising behavior,
the bootloader will just boot Rockbox immediately if USB is
plugged in at boot.

Change-Id: Icd1d48ef49a31eb32b54d440e9211aaf40c6b974
2026-01-25 07:46:31 -05:00
Solomon Peachy
4e4d5ac25b Fix yellow in echoplayer bootloader
Regression introduced in 7f0bc4bd95

Change-Id: I1341319d23a2813b8473e3fceb3370bf6371ef86
2026-01-24 09:13:49 -05:00
Solomon Peachy
b76cb3bf62 xduoox3: A couple of minor cleanups in the bootloader
* When SHOW_LOGO is not defined, print the version at the
   same time as the logo would have been displayed
 * Don't re-init the display after every message in USB mode

Change-Id: Ida0f5643b1d57004877ec5c42fc14028f53b1c89
2026-01-24 07:55:56 -05:00
Solomon Peachy
7f0bc4bd95 bootloader: Share definition of show_logo via common.h
For some reason it was locally defined everywhere.  Move a single
definition into common.h instead.

Change-Id: Ie2fad74acccd89e40fcbb0f47258d2e14e0f8285
2026-01-24 07:54:24 -05:00
Aidan MacDonald
97dce282b4 echoplayer: add USB support
Enable high speed USB for the Echo R1. Includes reasonably
complete support for full speed USB on the STM32H743 since
that was necessary to debug why it wasn't working at first
(which turned out to be a bug in memcpy, not a hardware or
driver issue).

Change-Id: Ie713195b22ba88c79b9b0d6eb289cb9ccd2763c2
2026-01-12 19:13:23 +00:00
Aidan MacDonald
671320b5d1 echoplayer: implement basic power-on / power-off logic
Use cpu_power_on as a GPIO to keep the main power supply
enabled when running from battery.

Change-Id: Ic79283a0cc640585a0297e11f9dcc2264ec9af26
2026-01-12 13:01:35 -05:00
Vencislav Atanasov
e2196c4566 Run the LBA48 check only if the target has support for reading of SysCfg
This fixes a regression introduced in ad6cc2f0 for the ipodnano4g bootloader.

Change-Id: Iacf079adbfa85399b248a4c4ac35b93155a1d87b
2026-01-08 10:12:57 -05:00
Aidan MacDonald
2e532129d7 echoplayer: add storage & RTC demo in bootloader
Change-Id: I146e2205182239ed9d0176c23e3d0ad05e72a3be
2026-01-04 10:27:30 -05:00
Marc Aarts
1183b1ab1b Rockbox for the HiBy R3 Pro II/R1
Original author Melissa Autumn (https://codeberg.org/oopsallnaps/rockbox-hibyos) with contributions from Marc Aarts.

Adaptation to Rockbox standards by Marc Aarts

Change-Id: I09e5af7ba0a75c648e4b9fd424badc2d3665c943
2025-12-27 15:44:54 -05:00
Solomon Peachy
936482abb5 bootloaders: Correct formatting of 'no parition found' table dump
Change-Id: I0eb48a0a40d317f9b47b181e0a31bef7ffde1e15
2025-11-24 21:17:09 -05:00
Solomon Peachy
ad6cc2f099 ipod6g: Prevent booting into OF if it does not support LBA48 and drive needs it
Early 6th gen ipods (80GB and 160GB "fat") are limited to LBA28
which results in a hard upper limit of 128GiB on the storage size.
The later 120GB model also shares this limitation.  These are identified
by HwVr of 0x00130000 and 0x00130100, respectively.

The final revision of the iPod Classic series (160GB "thin") does not
have this limitation, and can be identified by a HwVr of 0x00130200 or
0x00130300.

This is strictly an issue with Apple's stock firmware, and not the
hardware, and Rockbox will happily utilize the full capabiltiies of any
installed storage device.  Unfortunately, if you boot into the stock
Apple firmware, said firmware will destructively trash the partition
table and filesystem.

Consequently, the Rockbox bootloader will now check if the installed
drive requires LBA48, making sure the flashed firmware also supports
LBA48.  If not, we will disallow booting into the OF (including disk mode)
altogether.  This check can be overridden by holding down LEFT, at which
point you get to keep all the pieces.

Note: While Apple never released firmware without these limitaitons on
the older models, there is a way to update to update these to the newer
firmware.  This requires altering the stored HwVr, so it is safe to use
the HwVr as a proxy for the installe firmware capabilities.

Change-Id: Icdd5754f2a3d38c6de67fc7565fabc7aa20f19b3
2025-11-23 13:41:32 -05:00
Solomon Peachy
bc7bc4e8ac storage: report physical sector multiplier via storage_get_info()
Show this in in the info dump when we can't find a filesystem to mount
in main() plus in the ipod bootloaders

Change-Id: I3b437ae0032b17f29c0dd94043743f14d2b2f3ad
2025-11-17 08:57:43 -05:00
Solomon Peachy
a2c10f6189 unicode: Support characters beyond the first unicode plane
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * font manipulation, caching, rendering, and generation
 * on-screen keyboard
 * FAT filesystem (parsing and generating utf16 LFNs)
 * WIN32 simulator platform code

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Appears to work on:

  * hosted linux, native, linux simulator in both 16/32-bit modes.

Needs testing on:

  * windows and macos simulator (16bit+32bit)

Change-Id: Iba111b27d2433019b6bff937cf1ebd2c4353a0e8
2025-09-12 09:24:30 -04:00
Solomon Peachy
84504c7471 Revert "internals: Support characters beyond the first unicode plane (WIP)"
This reverts commit d05c59f35b.
2025-08-20 16:09:49 -04:00
Solomon Peachy
d05c59f35b internals: Support characters beyond the first unicode plane (WIP)
We used 16-bit variables to store the 'character code' everywhere but
this won't let us represent anything beyond U+FFFF.

This patch changes those variables to a custom type that can be 32 or 16
bits depending on the build, and adjusts numerous internal APIs and
datastructures to match.  This includes:

 * utf8decode() and friends
 * on-screen keyboard
 * font manipulation, caching, rendering, and generation
 * VFAT code parses and generates utf16 dirents
 * WIN32 simulator reads and writes utf16 filenames

Note that this patch doesn't _enable_ >16bit unicode support; a followup
patch will turn that on for appropriate targets.

Known bugs:

  * Native players in 32-bit unicode mode generate mangled filename
    entries if they include UTF16 surrogate codepoints.  Root cause
    is unclear, and may reside in core dircache code.

Needs testing on:

 * windows simulator (16bit+32bit)

Change-Id: I193a00fe2a11a4181ddc82df2d71be52bf00b6e6
2025-08-20 16:08:43 -04:00
Vencislav Atanasov
620a190baf iPod S5L87xx bootloader: Enable LCD sleep/awake test depending on target config, not on model
Change-Id: I7a3d86814e5f5b1c84ef73636f2094514aaf0120
2025-07-22 10:47:37 -04:00
Vencislav Atanasov
8d5f7baefe iPod S5L87xx bootloader: Add code for printing the bootloader hash
Change-Id: I6921ef894e328e462ea3ca77266a1a30b7a75972
2025-07-07 01:40:48 +03:00