Installation Steps for Gentoo on C2

Moderators: odroid, mdrjr

Installation Steps for Gentoo on C2

Unread postby rev0lt » Fri Jun 03, 2016 7:41 am

Hello everyone,

I have successfully gotten Gentoo's experimental stage 3 for ARM64 to boot and run on the ODROID C2.

I have written a summary detailing the steps needed to do this, as follows.

Please feel free to comment and improve and further distribute so that everyone with C2 who wishes to install Gentoo can do so.

Once improved and firmed up, hopefully it can turn into a Gentoo C2 wiki.

Thank you!


__________________________________________________________________________________________

GENTOO INSTALLATION STEPS FOR THE ODROID C2

by rev0lt


1. Boot C2 into a working Linux distribution. (As with all OS installations, be sure to backup important files just in case anything goes wrong.)
In this example, we will use Ubuntu for the C2 since it is officially supported.

2. Prepare the Gentoo root filesystem:

a. Download the experimental Gentoo stage 3 for ARM64 from gentoo.org to a local directory in Ubuntu
(in this example, we use /opt/gentoo as local directory in Ubuntu and the latest stage 3 from date 2016/03/24;
change these accordingly if you wish):

mkdir /opt/gentoo && cd /opt/gentoo
wget http://distfiles.gentoo.org/experimenta ... 24.tar.bz2
bzip2 -d stage3*
tar xvf stage3*

b. Copy over /lib/modules and /lib/firmware from Ubuntu to Gentoo.

cp -afv /lib/modules /opt/gentoo/lib64/
cp -afv /lib/firmware /opt/gentoo/lib64/
cp -afv /lib/modules /opt/gentoo/lib/ (Gentoo stage 3 has /lib and /lib64. We also copy over the modules and firmware directories into Gentoo's /lib just in case)
cp -afv /lib/firmware /opt/gentoo/lib/

3. Chroot into Gentoo:

a. Make sure /opt/gentoo/etc/portage/make.conf is set up properly. Consult and follow the Gentoo handbook on gentoo.org.
For C2, I leave the CFLAG untouched (CFLAGS="-O2 -pipe") for now because adding in -march and -mtune seems to result
in compile errors for some packages. I tried setting MAKEOPTS="-j5" but ran into low memory
issue (process killed -- keep a look out at your dmesg for this) for some big packages -- but using "-j3" instead resolves such low memory issue.
Just use conservative settings in the make.conf for now because we can always fine tune it later.

b. Preparing chroot:

cp -L /etc/resolv.conf /opt/gentoo/etc/
mount -t proc proc /opt/gentoo/proc
mount --rbind /sys /opt/gentoo/sys
mount --make-rslave /opt/gentoo/sys
mount --rbind /dev /opt/gentoo/dev
mount --make-rslave /opt/gentoo/dev

c. Chroot into Gentoo

chroot /opt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) $PS1"

4. Configure Gentoo

For further details, please consult the Gentoo handbook on gentoo.org.

passwd (set root password)
useradd -m -G wheel -s /bin/bash yourname (add user youname, for example)
passwd yourname (set user yourname's password)
emerge --sync (please use emerge --webrsync first)
echo "UTC" > /etc/timezone
emerge --config sys-libs/timezone-data
nano /etc/locale.gen (remove the relevant comment)
locale-gen
eselect locale list
eselect locale set X (where X is the desired locale)
env-update && source /etc/profile && export PS1="(chroot) $PS1"

Download the c2_init.sh script from https://raw.githubusercontent.com/mdrjr ... c2_init.sh and
place it as c2_init.start in the /etc/local.d directory.

Then,

chmod +x /etc/local.d/c2_init.start
rc-update add local default

5. Configure Gentoo's /etc/fstab.

We need to specify the Gentoo filesystem device in /etc/fstab. In this example, because I will be using partition 3
on my eMMC as the Gentoo root filesystem:

nano /etc/fstab (and edit file accordingly, for example, like this:)

# <fs> <mountpoint> <type> <opts> <dump/pass>

/dev/mmcblk0p3 / ext4 errors=remount-ro,noatime,nodiratime 0 1
tmpfs /tmp tmpfs nodev,nosuid,mode=1777 0 0
/dev/mmcblk0p1 /boot vfat defaults,rw,owner,flush,umask=000 0 0

If you are booting using microSD, the device will also be identified as mmcblk0 after booting, so the above should still work but you must
change the partition number accordingly. For example, if you are booting Gentoo from a micrSD with Gentoo on partition 2, you would
specify /dev/mmcblk0p2 as mountpoint / in your fstab (i.e., still use mmcblk0 but change p3 to p2).

6. Configure Gentoo's Network

Install netifrc first:

emerge --noreplace net-misc/netifrc

To use DHCP on network interfaces eth0 and wlan0 (if you have a USB wifi device for example), edit /etc/conf.d/net as follows:

config_eth0="dhcp"
config_wlan0="dhcp"

Then,

cd /etc/init.d
ln -s net.lo net.eth0
rc-update add net.eth0 default
ln -s net.lo net.wlan0
rc-update add net.wlan0 default
rc-update add sshd default (sshd is useful if you are doing a headless boot into C2)
emerge net-misc/dhcpcd sys-kernel/linux-firmware ntp wpa_supplicant (ntp is needed as C2 has no persistent clock or else Gentoo would boot to 1970!)
rc-update add ntpd default
wpa_passphrase MYSSID myssidpassphrase > /etc/wpa_supplicant/wpa_supplicant.conf (insert your MYSSID and myssidpassphrase accordingly)

(Note that to unmask some packages, you may want to use "emerge --autounmask-write" and then run "dispatch-conf" for ease of use.)

7. Exit chroot and unmount the chroot pseudo-filesystems:

exit
umount -l /opt/gentoo/dev{/shm,/pts,}
umount /opt/gentoo{/boot,/sys,/proc,}

8. Create the Gentoo Filesystem and Copying Over Gentoo's Files

Next, we need to create the filesystem on the partition for Gentoo, and then copy the Gentoo files prepared in the above steps over to that filesystem.

In this example, because I will be using partition 3 on my eMMC card for Gentoo, so:

mkfs.ext4 /dev/mmcblk0p3
mkdir /mnt/gentoo
mount /dev/mmcblk0p3 /mnt/gentoo

Then, we copy over the files from /opt/gentoo to /mnt/gentoo:

cp -afv /opt/gentoo/* /mnt/gentoo/

9. Edit boot.ini

In this example, because the boot.ini in Ubuntu's boot partition (mounted as /media/boot/ in Ubuntu) is pointing to the Ubuntu partition in /dev/mmcblk0p2,
we must edit boot.ini to point it to the Gentoo root partition instead:

nano /media/boot/boot.ini (and change the root= variable to root=/dev/mmcblk0p3 in this line as follows, for example:)

setenv bootargs "root=/dev/mmcblk0p3 rootwait ro ${condev} no_console_suspend hdmimode=${m} m_bpp=${m_bpp} vout=${vout} fsck.repair=yes net.ifnames=0 elevator=noop
disablehpd=${hpd}"

Please make sure that the above line (i.e., the one that starts with the words setenv bootargs followed by the variables enclosed by the quotation marks) stays in one line
when you edit in nano. (Webpage formatting may likely cause the line to be displayed in multiple lines inadvertently.)

10. Reboot

Reboot from Ubuntu, and the C2 will now boot into Gentoo, with the network eth0 and wlan0 working!

Congratulations!

The above method should also work if you are installing Gentoo and booting Gentoo on a microSD card instead of eMMC, as long as you
adjust everything accordingly.

For example, if you are installing Gentoo on a microSD card with partition 1 as boot and partition 2 as Gentoo root filesystem,
then you would specify mmcblk0p2 as your / in Gentoo's filesystem in Gentoo's /etc/fstab before rebooting into Gentoo.

To prep the microSD (/dev/sda1 for example), you would use sd_fusing.sh /dev/sda, and make sure
the boot files (boot.ini, Image, meson64_odroidc2.dtb, uInitrd) from /media/boot/ in Ubuntu are copied over to /dev/sda1 before rebooting.

You may want to keep your Ubuntu partition so that you can boot back into it and update kernel and /lib/modules /lib/firmware later. To do this, you simply
edit boot.ini in Gentoo's /boot and change the root= variable back to /dev/mmcblk0p2 (in my example) and reboot. Once kernel and /lib are updated in Ubuntu
(via for example, "apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y"), you can copy them to Gentoo partition and reboot back into Gentoo
by editing /media/boot/boot.ini as detailed above again. One convenient way is to script this into Gentoo, and
also Ubuntu (adding the -y flag to apt-get upgrade and apt-get dist-upgrade helps), and have them reboot back and forth periodically
to update Ubuntu and copy the /lib/firmware and /lib/modules directories over to Gentoo, so that it is all done automatically in the background at night as you sleep.

In Gentoo, because we only started out with stage 3, once you have tuned and firmed up your make.conf variables, you can then do "emerge -e world" to
go "backwards" and recompile everything in world (for example, after adding "-bindist" to your USE variable in make.conf) for your compiling pleasure!

Note that some packages may require kernel sources at /usr/src, so download or git clone the needed branch
from https://github.com/hardkernel/linux.git into a directory in /usr/src named for example linux-c2-3.14, and
then sym link (or eselect) it to the directory /usr/src/linux because emerge expects it there by default.

Finally, X Window compiles and runs quite nicely on C2 in Gentoo. If you wish to install X Window, you can do this:

USE="-llvm" emerge x11-base/xorg-server (this package is leaner; but it still pulls in llvm which may be problematic to build, so we exclude llvm for now)
emerge openbox xterm (or choose your favorite)
nano /etc/X11/xinit/xinitrc (and remove the reference to twm and replace it with exec openbox or your favorite)

Then,

startx

Oh, you may want to consider active cooling solutions for the C2 if you compile often. Looking at my log files, with the included
stock cpu-cooler and without active cooling, the C2 runs a bit too hot for my personal liking when running big emerge jobs, topping out at
around above 70 degrees celsius. (You can find and keep track of the temperature during big compile jobs by searching for temp in /sys and
looking at the relevant file.) So, it may be a good idea to keep it cool with a fan when you compile or at least keep it
at some safe distance away from the back of the TV.

I hope this guide helps. Enjoy your C2 and Gentoo! It is nice board!

Cheers,

rev0lt
Last edited by rev0lt on Fri Jun 17, 2016 8:32 pm, edited 26 times in total.
rev0lt
 
Posts: 6
Joined: Fri Jun 03, 2016 7:23 am
languages_spoken: english
ODROIDs: C2

Re: Installation Steps for Gentoo on C2

Unread postby rev0lt » Fri Jun 03, 2016 7:48 am

X Window compiles and runs nicely on the Odroid C2 in Gentoo.

Just do:

USE="-llvm" emerge x11-base/xorg-server

I have edited the steps to reflect this.

rev0lt
Last edited by rev0lt on Sun Jun 05, 2016 10:30 am, edited 1 time in total.
rev0lt
 
Posts: 6
Joined: Fri Jun 03, 2016 7:23 am
languages_spoken: english
ODROIDs: C2

Re: Installation Steps for Gentoo on C2

Unread postby LiquidAcid » Fri Jun 03, 2016 8:21 am

Why do you need LLVM for Xorg?
LiquidAcid
 
Posts: 1080
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2

Re: Installation Steps for Gentoo on C2

Unread postby Tpimp » Fri Jun 03, 2016 8:36 am

probably for mesa x11 extension generation. Just my guess.
Tpimp
 
Posts: 355
Joined: Thu Jul 16, 2015 5:57 am
languages_spoken: english
ODROIDs: U3, C1+, XU4

Re: Installation Steps for Gentoo on C2

Unread postby tchiwam » Fri Jun 03, 2016 9:25 am

That's a good get going fast how to you have.

Some of my notes are here:
https://wa.tchiwam.net/trac/wiki/Odroid%20C2

I'm planing to update my check list when I get my new C2 and update the image I have.
I need to add the how to compile the driver in order to use the mali driver for X11.
I don't know if the c2_init.sh is still needed for the C2 ?
Then I need to get the benchmarks sorted, but for that I have am writing my own as I need to compare different parameters.
tchiwam
 
Posts: 83
Joined: Wed Dec 30, 2015 4:53 am
Location: Greenland
languages_spoken: english, French, Finnish, Greenlandic(little)
ODROIDs: 5x XU4, 3x C2, 2 cloudshell, 1 VU7, 1 VU7+, UPS1, UPS2, UPS3, USB/SATA, and many other fine bits from Odroid

Re: Installation Steps for Gentoo on C2

Unread postby hephooey » Fri Jun 03, 2016 9:32 am

I am so glad to see someone also using gentoo, I wish I have this howto when I tried it instead of spending hours experimenting in the dark. A few suggestions:

1. I think it is a good idea to uncomment the serial consoles setup in /etc/inittab, usually serial console is useful when something goes wrong during experiments.

2. I use the gcc 6.1 ebuild from the hardened overlay and everything (I have not tested X, just the ones needed from kodi) compiles with the following cflags:

Code: Select all
CFLAGS="-O2 -march=armv8-a+crc -mcpu=cortex-a53 -mtune=cortex-a53 -fno-delete-null-pointer-checks -flifetime-dse=1 -funsafe-math-optimizations -pipe"


3. I use MAKEOPTS="-j3" or even smaller numbers, I remember at least boost and binutils have some cpp files uses GB memory when compiling so with -j5 you very likely will run out of memory and get an internal error from the compiler. Maybe this is related to your errors with llvm? Setup zram helps quite a bit, compiling kodi with lto can only be done with helps from zram

4. It might be useful to setup /var/tmp in tmpfs or redirect the portage tmp to /tmp. Most of the small packages can be compiled without exceed the memory limit, I use a sdcard and a little bit concerned about the longevity of it if I frequently compile things on it. For larger packages I do it on an nfs server. It is a little bit slow, but I do not compile monsters like gcc that often these days.

Finally a complain/request for amlogic/hardkernel. The really irksome aspect is that there is no way to compile uboot in the native environment, the fip_create file you need to run during compiling is a binary blob in amd64. So either setup a cross compile env which is somewhat overkill or rely on other distributions everytime hardkernel update the uboot. I hope hardkernel will be able to make amlogic release the source code or at least a binary for arm64.
hephooey
 
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2

Re: Installation Steps for Gentoo on C2

Unread postby hephooey » Fri Jun 03, 2016 10:22 am

tchiwam wrote:I'm planing to update my check list when I get my new C2 and update the image I have.
I need to add the how to compile the driver in order to use the mali driver for X11.
I don't know if the c2_init.sh is still needed for the C2 ?
Then I need to get the benchmarks sorted, but for that I have am writing my own as I need to compare different parameters.


I have pushed the ebuilds for mali and aml_c2 I modified from the c1 versions here:
https://github.com/hephooey/odroid-c2-overlay
I only have ebuild for the framebuffer version of mali, but it should be easy to extend to X11, I do not want to install the whole X so I cannot honestly test it.

I think you still need c2_init.sh or something similar to unblank the monitor and setup the screen.
hephooey
 
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2

Re: Installation Steps for Gentoo on C2

Unread postby LiquidAcid » Fri Jun 03, 2016 5:57 pm

Tpimp wrote:probably for mesa x11 extension generation. Just my guess.

What is "mesa x11 extension generation" supposed to be? Such a package doesn't exist in the portage tree.
LiquidAcid
 
Posts: 1080
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2

Re: Installation Steps for Gentoo on C2

Unread postby Tpimp » Fri Jun 03, 2016 6:47 pm

Sorry that was worded poorly. I meant to say that it might be related to llvmpipe and run-time code generation (Gallium and software rendering).
http://www.mesa3d.org/llvmpipe.html
Tpimp
 
Posts: 355
Joined: Thu Jul 16, 2015 5:57 am
languages_spoken: english
ODROIDs: U3, C1+, XU4

Re: Installation Steps for Gentoo on C2

Unread postby LiquidAcid » Fri Jun 03, 2016 7:29 pm

That is correct, you need LLVM for llvmpipe (obvious, duh!). But still you don't need it for Xorg, hence my first question.
LiquidAcid
 
Posts: 1080
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2

Re: Installation Steps for Gentoo on C2

Unread postby Tpimp » Fri Jun 03, 2016 7:59 pm

Well if they follow the normal route of

compile Mesa/DRM/DRI

compile XORG against mesa DRM/DRI.

Then it could be concluded that not being able to build mesa properly is preventing them from building xorg (they stop at step one).

But as you stated this isn't necessary (mesa DRM won't work) and likely the individual is confused.

https://wiki.gentoo.org/wiki/Xorg/Hardw ... tion_guide

@hephooey You need to use fbdev.
Tpimp
 
Posts: 355
Joined: Thu Jul 16, 2015 5:57 am
languages_spoken: english
ODROIDs: U3, C1+, XU4

Re: Installation Steps for Gentoo on C2

Unread postby LiquidAcid » Fri Jun 03, 2016 9:14 pm

Tpimp wrote:Well if they follow the normal route of

compile Mesa/DRM/DRI

You're mixing up a bunch of totally different things.

Tpimp wrote:compile XORG against mesa DRM/DRI.

The only Xorg module that links against shared libraries from Mesa is libglx. And it only links to libGL and libglapi, not to a specific driver like swrast.

Tpimp wrote:Then it could be concluded that not being able to build mesa properly is preventing them from building xorg (they stop at step one).

But as you stated this isn't necessary (mesa DRM won't work) and likely the individual is confused.

llvmpipe won't be build without LLVM. However you can still build mesa using the classic swrast driver. The only other hardware driver which needs LLVM is radeonsi, which is not relevant here.
Also there isn't anything like "mesa DRM".

Tpimp wrote:https://wiki.gentoo.org/wiki/Xorg/Hardware_3D_acceleration_guide

That guide is wrong on so many levels.

The DRM (Direct Rendering Manager) is an enhancement to Xorg that adds 3D acceleration for cards by adding the kernel module necessary for direct rendering.

That is simply wrong. DRM is not an enhancement but a subsystem/framework in the kernel and a userspace component to implement GPU hardware acceleration. It's not Xorg that uses the DRM but the Mesa hardware driver. Communication between the Mesa components and Xorg is done via DRI (most recently DRI3).

Long story short:
- Even if LLVM fails to build, you can still compile Mesa without it.
- Let's assume for a moment that you can't build Mesa for whatever reasons. Then you can still build Xorg (see the minimal useflag).
LiquidAcid
 
Posts: 1080
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2

Re: Installation Steps for Gentoo on C2

Unread postby Tpimp » Sat Jun 04, 2016 3:52 am

LiquidAcid wrote:
Tpimp wrote:Well if they follow the normal route of

compile Mesa/DRM/DRI

You're mixing up a bunch of totally different things.

Tpimp wrote:compile XORG against mesa DRM/DRI.

The only Xorg module that links against shared libraries from Mesa is libglx. And it only links to libGL and libglapi, not to a specific driver like swrast.

Tpimp wrote:Then it could be concluded that not being able to build mesa properly is preventing them from building xorg (they stop at step one).

But as you stated this isn't necessary (mesa DRM won't work) and likely the individual is confused.

llvmpipe won't be build without LLVM. However you can still build mesa using the classic swrast driver. The only other hardware driver which needs LLVM is radeonsi, which is not relevant here.
Also there isn't anything like "mesa DRM".

Tpimp wrote:https://wiki.gentoo.org/wiki/Xorg/Hardware_3D_acceleration_guide

That guide is wrong on so many levels.

The DRM (Direct Rendering Manager) is an enhancement to Xorg that adds 3D acceleration for cards by adding the kernel module necessary for direct rendering.

That is simply wrong. DRM is not an enhancement but a subsystem/framework in the kernel and a userspace component to implement GPU hardware acceleration. It's not Xorg that uses the DRM but the Mesa hardware driver. Communication between the Mesa components and Xorg is done via DRI (most recently DRI3).

Long story short:
- Even if LLVM fails to build, you can still compile Mesa without it.
- Let's assume for a moment that you can't build Mesa for whatever reasons. Then you can still build Xorg (see the minimal useflag).


No I'm not mixing things up, I'm just not going into 500 word detail about the relationships as this is for each individual to read and learn on their own. I don't use Gentoo so I just posted a link from their wiki for some background reading . It seems pretty old but If something is wrong take it up with the author of the wiki as I didn't have time to read the whole thing.

I never said.
"You can't build mesa without llvm" or that "you can't build x11 without mesa".

But if this is someone coming from x86 world it is possible they are confusing differences.
Tpimp
 
Posts: 355
Joined: Thu Jul 16, 2015 5:57 am
languages_spoken: english
ODROIDs: U3, C1+, XU4

Re: Installation Steps for Gentoo on C2

Unread postby LiquidAcid » Sat Jun 04, 2016 4:27 am

Right, so you post a link to a Wiki entry which you havent' read, for a distribution which you don't even use. Well, that's also some method to increase the post counter.
LiquidAcid
 
Posts: 1080
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2

Re: Installation Steps for Gentoo on C2

Unread postby Tpimp » Sat Jun 04, 2016 8:44 am

I read it enough to know it was relevant enough to the topic. If you had a better link you should have posted. Who gives a crap about post count? You've been on this forum for years. But you're still an arrogant asshole to everyone. Must be all that upstream work. :D
Tpimp
 
Posts: 355
Joined: Thu Jul 16, 2015 5:57 am
languages_spoken: english
ODROIDs: U3, C1+, XU4

Re: Installation Steps for Gentoo on C2

Unread postby psychedup74 » Sat Jun 04, 2016 3:26 pm

Appreciate this thread. I use Gentoo on all my other machines so naturally I want it on this one, too. I had set up the stage3 and configured it, that was pretty easy and straightforward, but getting the thing to boot has been pretty frustrated.

I guess I never thought to just use the ubuntu kernel. I tried building my own kernel and u-boot from the hardkernel git, following their instructions but it wouldn't boot up. Without a UART adapter I couldn't tell what was going wrong.

After going through your instructions, I was finally able to boot into my stage3 using the ubuntu kernel, then I was able to compile the kernel natively on the C2. It still wont' boot my kernel without an uInitrd, and I don't know how to make one, so now I'm using my kernel with ubuntu's uInitrd. I would love to know how to see what is in the uInitrd so that perhaps I could figure out how to make it work without it.
psychedup74
 
Posts: 2
Joined: Tue May 17, 2016 11:48 am
languages_spoken: english
ODROIDs: C2

Re: Installation Steps for Gentoo on C2

Unread postby hephooey » Sat Jun 04, 2016 9:55 pm

psychedup74 wrote:Appreciate this thread. I use Gentoo on all my other machines so naturally I want it on this one, too. I had set up the stage3 and configured it, that was pretty easy and straightforward, but getting the thing to boot has been pretty frustrated.

I guess I never thought to just use the ubuntu kernel. I tried building my own kernel and u-boot from the hardkernel git, following their instructions but it wouldn't boot up. Without a UART adapter I couldn't tell what was going wrong.

After going through your instructions, I was finally able to boot into my stage3 using the ubuntu kernel, then I was able to compile the kernel natively on the C2. It still wont' boot my kernel without an uInitrd, and I don't know how to make one, so now I'm using my kernel with ubuntu's uInitrd. I would love to know how to see what is in the uInitrd so that perhaps I could figure out how to make it work without it.


I use dracut to generate the uInintrd:

Code: Select all
sudo dracut --kver 3.14.65-Gentoo+ -m "rootfs-block base" uInitrd


the parameter of --kver should match the name of the kernel (the name of the directory make module_install creates under /lib). I never tried to compile the kernel using the defconfig though. I just get the config of a working kernel from /proc/config.gz (you might need to do modprobe configs first) and start from there. Make sure CONFIG_BINFMT_SCRIPT is compiled in the kernel, not as a module, openrc should be able to take over.

Since you do not have UART you might want to run c2_init.sh a little bit earlier to light up the screen, I modified /etc/init.d/bootmisc to run it at the end of start(). Hope it helps.
hephooey
 
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2

Re: Installation Steps for Gentoo on C2

Unread postby rev0lt » Sun Jun 05, 2016 2:53 am

psychedup74 wrote:
After going through your instructions, I was finally able to boot into my stage3 using the ubuntu kernel, then I was able to compile the kernel natively on the C2.


Hi Psychedup74,

Glad that the steps worked for you.

Let's hope to see more Gentoo users on the ODROID C2! It is a very nice aarch64 board.

rev0lt
rev0lt
 
Posts: 6
Joined: Fri Jun 03, 2016 7:23 am
languages_spoken: english
ODROIDs: C2

Re: Installation Steps for Gentoo on C2

Unread postby rev0lt » Sun Jun 05, 2016 9:14 am

hephooey wrote:
I use MAKEOPTS="-j3" or even smaller numbers, I remember at least boost and binutils have some cpp files uses GB memory when compiling so with -j5 you very likely will run out of memory and get an internal error from the compiler. Maybe this is related to your errors with llvm? Setup zram helps quite a bit, compiling kodi with lto can only be done with helps from zram



Ahhh, one learns something new each day.......I finally got around to checking my dmesg and sure enough, you were right. Turns out that the process kept getting killed due to low memory with "-j5".

Thanks much for your helpful suggestion. I have amended the steps above to use "-j3" instead, just to be conservative since the aim is to get Gentoo running.

rev0lt.
rev0lt
 
Posts: 6
Joined: Fri Jun 03, 2016 7:23 am
languages_spoken: english
ODROIDs: C2

Re: Installation Steps for Gentoo on C2

Unread postby tchiwam » Mon Jun 06, 2016 1:08 am

To prevent running out of memory, I use a -j4 -l3, the 4th process will bring it to load of 4, so I manage to compile most of the big packages with that. when the swap gets used a lot the load will go up and you won't have that many make forking any more.

When I use distcc the I use -l4 -j16 and it usually works. so that again the load will prevent going crazy and use all you memory for non gcc stuff.
tchiwam
 
Posts: 83
Joined: Wed Dec 30, 2015 4:53 am
Location: Greenland
languages_spoken: english, French, Finnish, Greenlandic(little)
ODROIDs: 5x XU4, 3x C2, 2 cloudshell, 1 VU7, 1 VU7+, UPS1, UPS2, UPS3, USB/SATA, and many other fine bits from Odroid

Re: Installation Steps for Gentoo on C2

Unread postby fvolk » Mon Jun 06, 2016 1:23 am

Hi all...

So I have a shiny new C2.
The official Ubuntu is too bloated, there are some Debian/jessie images, however as our production server runs Gentoo+Docker I'm considering putting Gentoo on this C2, too.

My idea would be to run a pretty bare installation, and then just put every service into a Docker container, re-using our Dockerfiles from the amd64 world to get the exactly same program versions. Then attach one of those new 4TB 2.5" USB disks from Seagate/Samsung, move the CPU-friendly stuff to the C2 and hide the thing where nobody can find it :-)

Questions is, anybody had success in bootstrapping Docker with their C2 Gentoo and the 3.14 kernel nicked from the official Ubuntu?

Tnx!
fvolk
 
Posts: 190
Joined: Sun Jun 05, 2016 11:04 pm
languages_spoken: english
ODROIDs: C2, HC1

Re: Installation Steps for Gentoo on C2

Unread postby sputnik » Sat Jul 23, 2016 6:13 am

<duplicate post>
Last edited by sputnik on Sat Jul 23, 2016 6:44 am, edited 1 time in total.
sputnik
 
Posts: 68
Joined: Tue Aug 11, 2015 9:39 am
languages_spoken: english, some spanish
ODROIDs: C1+

Re: Installation Steps for Gentoo on C2

Unread postby sputnik » Sat Jul 23, 2016 6:15 am

A bit late, but I've been running Funtoo on my C1+ for almost a year now. I didn't really stop to think that maybe I could exclude the llvm dependency for xorg-server, and it's the only thing I can't compile natively. Well, it might, I use zram which really helps a lot, but I don't think I've ever bothered. Instead I have an old core2 duo laptop m/b with no keyboard, screen, etc., I ssh into it (it boots Funtoo too of course) and use qemu on it to compile llvm, takes about 10 hours. I don't mind, that machine's sole purpose is to be a compile helper in my distcc farm. It only updates every few months. I simply mount the entire odroid HD to it and it works pseudo-natively. But I should think your C2's with 2G should compile it np.
I've had bad luck with chromium too in the past, but it turns out there was a problem with it upstream when I was hot & heavy on it, might do it now. Instead I grab the binary from Ubuntu armv7a repository, with a few tweaks to the launch file and lib files it works fine, but of course the memory challenged C1, it takes all it's got, don't open that 3rd tab! But 99% of the time I cheat, open an instance of chromium-browser on a 24/7 big boy laptop around here, just let X11 display it locally here, uses almost no resources locally. My big boy laptop died in February, my C1+ has been my daily user for awhile now...
I also recommend <shameless plug>this post regarding making unitrd with dracut: viewtopic.php?f=114&t=18768. And this <shameless plug 2> regarding cryptodev: viewtopic.php?f=112&t=7579
hephooey has the right idea with the ebuilds, except for llvm my C1+ updates, etc. like any of my other Funtoo machines, even the kernel (only when I choose to update the kernel).
Wish I had 2G ram...
sputnik
 
Posts: 68
Joined: Tue Aug 11, 2015 9:39 am
languages_spoken: english, some spanish
ODROIDs: C1+

Re: Installation Steps for Gentoo on C2

Unread postby darksurf » Fri Aug 19, 2016 2:53 pm

I'm really disappointed with the Odroid-C2. Currently, this point appears to be great only if you don't need the GPU. I purchased this for my son after seeing ORGA only to find, it doesn't exist for the C2. I payed the extra money thinking we could use the extra power on PS1 emulation. I started with odrobian, ended up with debian package management hell where all packages are split it in 5 separate packages and I need the -dev of everything if I want to compile. lightdm refused to allow autologin. Came with firefox esr that would only segfault when I tried to launch it. try to install midori as minimal browser... Not available and attempting to find all packages to compile is a freaking nightmare before I find packages that are broken and wont install. I eventually gave up and started looking around. Started on Sabayon for the odroid-c2 (gentoo based distro) . that started up really well, I'm more the gentoo/sabayon user myself. Was able to get everything rolling easily until....Graphics. Mali GPUs are an evil little nightmare. Sabayon comes rocking the 4.6 kernel. I can't seem to understand how to get this GPU up and working. Are we seriously restricted to the 3.14 kernel?

I just want a solid emulationstation for my son and wife who like retro games. Pi one didn't cut the mustard even on super nes games, lagged like crap even overclocked. I don't wish to purchase a Pi, I wish to understand how to get this C2 to work the way I want. Currently thinking about ubuntu 16.04, but the page even specifies there are issues with the Mali graphics. Its almost like this board was developed and sold incomplete, with no support at launch. Anyone got anything like ORGA working on the c2?
darksurf
 
Posts: 2
Joined: Fri Aug 19, 2016 2:20 pm
languages_spoken: english
ODROIDs: Odroid-C2

Re: Installation Steps for Gentoo on C2

Unread postby rooted » Fri Aug 19, 2016 3:43 pm

I feel your pain darksurf, you really want the XU4 for good emulation IMO.

Look at the user meverick postings, he is the one that continuously maintains emulation targeted stuff.
User avatar
rooted
 
Posts: 5902
Joined: Fri Dec 19, 2014 9:12 am
Location: Gulf of Mexico, US
languages_spoken: english

Re: Installation Steps for Gentoo on C2

Unread postby memeka » Fri Aug 19, 2016 5:22 pm

@darksurf

Yes the kernel is limited to 3.14. There is only very basic support in 4.8 kernel for S905, 4.6 won't even boot.
So you need to use the HK 3.14 kernel and install whatever rootfs you want - Gentoo, Debian, Ubuntu, fedora etc.
Take note at the architecture of the rootfs: armhf for 32 bits, arm64 for 64 bits.

GPU: you need to decide if you go for X11 or fbdev. Emulation station and retroarch can work with both; performance is better I think on fbdev (well, depending on drivers), but for fbdev you need to patch SDL2 with Mali support (for emulation station) and retroarch too. It's not quite straightforward and you need to read the forums here to find the patches. So it might be easier to go for X11.

For X11 - you need to install X11 as usual, then you need to compile the X11 Mali DDX - which should be available from @mdrjr 's repository. Then you configure xorg to use it - or easier to copy xorg.conf from a HK image or from @mdrjr's repo (if available). The X11 DDX is closely tied to X11 version so you can't reuse it if you don't have the same version as the one from the HK image.
Lastly you need to get the libmali binary driver - also from @mdrjr'd repo or from a HK image. I think they only provide it for arm64 - which means if you have a 32-bit Gentoo it won't work and all was for nothing - but I understand that HK will release a 32bit version too. So you need to copy the correct libmali and replace the existing Mesa installed in Gentoo (libegl.so, libgles1.so, libgles2.so) with links to this libmali.

Finally, compile emulation station, retroarch etc.
User avatar
memeka
 
Posts: 4063
Joined: Mon May 20, 2013 10:22 am
languages_spoken: english
ODROIDs: XU rev2 + eMMC + UART
U3 + eMMC + IO Shield + UART

Re: Installation Steps for Gentoo on C2

Unread postby hephooey » Sat Aug 20, 2016 2:39 am

@darksurf
On gentoo, the best approach to run emulators like retroarch is to setup a arm(32) chroot and run it from there, most of the emulators take advantages of arm asm and neon to gain a significant speed up, and unless you are an expert like exophase and willing to put months into rewriting the code for arm64, just chroot to the 32bit system.

Since there is no 32bit mali driver for X, framebuffer is the only choice. The good news is at this point you can just treat C2 as a faster C1, I think there are portage overlays to help you install the retroarch and its various cores, I just compile the code myself since I want to use the latest thing from git. Just remember to install the mali framebuffer driver for C2.
hephooey
 
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2

Re: Installation Steps for Gentoo on C2

Unread postby best_odroidfreak » Sun May 07, 2017 2:47 am

Would you so kind as to upload a minimal Gentoo image for Odroid c2 (ARM 64)?
Thank you in advance!
best_odroidfreak
 
Posts: 364
Joined: Wed May 04, 2016 1:07 am
languages_spoken: english


Return to Other OS

Who is online

Users browsing this forum: No registered users and 1 guest