• Status Closed
  • Percent Complete
  • Task Type Patches
  • Category Bootloader
  • Assigned To
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by barrywardell - 2007-01-20
Last edited by barrywardell - 2007-01-20

FS#6554 - Move bootloader code into a common file

There is quite a bit of common code between the bootloaders. At the moment, this code is in separate files for each target which results in code duplication.

This patch pulls all common code out to a common.c file. The functions in common.c are the result of merging the small differences between the corresponding functions in the target specific bootloader files.

Other changes made are:
* more descriptive error messages on targets other than the iPod (the error code is taken from the iPod code).
* power off after 5 seconds when there’s a bootloader error on PP targets
* Load directly to DRAM_START and skip memcpy() phase on PP and iPod. This is possible since the bootloader is already copied to and running from IRAM on those targets.
* Remove unneeded #include’s from main-pp.c
* Minor whitespace fixes in main-pp.c in the ata_init phase.

I have tested this on my H10 and e200 and it seems to work. It could do with testing on other targets (iPods, X5, H100, H300, are there any others affected?)

Closed by  linusnielsen
2007-02-22 15:10
Reason for closing:  Accepted
bot47 commented on 2007-01-20 18:01

The loader works for my (1st Gen) iPod nano 2GB, but the size of the patched one is 947 bytes larger than the original version.

The size increase was due to the dummy functions at the end of common.c being different than they were in ipod.c. I've attached an updated patch which actually results in a decrease in size by 32 bytes. The only difference from the previous one is the choice of dummy functions at the end of common.c

The previous patch broke building the X5, H300 and H100 bootloaders. This version should allow building for iPod, H10, e200, X5, H300 and H100. I have only tested building on iPods, X5, H300 and H100. I haven't actually tried the resulting bootloader on a device so testing on those would be welcome.

Binary size increases by about 300-500 bytes on all targets other than the iPod. This is mainly down the the addition of the verbose error messages with the function strerror().

Updated again to work with Gigabeat and Elio bootloaders. Also fixes the fatal_error() function in iPod bootloaders.

Updated the behaviour of the iPod bootloader:

1) If hold is on or Menu is pressed, try to load RetailOS

a) If apple_os.ipod exists try to load it.
b) If apple_os.ipod doesn't exist, but RetailOS is already at DRAM_START, load that.

2) If play is pressed, try to load iPod Linux
3) Otherwise try to load rockbox.ipod

If any of those steps fail, direct the user to reboot into disk mode.

The last patch didn't work on the Gigabeat. Hopefully this one will address that issue (hasn't been tested on-device yet though). I've also updated the Gigabeat bootloader to use the new descriptive error messages.

Appears to break iPod Mini 2G. Getting a stack of errors in common.c, like..

common.c:241: error: redefinition of 'reset_screen'
common.c:36: error: previous definiton of 'reset_screen' was here

Also breaks iPod Color 4G and iPod Video 5G with the same errors (happens when building bootloader, not firmware for all three devices)

Appears to be working correctly on my 5.5G Video

I have committed this to SVN for iPods and other PortalPlayer devices. There were reports of the patch not working on X5 and on Gigabeat, so I left those out of the commit. Here's a patch with the bits that were left out of the commit.

Project Manager

I have made some adjustments and tested on iAudio X5. Works fine.

Project Manager

And now I have tested it on the H100 and H300 series too without problems.


Available keyboard shortcuts


Task Details

Task Editing