[ltp] more /dev/thinkpad

Tom Adelstein linux-thinkpad@linux-thinkpad.org
Sun, 17 Jul 2005 11:34:27 -0500


On 7/17/05, honey@gneek.com <honey@gneek.com> wrote:
> On Sun, 17 Jul 2005, Tom Adelstein wrote:
>=20
> > On 7/17/05, honey@gneek.com <honey@gneek.com> wrote:
> >>
> >> I'd imagine the Extras repositories has plans for a
> >> kernel-modules-thinkpad package (which includes /dev/thinkpad), as
> >> they already have tpctl and configure-thinkpad in there for Fedora
> >> Core 4 - I haven't checked the bugzilla yet.  If it has any
> >> proprietary parts to it, the Livna repository will have plans -
> >> either way it will install simply with yum.  I guess it's on the TODO
> >> list - I can ask around.
> >>
> >> In the meantime, I'm just playing with the spec file to build an RPM
> >> for it from Dag Wieers' RPM, which is quite outdated and for kernel
> >> 2.4. It looks like I have it at least building now, but it needs a
> >> little tweaking.  If anyone's interested, I'll send back my spec file
> >> to Dag, and I guess he'll include an updated RPM soon.  Or if you're
> >> ok for building your own RPM from a spec file (it'll need rebuilding
> >> for each new kernel) I could send it to anyone, if wanted.
> >>
> >> It's a bit hacky just now, so I'll try and clean it up.  And make
> >> sure it actually works :)  But /dev/thinkpad for FC4 doesn't look
> >> hard to do.
> >> --
> >
> > That would be a great service. I would be very grateful. Also, I'm
> > guessing but the Thinkpad seems to be a very popular choice.
> >
>=20
> OK, quick rush at a spec file below.  Just to emphasis, this
> is only for FC4 - it relies on the new kernel-devel package.
> It could be much improved and generalised for all Red Hat-based
> distributions, which I'm sure is Dag's and RPMForge's aim.
> I'll copy this also to Dag, in case my hack is useful (Dag,
> I broke your define kernel line, as it's a rushed job :) ).
> I imagine this list doesn't accept attachments, so you'll need to
> download the thinkpad tarball yourself.  Save the spec file below as
> "kernel-module-thinkpad-5.8.4-dag-gnk-fc4.spec" - be careful about
> linebreaks.  Note you'll need the rpm-build RPM installed to build.
> Then quick instructions:
>=20
> First patch thinkpad to 5.8.4: go to
> ftp://ftp.debian.org/debian/pool/main/t/thinkpad/ and download
> thinkpad_5.8.orig.tar.gz and thinkpad_5.8-4.diff.gz
> % tar xfz thinkpad_5.8.orig.tar.gz
> % gunzip thinkpad_5.8-4.diff.gz
> % cd thinkpad-5.8.orig
> % patch -p1 < ../thinkpad_5.8-4.diff
> % cd ..
> % mv thinkpad-5.8.orig thinkpad-5.8.4
> % tar cfz thinkpad_5.8.4.tar.gz thinkpad-5.8.4
>=20
> Then copy to the build area and build the RPM, install it:
> % cp thinkpad_5.8.4.tar.gz /usr/src/redhat/SOURCES/
> % rpmbuild -ba --target=3Di686 kernel-module-thinkpad-5.8.4-dag-gnk-fc4.s=
pec
> # rpm -ivh <the rpm file specified above>
> # depmod -ae
> # modprobe thinkpad
>=20
> Once you've done this, provided your repositories are set up ok, you
> should be able to simply:
> # yum install tpctl configure-thinkpad
>=20
> I think I have that right - apologies for typos.  Seems to works for
> me, as far as these utils are useful for ACPI users.  Note that I
> can't actually fix thinkpad itself for you if something doesn't work
> in FC4(!), and if you don't understand the above you should probably just
> wait for one of the repositories to ship kernel-module-thinkpad :)
> Or file a bugzilla, if there isn't one filed.  Note also that Dag did mos=
t
> of the work, not me!  My hacks marked "#GNK".
>=20
> Spec file:
>=20
> ---
>=20
>=20
> # $Id: kernel-module-thinkpad.spec 2005-07-17 gnk $
> # Authority: gnk
> # Upstream Dag Wieers <dag@wieers.com>
> # UpUpstream: Thomas Hood <jdthood@yahoo.co.uk>
>=20
> # Archs: i686 i586 i386 athlon
> # Distcc: 0
> # Soapbox: 0
> # BuildAsRoot: 1
>=20
> %define _libmoddir /lib/modules
>=20
> %define real_name thinkpad
>=20
> #GNK broken external kernel --defines - hack for now
> #%{!?kernel:%define kernel %(rpm -q kernel-devel --qf '%{RPMTAG_VERSION}-=
%{RPMTAG_RELEASE}' | tail -1)}
> %define kernel %(uname -r)
>=20
> %define kversion %(echo "%{kernel}" | sed -e 's|-.*||')
> %define krelease %(echo "%{kernel}" | sed -e 's|.*-||')
>=20
> %define moduledir /kernel/drivers/thinkpad
> #GNK
> %define modules rtcmosram.ko smapi.ko superio.ko thinkpad.ko thinkpadpm.k=
o
>=20
> Summary: IBM ThinkPad kernel modules
> Name: kernel-module-thinkpad
> Version: 5.8.4
> Release: 0_%{kversion}_%{krelease}.gnk
> License: GPL
> Group: System Environment/Kernel
> URL: http://tpctl.sf.net/
>=20
> Packager:Gneeki <gneeki@gmail.com>
> Vendor: Gneeki
>=20
> Source0: http://dl.sf.net/tpctl/thinkpad_%{version}.tar.gz
> BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
>=20
>=20
> BuildRequires: kernel-devel
> Requires: /boot/vmlinuz-%{kversion}-%{krelease}
>=20
> Obsoletes: thinkpad, kernel-thinkpad
> Provides: thinkpad, kernel-thinkpad
> Provides: kernel-modules
>=20
> %description
> IBM ThinkPad kernel modules.
>=20
> These drivers are built for kernel %{kversion}-%{krelease}.
> They might work with newer/older kernels.
>=20
> %prep
> %setup -n %{real_name}-%{version}
>=20
> ### FIXME: Remove chown/chgrp from Makefile. (Please fix upstream)
> %{__perl} -pi.orig -e '
>                 s| -o 0 -g 0 | |;
>                 s|^(DIR_MOD):=3D(.+)$|$1:=3D\$(RPM_BUILD_ROOT)$2|;
>                 s|^(DIR_MOD_VER):=3D.*$|$1:=3D\$(DIR_MOD)/%{kversion}-%{k=
release}/kernel/drivers|;
>                 s|^(CFLAGS):=3D(.*)$|$1:=3D$2 \$(RPM_OPT_FLAGS)|;
>         ' Makefile */*/Makefile
>=20
> %{__cat} <<EOF >README.modules.conf
> To enable the thinkpad kernel modules, place the following to your
> /etc/modules.conf:
>=20
> alias char-major-10-170 thinkpad
> EOF
>=20
> #GNK comment back in with 2.6 as per README - could generalise for
> #GNK kernel version
> %{__ln_s} -f 2.6/drivers/ .
> %{__ln_s} -f 2.6/include/ .
>=20
> %build
> %{__rm} -rf %{buildroot}
> echo -e "\nDriver version: %{version}\nKernel version: %{kversion}-%{krel=
ease}\n"
>=20
> ### Prepare UP kernel.
> #GNK - fixed path but actually not needed in FC4
> #cd %{_usrsrc}/kernels/%{kversion}-%{krelease}-%{_target_cpu}
> #%{__make} -s distclean &>/dev/null
> #%{__cp} -f configs/kernel-%{kversion}-%{_target_cpu}.config .config
> #%{__make} -s symlinks oldconfig dep EXTRAVERSION=3D"-%{krelease}" &>/dev=
/null
> #cd -
>=20
> ### Make UP module.
> %{__make} %{?_smp_mflags} clean all \
>         KSRC=3D"%{_libmoddir}/%{kversion}-%{krelease}/build"
> #GNK
> #cd 2.4/drivers/
> cd drivers/
> %{__install} -d -m0755 %{buildroot}%{_libmoddir}/%{kversion}-%{krelease}%=
{moduledir}
> %{__install} -m0644 %{modules} %{buildroot}%{_libmoddir}/%{kversion}-%{kr=
elease}%{moduledir}
>=20
> %install
> %{__install} -d -m0755 %{buildroot}/dev \
>                         %{buildroot}%{_mandir}/man4
> touch %{buildroot}/dev/thinkpad
> %{__install} -m0644 man/*.4 %{buildroot}%{_mandir}/man4/
>=20
> ### FIXME: A manual page should not be part of a kernel module package, a=
dded to documentation.
> %{__rm} -rf %{buildroot}%{_mandir}
>=20
> %post
> if [ "$1" -ne 0 ]; then
>         groupadd -r thinkpad
>         if [ ! -e /dev/thinkpad ]; then
>                 mknod -m0664 /dev/thinkpad c 10 170
>         fi
>         chown root:thinkpad /dev/thinkpad
> fi
> /sbin/depmod -ae %{kversion}-%{krelease} || :
>=20
> %postun
> groupdel thinkpad
> /sbin/depmod -ae %{kversion}-%{krelease} || :
>=20
> %clean
> %{__rm} -rf %{buildroot}
>=20
> %files
> %defattr(-, root, root, 0755)
> %doc AUTHORS ChangeLog COPYING README* SUPPORTED-MODELS TECHNOTES man/
> #%doc %{_mandir}/man4/*
> %{_libmoddir}/%{kversion}-%{krelease}%{moduledir}/
> %ghost /dev/thinkpad
>=20
> %changelog
> * Sat Jul 17 2005 Gneeki <gneeki@gmail.com> - 5.8.4-0
> - Updated for FC4/5.8.4.
>=20
> * Sat Mar 06 2004 Dag Wieers <dag@wieers.com> - 5.0-0
> - Updated to release 5.0.
>=20
> * Thu Dec 04 2003 Dag Wieers <dag@wieers.com> - 4.8-0
> - Updated to release 4.8.
>=20
> * Fri Jul 18 2003 Dag Wieers <dag@wieers.com> - 4.3-3
> - Moved manpage to documentation directory.
>=20
> * Fri Apr 11 2003 Dag Wieers <dag@wieers.com> - 4.3-1
> - Updated to release 4.3.
>=20
> * Tue Mar 11 2003 Dag Wieers <dag@wieers.com> - 4.0-0
> - Initial package. (using DAR)



I saw this before I replied to the last email.

This works for me. No need to wait. Thank you big time!