Rockbox Technical Forums

Support and General Use => Hardware => Topic started by: johnb on April 22, 2016, 03:23:45 PM

Title: SD card support in bootloader?
Post by: johnb on April 22, 2016, 03:23:45 PM
Hi Mihail,
I have seen your commit on the front page:
http://git.rockbox.org/?p=rockbox.git;a=commit;h=7cb1e5a AMS: enable SD card support in bootloader


I have two questions:
- As you have only changed device specific code, does that mean that the current bootloader is already capable of booting rockbox off the SDcard?
- Does this only work if the internal storage is not accessible (I had removed the .rockbox directory from the internal storage and installed the new build on SD, but it did not boot).

Overall I think this will be a very useful feature as I have one clip+ where I think the internal flash is dying ...

Thanks
johnb
Title: Re: SD card support in bootloader?
Post by: saratoga on April 22, 2016, 04:00:05 PM
Those changes are in the bootloader, so you'll need to install an updated bootloader, which we haven't released yet.  Mihail can answer the other points, but I believe if your internal storage doesn't have a file system it should try to boot from the SD once the new bootloader is installed.
Title: Re: SD card support in bootloader?
Post by: Mihail Zenkov on April 22, 2016, 04:01:40 PM
As you have only changed device specific code, does that mean that the current bootloader is already capable of booting rockbox off the SDcard?

No, you should update bootloader.

Does this only work if the internal storage is not accessible (I had removed the .rockbox directory from the internal storage and installed the new build on SD, but it did not boot).

Yes. It work only if rockbox can't mount internal storage. It useful if internal storage corrupted (by software or hardware). I think it should good solution for partially bricked players - when bootloader still work (you can see rockbox logo at startup)  but cannot mount and boot from internal storage.

In near future I want add booting from sd card by default if it have .rockbox folder. It can be useful when internal storage can be mounted but FS broken. Also it can be useful if someone want update rockbox on player with broken usb.

Overall I think this will be a very useful feature as I have one clip+ where I think the internal flash is dying ...

Yes, but you should update bootloader before your player bricked - player should to be able update firmware.

At this moment we don't provide new builds of bootloaders.

saratoga: Can you build and post links to this topic?
Title: Re: SD card support in bootloader?
Post by: saratoga on April 22, 2016, 04:25:28 PM
http://web.mit.edu/mgg6/www/bootloader-clipzip.sansa
http://web.mit.edu/mgg6/www/bootloader-clipplus.sansa
http://web.mit.edu/mgg6/www/bootloader-clipv2.sansa
http://web.mit.edu/mgg6/www/bootloader-fuzev2.sansa

Use these with mkamsboot (available from the manual or wiki) and the original firmware file of your choice.  Note that I have not tested these, so beware. 
Title: Re: SD card support in bootloader?
Post by: Mihail Zenkov on April 22, 2016, 04:32:43 PM
Note that I have not tested these, so beware.

In any case it should be safe as we don't change dualboot code and loading to OF should work.

P.S. Charge your player and check disk for errors before update firmware.
Title: Re: SD card support in bootloader?
Post by: Mihail Zenkov on April 22, 2016, 04:54:50 PM
Mini how-to update bootloader:
1. place to one dir: OF (clpzV010121.bin), new (bootloader-clipzip.sansa) and mkamsboot.
2. open terminal in this dir and run: ./mkamsboot clpzV010121.bin bootloader-clipzip.sansa clpzV010121_new.bin
3. copy clpzV010121_new.bin to your player
4. reboot to OF
Title: Re: SD card support in bootloader?
Post by: johnb on April 23, 2016, 07:00:42 AM
I successfully installed the new bootloader on this clip+ I mentioned before.
While I faced dismounting issues in Win10 and drives disappearing when I was
- trying to copy over the latest rockbox build
- deleting the files/dirs created by the OF
which is familiar (that's why I said the internal storage is dying),
I ended in a situation where the clip+ actually booted from SD, recent_bookmarks file was created in the .rockbox dir on the SD and no internal storage was visible from the file browser.

In a nutshell: the new bootloader WORKED for me!

Thanks a lot!

P.S.: during those activities, an ATA error and a mount problem was reported on the clip. Chkdsk also had found problems. So I am not fully clear, whether it really is the flash or the controller which is flaky.
Title: Re: SD card support in bootloader?
Post by: Mihail Zenkov on April 23, 2016, 09:39:24 AM
johnb: Good report, I glad that changes works as expected and helpful. And yes - when rockbox boot from SD it will show only SD as internal storage was not mounted.
Title: Re: SD card support in bootloader?
Post by: shrizza on January 02, 2017, 11:17:16 PM
I have a Sansa Clip Zip that randomly (about 50% of the time) stops at boot on the "Boot 4.0" message. I suspected it was suffering from faulty NAND and thus decided to install this bootloader.

I'm pretty sure it was successfully installed since I am seeing a different message "Boot 7cb1e5a-160" as opposed to "Boot 4.0". Unfortunately, it is still randomly failing with the message "Loading firmware. Read failed" (there's a bit more to that message but it is cut off). Is my Clip Zip failing in some way this bootloader is not expecting?

For reference: both before and after the installation, when booting is successful it shows a "Boot 3.13" message before finally idling at the usual RB menu. When it is not successful it sometimes stops at a blank screen with the message "Plug USB cable".
Title: Re: SD card support in bootloader?
Post by: johnb on January 03, 2017, 04:07:46 AM
Do you have a copy of the .rockbox directory on the SD card?

Don't use the 3.13, but the current dev build and try again.
Title: Re: SD card support in bootloader?
Post by: Mihail Zenkov on January 30, 2017, 05:04:05 PM
Patch to boot rockbox from sd card by default: http://knk.square7.ch/rb/rockbox-boot_from_sd_card.patch
It have hardcoded path and should be reworked. But it enough to check first is we have rockbox on sd card and boot from it.

If you boot from sd card and your internal memory still mounted by rockbox, you should also apply this patch: http://knk.square7.ch/rb/rockbox-dont_mount_internal_drive.patch
So internal drive will be ignored and you can load all rockbox stuff (codecs/plugins/settings/etc) from sd card.
Title: Re: SD card support in bootloader?
Post by: asymsucon on February 07, 2017, 12:10:10 AM
My question probably got lost in another thread, but it's an important issue, so let me touch it again.
What is the procedure for loading alternative bootloader when one's clip has already defective (read-only) internal flash?
Holding down select during boot won't mount the damaged volume:

Code: [Select]
[  104.394323] hub 1-0:1.0: unable to enumerate USB device on port 2
[  105.700082] usb 1-2: new high-speed USB device number 5 using ehci_hcd
[  105.816926] usb 1-2: New USB device found, idVendor=0781, idProduct=74d1
[  105.816934] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  105.816941] usb 1-2: Product: Rockbox media player
[  105.816946] usb 1-2: Manufacturer: Rockbox.org
[  105.816951] usb 1-2: SerialNumber: 2A8C381030AEE202100000000
[  105.818804] input: Rockbox.org Rockbox media player as /devices/pci0000:00/0000:00:1d.7/usb1/1-2/1-2:1.0/input/input9
[  105.819215] generic-usb 0003:0781:74D1.0003: input,hidraw2: USB HID v1.10 Keyboard [Rockbox.org Rockbox media player] on usb-0000:00:1d.7-2/input0
So what should one do in such case?
Title: Re: SD card support in bootloader?
Post by: saratoga on February 07, 2017, 01:03:29 AM
You can't install a bootloader from inside rockbox anyway, you have to boot into the OF and patch it from there just like you did the first time you installed rockbox. 
Title: Re: SD card support in bootloader?
Post by: asymsucon on February 07, 2017, 02:13:18 AM
Fair enough, but it's not possible to boot into OF with corrupted internal flash (it freezes on Sansa logo). So what then?
Title: Re: SD card support in bootloader?
Post by: Mihail Zenkov on February 07, 2017, 05:49:18 AM
What is the procedure for loading alternative bootloader when one's clip has already defective (read-only) internal flash?
Holding down select during boot won't mount the damaged volume:

It's don't look like read-only case. At read-only you should still able mount drive but all changes on it ignored.  Can you show what you have in dmesg if you connect after rockbox loading?

Fair enough, but it's not possible to boot into OF with corrupted internal flash (it freezes on Sansa logo). So what then?

You should install bootloader before problems with internal flash. If you try install new bootloader on bad internal flash - you just brick device.

In your case: if rockbox still loading and you can see sd card - you can load new rockbox from sd card by hands.
Extract "rockbox.zip" to sd card. Enter to ".rockbox" dir and copy "rockbox.sansa" to root dir. Then boot rockbox and select Files > rockbox on sd card.
Title: Re: SD card support in bootloader?
Post by: asymsucon on February 08, 2017, 01:11:06 AM
You should install bootloader before problems with internal flash.
I agree, but this bootloader boots from SD card only if it finds internal storage faulty.
It work only if rockbox can't mount internal storage.
So I'm not sure if I should use this one, or wait for binary build for "SD-card only" bootloader as you suggested.
Yes, but better wait until someone provide tested binary build.


In your case: if rockbox still loading and you can see sd card - you can load new rockbox from sd card by hands.
Extract "rockbox.zip" to sd card. Enter to ".rockbox" dir and copy "rockbox.sansa" to root dir. Then boot rockbox and select Files > rockbox on sd card.
I already returned the player to the seller for exchange, but I remember it was impossible to even access audio files for playback. It returned Plugin error and returned to main menu. The stub I pasted into my last post is taken from dmesg.