Bootloader for Omega2S and Omega2S+
How to Boot from External Storage
- Good to know that I can use source repo for building working bootloader. Thank you!
- We'd like to put rootfs and kernel on eMMC storage and boot from it. This requires loading kernel from eMMC - which implies changes in u-boot. In the next step, we would like to implement A/B update strategy using mender (https://mender.io/product/how-it-works).
- I was rather wondering how to unbrick device after I flash broken u-boot image. Is unsoldering and flashing in external hardware the only way to unbrick?
- As I mentioned earlier, we'd like to boot from eMMC. I've already seen the "How to Boot from External Storage", but actually, it is overlay mechanism - rootfs and kernel is still on the 32M flash.
Is there any Onion documentation covering the process of flashing the bootloader? I looked around not long ago, but didn't manage to find any.
Douglas Kryder last edited by Douglas Kryder
Yup, that's what I found as well, and while those touch on building and using the bootloader, they don't cover anything related to flashing one. If Onion are publishing links to bootloader binaries and suggest that users flash them, I'd have thought there was a user friendly doc to go along with that.
I did manage to achieve my goal, so for my own purposes I'm good, but it was a process and a half, so I was hoping for something less complicated (and officially endorsed) to refer forum users to in future.
@Arek-Z I modified the bootloader on an omega2s+, based on the github repo of onion. This went fine without problems. For flashing, I use a FTDI SPI cable in combination with the most recent version of flashrom, which works out of the box. You can freely write the flash as long as you keep the processor in reset, so unbricking is not a problem and all required HW signals are available on the omega2s. Just make sure that you don't erase the second partition, I don't think you can restore that one.
In practical terms, I added a programming header that contains the SPI signals as well as ground, 3V3 and reset. When the programming header is inserted, a short keeps the processor in reset, so that the flash can be safely programmed. This method only works with the s/s+ version of the omega.
@wdu Awesome, thank you so much. This is the confirmation I needed!
There is actually a simplier way to flash the bootloader: by using the Bootloader web recovery mode. Please follow the instructions provided in our docs on how to flash the firmware via web recovery mode but when you get to the 192.168.8.8, you'll be presented with the page where you need to load the firmware or load a UBoot file.
You'll want to click
uBoot Updateand load the bootloader binary. This will start the bootloader installation process. You can get the officail Omega2 binaries from our us.
If you flash a broken bootloader, you need to physically desolder and reprogram the flash memory.
If you modify the bootloader and/or make any physical modifications (e.g. remove the flash and etc), Onion Corporation is not responsible for any damage to your device and the warranty will be voided. Proceed at your own risk.
Thank you for this useful explanation.
@Pavel-Metrokhin Thank you Pavel, we know this. However, web recovery is not available when u-boot is damaged. User wdu confirmed that it is possible to flash with SPI when you are unable to use web recovery.
- If you have working u-boot - use web recovery https://docs.onion.io/omega2-docs/Firmware-Flashing-Web-Recovery.html
- If you damaged u-boot - You do not have to unsolder memory for flashing with external hardware. You are able to flash the bootloader with SPI (not a trivial thing, however). To be able to flash the memory, you need to keep Omega's processor in reset state.
@Arek-Z Thanks for sharing this great solution!
Caio Mehlem last edited by Caio Mehlem
@wdu , hi! Can you share with us the details? Did you just write the binary to the raw flash memory? Starting at which address? I imagine at least some part of the 32MB of flash must be partitioned with a FS (jffs2?), so we must be careful not to overwrite it, right?
Can someone point me to or share the flash's map / partitioning scheme?
@Pavel-Metrokhin , can you please confirm if building the source @ https://github.com/OnionIoT/omega2-bootloader will generate the same bootloader provided @ http://repo.onion.io/omega2/bootloader/ ? In other words, is the GitHub repo complete and up to date or you build the provided bootloader from a private repo?