§2023-09-27
Gentoo on ODROID C2 Published on December 20, 2020 Author Artem Butusov
Here we will fill the gap and install Gentoo Linux on ODROID C2. The instruction should be relatively easy to update for other ODROID boxes,like, ODROID C4 etc.
Inspired by a short but a bit outdated instruction located here: https://forum.odroid.com/viewtopic.php?t=21675
- Get ubuntu 20.04 image and balena-etcher to etche it
$ wget https://odroid.in/ubuntu_20.04lts/c2/ubuntu-20.04-3.16-minimal-odroid-c2-20210201.img.xz
§2023-09-28
I sucessfuly booted up a odroid-hc4 following this arcticle.
1). I use netboot_default
to install Debian 11, Bullseye on a 246G MicroSD. and make sure it could be booted up.
- Mount eMMC/SD card
mkdir -p /mnt/gentoo
mount /dev/sdX2 /mnt/gentoo/
mount /dev/sdX1 /mnt/gentoo/boot
cd /mnt/gentoo
- Backup vanilla ODROID-hc4 kernel and configuration
mkdir -p opt/odroid-hc4-backup
cp -rfav lib/modules opt/odroid-hc4-backup
cp -rfav lib/firmware opt/odroid-hc4-backup
cp -rfav boot opt/odroid-hc4-backup
cp -av etc/fstab opt/odroid-hc4-backup
- Remove not needed stuff
find . -maxdepth 1 \
| while read file; do \
[ "$file" != "./boot" ] \
&& [ "$file" != "./opt" ] \
&& [ "$file" != "./lost+found" ] \
&& [ "$file" != "." ] \
&& rm -rf "$file"; \
done
- Install aarch64 stage3
tar xvpf stage3-* --xattrs-include='.' --numeric-owner rm -f stage3-*
6) copy `/usr/bin/dhcpcd` and `/etc/dhcpcd.conf`
cp -v /usr/bin/dhcpcd /mnt/gentoo/usr/bin cp -v /etc/dhcpcd.conf /mnt/gentoo/etc/
7) arch-chroot
arch-chroot /mnt/gebtoo /bin/bash source /etc/profile export PS1="(chroot) $PS1"
- edit /etc/resolv.conf as
nameserver 8.8.8.8 nameserver 8.8.4.4 ``
- make sure you can ping
ping google.com
- copy the saved
cp -rfav /opt/odroid-hc4-backup/modules lib/
cp -rfav /opt/odroid-hc4-backup/firmware lib/
cp -rfav /opt/odroid-hc4-backup/fstab /etc
- reset root password, no passwd
# sed -i 's/^root:.*/root::::::::/' /etc/shadow
-
exit and boot
-
If booted up uding
dhcpcd end0
to get ip
Post-reboot Installation
Disconnect eMMC/SD card and attach to ODROID C2, connect power and ethernet cord.
After boot:
- SSH into ODROID C2
Wait for some time and find new IP in the router settings and try to ssh using username “root” and password “gentoo”.
You can also find an IP using network scanner nmap:
nmap -p 22 192.168.50.1/24 | grep open -B 4
SSH using know IP address:
ssh root@A.B.C.D
If you have serial console cable, you can connect using it and track the boot process from macOS:
screen /dev/tty.SLAB_USBtoUART 115200
- Set time
ODROID C2 doesn’t have RTC so every time it reboots it will forget current time.
We will install later ntp to address this issue but for now we need to manually set the clock, otherwise, nothing will work well.
You can run date on macOS and copy paste into terminal like below:
date -s "Sat Dec 19 21:04:49 EST 2020"
- Install portage
mkdir -p /etc/portage/repos.conf cp -f /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf emerge-webrsync
- Install ntp server
ODROID-C2 doesn’t have RTC so every time it reboots it will forget current time.
Classical ntp doesn’t play well for systems without RTC (like ODROID C2), so lets install chrony instead that has support for systems without RTC.
emerge chrony
nano /etc/conf.d/chronyd ARGS="... -s -r"
rc-update add chronyd default
/etc/init.d/chronyd start
Default hwclock init script is useless without RTC:
rc-update delete hwclock boot
Reboot and confirm that clock is properly set.
- Done
Okay, the minimal Gentoo installation is completed. It boots and new packages can be installed.
Please follow official Gentoo instruction to change defaults like locale, timezone, make.conf etc: https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation References
https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
https://forum.odroid.com/viewtopic.php?t=21675
https://archlinuxarm.org/platforms/armv8/amlogic/odroid-c2
One Response to Gentoo on ODROID C2
David says:
April 22, 2021 at 8:42 am
Interesting take on the install. I also use gentoo on the C2, and it works really great.
Did you know about this overlay?
https://github.com/nxmyoz/c2-overlay
The instructions on how to use the official sys-kernel/gentoo-sources kernel are there, in case you want the ability to easily upgrade and customize it.
It’s also possible to install without a virtual machine, or even a second computer. I used arch linux on the c2 running on an sd card to create a gentoo install from scratch on a second sd card via a usb sd adapter. It took a day to compile gcc, and an another day to (re)compile everything else. Having swap space isn’t strictly necessary, although gcc can only compile this way using 1 thread and no “-pipe” CFLAG.