Topic: Installing Gentoo

...was actually fairly straightforward. The trickiest part, since I have a custom setup, was setting up the initramfs, with the rest being a few changes to U-Boot. Below are the changes to U-Boot's include/configs/novena.h:

-        "initrd_addr_r=-\0"                                            \
+        "initrd_addr_r=0x15000000\0"                                   \

Since I'm using an 'initramfs', I need to have U-Boot load it to a location in memory. This location was arbitrarily chosen with no knowledge of the memory layout whatsoever, so it may actually be an awful choice.

-       "bootargs=init=/lib/systemd/systemd rootwait rw\0"              \
+       "bootargs=init=/sbin/init rootwait rw\0"                \

We need to boot from the regular init program, not systemd. This actually works on Debian, since /sbin/init is just a symlink to systemderp.

                        "if sleep 2 ; then true; else exit ; fi ; "     \
                        "echo Entering recovery mode... ; "             \
                        "setenv rec .recovery ; "                       \
-                       "setenv bootargs ${bootargs} recovery ; "       \
+                       "setenv bootargs init=/lib/systemd/systemd rootwait rw recovery ; " \
+                       "setenv initrd_addr_r - ; "                     \
                        "setenv rootdev PARTUUID=4e6f764d-03 ; " /* NovM */ \
                "else ; "                                               \
                        "echo Hold recovery button to boot to "         \
                        "recovery, or to enter U-Boot shell. ; "        \
+                       "setenv rootdev /dev/disk/by-id/ata-SSD_840_EVO_250GB ; " \

A quick hack that resets boot values to ones appropriate for either the recovery partition or the SSD (Note that the disk ID is different that what you'll see at runtime). You should set the appropriate rootdev if you are running this code yourself.

                "fatload ${bootsrc} ${bootdev} "                        \
                        "${fdt_addr_r} novena${rec}.dtb ; "             \
+               "fatload ${bootsrc} ${bootdev} "                        \
+                       "${initrd_addr_r} initramfs ; "                 \
                "fdt addr ${fdt_addr_r} ; "                             \

Load the initramfs from the boot device into memory.

                "setenv bootargs ${bootargs} "                          \
                        "root=${rootdev} "                              \
+                       "initrd=initramfs "                             \
                        "console=${consdev} ; "                         \

Add the initramfs to kernel arguments.

...and I think that those were most of the U-boot changes that I made.

Most of the pain points involved creating static binaries. A couple of notes follow:

If you've updated the kernel, you may need to update the recovery partition as well:

cp zImage zImage.recovery
cp novena.dtb novena.recovery.dtb

bash is tricky to compile natively. I had to use both

--enable-static-link --without-bash-malloc

hdparm returns different data in the initramfs environment, possibly due to missing kernel modules in that environment.

Make sure that any crypto algorithms that you need in the kernel are built in or available as modules; Novena doesn't have Twofish, Serpent, or ripemd160 enabled by default.

Have a backup boot device (SD Card) before attempting to modify U-Boot.

Re: Installing Gentoo

How painful is it compiling things? I know Chromium is awful on my main laptop (Core 2 Duo), and I can't imagine it's better on the Novena.

Have you tried setting up distcc or something to speed things up?

I use Gentoo on all my other boxes, so I'm interested in this. And now I see there are more recent stage3 tarballs available for armv7a... last time I looked they were pretty old.

Re: Installing Gentoo

Depends on how impatient you are. System upgrades for non-server environments can easily be done at night. Do them regularly and you're unlikely to wake up in the morning with the system still compiling.

I haven't set up distcc before.

So, one thing interesting about the stage3 tarballs is that I couldn't find a "hardened" version from the OSU OSL, but, once chrooted to the Gentoo system, could select the "hardened" profile from armv7a. Cool, right? Well, no, there's a problem; trying to do a system upgrade to the hardened profile would lead to downgrading glibc which then complains that "Downgrading glibc is not support and a sure way to destruction" (emphasis mine). Balls. I'd like to use the hardened toolchain, so I guess I'll wait until they bump up the supported glibc version... But, uh, what I was trying to say is that I suspect that, even if you install an old stage3, you can do a system upgrade right after installation to have a more recent version of software.

Re: Installing Gentoo

I found where to get a hardened Stage 3 tarball for ARM. It's under the "experimental" directory (http://distfiles.gentoo.org/experimental/arm/hardened/).

Sadly, I couldn't think up an easy way to transition over to the hardened system, so I just did a complete reinstall. It does seem to be working, though!

Re: Installing Gentoo

Posting this on my Novena running Gentoo. Managed to get X, xdm, and i3 working, though the i3status bar and window titles are difficult to read at the moment.

Ran into some troubles compiling the video drivers for X with default settings (specifically, the "omap" driver) and also ran into a dead mouse and keyboard after my first run, but was able to fix/workaround these issues with the following changes in 'make.conf'

VIDEO_CARDS="fbdev"
INPUT_DEVICES="evdev"

Also had to create the symlink '~/.Xdefaults -> ~/.xresources' in order to get a proper 'xterm' background. but that's probably not a Novena issue. The 'xdm' background looks a little off compared to my other systems, reminiscent of an error I had where an invalid gcc profile was set and some runtime compilation failed,  but it seems properly set on this system, and it does work, so I'm not sure what the issue is there (if there even is one).

I'll have to play around with 'i3status' a bit. Right now it reads "No Battery", which is obviously bogus.

Minor issues aside, though, it works!!! :D :D :D

Re: Installing Gentoo

Your life will probably be better if you add "modesetting" to VIDEO_CARDS and use that.  It will give you things like resolution setting, multi-monitor support, and rotation.

i3status is probably looking at the wrong device, or you're hitting a bug with the battery not activating.  The latest Senoko firmware should help with that problem.

Re: Installing Gentoo

"modesetting" doesn't seem to do anything as far as video goes, whether it's appended or used in place of "fbdev" (test was to run 'emerge -avuND --with-bdeps=y @world' and to see if any changes would be made).

One other issue that I forgot to mention was having a message along the lines of "Serial console respawning too fast: disabling for 5 minutes" (or something similar), which I was able to "fix" (not sure if it's a sane solution though), by editing '/etc/inittab' and commenting out the '# SERIAL CONSOLES' section.

Re: Installing Gentoo

Your default /etc/inittab is probably trying to attach to a serial console that does not exist, such as /dev/ttyS0.  You should remove that, or change it to /dev/ttymxc1.

I'm getting the "modesetting" value from their page: https://packages.gentoo.org/useflags/vi … odesetting

It could be that modesetting isn't enabled on ARM for some reason, or maybe they took it out of the ebuild.  Once you enable modesetting, you'll need to enable it in xorg.conf.