# systemd and radeon/kms

## Circuitsoft

It would appear that I'm facing a firmware issue. If I boot with systemd, I get a blank screen and nothing works. If I boot openrc, it's fine. If I then reboot the machine with systemd, it's fine. So, systemd is not loading my radeon firmware, but if it's already been loaded, then it continues to work.

```
alex@alex-thinks ~ $ emerge --info

Portage 2.1.11.9 (default/linux/amd64/10.0/desktop, gcc-4.5.3, glibc-2.14.1-r3, 3.3.8-gentoo x86_64)

=================================================================

System uname: Linux-3.3.8-gentoo-x86_64-AMD_E-350_Processor-with-gentoo-2.1

Timestamp of tree: Sun, 12 Aug 2012 21:00:01 +0000

app-shells/bash:          4.2_p20

dev-java/java-config:     2.1.11-r3

dev-lang/python:          2.7.3-r2, 3.1.4-r3, 3.2.3-r1

dev-util/cmake:           2.8.7-r5

dev-util/pkgconfig:       0.26

sys-apps/baselayout:      2.1-r1

sys-apps/openrc:          0.10.5

sys-apps/sandbox:         2.5

sys-devel/autoconf:       2.13, 2.68

sys-devel/automake:       1.11.1

sys-devel/binutils:       2.21.1-r1

sys-devel/gcc:            4.5.3-r2

sys-devel/gcc-config:     1.6

sys-devel/libtool:        2.4-r1

sys-devel/make:           3.82-r1

sys-kernel/linux-headers: 3.4 (virtual/os-headers)

sys-libs/glibc:           2.14.1-r3

Repositories: gentoo x-portage virtualization emg-overlay zugaina tlp

ACCEPT_KEYWORDS="amd64"

ACCEPT_LICENSE="* -@EULA google-chrome AdobeFlash-10.3 google-talkplugin skype-eula"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=amdfam10 -O2 -pipe -fomit-frame-pointer -mno-3dnow -mcx16 -mpopcnt -mssse3 -msse4a -mmmx -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"

CXXFLAGS="-march=amdfam10 -O2 -pipe -fomit-frame-pointer -mno-3dnow -mcx16 -mpopcnt -mssse3 -msse4a -mmmx -O2 -pipe"

DISTDIR="/usr/portage/distfiles"

FCFLAGS="-O2 -pipe"

FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

FFLAGS="-O2 -pipe"

GENTOO_MIRRORS="http://mirror.datapipe.net/gentoo"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en en_US tr"

MAKEOPTS="-j3"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/virtualization /var/lib/layman/crossdev /var/lib/layman/zugaina /var/lib/layman/tlp"

SYNC="rsync://rsync.gentoo.org/gentoo-portage"

USE="X a52 aac acl acpi alsa amd64 avahi berkdb bluetooth branding bzip2 cairo cdda cdparanoia cdr cli consolekit cracklib crypt cups cxx dbus device-mapper dia dot dri dts dvd dvdr emboss encode exif fam fbcon fbsplash firefox flac fontconfig fortran ftp gdbm gif gnutls gpm gtk iconv ipv6 jack java jpeg jpeg2k ladspa lame laptop latex lcms ldap libkms libmpeg2 libnotify lv2 lzma mad mmx mmxext mng modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl nsplugin ogg openal opengl openmp openvg pam pango pcre pdf png pnm policykit ppds pppd pulseaudio python qt3support qt4 rdp readline rtmp samba sdl session spell sqlite sse sse2 sse3 ssl ssse3 startup-notification svg systemd tcpd tga threads tiff tk truetype udev udisks unicode upower usb v4l2 vorbis vpx wifi wxwidgets x264 xcb xcomposite xft xml xv xvid xvmc zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="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" 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 ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US tr" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" QEMU_USER_TARGETS="arm i386 x86_64" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="radeon r600" 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"

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

alex@alex-thinks ~ $ eix -e systemd

[I] sys-apps/systemd

     Available versions:  (~)44-r2 (~)188 {acl audit cryptsetup lzma pam selinux tcpd}

     Installed versions:  188(16:33:27 08/12/12)(acl lzma pam tcpd -audit -cryptsetup -selinux)

     Homepage:            http://www.freedesktop.org/wiki/Software/systemd

     Description:         System and service manager for Linux

alex@alex-thinks ~ $ uname -a

Linux alex-thinks 3.3.8-gentoo #1 SMP Mon Jul 30 15:33:35 CDT 2012 x86_64 AMD E-350 Processor AuthenticAMD GNU/Linux

alex@alex-thinks ~ $ eix -e udev

[I] sys-fs/udev

     Available versions:  (~)141-r1 146-r1!t 149 151-r4 164-r2 (~)171-r5[1] 171-r6 (~)187-r1!t (~)187-r3!t **9999!t {acl action_modeswitch build debug (+)devfs-compat doc edd (-)extras floppy gudev hwdb introspection keymap old-hd-rules +openrc +rule_generator selinux static-libs test}

     Installed versions:  187-r3!t(17:05:33 08/11/12)(gudev hwdb keymap openrc -doc -introspection -selinux -static-libs)

     Homepage:            http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html

     Description:         Linux dynamic and persistent device naming support (aka userspace devfs)

[1] "emg-overlay" /var/lib/layman/crossdev

alex@alex-thinks ~ $ eix -e linux-firmware

[I] sys-kernel/linux-firmware

     Available versions:  20120502 ~20120615 ~20120708 ~20120719 **99999999 {savedconfig}

     Installed versions:  20120502(17:15:36 07/07/12)(-savedconfig)

     Homepage:            http://git.kernel.org/?p=linux/kernel/git/firmware/linux-firmware.git

     Description:         Linux firmware files
```

----------

## d2_racing

I gonna watch this thread, because I didn't find out how to force the loading of a specific firmware inside SystemD.

I found that, but I don't know if you can reuse that kind of stuff :

http://en.gentoo-wiki.com/wiki/Systemd#microcode_ctl

----------

## Circuitsoft

It's a race condition; X starts before the firmware is loaded. If I enable a USB Serial Console for kernel messages, then it all works, but then fails again after unplugging the USB cable.

----------

## Circuitsoft

So, since X starts before radeon has finished loading the firmware, is that a bug that hasn't been hit before? Is there an event X should be waiting for before connecting to the DRM device? Is there an event systemd can wait for before starting X?

----------

## Logicien

The Radeon firmware to be loaded can be in the kernel and/or in the initramfs and/or in the root partition.

From the moment who Linux detect the Ati card work with Radeon DRM, it should load the firmware and the Radeon support and, if KMS is activated by default in the kernel and/or the radeon.modeset=1 parameter is pass to the kernel, Linux should set the native resolution for the screen.

If the firmware is in the root partition only, you have to wait for the moment the Radeon support can find the firmware in the boot process. It is important to have the line

```
options radeon modeset=1
```

in the /etc/modprobe.d/modprobe.conf file and include it in the initramfs if you have one, needed when the Radeon support is in module.

There should be no doubt that KMS is activated by default no matter if the Radeon support is compiled in the kernel or in module. In plus the radeon module should be autoloaded from /etc/conf.d/modules.

Mabye your missing some directives about the Radeon support and/or KMS in the boot process. When KMS is desactivated, the Radeon Xorg module may be not usable. As a result, you can have a black screen. The kernel side of the Radeon support do not depend on Xorg to drive the Ati card and have to be registrated, up and running first.

Because Openrc succeed and Systemd fail, it look like your firmware is only in the root partition, otherwise, Linux should load it before Init start. Anyway, you have to be sure Systemd do the job for the Radeon support as Opennrc do.

I am studying Systemd presently. I wait again before try it. I think you have to rebuild the initramfs for Systemd if not done.

----------

## Circuitsoft

I don't have an initramfs; I'll see if I can figure out how to compile the firmware into the kernel binary. Really, the issue seems to just be that Systemd is too fast, especially since adding "console=ttyUSB0,115200n8" to the kernel command line causes it to work, as long as I have a USB serial port plugged in.

----------

## mbar

That's easy:

```
CONFIG_PREVENT_FIRMWARE_BUILD=y

CONFIG_FIRMWARE_IN_KERNEL=y

CONFIG_EXTRA_FIRMWARE="radeon/R600_rlc.bin radeon/R700_rlc.bin"

CONFIG_EXTRA_FIRMWARE_DIR="/lib/firmware"

```

----------

