Odroid N2 boot from USB HDD

This is for ARMv8 based devices

Re: Odroid N2 boot from USB HDD

Postby karog » Tue Aug 06, 2019 9:04 pm

Oh right. Kind of hard to use /etc/fstab on the / drive to find the / drive. Unlikely to work.

Back to what I said before about Boot Args.

I have only read a little about Pettiboot in SPI. It would appear to require some kind of UI, either serial connection or HDMI I guess. As I use my N2 and XU4 as headless and not generally connecting a serial connection, not sure how I would use Pettiboot.

I have an old Pogo E02 running arch with the 5.2.6 linux kernel and its uboot allows for a network connection and boot which actually slows boot down by about 10 seconds until it times out not finding the net connection and moves on. I have a serial connection set up for that one.
karog
 
Posts: 300
Joined: Thu Jan 05, 2012 7:55 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Tue Aug 06, 2019 10:04 pm

I'm trying to get my N2 to boot into a USB drive from SPI. It seems to be possible, but debugging it is tedious. You can hook up a display device with HDMI and keyboard and interact with the Petitboot menu on the SPI. There's a way to edit the boot.ini file and install it on the SPI.

I don't think the fstab approach will work, because it will be referenced after the boot process has already started. If I figure it out, I'll post back here.
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby karog » Sat Aug 10, 2019 1:09 am

@woody any progress with SPI? I hooked my N2 to my monitor with HDMI and a wireless keyboard with USB dongle and got into Petitboot. It looked like in System Configuration one could select a partition to boot from. What happens if you just install arch linux arm on such a USB drive partition without doing the u-boot.bin, select that partition in Petitboot and try to boot?

You might have to copy /boot/boot.ini to /boot.ini.

What do you mean by install the boot.ini in the SPI?

As I stated before, I agree the fstab will not work.

Trying all that is more than I care to do as I use eMMC and my N2 is just a headless server with 2 4GB USB drives attached which I access via ssh. Same with my XU4. Both work great. I have no need for a GUI interface for the N2. Switching inputs on my monitor is more of a pain than just using ssh.

ETA: Ah, I just saw you are asking on the Re: Petitboot, yet another bootloader thread.
karog
 
Posts: 300
Joined: Thu Jan 05, 2012 7:55 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Sat Aug 10, 2019 9:53 pm

@karog
As you've probably read on the Odroid forum. I just now got my Odroid N2 to boot into my USB hard drive from Petitboot.
For the sake of anybody else who wants to do the same, here's what I did:
1. Updated Petitboot to the latest version (201906-RC3). I don't know if this step is absolutely necessary, but it's probably a good idea. See this thread for how to do it: https://forum.odroid.com/viewtopic.php?f=182&t=33873
2. I had originally installed Arch Linux Arm on an SD card, as per the instructions for an N2 install on the ALARM forum. I was able to get this installation to boot up when I plugged the SD card into the SD slot on the N2, but not when I tried to use it in a USB adapter.
3. I got everything to work when I cloned the Arch installation from the SD card to a USB hard drive. The boot partition on the default installation is formatted as VFAT. On the SD drive, I formatted the boot partition as ext2 and the other partitions as ext4.
4. After I installed Arch on the hard drive, I edited the /boot/boot.ini file to change the bootargs
from $this->bbcode_second_pass_code('', 'root=/dev/mmcblk${devno}p2.... etc.') to $this->bbcode_second_pass_code('', 'root=/dev/sda2,,,, etc.') (to conform with the way the USB drive gets mounted).

I also went into the /etc/fstab and changed the entry there
from $this->bbcode_second_pass_code('', '/dev/mmcblk1p1 /boot vfat defaults 0 0')to $this->bbcode_second_pass_code('', '/dev/sda1 /boot ext2 defaults 0 0') These are the steps that seem to be needed to get the job done. Of course, you could skip installing Arch on the SD card if you have no need to that and just install to the USB drive and change the settings as indicated.
If I run into any issues further along, I'll post back.
Last edited by woody on Mon Aug 12, 2019 2:01 pm, edited 1 time in total.
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby beakfire » Sun Aug 11, 2019 2:25 am

Cool

Was going to mention that there was a solution to this posted here:

https://forum.odroid.com/viewtopic.php?t=34361

Looks like you've figured it out though
beakfire
 
Posts: 14
Joined: Sat Apr 21, 2018 10:13 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Sun Aug 11, 2019 4:54 pm

@breakfire
I don't fully understand what's going on in that thread. I think they might be booting from an SD card first, pointing to a root directory on an USB SD drive. And I think that thread is discussing Armbian rather than Arch Linux. Their final solution might work out to be about the same, though.
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby beakfire » Mon Aug 12, 2019 4:27 am

From my understanding they did something similar to you, except they left the boot partition on an SD card, looks like you've managed to move everything over to the USB drive.

So do you even have an SD card or eMMC module in your N2 at this point? Is the boot selector switch in the SPI or MMC position?

I thought I would mention that trim doesn't work with most USB enclosures, so if using an SSD may have trouble with trim. I've been working on this for a little bit and finally got a USB enclosure that does support trim, it's USB 3.1 though with a USB-C connector on it.

The chipset and firmware seem to be the issue, as most USB enclosures don't have support for trim even if they support UASP. Additionally, some with a correct chipset that can support trim and have UASP enabled don't have firmware that supports trim commands.

From reading around it seems like the startech ones should work, with updated firmware, I haven't tried any though. I picked up a Satechi ST-TCDEM that works. It has the VIA VL716 chipset, though it still requires a udev rule to get trim working, info on that is here:

https://bbs.archlinux.org/viewtopic.php?id=236280

Mine had a slightly different product id from that post, but thats easy to figure out.
beakfire
 
Posts: 14
Joined: Sat Apr 21, 2018 10:13 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Mon Aug 12, 2019 1:10 pm

I don't have any card in the card slot now. The switch points to SPI. During startup, Petitboot in SPI flashes up on the screen for a moment, as Petitboot scans the 1st partition on the SD drive. Then, it finds the boot.ini on the SD boot partition and boots up. I'm using a 2.5" HDD in a USB 3.0 enclosure, not an SSD. It's good to know about the issues with SSDs in enclosures, though, since I might swap out for one sometime. Note that I have a version of Petitboot, (201906-RC3) that's been tweaked a little. The 201904 version on that's the current official Odroid release would probably work too.

I like being able to boot without requiring an SD card; it seems cleaner and removes another point where things could break. It's possible that booting with an SD card in the slot could speed up the boot process by a couple of seconds, but that's not a big deal for me.
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby woody » Fri Sep 20, 2019 1:57 pm

Update: Yesterday, when I did a pacman -Syu, I got an option to update the u-boot version. After the update, the USB ROOTFS partition was corrupted and the drive wouldn't boot. I used another device to fix the errors on the partition, but it still wouldn't boot. Finally I mounted the boot partition (which is a separate partition on my installation) and switched boot.ini.pacnew with the old boot.ini. I had to make a change to the 'bootargs' setting in boot.ini.pacnew to conform with the one in the old boot.ini. Note that the new boot.ini has a an additional parameter for 'cec'.

I had some problems booting when my unpowered USB drive was plugged into the bottom right USB port. I think that port may have a power problem. It booted ok, when I moved it to the top right port.
woody
 
Posts: 88
Joined: Tue Dec 11, 2012 2:40 pm

Re: Odroid N2 boot from USB HDD

Postby karog » Fri Sep 20, 2019 8:20 pm

@woody Check out my post re: uboot update at uboot-odroid-n2 flash_uboot in .INSTALL

If you didn't look at the drive it was offering to flash uboot to, you would flash to the one with the root drive as I did and also corrupted mine though thankfully I too was able to repair it.
karog
 
Posts: 300
Joined: Thu Jan 05, 2012 7:55 pm

PreviousNext

Return to ARMv8 Devices

Who is online

Users browsing this forum: No registered users and 11 guests