[solved] Odroid-XU4 with an external root-fs possible?

This forum is for supported devices using an ARMv7 Samsung SoC.

[solved] Odroid-XU4 with an external root-fs possible?

Postby boggn » Sun May 21, 2017 4:31 pm

Hey there,
I have spent about two hours on getting it running but failed with different attempts.
Maybe you can help me, I have no idea left.

I want to run the root-fs on an external device (SSD via USB3.0).
Actually I want this encrypted but first things first, I need to get it running without encryption first.

I actually use for my desktop a nearly similar setup, boot is decrypted, root encrypted and I need to enter a password before it boots my setup. (A archlinux-derivate.) So this is not new to me.


What I want:
$this->bbcode_second_pass_code('', 'sdcard
└─partition1 512M /boot
SSD (USB3.0)
└─partition1 30G crypt /')

What I tried:
$this->bbcode_second_pass_code('', '+++++ Variant1: +++++
sdcard
└─partition1 512M /boot
└─partition2 2G /
+++++ Variant2: +++++
sdcard
└─partition1 512M /boot
SSD (USB3.0)
└─partition1 30G /
+++++ Variant3: +++++ (with edited fstab pointing / to SSD-partition1)
sdcard
└─partition1 512M /boot
└─partition2 2G /
SSD (USB3.0)
└─partition1 30G /')

Both variants do not work. I also edited the /boot/boot.txt (changed the PARTUUID to UUID and PARTUUID to be sure) and ran mkscr and sd_fusing.sh again.
I edited the fstab to have the correct UUID values but the fstab seems to be ignored.

I hope you can help me.


What works is the simple variant getting everything on the sdcard on partition1. But that is not really a valid solution for me.
Last edited by boggn on Sun Jun 11, 2017 9:38 am, edited 1 time in total.
boggn
 
Posts: 2
Joined: Sun May 21, 2017 4:13 pm

Re: Odroid-XU4 with an external root-fs possible?

Postby boggn » Sun Jun 11, 2017 9:26 am

I've got it!
It works, but I am not really sure of what made the difference... maybe the updated packages.

---Important!!!---
If the /boot partition is a standalone partition, create a symlink to ./
This is needed because uboot searched for the data in /boot and not in / of the boot-partition.
It handles the first partition as the rootfs but if you make it separate you need to move all the data of ./boot to ./ but uboot is still looking into ./boot

example:
If only one partition for everything is used:
$this->bbcode_second_pass_code('', '- partition1 = /
uboot and boot data is in /boot/
uboot looks for data in /boot/')

If boot and rootfs are separate:
$this->bbcode_second_pass_code('', '- partition1 = /boot (calling it bootfs)
- partition2 = / (calling it rootfs)
uboot and boot is in bootfs/
uboot looks for data in bootfs/boot/
if rootfs mounts bootfs:
bootfs = /boot/
uboot and boot is in /boot/
uboot looks for data in /boot/boot/')
Therefor you need a symlink which points to /boot but (!) it must be a relative path so the symlink of /boot/boot points to ./
Howto create a symlink: (as root)
$this->bbcode_second_pass_code('', '# cd /boot
# ln -s ./ boot')


I hope this explains it somehow...
My current kernel-arguments
$this->bbcode_second_pass_code('', 'setenv bootargs "cryptroot=UUID=***:root root=/dev/mapper/root rw rootwait smsc95xx.macaddr=${macaddr} ${videoconfig}"')

Except for the above things, I used this guide since I want it to be a headless server:
https://wiki.archlinux.org/index.php/Dm ... .2C_ppp.29

Please correct me if you see any typo or something that doesn't fit.
boggn
 
Posts: 2
Joined: Sun May 21, 2017 4:13 pm

Re: [solved] Odroid-XU4 with an external root-fs possible?

Postby rontant » Thu Jun 15, 2017 3:03 am

Here are the steps I did:

1. Create a new primary partition on the external hard-drive for the new root.

$this->bbcode_second_pass_code('', 'fdisk /dev/sda')

Note: Assuming the external hard drive is /dev/sda. On your system, it can be /dev/sda or /dev/sdb or something else. You can check with "fdisk -l" command.

2. Format the newly created partition into ext4 and label it as rootfs.

$this->bbcode_second_pass_code('', 'mkfs.ext4 -L rootfs /dev/sda1')

Note: This assumes that the newly created partition is called /dev/sda1. On your system, it can be something else, so please check first with lsblk command.

3. Mount the newly created partition

$this->bbcode_second_pass_code('', 'mount /dev/sda1 /mnt ')

4. Copy all, except /boot, from the existing root directory in the SD card to the new external drive partition

$this->bbcode_second_pass_code('', 'rsync -avx --exclude="/boot" / /mnt ')


4. Add the following line to /mnt/etc/fstab:

$this->bbcode_second_pass_code('', '/dev/mmcblk1p1 /mnt ext4 defaults 0 0 ')

Assuming the existing SD card which is used to boot up the Odroid is /dev/mmcblk1p1

5. Edit /boot/boot.txt to use label instead of UUID

Look for the line that starts with "setenv bootargs" and change the "root=PARTUUID=${uuid}" to "root=LABEL=rootfs". See below:

$this->bbcode_second_pass_code('', 'setenv bootargs "console=tty1 console=ttySAC2,115200n8 root=LABEL=rootfs rw rootwait smsc95xx.macaddr=${macaddr} ${videoconfig}"')

5. Create the new boot.scr by running ./mkscr

$this->bbcode_second_pass_code('', '
cd /boot
./mkscr
')

6. Ensure all changes are committed:

$this->bbcode_second_pass_code('', 'sync')

7. Reboot

8. Verify

$this->bbcode_second_pass_code('', 'lsblk -f')

You should see that the root is now using the external hard-drive.

9. Create a symbolic link for /boot and point it to /mnt/boot

$this->bbcode_second_pass_code('', '
cd /
ln -s /mnt/boot /boot
')
Rock 64, Odroid XU4, Raspberry Pi 3, Pogo 4, Pogo Pink E02, Goflex
rontant
 
Posts: 25
Joined: Sat May 27, 2017 1:10 am
Location: Singapore

Re: [solved] Odroid-XU4 with an external root-fs possible?

Postby WarheadsSE » Thu Jun 15, 2017 2:02 pm

For the reference of others: Why use a symlink for /boot => /mnt/boot vs a symlink in /boot of boot => . ? Was it an issue with the bootloader understanding symlinks?
$this->bbcode_second_pass_code('', '
mount /dev/mmvblk0p1 /mnt/boot
cd /
ln -sf /mnt/boot /boot
')
versus
$this->bbcode_second_pass_code('', '
mount /dev/mmcblk0p1 /boot
cd /boot
ln -s boot .
')
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: [solved] Odroid-XU4 with an external root-fs possible?

Postby rontant » Fri Jun 16, 2017 1:19 am

Here is why ln -s boot . was not used.

As TS mentioned in his second post, bootloader looks for /boot and not / (in the SD card). That's why the symlink /boot => /mnt/boot was made.

$this->bbcode_second_pass_code('', '
[root@xu4 ~]# lsblk -f
NAME FSTYPE LABEL UUID MOUNTPOINT
sda
|-sda1 ext4 rootfs eda6bae5-030e-488d-8895-0d4055f3c380 /
`-sda2 ext4 25c2b65a-6f24-4a2d-8063-491c58ee712a /public
mmcblk1
`-mmcblk1p1 ext4 sdhc b5dd8112-3a24-4f05-932f-ee057d9a1a7c

[root@xu4 ~]# mount /dev/mmcblk1p1 /boot
[root@xu4 boot]# cd /boot
[root@xu4 boot]# ls -al
total 88
drwxr-xr-x 19 root root 4096 May 24 12:44 .
drwxr-xr-x 21 root root 4096 Jun 16 08:57 ..
lrwxrwxrwx 1 root root 7 Apr 1 09:33 bin -> usr/bin
drwxr-xr-x 3 root root 4096 Jun 7 13:19 boot
drwxr-xr-x 2 root root 4096 May 1 11:41 dev
drwxr-xr-x 41 root root 4096 Jun 15 09:53 etc
drwxr-xr-x 3 root root 4096 May 1 11:42 home
lrwxrwxrwx 1 root root 7 Apr 1 09:33 lib -> usr/lib
drwx------ 2 root root 16384 May 12 14:11 lost+found
drwxr-xr-x 2 root root 4096 Apr 1 09:33 mnt
drwxr-xr-x 2 root root 4096 Apr 1 09:33 opt
dr-xr-xr-x 2 root root 4096 May 1 11:41 proc
drwxr-xr-x 2 root root 4096 May 23 15:03 public
drwxrwxrwx 2 nobody nobody 4096 May 23 20:21 public3
drwxr-x--- 4 root root 4096 May 24 10:18 root
drwxr-xr-x 2 root root 4096 May 1 11:41 run
lrwxrwxrwx 1 root root 7 Apr 1 09:33 sbin -> usr/bin
drwxr-xr-x 4 root root 4096 Apr 1 09:33 srv
dr-xr-xr-x 2 root root 4096 May 1 11:41 sys
drwxrwxrwt 2 root root 4096 May 1 11:41 tmp
drwxr-xr-x 8 root root 4096 Jun 15 09:51 usr
drwxr-xr-x 12 root root 4096 Feb 1 09:10 var

[root@xu4 boot]# ln -s boot .
ln: failed to create symbolic link './boot': File exists
')
Rock 64, Odroid XU4, Raspberry Pi 3, Pogo 4, Pogo Pink E02, Goflex
rontant
 
Posts: 25
Joined: Sat May 27, 2017 1:10 am
Location: Singapore

Re: [solved] Odroid-XU4 with an external root-fs possible?

Postby WarheadsSE » Fri Jun 16, 2017 5:12 pm

Ah, see. I missed it the first time through as well :P

$this->bbcode_second_pass_code('', '
ln -s . boot
')
Core Developer
Remember: Arch Linux ARM is entirely community donation supported!
WarheadsSE
Developer
 
Posts: 6807
Joined: Mon Oct 18, 2010 2:12 pm

Re: [solved] Odroid-XU4 with an external root-fs possible?

Postby rontant » Sat Jun 17, 2017 12:35 am

Just to share...

The last full system upgrade (pacman -Syu) somehow removed the symlink and physically recreated /boot (containing one file only i.e. initramfs-linux.img) on my rootfs partition of the external disk.

$this->bbcode_second_pass_code('', '[root@xu4 ~]# uname -r
4.9.30-1-ARCH')
Rock 64, Odroid XU4, Raspberry Pi 3, Pogo 4, Pogo Pink E02, Goflex
rontant
 
Posts: 25
Joined: Sat May 27, 2017 1:10 am
Location: Singapore


Return to Samsung

Who is online

Users browsing this forum: No registered users and 5 guests