1 (edited by sakaki 2016-09-27 23:01:27)

Topic: Gentoo overlay for Novena released (incl all standard Novena packages)


if you are using Gentoo on your Novena, you might like to take a look at my novena-overlay, which I've just released on GitHub (here).

This overlay provides ebuilds shadowing all xobs' standard Novena packages from Debian (novena-eeprom-gui etc.), allowing you to enjoy these same facilities under Gentoo.

More details (including installation instructions) are in the project's GitHub page, but here is a brief summary of the provided ebuilds:

  • sys-kernel/novena-sources Full kernel sources for 4.7.2, with Gentoo and Novena patchsets.

  • sys-kernel/novena_hardened-sources As above, but with the hardened patchset; also, deblobbed by default.

  • dev-embedded/novena-eeprom Tool to view and edit the contents of the Novena's personality EEPROM.

  • dev-embedded/novena-eeprom-gui Qt GUI version of the above.

  • dev-embedded/novena-heirloom Support files for the heirloom laptop variant of Novena.

  • dev-embedded/novena-usb-hub Hub management tool (power control, etc.) for Novena.

  • dev-embedded/u-boot-novena Novena-packaged version of U-Boot.

  • dev-embedded/update-senoko Firmware loader for the Senoko battery/passthrough board.

  • sys-firmware/senoko-chibios Compile-from-source ChibiOS firmware for Senoko.

  • media-sound/pulseaudio-novena Support files for pulseaudio on Novena.

  • net-wireless/novena-disable-ssp Small daemon which disables SSP on all Bluetooth adaptors.

  • sys-apps/irqbalance-novena Distributes hardware interrupts across processors on Novena.

  • dev-embedded/etna_viv FOSS user-space driver for the Vivante GCxx GPUs (armada dependency).

  • x11-libs/libdrm-armada Userspace interface to kernel DRM services (armada dependency).

  • x11-drivers/xf86-video-armada-novena Accelerated X.org video driver for the Novena's i.MX6.

  • x11-misc/xorg-novena X.org configuration files for the armada video driver on Novena.

  • sys-devel/portage-distccmon-gui Easily view Portage jobs with distccmon-gui.

  • dev-embedded/novena-meta Merge this to pull in all baseline Novena packages (USE-flag controlled).

The ebuilds all seem to work OK on my machine, but if you get a chance to try them out, please let me know of any issues you uncover (with missing dependencies, for example). I'm aiming to announce this on the Gentoo forum in a week or so, so any early feedback would be much appreciated!

Best, sakaki

Edited to reflect name change of GitHub project (gentoo-novena-overlay -> novena-overlay) and repo (gentoo-novena -> novena).

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

I'm SUPER excited about this! I've been trying to track down how to build all of the etnaviv/libdrm/X11/armada stuff, and use Gentoo on my other machines. I'll definitely be giving this a shot! Probably not until after I get my case machined, though... really need to finish that.

Thanks for putting this together!

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

I've been meaning to do something like this myself for awhile now. Thanks for saving me time! I'll definitely try this out this weekend and let you know how it goes.

4 (edited by sakaki 2016-09-27 23:08:45)

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

Hi -

I've now added systemd support (in addition to OpenRC) for novena-usb-hub, novena-disable-ssp and irqbalance-novena (seemed silly not to include this, since the necessary unit files are already provided by xobs' original Debian packages). Haven't had a chance to test with systemd yet, however.

Please note also, that the GitHub project name has been shortened (from gentoo-novena-overlay to novena-overlay) and the corresponding repo name has too (from gentoo-novena to novena).

Best, sakaki

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

Cool, I hope the accellerated Xorg will finally work on my machine.

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

Since I still have the loaner desktop- and laptop-configuration Novenas, this morning I tried running update-senoko from the overlay, and realized that it has a missing dependency, stm32flash, which is not in the standard Gentoo repos.

So, I've just added an ebuild, dev-embedded/stm32flash-0.5 to the overlay, and bumped dev-embedded/update-senoko-3.2.5 to 3.2.5-r1 (including an RDEPEND on stm32flash).

If you are using this overlay (or one of the gentoo-on-novena microSD-card images, which is subscribed to it), before you can use update-senoko successfully, you need to issue:

# emaint sync --repo=novena
# emerge --ask --verbose --oneshot dev-embedded/update-senoko
(confirm when prompted, this should now pull in stm32flash as a dependency. as well as the build-from-source senoko-chibios firmware, if you don't already have that installed)

Then (at your own risk!) you can reflash with the latest ChibiOS firmware:

# update-senoko
Enabling Senoko reset lines...
Hold down the 'Reflash' button on your Senoko battery board...

push the button and keep it pushed...

stm32flash 0.5


Using Parser : Intel HEX
Interface serial_posix: 115200 8E1
Version      : 0x22
Option 1     : 0x00
Option 2     : 0x00
Device ID    : 0x0410 (STM32F10xxx Medium-density)
- RAM        : 20KiB  (512b reserved by bootloader)
- Flash      : 128KiB (size first sector: 4x1024)
- Option RAM : 16b
- System RAM : 2KiB
Write to memory
Erasing memory
Wrote address 0x0800ad10 (100.00%) Done.

Release the 'Reflash' button

Wait a second, then release the button as requested. update-senoko should now exit:

Senoko has been updated

Then, you can connect to your reflashed board, for example, using GNU screen:

# screen /dev/ttymxc3 115200
(press Enter to get a prompt)
ch> info
Kernel:       3.0.0dev
Compiler:     GCC 4.9.3
Architecture: ARMv7-M
Core Variant: Cortex-M3
Port Info:    Advanced kernel mode
Platform:     STM32F10x Performance Line Medium Density
Board:        Senoko STM32F1
Build time:   Sep 27 2016 - 15:54:26

(Your reported build time will differ, depending on when dev-embedded/senoko-chibios was built on your machine.)
When done, type ctrl-a then K, to exit screen.

Best, sakaki

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

Thanks for the overlay, sakaki!

I haven't been able to get the graphics working yet, though, as the Xorg armada driver is failing to load (ehh I can't seem to bold-textify lines in the code block):

emerge --info xorg-server dev-embedded/etna_viv x11-libs/libdrm-armada x11-drivers/xf86-video-armada-novena x11-misc/xorg-novena

Portage 2.3.0 (python 2.7.12-final-0, hardened/linux/arm/armv7a, gcc-4.9.4, glibc-2.23-r3, 4.7.2-novena_hardened-r3-gnu armv7l)
                         System Settings
System uname: Linux-4.7.2-novena_hardened-r3-gnu-armv7l-ARMv7_Processor_rev_10_-v7l-with-gentoo-2.3
KiB Mem:     3882320 total,   3649184 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Fri, 20 Jan 2017 06:00:01 +0000
sh bash 4.3_p48-r1
ld GNU ld (Gentoo 2.25.1 p1.1) 2.25.1
app-shells/bash:          4.3_p48-r1::gentoo
dev-lang/perl:            5.22.3_rc4::gentoo
dev-lang/python:          2.7.12::gentoo, 3.4.5::gentoo
dev-util/cmake:           3.5.2-r1::gentoo
dev-util/pkgconfig:       0.28-r2::gentoo
sys-apps/baselayout:      2.3::gentoo
sys-apps/openrc:          0.22.4::gentoo
sys-apps/sandbox:         2.10-r1::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69::gentoo
sys-devel/automake:       1.11.6-r1::gentoo, 1.14.1::gentoo, 1.15::gentoo
sys-devel/binutils:       2.25.1-r1::gentoo
sys-devel/gcc:            4.9.4::gentoo
sys-devel/gcc-config:     1.7.3::gentoo
sys-devel/libtool:        2.4.6-r2::gentoo
sys-devel/make:           4.1-r1::gentoo
sys-kernel/linux-headers: 4.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.23-r3::gentoo

    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000

    location: /usr/local/portage/novena
    sync-type: git
    sync-uri: https://github.com/sakaki-/novena-overlay.git
    masters: gentoo
    priority: 100

CFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/portage /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard"
FCFLAGS="-O2 -pipe -march=armv7-a"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-O2 -pipe -march=armv7-a"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
USE="acl alsa arm armv5te armv6 armv6t2 berkdb bmp bzip2 cli cracklib crypt cxx dri gdbm gif hardened iconv ipv6 jpeg jpeg2k modules ncurses nls nptl openmp pam pax_kernel pcre pic pie png postscript readline seccomp session ssl ssp svg tcpd unicode urandom webm wifi wireless xattr xtpax zlib" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump author" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_4" RUBY_TARGETS="ruby21" SANE_BACKENDS="epson epson2" USERLAND="GNU" VIDEO_CARDS="armada fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"

                        Package Settings

x11-base/xorg-server-1.18.4::gentoo was built with the following:
USE="ipv6 suid udev xorg -dmx -doc -glamor -kdrive (-libressl) -minimal (-selinux) -static-libs -systemd -tslib -unwind -wayland -xephyr -xnest -xvfb"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,lazy"

dev-embedded/etna_viv-20160915::novena was built with the following:

x11-libs/libdrm-armada-0.2.0::novena was built with the following:

x11-drivers/xf86-video-armada-novena- was built with the following:

x11-misc/xorg-novena-1.7.1::novena was built with the following:

cat /var/log/Xorg.0.log

[    95.673] 
X.Org X Server 1.18.4
Release Date: 2016-07-19
[    95.674] X Protocol Version 11, Revision 0
[    95.674] Build Operating System: Linux 4.4.0-00160-g49d5f10-dirty armv7l Gentoo
[    95.674] Current Operating System: Linux plato 4.7.2-novena_hardened-r3-gnu #2 SMP PREEMPT Thu Jan 19 21:27:49 PST 2017 armv7l
[    95.674] Kernel command line: init=/sbin/init rootwait rw root=/dev/mapper/ata-SSD_840_EVO_250GB devices=/dev/disk/by-id/ata-SSD_840_EVO_250GB initrd=uInitramfs console=tty0
[    95.674] Build Date: 02 December 2016  09:27:10PM
[    95.674]  
[    95.674] Current version of pixman: 0.34.0
[    95.674]     Before reporting problems, check http://wiki.x.org
    to make sure that you have the latest version.
[    95.674] Markers: (--) probed, (**) from config file, (==) default setting,
    (++) from command line, (!!) notice, (II) informational,
    (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    95.675] (==) Log file: "/var/log/Xorg.0.log", Time: Wed Dec 31 16:01:35 1969
[    95.690] (==) Using config directory: "/etc/X11/xorg.conf.d"
[    95.691] (==) Using system config directory "/usr/share/X11/xorg.conf.d"
[    95.697] (==) No Layout section.  Using the first Screen section.
[    95.697] (==) No screen section available. Using defaults.
[    95.697] (**) |-->Screen "Default Screen Section" (0)
[    95.698] (**) |   |-->Monitor "<default monitor>"
[    95.728] (==) No device specified for screen "Default Screen Section".
    Using the first device section listed.
[    95.728] (**) |   |-->Device "novena"
[    95.728] (==) No monitor specified for screen "Default Screen Section".
    Using a default monitor configuration.
[    95.728] (==) Automatically adding devices
[    95.728] (==) Automatically enabling devices
[    95.728] (==) Automatically adding GPU devices
[    95.770] (==) Max clients allowed: 256, resource mask: 0x1fffff
[    95.788] (WW) The directory "/usr/share/fonts/TTF/" does not exist.
[    95.788]     Entry deleted from font path.
[    95.788] (WW) The directory "/usr/share/fonts/OTF/" does not exist.
[    95.788]     Entry deleted from font path.
[    95.788] (WW) The directory "/usr/share/fonts/Type1/" does not exist.
[    95.788]     Entry deleted from font path.
[    95.790] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/100dpi/".
[    95.790]     Entry deleted from font path.
[    95.790]     (Run 'mkfontdir' on "/usr/share/fonts/100dpi/").
[    95.792] (WW) `fonts.dir' not found (or not valid) in "/usr/share/fonts/75dpi/".
[    95.792]     Entry deleted from font path.
[    95.792]     (Run 'mkfontdir' on "/usr/share/fonts/75dpi/").
[    95.792] (==) FontPath set to:
[    95.792] (**) ModulePath set to "/usr/lib/xorg/modules/,/usr/lib/arm-linux-gnueabihf/xorg/modules/"
[    95.792] (II) The server relies on udev to provide the list of input devices.
    If no devices become available, reconfigure udev or disable AutoAddDevices.
[    95.804] (II) Loader magic: 0x7f77ae50
[    95.804] (II) Module ABI versions:
[    95.804]     X.Org ANSI C Emulation: 0.4
[    95.805]     X.Org Video Driver: 20.0
[    95.805]     X.Org XInput driver : 22.1
[    95.805]     X.Org Server Extension : 9.0
[    95.808] (II) xfree86: Adding drm device (/dev/dri/card1)
[    95.809] (II) xfree86: Adding drm device (/dev/dri/card0)
[    95.809] (II) no primary bus or device found
[    95.809]     falling back to /sys/devices/soc0/display-subsystem/drm/card1
[    95.817] (II) LoadModule: "glx"
[    95.901] (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
[    96.259] (II) Module glx: vendor="X.Org Foundation"
[    96.259]     compiled for 1.18.4, module version = 1.0.0
[    96.259]     ABI class: X.Org Server Extension, version 9.0
[    96.259] (==) AIGLX enabled
[    96.259] (II) LoadModule: "armada"
[    96.259] (II) Loading /usr/lib/xorg/modules/drivers/armada_drv.so
[    96.309] (EE) Failed to load /usr/lib/xorg/modules/drivers/armada_drv.so: /usr/lib/xorg/modules/drivers/armada_drv.so: undefined symbol: fbImageGlyphBlt
[    96.310] (II) UnloadModule: "armada"
[    96.310] (II) Unloading armada
[    96.310] (EE) Failed to load module "armada" (loader failed, 7)
[    96.310] (EE) No drivers available.
[    96.310] (EE) 
Fatal server error:
[    96.310] (EE) no screens found(EE) 
[    96.310] (EE) 
Please consult the The X.Org Foundation support 
     at http://wiki.x.org
 for help. 
[    96.310] (EE) Please also check the log file at "/var/log/Xorg.0.log" for additional information.
[    96.310] (EE) 

I'm going to see if I can find the solution in the next couple of hours.

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

Hi - a quick search found this bug; different driver, but may be related (as you appear to be building under a hardened toolchain)? Your Xorg log is showing something similar:

[    96.259] (II) LoadModule: "armada"
[    96.259] (II) Loading /usr/lib/xorg/modules/drivers/armada_drv.so
[    96.309] (EE) Failed to load /usr/lib/xorg/modules/drivers/armada_drv.so: /usr/lib/xorg/modules/drivers/armada_drv.so: undefined symbol: fbImageGlyphBlt
[    96.310] (II) UnloadModule: "armada"
[    96.310] (II) Unloading armada
[    96.310] (EE) Failed to load module "armada" (loader failed, 7)

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

That might be it -- I'll see if I can build it without the hardened toolchain.  In the meantime, looking for symbols gives:

for file in `ls drivers/*.so`; do echo $file; objdump -T $file | grep fbImage; done
00000000      D  *UND*    00000000              fbImageGlyphBlt
00000000      D  *UND*    00000000              fbImageGlyphBlt
00000000      D  *UND*    00000000              fbImageGlyphBlt

for file in `ls *.so`; do echo $file; objdump -T $file | grep fbImage; done
00015c3c g    DF .text    00000528  Base        fbImageGlyphBlt
0001d9ac g    DF .text    0000062c  Base        wfbImageGlyphBlt

...so perhaps I can force-load 'libfb.so', or it's having linking troubles of some kind.

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

I tried tweaking the 'xf86-video-armada-novena' ebuild by adding:

inherit flag-o-matic
src_compile() {
    filter-flags -fPIE

as per https://wiki.gentoo.org/wiki/Hardened/T … with_PIEs, but it didn't help.  I'll probably take another shot at this next week, depending on my schedule.

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

I took another stab at it today but didn't have any luck.  I suspect the issue has something to do with trying to define symbols immediately at link time, but adding 'append-ldflags -Wl,-z,lazy' and variants didn't have any success.  I also checked other drivers and have been trying to see if I can use the 'xorg-2' eclass in the ebuild for this driver, but haven't had any luck getting it working yet.

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

Hi - just built this again to check - the modules load OK into X my end, but when queried show similar missing symbols to you (i.e. if I do "for file in `ls drivers/*.so`; do echo $file; objdump -T $file | grep fbImage; done").

If you download and use these files: armada_drv.so, etnadrm_gpu.so and etnaviv_gpu.so, do you still get the same issues trying to start X (I suspect you might).
Best, sakaki

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

That actually worked.  Not what I was expecting at all, honestly.

Re: Gentoo overlay for Novena released (incl all standard Novena packages)

Okay, I tried various toolchains, and the results are as follows:

 [1] armv7a-hardfloat-linux-gnueabi-4.9.4  // BROKEN
 [2] armv7a-hardfloat-linux-gnueabi-4.9.4-hardenednopie  // BROKEN
 [3] armv7a-hardfloat-linux-gnueabi-4.9.4-hardenednopiessp  // BROKEN
 [4] armv7a-hardfloat-linux-gnueabi-4.9.4-hardenednossp  // BROKEN
 [5] armv7a-hardfloat-linux-gnueabi-4.9.4-vanilla  // WORKS

So the problem seems to be the hardened toolchain.  I personally suspect that BIND_NOW is the suspect (https://wiki.gentoo.org/wiki/Hardened/T … efault_NOW):

The second more serious effect is that applications that are not written to refer to shared libraries in the standard way can fail; the most obvious of these is X, which has modules with circular resolution dependencies amongst other unusual behaviour.

After playing with the xorg-2 eclass a little, I finally found something horribly hacky that works https://github.com/sakaki-/novena-overlay/pull/2.

Oh, hm, I'm not currently getting any video output from mplayer.  Well, at least I have i3 again.