[Solved] USB Arch installation on the Odroid XU4

This forum is for discussion about general software issues.

[Solved] USB Arch installation on the Odroid XU4

Postby andoru » Sat Jul 21, 2018 5:56 pm

Note: I originally posted this on one of the hardware subforums, apologies for that!

As the thread subject mentions, I wanted to ask if it's possible to install the OS on an USB3 hard drive while keeping the necessary boot files on the microSD? Are there any automated scripts that make this possible?
I know for certain that this is possible with Armbian, and they have an script specifically for this.
Last edited by andoru on Wed Aug 15, 2018 2:15 am, edited 2 times in total.
andoru
 
Posts: 20
Joined: Fri Jul 20, 2018 5:18 pm

Re: USB Arch installation on the Odroid XU4

Postby andoru » Sat Aug 11, 2018 1:52 am

Anyone...?
andoru
 
Posts: 20
Joined: Fri Jul 20, 2018 5:18 pm

Re: USB Arch installation on the Odroid XU4

Postby summers » Sat Aug 11, 2018 9:09 am

Set up a separate boot partition on on the SD card, then however you pass kernel options (so probably /boot/boot.txt) make sure you pass the kernel the option "root=" and give it the location of the USB stick.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: USB Arch installation on the Odroid XU4

Postby andoru » Sat Aug 11, 2018 11:24 pm

Your explanation is a bit unclear, and I don't want to get my ***** stuck somewhere, so...

Could you let me know of the exact commands I need to run to create that partition? (ie. does it need some special parameters in fdisk or mkfs, or could I do this all in gparted? How big should it be? How should I place the boot files on this boot partition? (all the files under /boot/ on the root of the partition -- *path to boot partition*/ , or should I place them under *path to boot partition*/boot/ ? )
Also what's the best way to copy the files from the current system partition? I've read somewhere that doing using this rsync command should suffice:
$this->bbcode_second_pass_code('', 'rsync -avHX')
I don't want to use dd, as the new system partition is smaller than the current one.

$this->bbcode_second_pass_quote('', 'm')ake sure you pass the kernel the option "root=" and give it the location of the USB stick.


How? Is there a line regarding that, or do I have to make a new one? Should I set the physical path, or the UUID of the partition...?
andoru
 
Posts: 20
Joined: Fri Jul 20, 2018 5:18 pm

Re: USB Arch installation on the Odroid XU4

Postby summers » Sun Aug 12, 2018 9:43 am

Well I don't have an XU4, and many of the arm arch boards are set up slightly differently. So you'll need to do some work, to work out what is needed.

So fist off, what is your file system. Is /boot a seperate partition, or is it a sub directory of the root partition $this->bbcode_second_pass_code('', 'df') is your friend.

From what I can see of the XU4 install instructions, you probably just have a root partition formatted as ext4. So you'll want to format your usb stick in the same way, and install arm arch on it in the same way. Details https://archlinuxarm.org/platforms/armv7/samsung/odroid-xu4.

Next we need to go into how your machine is set up to interact with uboot. $this->bbcode_second_pass_code('', 'ls /boot') is your friend.

Probably you have a modern set up with $this->bbcode_second_pass_code('', 'boot.txt') if so look at that file, near the top:
$this->bbcode_second_pass_code('', 'if test -n ${distro_bootpart}; then setenv bootpart ${distro_bootpart}; else setenv bootpart 1; fi
part uuid ${devtype} ${devnum}:${bootpart} uuid

setenv bootargs "console=tty0 console=${console} root=PARTUUID=${uuid} rw rootwait"
')
Now for us the relevant bit is the "bootargs root=" we'll want to change ${uuid} from point to your flash, to pointing at the USB. So find what devices your usb root file system is, say its on /dev/sda1 then:
$this->bbcode_second_pass_code('', 'blkid /dev/sda1
/dev/sda1: UUID="9c66e1c4-d82b-4606-b686-f5bc6d42e9d9" TYPE="ext4" PARTUUID="94a2dc27-01"')
And you can see that gives the PARTUUID of the device, so you the usb root partition. This is what we want passed to the kernel.

So somewhere above the bootargs line you'll want to add something like $this->bbcode_second_pass_code('', 'setenv uuid 94a2dc27-01') or whatever your usb root partuuid is.

You'll then need to run "./mksrc" to convert the "boot.txt" into a "boot.src".

Then uboot when it boots, will look for the boot.src. load it, and that will set the bootargs to such that root is the usb root. And all is good.

But how does uboot find the boot.src. You'll need to check what your uboot does. Its probably specified somewhere in the source code, ether in a arm arch path, or on the main uboot site. What would be easiest is to access uboot from the command line, so attaching a uart to the board, then you can interrupt u-boot and see whats its doing. It may well be it will scan the usb stick for a boot.src, in which case uboot will probably just run from the first boot.src it finds. So that gives another method, set up the usb stick, and then just remove the flash set up - but you can only do this if you know what uboot does.

And this is the crux, to do what you want we know how to do it, pass the correct "root=" to the kernel command line. But how your arm arch OS and how u-boot does that, isn't clear - and thats what you'll need to understand, and need to dig into at your end.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: USB Arch installation on the Odroid XU4

Postby andoru » Mon Aug 13, 2018 2:06 am

Thanks for the answer summers!

$this->bbcode_second_pass_quote('summers', 'S')o fist off, what is your file system. Is /boot a seperate partition, or is it a sub directory of the root partition


It is a sub directory of the root partition ( ie. uSD-root/boot/)


$this->bbcode_second_pass_quote('summers', 'P')robably you have a modern set up with boot.txt


Correct.

So after your help, I managed to make the XU4 boot from an USB HDD, and since this has worked, I tried removing all files/directories from the uSD root partition except /boot/, and before that I copied (with the above mentioned rsync command) all the files/directories except /boot/ to the system partition on the HDD. It now boots fine, and works a treat. I didn't install the OS again on the HDD as you suggested, as I wanted to keep all the modifications I've done to it.
Fortunately this means I don't have to access the device through UART, which I don't have on hand.

There's one catch though:
I'm unable to update the kernels this way, as I'm unable to mount the /boot/ directory on the uSD directly. Mounting the device on a separate mountpoint, then symlinking it to HDD-root/boot/ doesn't work, as the update process removes that said symlink, which complicates the update process.
I've tried to move the contents of /boot/ to the root of the partition, and run ./mkscr from there, but the device refuses to boot this way, so I guess I'm stuck with this setup.
Would you happen to know of any way of mounting the boot directory from the uSD directly on the root of the system partition on the HDD? Or maybe a different solution?
andoru
 
Posts: 20
Joined: Fri Jul 20, 2018 5:18 pm
Top

Re: USB Arch installation on the Odroid XU4

Postby summers » Mon Aug 13, 2018 9:39 am

Why not just mount it directly to the /boot directly, something like:
$this->bbcode_second_pass_code('', 'mount /dev/sdb1 /boot') Change the device to whatever you need.
Once you have go it to work, you can do the same in $this->bbcode_second_pass_code('', '/etc/fstab') so it happens automatically at boot time.
Last edited by summers on Mon Aug 13, 2018 4:01 pm, edited 1 time in total.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: USB Arch installation on the Odroid XU4

Postby andoru » Mon Aug 13, 2018 11:50 am

Well, yeah sure, the specific partition is /dev/mmcblk1p1, but the problem is that the partition doesn't have the contents of /boot/ in the root of the partition (so mmcblk1p1/* ), but instead it's under the /boot folder ( mmcblk1p1/boot/* ). The command you gave me just mounts the partition under /root on the filesystem (so now the boot files are under /root/boot instead of /boot )
andoru
 
Posts: 20
Joined: Fri Jul 20, 2018 5:18 pm

Re: USB Arch installation on the Odroid XU4

Postby summers » Mon Aug 13, 2018 12:06 pm

Ah I see the problem. What bout "mount --bind" ?

A better solution would be to move the contents of the boot directory up a level - but you would probably have to modify some u-boot env variables.
summers
 
Posts: 984
Joined: Sat Sep 06, 2014 12:56 pm

Re: USB Arch installation on the Odroid XU4

Postby TheSaint » Mon Aug 13, 2018 3:43 pm

From my point of view I'd rather opt to label the partitions than using UUID. Usually the kernel will understand also with LABEL. It might be a different issue if u-boot looks for a particular UUID, which is mentioned in the docs.
TheSaint
 
Posts: 346
Joined: Mon Jul 23, 2018 7:57 am

Next

Return to General

Who is online

Users browsing this forum: No registered users and 9 guests