Odroid N2 boot from USB HDD

This is for ARMv8 based devices

Odroid N2 boot from USB HDD

Postby woody » Fri Aug 02, 2019 8:35 pm

I'm switching my existing ALARM installation from a Pogoplug to an Odroid N2. I understand that I need to install files to an SD card, then edit the SD card to get the system to boot from the HDD. I've seen instructions for how to do this for Ubuntu, but not how to do it with ALARM. Can somebody step me through how I need to configure the SD card to do this?
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby TheSaint » Sat Aug 03, 2019 11:24 am

It seems to me, that most of these SBC, starting by u-boot, since there's no flash that holds a BIOS. So to have the u-boot it takes to look for a piece of memory that the MCU can address, until will be able to load the USB (and other peripheral drivers) stack subsystem.
Therefore you mostly need the SD card with at least 1 Mb available at the beginning which will contain the u-boot (very similar to a linux kernel, or at the least a portion of it)
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Re: Odroid N2 boot from USB HDD

Postby karog » Sun Aug 04, 2019 3:28 am

For $15 you can get a 16GB eMMC module which snaps onto the N2 board and you can install Arch Linux to it and boot from that. It is pretty fast with estimated 150MBs/125MBs read/write speeds. Makes a lot more sense than booting from USB HDD. You can still plug USB HDD drives in for extra storage. This is what I do. Oh, you also need an eMMC to uSD adapter ($3.95) (need to be able to read/write to uSD) or USB to eMMC ($12.95) to initialize the eMMC. The eMMC comes with Ubuntu or Android already installed, buyer's choice, but you can overwrite that.

The N2 also had 8MB of SPI boot flash. I have never tried to use that so do not know much of anything about that but you could look into it.
karog
 
Posts: 301
Joined: Thu Jan 05, 2012 7:55 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Sun Aug 04, 2019 3:41 pm

I know that I can boot up an OS from an eMMC card or an SD card, but it's also possible to boot from a USB drive. I'm just trying to figure out the specifics of how to do it. I think it might be possible to use the SPI memory to boot to a USB drive, but I'm not sure. I've seen instructions on how to use an SD card to direct the boot up to a USB drive running Ubuntu, but I'd rather use Arch Linux. So I'm trying to figure out how to adapt the Arch Linux installation for use on a USB drive.
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby karog » Sun Aug 04, 2019 9:34 pm

Booting with /root on USB and /boot on SD should be pretty easy. The standard install instructions for archlinuxarm on N2 say to create two partitions, one 256M VFAT for /boot and the rest or whatever size you like for ext4 /root. So create the the VFAT on an SD card and install u-boot.bin there as well. Create the ext4 on the USB drive. Download and install archlinuxarm image on the USB root drive. Copy the root /boot to the /boot on the SD card. Then edit SD /boot/boot.ini Boot Args changing root=/whatever to root=/dev/sdX1 assuming root is the first partition on the USB drive and that it appears as /dev/sdX1.

The tricky part here is what device the USB gets. I don't know if the SD will appear as /dev/sdX1 or look like eMMC and be /dev/mmcblk0p1 so whether USB will be /dev/sda1 or /dev/sdb1 or something else even if you also have other USB drives. I would first try with USB as /dev/sda1 and guess that the SD looks like eMMC as a device, namely /dev/mmcblk0p1. Or maybe SD looks like /dev/mmcblk1p1 ie blk1. Either way, if /dev/sda1 works for USB and you boot successfully you can do df command to see what the devices actually are. If you have other SD devices so that the root USB does not always become the same device then you will have a new problem to solve.

Set the boot switch to the right (eMMC also for SD, not left SPI), power up, and cross your fingers.

Note that I have not done this. So it may or may not work. Take a chance.

Then there is learning how to boot with SPI. I have not played with that.

Would be good to have a serial connection to watch what happens.

Also see ODROID N2 boot sequence
karog
 
Posts: 301
Joined: Thu Jan 05, 2012 7:55 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Sun Aug 04, 2019 9:41 pm

Thanks! That all makes sense. I'll give that a try. People say that they're able to boot Ubuntu from SPI, but I'm not sure exactly what's needed to do it.
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Mon Aug 05, 2019 3:06 pm

Just curious, but do you know why the boot partition on the SD card has to be formatted as VFAT?
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby beakfire » Mon Aug 05, 2019 6:44 pm

Not sure why it has to be VFAT, maybe someone else can say why that is maybe has to do with U-Boot?

Instead of editing the boot.ini an appropriate fstab should work, as an example I've created one that creates multiple separate partitions on the eMMC and it works just fine.

$this->bbcode_second_pass_code('', '
#/dev/mmcblk0p1
UUID=<uuid> /boot vfat defaults 0 0

# /dev/sda2
UUID=<uuid> / ext4 rw,relatime 0 2

# /dev/sda3
UUID=<uuid> /var ext4 rw,relatime 0 2

# /dev/sda4
UUID=<uuid> /home ext4 rw,relatime 0 2
')

Above works just fine as an example, and would allow you to use more of the eMMC module or SD card if desired, whichever you prefer, for other purposes as well so you can have more than just the /boot partition on it.
beakfire
 
Posts: 14
Joined: Sat Apr 21, 2018 10:13 pm

Re: Odroid N2 boot from USB HDD

Postby karog » Tue Aug 06, 2019 1:04 am

@beakfire, cool. woody is actually wanting to put / on a USB drive. Using fstab solves the problem that the USB drive could appear as different devices on different boots. Instead he can reference the UUID or PARTUUID in fstab to set /.

I should have realized this as the armlinuxarm tar file comes with an fstab containing
/dev/mmcblk0p1 /boot vfat defaults 0 0

As for why VFAT for /boot I too would guess it has to do with u-boot.bin and what it can read and what it expects. Curiously, on the ODROID-XU4, there is only one ext4 partition and /boot is in /, not a separate partition. Go figure.
karog
 
Posts: 301
Joined: Thu Jan 05, 2012 7:55 pm

Re: Odroid N2 boot from USB HDD

Postby beakfire » Tue Aug 06, 2019 3:57 am

Makes sense, I'm actually a little curious if what I mentioned will work though.

I know that you can modify the fstab to use UUIDs and create additional partitions like I mentioned on an SD card or eMMC module and it will work as I've done this.

I'm just not certain if U-boot will look for the root partition on the USB connected drive or not, as if the root partition is moved there then the /etc/fstab file will be located on the USB drive and I don't know if it will look there for it or not.

If not then something else may need to be done to get it to do so and use the /etc/fstab located there. Not something I've attempted myself though.

The N2 does have petitboot in the SPI, so that may be something that has to be played with. I saw a thread over on the hardkernel forums about trying to dual boot an N2 with two different Linux distros, and someone mentioned petitboot over there to try to get that working.
beakfire
 
Posts: 14
Joined: Sat Apr 21, 2018 10:13 pm

Next

Return to ARMv8 Devices

Who is online

Users browsing this forum: No registered users and 13 guests