Rockbox.org home
Downloads
Release release
Dev builds dev builds
Extras extras
themes themes
Documentation
Manual manual
Wiki wiki
Device Status device status
Support
Forums forums
Mailing lists mailing lists
IRC IRC
Development
Bugs bugs
Patches patches
Dev Guide dev guide
translations translations
Search



Donate

Rockbox Technical Forums


Login with username, password and session length
Home Help Search Staff List Login Register
News:

Welcome to the Rockbox Technical Forums!

+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Sansa E200V2 Bootloader is broken in master
« previous next »
  • Print
Pages: [1] 2 3

Author Topic: Sansa E200V2 Bootloader is broken in master  (Read 11226 times)

Offline bahus

  • Member
  • *
  • Posts: 206
Sansa E200V2 Bootloader is broken in master
« on: February 17, 2024, 04:39:55 AM »
Bootloader built from master doesn't fit in the firmware.

Code: [Select]
./mkamsboot e200pf.bin bootloader-e200v2.sansa e200pf.bin.patched

[ERR]  Packed data (132960 bytes) doesn't fit in the firmware (120860 bytes)

Firmware file: https://mp3support.sandisk.com/firmware/e200/e200v203.01.16f.zip


I found an old issue: https://www.rockbox.org/tracker/task/12380

But suggested workaround with --thumb flag no longer works:
Code: [Select]
[ERR]  Packed data (131229 bytes) doesn't fit in the firmware (120860 bytes)

Any idea how to fix? Ideally I'd like to enable multiboot/boot redirect for this device. Can I somehow disable logo or completely disable any graphic related logic and make it boot only in text mode or something.

« Last Edit: February 17, 2024, 02:59:51 PM by bahus »
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9369
Re: Sansa E200V2 Bootloader is broken in master
« Reply #1 on: February 17, 2024, 10:25:12 AM »
What I would do is grab a .map file for an older build that works (maybe we still have them on the server?) and the map file for your build that's too big and see if any large, new items appear. It is possible something was included that could be be removed or shrunk.
Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #2 on: February 17, 2024, 12:24:23 PM »
Quote from: saratoga on February 17, 2024, 10:25:12 AM
What I would do is grab a .map file for an older build that works.

According to FS#12380 issue is introduced in
https://github.com/Rockbox/rockbox/commit/f443e7bbf7771ce3a79b1c2116b9cf216f15938f

I created build for earlier commit https://github.com/Rockbox/rockbox/commit/6223ad26 and it also fails to fit "as is" but works with --thumb flag. My guess it's due to more recent build tools. Still it's considerably smaller in size and can still be used for inspection:
master - 101 Kb
6223ad26 (with latest build tools) - 84.5 Kb
Official bootloader - 79 Kb

Bootloaders with map/elf files are uploaded here: https://mega.nz/file/1GAznbAJ#ClNdPEILinBuRdbmPbuUzy7MXP1NE4OvxwVlbGrgFHE


« Last Edit: February 17, 2024, 02:56:05 PM by bahus »
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9369
Re: Sansa E200V2 Bootloader is broken in master
« Reply #3 on: February 17, 2024, 01:33:06 PM »
Yes I see in the .map the transparency blending functions take a few kilobytes.  It might make sense to disable that for the bootloader.  You could also disable the logo for the bootloader which is only shown for a split second since the bootloader on the e200v2 barely does anything.  I doubt it would even be noticeable if it weren't loaded since there is no time to see it.
Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #4 on: February 17, 2024, 02:09:15 PM »
Is it safe to disable the following USB defines for bootloader:
Code: [Select]
#define HAVE_USBSTACK
#define HAVE_BOOTLOADER_USB_MODE
Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #5 on: February 17, 2024, 02:38:49 PM »
I applied some trimming and enabled multiboot/boot redirect:
https://github.com/bahusoid/rockbox/tree/e200V2Boot

And I still need 6 kilobytes:
Packed data (126895 bytes) doesn't fit in the firmware (120860 bytes)

Here is size comparison with bootloader from 2011.11.08_6223ad26:
https://gist.github.com/bahusoid/d627e4d19e3d99906ba20a7cdfc9872b

What else can be trimmed?

With HAVE_USBSTACK and HAVE_BOOTLOADER_USB_MODE disabled it fits. But is it really safe?
« Last Edit: February 17, 2024, 03:02:57 PM by bahus »
Logged

Offline saratoga

  • Developer
  • Member
  • *
  • Posts: 9369
Re: Sansa E200V2 Bootloader is broken in master
« Reply #6 on: February 17, 2024, 08:12:02 PM »
USB in the bootloader is helpful if you don't have a .rockbox binary or otherwise cannot boot, so disabling it isn't a good idea. 
Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #7 on: February 18, 2024, 10:10:12 AM »
Ok I've been able to make a build that fits (only --thumb build). Can someone please review my changes to make sure they are safe (at least in theory):
https://github.com/bahusoid/rockbox/tree/e200V2Boot


Max allowed size: 120860
Thumb build: 120256 (fits!)
No thumb: 121842

Disabled:
Logo;
alpha blending capabilities for bitmaps;
Non default locales (only utf-8 and latin left);
Arm stack unwinder (needed for backtrace);

Enabled:
Boot redirect (to allow loading from SD card)


« Last Edit: February 18, 2024, 12:53:33 PM by bahus »
Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #8 on: February 19, 2024, 01:34:01 PM »
Flashed it and rockbox doesn't boot (black screen with no indications). Luckily dual boot still works.. Will investigate if it's me or some changes in master...
Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #9 on: February 19, 2024, 03:01:27 PM »
Quote from: bahus on February 19, 2024, 01:34:01 PM
Flashed it and rockbox doesn't boot (black screen with no indications).

It's not me. The same changes applied to 4 years old commit work! Sd card boot also works!
https://github.com/bahusoid/rockbox/tree/e200V2_24.10.2020


« Last Edit: February 19, 2024, 03:09:49 PM by bahus »
Logged

Offline speachy

  • Administrator
  • Member
  • *
  • Posts: 651
Re: Sansa E200V2 Bootloader is broken in master
« Reply #10 on: February 19, 2024, 06:58:55 PM »
Would you consider doing a 'git bisect' on this to narrow down when it breaks?  4 years is a looong time.

(Also, did you use the same toolchains for the new vs old builds?)
Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #11 on: February 20, 2024, 05:37:44 AM »
Quote from: speachy on February 19, 2024, 06:58:55 PM
Would you consider doing a 'git bisect'

Yes. Offending commit:
Quote
commit 3301c5aa6db76832dbb9af8f72d29b348190fd91
Author: Aidan MacDonald <amachronic@protonmail.com>
Date:   Sat Oct 15 23:14:27 2022 +0100

    Remove buflib allocation names, part one
   
    Remove the name handling code, but leave the allocation structure
    otherwise untouched; it's as if all callers provided a NULL name.
    The public API still accepts names but names are no longer stored
    or returned.
   
    Change-Id: I6c4defcdfd255774f02030949a0fd731477e6a54

Full logs here: https://gist.github.com/bahusoid/70f69bb46644851a75fe6db7c45fffab

All builds were made with the same latest toolchains. My guess would be that e200V2 is not the only bootloader that's broken by it.
« Last Edit: February 20, 2024, 06:18:26 AM by bahus »
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 1191
Re: Sansa E200V2 Bootloader is broken in master
« Reply #12 on: February 20, 2024, 01:15:56 PM »
Ah the long tail..

IM way AFK ATM but i can confirm the bootloaders for clip plus and the zip are not affected

I already did a lot to get the clip plus bootloader to fit and some of that can probably be applicable to the e200 can have a look in about a week

Logged

Offline bahus

  • Member
  • *
  • Posts: 206
Re: Sansa E200V2 Bootloader is broken in master
« Reply #13 on: February 20, 2024, 01:40:34 PM »
Quote from: Bilgus on February 20, 2024, 01:15:56 PM
IM way AFK ATM but i can confirm the bootloaders for clip plus and the zip are not affected

Just to confirm. Are you saying that bootloader for Sansa Clip+/Zip  built from master still boots Rockbox just fine? As my initial rant was about size.  But I've been able to fit it and it doesn't boot after 3301c5aa (black screen, RB doesn't boot).
« Last Edit: February 20, 2024, 05:40:09 PM by bahus »
Logged

Offline Bilgus

  • Developer
  • Member
  • *
  • Posts: 1191
Re: Sansa E200V2 Bootloader is broken in master
« Reply #14 on: February 20, 2024, 03:59:39 PM »
IM saying that buflib commit hasn't affected the others mentioned

And i went thru those bootloaders previously to make them fit and left some wiggle room

Some of those things might work on the e200 to buy you some space
Logged

  • Print
Pages: [1] 2 3
« previous next »
+  Rockbox Technical Forums
|-+  Rockbox Development
| |-+  Starting Development and Compiling
| | |-+  Sansa E200V2 Bootloader is broken in master
 

  • SMF 2.0.19 | SMF © 2021, Simple Machines
  • Rockbox Privacy Policy
  • XHTML
  • RSS
  • WAP2

Page created in 0.117 seconds with 21 queries.