WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: xf86-video-nouveau.tcz -> missing nouveau.ko module  (Read 22460 times)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11588
Re: xf86-video-nouveau.tcz -> missing nouveau.ko module
« Reply #45 on: February 09, 2020, 09:33:40 AM »
Hi hoehermann
Welcome to the forum.
----SNIP----
   5.  With the new graphics extension in place, trying to load nouveau triggers a loading a dependency. However backlight cannot be loaded as the symbol backlight_device_get_by_type is already owned by kernel. Which seems to be a known problem.[/li][/list]

At this point, I am stumped. Why would menuconfig emit a configuration which leads to modules which cannot actually be used by the kernel the build produces? I am trying to produce a solution that is not only usable by me, but also by madmax and quite possibly other interested users. Any pointers of what I missed?
A couple of months ago I had to recompile a kernel to get some hardware on an ASUS T100 Transformer recognized and ran into
the same problem ("is already owned by kernel" error).

The error ("is already owned by kernel") is basically saying a symbol that a module is defining is already defined by the kernel. When
configuring a kernel, selecting certain options will force some drivers to be built into the kernel instead of as a module. So, assuming
you already have existing kernel modules, DRIVER_A is a module depending on DRIVER_B. You select a kernel option that requires
DRIVER_B to be built into the kernel. If you try loading DRIVER_A with the new kernel, it will attempt to load DRIVER_B (a dependency)
and you get that symbol "is already owned by kernel" error. This means DRIVER_A also needs to be recompiled so it no longer tries
to load DRIVER_B.

What I wound up doing is recompiling all modules when I changed the kernel. Here's a step by step for the whole procedure:
Code: [Select]
Compile a kernel:
tce-load -i compiletc perl5 bash ncursesw-dev bc glibc_apps elfutils-dev
wget http://tinycorelinux.net/10.x/x86_64/release/src/kernel/config-4.19.10-tinycore64
wget http://tinycorelinux.net/10.x/x86_64/release/src/kernel/linux-4.19.10-patched.txz
tar xf linux-4.19.10-patched.txz
cd  linux-4.19.10
make mrproper
# Start with the most recent config file.
cp ../config-4.19.10-tinycore64 .config
make oldconfig
make menuconfig [make your changes]
# I like to save a copy of the config file to use as a starting point for the next time.
cp .config ../config-4.19.10-tinycore64-asusT100CHIrev1
# Compile kernel
make -j 2 bzImage
# Copy the kernel where the bootloader can find it.
cp arch/x86/boot/bzImage /mnt/sdg1/Linux/vmlinuzASUS64rev1
# Compile modules
make -j 2 modules
# Place the modules somewhere for packaging.
mkdir -p /home/tc/tmp/ASUS/modules/usr/local
make INSTALL_MOD_PATH=/home/tc/tmp/ASUS/modules/usr/local modules_install
cd /home/tc/tmp/ASUS/
# I like to keep the mod.alias, mod.builtin, mod.dep, mod.order, and mod.symbols files.
mv modules/usr/local/lib/modules/4.19.10-tinycore64/modules.* .
# Remove the 2 links in modules/usr/local/lib/modules/4.19.10-tinycore64/
rm modules/usr/local/lib/modules/4.19.10-tinycore64/build
rm modules/usr/local/lib/modules/4.19.10-tinycore64/source

# Set up sorter.sh to package all the modules.
cd ..
mkdir sorter
cd sorter
tce-load -i squashfs-tools zsync
wget https://github.com/tinycorelinux/sorter/archive/master.zip
unzip master.zip
cd sorter-master/
# This creates all of the Tinycore module packages and leaves them in the current directory.
./sorter.sh 4.19.10-tinycore64 /home/tc/tmp/ASUS/modules
# Back to the tmp directory.
cd ../../
# Fetch a 32 bit root file system.
wget http://tinycorelinux.net/10.x/x86/release/distribution_files/rootfs.gz
# Copy the module archive that's part of the base system
cp sorter/sorter-master/modules64.gz modulesASUS64rev1.gz
# Make a new initrd, 64 bit modules with 32 bit root file system (32 bit apps) in this example.
cat rootfs.gz modulesASUS64rev1.gz > coreASUS64rev1.gz
# Copy the initrd where the bootloader can find it.
cp coreASUS64rev1.gz /mnt/sdg1/Linux/

The downloads only need to be done once. If you need to compile again, use the config file you saved previously as a starting point.

Created directories to archive the results of each build. This allows you to revert to a previous build and keeps matching config,
kernels, modules, and initrd files together. Append  rev1  to the config, kernel, and initrd filenames and place them in a  rev1
directory along with their matching modules.

Compile times on a Dell Dimension E310 were 52 minutes for the kernel and 3 hours 45 minutes for the modules.

Offline hoehermann

  • Newbie
  • *
  • Posts: 7
Re: xf86-video-nouveau.tcz -> missing nouveau.ko module
« Reply #46 on: February 09, 2020, 11:28:24 AM »
Thank you for your detailed explanation, Rich. I tried to replace the official versions with my custom build ones like this:

Code: [Select]
apt install bison flex ncurses-dev
wget http://tinycorelinux.net/10.x/x86/release/src/kernel/linux-4.19.10-patched.txz
tar xf linux-4.19.10-patched.txz
pushd linux-4.19.10/
wget -O .config http://tinycorelinux.net/10.x/x86/release/src/kernel/config-4.19.10-tinycore
make oldconfig
make menuconfig
make
cp arch/i386/boot/bzImage ${target}/tce/boot/vmlinuz
popd

wget --no-clobber http://tinycorelinux.net/10.x/x86/tcz/graphics-4.19.10-tinycore.tcz
unsquashfs graphics-4.19.10-tinycore.tcz
mksquashfs squashfs-root/ graphics-4.19.10-tinycore.tcz
pushd squashfs-root/usr/local/lib/modules/4.19.10-tinycore/kernel/
for m in $(find . -type f) ; do echo $(basename ${m%%.gz}) && cp ../../../../../../../linux-4.19.10/${m%%.gz} ${m%%.gz} && gzip -f ${m%%.gz} ; done
popd
mksquashfs squashfs-root/ graphics-4.19.10-tinycore.tcz
rm -r squashfs-root/
cp graphics-4.19.10-tinycore.tcz ${target}/tce/optional
md5sum ${target}/tce/optional/graphics-4.19.10-tinycore.tcz > ${target}/tce/optional/graphics-4.19.10-tinycore.tcz.md5.txt

wget --no-clobber http://tinycorelinux.net/10.x/x86/tcz/nouveau-4.19.10-tinycore.tcz
unsquashfs nouveau-4.19.10-tinycore.tcz
mksquashfs squashfs-root/ nouveau-4.19.10-tinycore.tcz
pushd squashfs-root/usr/local/lib/modules/4.19.10-tinycore/kernel/
for m in $(find . -type f) ; do echo $(basename ${m%%.gz}) && cp ../../../../../../../linux-4.19.10/${m%%.gz} ${m%%.gz} && gzip -f ${m%%.gz} ; done
popd
mksquashfs squashfs-root/ nouveau-4.19.10-tinycore.tcz
rm -r squashfs-root/
cp nouveau-4.19.10-tinycore.tcz ${target}/tce/optional
md5sum ${target}/tce/optional/nouveau-4.19.10-tinycore.tcz > ${target}/tce/optional/nouveau-4.19.10-tinycore.tcz.md5.txt

However, I ended up with a vmlinux wich actually positively included backlight_device_get_by_type. Only after reading your post I realize that my custom build also needs to replace /lib/modules/4.19.10-tinycore/kernel/drivers/video/backlight/backlight.ko.gz which is not part of either of the extensions I "remastered" but of the core.gz. Well, another thing learned, I guess.

nouveau is enabled in the tc-11.x kernel - see http://forum.tinycorelinux.net/index.php/topic,23439.0.html
Well I guess I made this a lot harder on me than I needed to. :D Thank you for the new version! :)

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11588
Re: xf86-video-nouveau.tcz -> missing nouveau.ko module
« Reply #47 on: February 09, 2020, 11:56:33 AM »
Hi hoehermann
Thank you for your detailed explanation, Rich.  ...
You are welcome. I felt since you ran into the same issue that bit me, some clarification was in order in case anyone else has the
same problem.

One other note about kernel configuration. Selecting an option may force a module to be built in to the kernel. De-selecting that
same option will not undue that change. You have to be aware that it happened, track down the effected driver, and change its
status back to module if that's what you want.

Offline hoehermann

  • Newbie
  • *
  • Posts: 7
Re: xf86-video-nouveau.tcz -> missing nouveau.ko module
« Reply #48 on: February 09, 2020, 05:02:30 PM »
One other note about kernel configuration. Selecting an option may force a module to be built in to the kernel. De-selecting that same option will not undue that change. You have to be aware that it happened, track down the effected driver, and change its status back to module (…)
This is valuable information for the next time I configure a kernel build. Thank you for sharing your knowledge. :)

Offline hoehermann

  • Newbie
  • *
  • Posts: 7
Re: xf86-video-nouveau.tcz -> missing nouveau.ko module
« Reply #49 on: March 05, 2020, 02:57:57 PM »
Just a heads-up: After using TCL for a couple of weeks now, I can report nouveau is working perfectly fine for me. :) Good work and thank you!