注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

ODROID-XU4 Installation

From Funtoo
Jump to navigation Jump to search

This page documents a procedure you can use to install Funtoo Linux on the ODROID XU4. We assume that you have purchased the ODROID XU4 with an EMMC image containing Ubuntu. This guide will show you how to back up the Ubuntu image and then replace it with a Funtoo Linux image.

   Note

The following instuctions also work with the ODROID XU3 and ODROID XU3-LITE because they are fully software compatible with the ODROID XU4.

   Note

These installation docs work even if you don't have another ARM system. You can use an existing x86 Linux system for the steps below.

Backing Up Ubuntu

The first thing you will want to do is to attach your Linux EMMC module to an ODROID EMMC to MicroSD adapter. Then, using a device such as a USB MicroSD card reader, attach the EMMC module to an existing Linux system (it doesn't need to be an ARM system -- it can be an x86 system) where you would like to store the Ubuntu backup. The filesystem we want to back up is located on the second partition of the drive:

root # install -d /mnt/ubuntu
root # mount /dev/sdc2 /mnt/ubuntu -o ro
root # cd /root
root # tar czvf ubuntu-backup.tar.gz -C /mnt/ubuntu

You will also want to back up the lib/firmware and lib/modules directories from the Ubuntu image, for easy access, as well as the etc/fstab file. We will end up putting these on the new Funtoo root filesystem to ensure that things boot correctly. Do this as follows:

root # install -d /root/ubuntu-backup
root # cp -a /mnt/ubuntu/lib/modules /root/ubuntu-backup/
root # cp -a /mnt/ubuntu/lib/firmware /root/ubuntu-backup/
root # cp /mnt/ubuntu/etc/fstab /root/ubuntu-backup/

You are now ready to recreate the ext4 filesystem to wipe it clean.

Create New Root Filesystem

To create a new root filesystem for Funtoo, you will perform the following steps:

root # umount /mnt/ubuntu
root # mkfs.ext4 /dev/sdc2
root # e2label /dev/sdc2 rootfs

The e2label command associates the label "rootfs" with the root filesystem, which will come in handy later. Now, we will want to mount our filesystem so we can start installing Funtoo.

   Note

If you have sufficient capacity on your EMMC card, it's recommended that you use fdisk to delete the second paritition, and create a swap partition as well as a partition for the root filesystem. 2GB of swap is optimal, but any amount helps.

Mount and Install

Now, time to mount the new filesystem, download a Funtoo stage3, and extract it to our new filesystem:

root # install -d /mnt/funtoo
root # mount /dev/sdc2 /mnt/funtoo
root # cd /mnt/funtoo
root # wget http://build.funtoo.org/1.4-release-std/arm-32bit/odroid-xu4/stage3-latest.tar.xz
root # tar xpvf stage3-latest.tar.xz

Installation is almost complete! But we have a few more finishing touches before the system is bootable.

Getting Funtoo Boot-Ready

To get the ODROID XU4 boot-ready, we will need to copy back the firmware and modules directories, and set up the etc/fstab file. We'll do this as follows:

root # cp /root/ubuntu-backup/etc/fstab /mnt/funtoo/etc
root # cp -a /root/ubuntu-backup/firmware /mnt/funtoo/lib
root # cp -a /root/ubuntu-backup/modules /mnt/funtoo/lib

Now, let's edit the fstab file and ensure it's set up correctly:

root # vim /mnt/funtoo/etc/fstab

You'll want the file to look like this:

   
LABEL=rootfs / ext4 errors=remount-ro,noatime 0 1
LABEL=boot /boot vfat noauto 0 1

Setting Root Password

Now, we need to set the root password on the ODROID Funtoo image. If you are on an x86 system, you can't just chroot into /mnt/funtoo since all the binaries are ARM, not x86. So to do this, you will edit the /etc/shadow on your local system and /mnt/funtoo/etc/shadow. Then copy the line starting with root from the former to the latter file. This will copy the root password set on your local Linux system to your ODROID.

Setting Boot Options

We've completed sufficient steps to prepare the root filesystem for boot. Now, we need to make a minor tweak to the boot filesystem on the EMMC card. Let's mount our boot filesystem:

root # umount /mnt/funtoo
root # install -d /mnt/boot
root # mount /dev/sdc1 /mnt/boot
root # vim /mnt/boot/boot.ini

We will now change the line near the top starting with setenv bootrootfs so it looks exactly like this:

   
setenv bootrootfs "console=tty1 consoleblank=0 root=LABEL=rootfs rootwait ro fsck.repair=yes net.ifnames=0"

Now, we can unmount the boot filesystem, detach our USB MicroSD card reader, and attach our EMMC card to a powered-down ODROID:

root # umount /mnt/boot
root # sync
(Now remove the reader/card)

Final Steps

Next, you will want to hook the ODROID, EMMC installed, up to an HDMI monitor and a functioning ethernet cable. Power up the ODROID. You should see Funtoo Linux boot and you should be able to login with your other system's root password. You can now continue Funtoo Linux setup according to the Funtoo Linux Installation Guide. The remaining steps to complete are to perform an initial emerge --sync, configure your hostname, and configure your network. It is not necessary to install a kernel or bootloader as the Funtoo boot process is fully working.