Can C2 Boot from USB Memory stick

Post Reply
commander
Posts: 23
Joined: Sun Mar 20, 2016 1:18 am
languages_spoken: english
ODROIDs: non yet
Has thanked: 0
Been thanked: 0
Contact:

Can C2 Boot from USB Memory stick

Post by commander »

As the title states, I was wondering if the C2 can be made to boot from a USB stick first. Would like to have different OS on USB sticks to boot from.

User avatar
mad_ady
Posts: 10817
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4 (HC1, HC2), C1+, C2, C4 (HC4), N1, N2, H2, Go, Go Advance, M1
Location: Bucharest, Romania
Has thanked: 647 times
Been thanked: 951 times
Contact:

Re: Can C2 Boot from USB Memory stick

Post by mad_ady »

The bootloader code needs to be on emmc/sd. The kernel/boot.ini probably as well. The root filesystem/distro can be anywhere - usb/network, etc. So you can probably get away with a 8MB sd card

umiddelb
Posts: 452
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Can C2 Boot from USB Memory stick

Post by umiddelb »

The bootloader can access USB devices as well (e.g. for loading the kernel image and associated files), but the standard boot mechanism knows only one configuration at a time to boot. If you want to have some kind of boot device priority you need to do it by yourself. I have written a collection of u-boot scripts which I use for my own purpose in order to get more flexibility.

afremont
Posts: 128
Joined: Sun Mar 08, 2015 12:58 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Can C2 Boot from USB Memory stick

Post by afremont »

@umiddelb you seem like someone that can answer s question that i have.

After power is applied, where exactly is the very first executable code located on a C2? I assume that it is uboot, but where does it actually reside? Is it stored in some piece of flash on the board that is not SD or eMMC? And, is that what you are modifying? I guess the short question is, can I brick my board trying this?

Sent from my Moto G (4) using Tapatalk

umiddelb
Posts: 452
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Can C2 Boot from USB Memory stick

Post by umiddelb »

afremont wrote:...
After power is applied, where exactly is the very first executable code located on a C2?
The very first executable is called `bl1`. It is stored at the beginning of the eMMC/sd card, starting with sector 0 but leaving the partition table intact. If both cards are present at boot, bl1 is taken from eMMC.
bl1 itself starts a chain of subsequent binaries finally the u.boot binary. This is what you may know as u-boot.img. For the C2 this img is loaded starting from sector 97 of the eMMC/sd card.
afremont wrote:...
I assume that it is uboot, but where does it actually reside? Is it stored in some piece of flash on the board that is not SD or eMMC? And, is that what you are modifying? I guess the short question is, can I brick my board trying this?
You always need a eMMC or sd card for loading the firmware during boot, so you cannot brick your C2 (unlike other ARM devices using internal flash memory for this task).

I am modifying the on disk u-boot environment (stored from sector 1440 to sector 1503), this change is also non-permanent and can be revoked by re-flashing the eMMC/sd card with a well-known disk image.

afremont
Posts: 128
Joined: Sun Mar 08, 2015 12:58 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Can C2 Boot from USB Memory stick

Post by afremont »

Okay then. So that has to reside on the "primary" boot device which I understand to be eMMC when present, then an SD card when no eMMC is installed. Which means that I still need at least an SD card containing the uboot software in order to boot from USB. Does that sound right?

Sent from my Moto G (4) using Tapatalk

afremont
Posts: 128
Joined: Sun Mar 08, 2015 12:58 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Can C2 Boot from USB Memory stick

Post by afremont »

By uboot software, I mean the SPL, uboot executable and uboot environment which is the first 1504 sectors on the C2. I hope I got this right.

Sent from my Moto G (4) using Tapatalk

afremont
Posts: 128
Joined: Sun Mar 08, 2015 12:58 am
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Can C2 Boot from USB Memory stick

Post by afremont »

BTW, thank you for explaining the power on stuff.

Sent from my Moto G (4) using Tapatalk

umiddelb
Posts: 452
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Can C2 Boot from USB Memory stick

Post by umiddelb »

afremont wrote:Okay then. So that has to reside on the "primary" boot device which I understand to be eMMC when present, then an SD card when no eMMC is installed. Which means that I still need at least an SD card containing the uboot software in order to boot from USB. Does that sound right?
Correct

umiddelb
Posts: 452
Joined: Thu Jan 29, 2015 6:42 am
languages_spoken: English, German
ODROIDs: ODROID-C1, ODROID-XU4, ODROID-C2
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Can C2 Boot from USB Memory stick

Post by umiddelb »

afremont wrote:By uboot software, I mean the SPL, uboot executable and uboot environment which is the first 1504 sectors on the C2. I hope I got this right.
You may call it firmware, and it's supposed to occupy the first 2048 sectors (on other ODROID devices the first 3072 sectors), see here for details.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 4 guests