Fedora 21: fglrx 15.20 fix again… for Kernel 4.0.8. Is it the last time?

This is a draft, have no enough time, btw, I guess, it could be informative for someone.
I’ll make patch for 4.0.x version of kernel as soon as possible, if I don’t made it – ping me, please, in a comment :)

Prime sources patch:
Since from kernel version 3.20.0 read_cr4 and write_cr4 function renamed to __read_cr4 and __write_cr4.
This fix a lib/modules/fglrx/build_mod/firegl_public.c at 4471,4472,4485,4512,4513,4525 lines
The next patch is not a prime, it just remove a warning from build. lib/modules/fglrx/build_mod/kcl_ioctl.c at 225 line
void __user *ret = COMPAT_ALLOC_USER_SPACE(size);
A modern make tool drop a warning (or an error?) while definition string directive COMPAT_ALLOC_USER_SPACE in a build time – unknown definition, so I replace it by numerical definition (a length of functions name) and direct calling compat_alloc_user_space and arch_compat_alloc_user_space
#if COMPAT_ALLOC_USER_SPACE == 27 void __user *ret = arch_compat_alloc_user_space(size); #elif COMPAT_ALLOC_USER_SPACE == 22 void __user *ret = compat_alloc_user_space(size); #else # error "COMPAT_ALLOC_USER_SPACE can be 22 (compat_alloc_user_space) or 27 (arch_compat_alloc_user_space) only." #endif and common/lib/modules/fglrx/build_mod/make.sh need to be patched at 418: COMPAT_ALLOC_USER_SPACE=22 and at 439: COMPAT_ALLOC_USER_SPACE=27

I like to install a driver from a package to correct updates. When I build it and install I’ve got an freezing system without response from keyboard after starting Xorg. Some time later I found a problem when trying to install kernel module manually: sudo dkms install --verbose -m fglrx -v 14.501.1003 -k $(uname -r) Error in function to_rpm_file_list in packages/RedHat/ati-packager.sh, cut:
210 find ${TmpDrvFilesDir} -type f -name "*" | grep -v "fireglcontrol" | sed -e "s!${TmpDrvFilesDir}!!" | to_rpm_file_list >> ${TmpPkgSpec} I would try to explain: in original code it break (return code 1) execution at the moment when any filename have unknown extension and it break the pipe, so file list was incomplete and as result – package will unfull and module wasn’t builded. Ok: to_rpm_file_list() { local file o g local ret=0 while read file; do o=root g=root doc= MODE= # find file mode based on file extension or directory mode_from_basename "$file" [ -n "$MODE" ] || mode_from_directory "$file" [ -n "$MODE" ] || { echo "Unsupported file extension: $file" >&2 ret=1 continue } echo "${doc}%attr($MODE, $o, $g) $file" done return $ret }
Next sumbling-stone was a common/lib/modules/fglrx/build_mod/make.sh script of module. Actually there is two mistakes. First, the script use a static path to kernel source /usr/src/linux. It’s incorrect: there may be more than one kernel source, so the first patch is replacement:
linuxbuild=/usr/src/linux to if [ -d "/usr/src/kernels/$(uname -r)" ]; then linuxbuild="/usr/src/kernels/$(uname -r)" else linuxbuild=/usr/src/linux fi And the second “brick” is a setting uname_r variable even when attribute is empty: if echo $1 | grep '=' >/dev/null ; then t_uname_r=`echo $1 | sed 's/^.*=//'` else t_uname_r="$2" shift fi if [ -n "$t_uname_r" ]; then uname_r=$t_uname_r fi ;;
Well after this a half-night brain storming package is ready. Successfull installed and worked fine.


This guy faster public than me, but I don’t read him until patch was ready and keep my desktop working:

Leave a Reply

Your email address will not be published. Required fields are marked *