mirror of https://gitee.com/openkylin/dkms.git
Import Upstream version 3.0.7
This commit is contained in:
commit
6059f52d89
|
@ -0,0 +1,131 @@
|
|||
name: Run tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test-distributions:
|
||||
name: Build in containers
|
||||
strategy:
|
||||
matrix:
|
||||
distro:
|
||||
- {name: "alpine", tag: "3.14", variant: "-lts"}
|
||||
- {name: "alpine", tag: "3.14", variant: "-virt"}
|
||||
- {name: "alpine", tag: "3.13", variant: "-lts"}
|
||||
- {name: "alpine", tag: "3.13", variant: "-virt"}
|
||||
- {name: "alpine", tag: "3.12", variant: "-lts"}
|
||||
- {name: "alpine", tag: "3.12", variant: "-virt"}
|
||||
- {name: "alpine", tag: "3.11", variant: "-lts"}
|
||||
- {name: "alpine", tag: "3.11", variant: "-virt"}
|
||||
- {name: "alpine", tag: "3.10", variant: "-vanilla"}
|
||||
- {name: "alpine", tag: "3.10", variant: "-virt"}
|
||||
- {name: "archlinux", tag: "latest"}
|
||||
- {name: "archlinux", tag: "latest", variant: "-lts"}
|
||||
- {name: "archlinux", tag: "latest", variant: "-zen"}
|
||||
- {name: "centos", tag: "7"}
|
||||
- {name: "almalinux", tag: "8"}
|
||||
- {name: "almalinux", tag: "9"}
|
||||
- {name: "debian", tag: "11"}
|
||||
- {name: "debian", tag: "10"}
|
||||
- {name: "debian", tag: "9"}
|
||||
- {name: "debian", tag: "8"}
|
||||
- {name: "ubuntu", tag: "22.04"}
|
||||
- {name: "ubuntu", tag: "20.04"}
|
||||
- {name: "ubuntu", tag: "18.04"}
|
||||
runs-on: ubuntu-20.04
|
||||
container:
|
||||
image: docker://docker.io/library/${{ matrix.distro.name }}:${{ matrix.distro.tag }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install Alpine dependencies
|
||||
if: matrix.distro.name == 'alpine'
|
||||
run: |
|
||||
apk --no-cache --update add bash gcc linux${{ matrix.distro.variant }} linux${{ matrix.distro.variant }}-dev make openssl
|
||||
|
||||
- name: Install Arch Linux dependencies
|
||||
if: matrix.distro.name == 'archlinux'
|
||||
run: |
|
||||
pacman -Syu --noconfirm diffutils gcc make linux${{ matrix.distro.variant }}-headers openssl
|
||||
|
||||
- name: Install CentOS dependencies
|
||||
if: matrix.distro.name == 'centos'
|
||||
run: |
|
||||
yum install -y diffutils elfutils-libelf-devel gcc kernel kernel-devel make openssl
|
||||
|
||||
- name: Install AlmaLinux dependencies
|
||||
if: matrix.distro.name == 'almalinux'
|
||||
run: |
|
||||
yum install -y diffutils elfutils-libelf-devel gcc kernel kernel-devel make openssl
|
||||
|
||||
- name: Install Debian dependencies
|
||||
if: matrix.distro.name == 'debian'
|
||||
run: |
|
||||
apt-get update -q
|
||||
apt-get install -qy gcc make linux-headers-amd64 linux-image-amd64 openssl
|
||||
|
||||
- name: Install Ubuntu dependencies
|
||||
if: matrix.distro.name == 'ubuntu'
|
||||
run: |
|
||||
apt-get update -q
|
||||
apt-get install -qy gcc make linux-headers-generic linux-image-generic openssl
|
||||
|
||||
- name: Compute packaged kernel version
|
||||
id: versions
|
||||
run: |
|
||||
KERNEL_VER=''
|
||||
if [ "${{ matrix.distro.name }}" = alpine ] ; then
|
||||
KERNEL_VER="$(apk info --contents "linux${{ matrix.distro.variant }}-dev" | sed -n 's:^lib/modules/\([^/][^/]*\)/.*:\1:p' | head -n 1)"
|
||||
elif [ "${{ matrix.distro.name }}" = archlinux ] ; then
|
||||
KERNEL_VER="$(pacman -Qql "linux${{ matrix.distro.variant }}-headers" | sed -n 's:^/usr/lib/modules/\([^/]\+\)/.*:\1:p' | head -n 1)"
|
||||
elif [ "${{ matrix.distro.name }}" = centos ] || [ "${{ matrix.distro.name }}" = almalinux ] ; then
|
||||
KERNEL_VER="$(LANG=C rpm -qi kernel-devel | sed -n 's/^Source RPM *: kernel-\(.*\).src.rpm$/\1.x86_64/p' | tail -n 1)"
|
||||
elif [ "${{ matrix.distro.name }}" = debian ] ; then
|
||||
KERNEL_VER="$(LANG=C dpkg --status linux-headers-amd64 | sed -n 's/^Depends: linux-headers-\(\S\+\)\( .*\)\?/\1/p' | head -n 1)"
|
||||
elif [ "${{ matrix.distro.name }}" = ubuntu ] ; then
|
||||
KERNEL_VER="$(LANG=C dpkg --status linux-headers-generic | sed -n 's/^Depends: linux-headers-\(\S\+\)\( .*\)\?/\1/p' | head -n 1)"
|
||||
fi
|
||||
if [ -z "${KERNEL_VER}" ] ; then
|
||||
echo >&2 "Error: no kernel package found"
|
||||
exit 1
|
||||
fi
|
||||
echo "Found packaged kernel ${KERNEL_VER}"
|
||||
echo "KERNEL_VER=${KERNEL_VER}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Install dkms
|
||||
run: make install
|
||||
|
||||
- name: Run tests
|
||||
run: ./run_test.sh
|
||||
|
||||
test-vm:
|
||||
name: Test in Ubuntu VM
|
||||
strategy:
|
||||
matrix:
|
||||
version:
|
||||
- 22.04
|
||||
- 20.04
|
||||
runs-on: ubuntu-${{ matrix.version }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update -q
|
||||
sudo apt-get install -qqy make
|
||||
|
||||
- name: Install dkms
|
||||
run: sudo make install
|
||||
|
||||
- name: Run tests
|
||||
run: sudo ./run_test.sh
|
||||
|
||||
- name: Install the test module
|
||||
run: sudo dkms install test/dkms_test-1.0
|
||||
|
||||
- name: Load the test module
|
||||
run: sudo modprobe dkms_test
|
||||
|
||||
- name: Remove the test module
|
||||
run: sudo dkms remove --all -m dkms_test -v 1.0
|
|
@ -0,0 +1,4 @@
|
|||
dist/*
|
||||
*.o
|
||||
dkms
|
||||
dkms.8
|
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,74 @@
|
|||
RELEASE_DATE := "27 September 2022"
|
||||
RELEASE_MAJOR := 3
|
||||
RELEASE_MINOR := 0
|
||||
RELEASE_MICRO := 7
|
||||
RELEASE_NAME := dkms
|
||||
RELEASE_VERSION := $(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_MICRO)
|
||||
RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_VERSION)
|
||||
DIST := unstable
|
||||
SHELL=bash
|
||||
|
||||
SBIN = $(DESTDIR)/usr/sbin
|
||||
ETC = $(DESTDIR)/etc/dkms
|
||||
VAR = $(DESTDIR)/var/lib/dkms
|
||||
MAN = $(DESTDIR)/usr/share/man/man8
|
||||
INITD = $(DESTDIR)/etc/rc.d/init.d
|
||||
LIBDIR = $(DESTDIR)/usr/lib/dkms
|
||||
BASHDIR = $(DESTDIR)/usr/share/bash-completion/completions
|
||||
KCONF = $(DESTDIR)/etc/kernel
|
||||
SHAREDIR = $(DESTDIR)/usr/share
|
||||
DOCDIR = $(SHAREDIR)/doc/dkms
|
||||
SYSTEMD = $(DESTDIR)/usr/lib/systemd/system
|
||||
|
||||
#Define the top-level build directory
|
||||
BUILDDIR := $(shell pwd)
|
||||
TOPDIR := $(shell pwd)
|
||||
|
||||
.PHONY = tarball
|
||||
|
||||
all: clean tarball
|
||||
|
||||
clean:
|
||||
-rm -rf dist/
|
||||
-rm -rf dkms
|
||||
-rm -rf dkms.8
|
||||
|
||||
dkms: dkms.in
|
||||
sed -e 's/#RELEASE_STRING#/$(RELEASE_STRING)/' $^ > $@
|
||||
|
||||
dkms.8: dkms.8.in
|
||||
sed -e 's/#RELEASE_STRING#/$(RELEASE_STRING)/' -e 's/#RELEASE_DATE#/$(RELEASE_DATE)/' $^ > $@
|
||||
|
||||
install: dkms dkms.8
|
||||
mkdir -p $(VAR)
|
||||
install -D -m 0755 dkms_common.postinst $(LIBDIR)/common.postinst
|
||||
install -D -m 0755 dkms $(SBIN)/dkms
|
||||
install -D -m 0755 dkms_autoinstaller $(LIBDIR)/dkms_autoinstaller
|
||||
install -D -m 0644 dkms_framework.conf $(ETC)/framework.conf
|
||||
mkdir -p $(ETC)/framework.conf.d
|
||||
install -D -m 0644 dkms.bash-completion $(BASHDIR)/dkms
|
||||
install -D -m 0644 dkms.8 $(MAN)/dkms.8
|
||||
install -D -m 0755 kernel_install.d_dkms $(KCONF)/install.d/dkms
|
||||
install -D -m 0755 kernel_postinst.d_dkms $(KCONF)/postinst.d/dkms
|
||||
install -D -m 0755 kernel_prerm.d_dkms $(KCONF)/prerm.d/dkms
|
||||
gzip -n -9 $(MAN)/dkms.8
|
||||
|
||||
install-redhat: install
|
||||
install -D -m 0755 dkms_find-provides $(LIBDIR)/find-provides
|
||||
install -D -m 0755 lsb_release $(LIBDIR)/lsb_release
|
||||
install -D -m 0644 dkms.service $(SYSTEMD)/dkms.service
|
||||
|
||||
install-debian: install
|
||||
install -D -m 0755 dkms_apport.py $(SHAREDIR)/apport/package-hooks/dkms_packages.py
|
||||
install -D -m 0755 kernel_postinst.d_dkms $(KCONF)/header_postinst.d/dkms
|
||||
|
||||
install-doc:
|
||||
install -d -m 0644 COPYING $(DOCDIR)
|
||||
install -d -m 0644 README.md $(DOCDIR)
|
||||
|
||||
TARBALL=$(BUILDDIR)/dist/$(RELEASE_STRING).tar.gz
|
||||
tarball: $(TARBALL)
|
||||
|
||||
$(TARBALL): dkms dkms.8
|
||||
mkdir -p $(@D)
|
||||
git archive --prefix=$(RELEASE_STRING)/ --add-file=dkms --add-file=dkms.8 -o $@ HEAD
|
|
@ -0,0 +1,171 @@
|
|||
Dynamic Kernel Module System (DKMS)
|
||||
==
|
||||
This intention of this README is to explain how DKMS can be used in conjunction
|
||||
with tarballs which contain a dkms.conf file within them.
|
||||
|
||||
The DKMS project (and any updates) can be found at: https://github.com/dell/dkms
|
||||
|
||||
Installation
|
||||
--
|
||||
|
||||
Installation is performed from the source directory with one of the following
|
||||
commands:
|
||||
|
||||
```
|
||||
make install
|
||||
make install-debian
|
||||
make install-redhat
|
||||
```
|
||||
|
||||
Distribution specific installations (RPM, DEB, etc.) are not contained in this
|
||||
source repository.
|
||||
|
||||
|
||||
Installation via DKMS Tarballs
|
||||
--
|
||||
|
||||
DKMS can install directly from the following:
|
||||
|
||||
1. Generic module source tarballs which contain a dkms.conf file
|
||||
2. Specially created DKMS tarballs with module source, pre-built module
|
||||
binaries and a dkms.conf file
|
||||
3. Specially created DKMS tarballs with pre-built module binaries and a
|
||||
dkms.conf file
|
||||
4. Manual placement of module source and dkms.conf file into
|
||||
`/usr/src/<module>-<moduleversion>/` directory
|
||||
|
||||
In order to load any tarball into the DKMS tree, you must use the following
|
||||
command:
|
||||
|
||||
```
|
||||
# dkms ldtarball /path/to/dkms_enabled.tar.gz
|
||||
```
|
||||
|
||||
This command will first inspect the tarball to ensure that it contains a
|
||||
dkms.conf configuration file for that module. If it cannot find this file
|
||||
anywhere within the archive, then the ldtarball will fail.
|
||||
|
||||
From here, it will place the source in the tarball into
|
||||
`/usr/src/<module>-<moduleversion>/`. If source already exists in the directory,
|
||||
it will not overwrite it unless the --force option is specified. If the tarball
|
||||
is of type "c" above and does not contain source, it will only continue to load
|
||||
the tarball if existing module source is found in
|
||||
`/usr/src/<module>-<moduleversion>/` or if the --force option is specified.
|
||||
|
||||
Continuing on, if the tarball is of type "b" or "c" it will then load any
|
||||
pre-built binaries found within the tarball into the dkms tree, but will stop
|
||||
short of installing them. Thus, all pre-built binaries will then be of in the
|
||||
*built* state when checked from the `dkms status` command. You can then use the
|
||||
`dkms install` command to install any of these binaries.
|
||||
|
||||
To create a tarball of type "1" above, you need only to take module source and a
|
||||
dkms.conf file for that module and create a tarball from them. Tarballs of
|
||||
type *2* or type *3* are created with the `dkms mktarball` command. To create
|
||||
a type *3* tarball, you must specify the flag `--binaries-only` with the
|
||||
`mktarball`.
|
||||
|
||||
|
||||
|
||||
Installation on Systems with no Module Source and/or Compiler
|
||||
--
|
||||
|
||||
If you choose not to load module source on your system or if you choose not to
|
||||
load a compiler such as gcc onto your system, DKMS can still be used to install
|
||||
modules. It does this through use of DKMS binary only tarballs as explained in
|
||||
this README under tarballs of type *c*.
|
||||
|
||||
If your system does not have module source, loading the dkms tarball will fail
|
||||
because of this. To avoid this, use the --force flag, as such:
|
||||
|
||||
```
|
||||
# dkms ldtarball /path/to/dkms_enabled.tar.gz --force
|
||||
```
|
||||
|
||||
This will load the pre-built binaries into the dkms tree, and create the
|
||||
directory `/usr/src/<module>-<moduleversion>/` which will only contain the
|
||||
module's dkms.conf configuration file. Once the tarball is loaded, you can then
|
||||
use `dkms install` to install any of the pre-built modules.
|
||||
|
||||
Of course, since module source will not be located in your dkms tree, you will
|
||||
not be able to build any modules with DKMS for this package.
|
||||
|
||||
Module signing
|
||||
--
|
||||
|
||||
By default, DKMS generates a self signed certificate for signing modules at
|
||||
build time and signs every module that it builds before it gets compressed in
|
||||
the configured kernel compression mechanism of choice.
|
||||
|
||||
This requires the `openssl` command to be present on the system.
|
||||
|
||||
Private key and certificate are auto generated the first time DKMS is run and
|
||||
placed in `/var/lib/dkms`. These certificate files can be prepulated with your
|
||||
own certificates of choice.
|
||||
|
||||
The location as well can be changed by setting the appropriate variables in
|
||||
`/etc/dkms/framework.conf`. For example, to awllow usage of the system default
|
||||
Debian and Ubuntu `update-secureboot-policy` set the configuration file as
|
||||
follows:
|
||||
```
|
||||
mok_signing_key="/var/lib/shim-signed/mok/MOK.der"
|
||||
mok_certificate="/var/lib/shim-signed/mok/MOK.priv"
|
||||
```
|
||||
|
||||
Secure Boot
|
||||
--
|
||||
|
||||
On an UEFI system with Secure Boot enabled, modules require signing (as
|
||||
described in the above paragraph) before they can be loaded and the firmware of
|
||||
the system must know the correct public certificate to verify the module
|
||||
signature.
|
||||
|
||||
For importing the MOK certificate make sure `mokutil` is installed.
|
||||
|
||||
To check if Secure Boot is enabled:
|
||||
|
||||
```
|
||||
# mokutil --sb-state
|
||||
SecureBoot enabled
|
||||
```
|
||||
|
||||
With the appropriate key material on the system, enroll the public key:
|
||||
|
||||
```
|
||||
# mokutil --import /var/lib/dkms/mok.pub"
|
||||
```
|
||||
|
||||
You'll be prompted to create a password. Enter it twice, it can also be blank.
|
||||
|
||||
Reboot the computer. At boot you'll see the MOK Manager EFI interface, press any
|
||||
key to enter it.
|
||||
|
||||
- "Enroll MOK"
|
||||
- "Continue".
|
||||
- "Yes".
|
||||
- Enter the password you set up just now.
|
||||
- Select "OK" and the computer will reboot again.
|
||||
|
||||
After reboot, you can inspect the MOK certificates with the following command:
|
||||
|
||||
```
|
||||
# mokutil --list-enrolled | grep DKMS
|
||||
Subject: CN=DKMS module signing key
|
||||
```
|
||||
|
||||
To check the signature on a built DKMS module that is installed on a system:
|
||||
|
||||
```
|
||||
# modinfo dkms_test | grep ^signer
|
||||
signer: DKMS module signing key
|
||||
```
|
||||
|
||||
The module can now be loaded without issues.
|
||||
|
||||
Further Documentation
|
||||
--
|
||||
|
||||
Once DKMS is installed, you can reference its man page for further information
|
||||
on different DKMS options and also to understand the formatting of a module's
|
||||
dkms.conf configuration file.
|
||||
|
||||
The DKMS project is located at: https://github.com/dell/dkms
|
|
@ -0,0 +1,40 @@
|
|||
HOWTO Build DKMS debs w/ Debian & Ubuntu systems
|
||||
Copyright 2008 Dell Inc.
|
||||
Author: Mario Limonciello <Mario_Limonciello@Dell.com>
|
||||
|
||||
------------
|
||||
|
||||
A dkms deb is a common representation of a DKMS package that can be distributed across multiple machines.
|
||||
After you have a functional DKMS package, you can follow these steps to build a DKMS deb.
|
||||
|
||||
1) Start out by putting together a tree in /usr/src/PACKAGE-VERSION. For our example, we are going to use
|
||||
the PACKAGE lirc and VERSION 0.8.3~pre1. Create a dkms.conf per the recommendations in the DKMS guide.
|
||||
|
||||
2) "Add" the package to the dkms tree system:
|
||||
dkms add -m lirc -v 0.8.3~pre1
|
||||
|
||||
3) "Build" the binary modules for the current kernel:
|
||||
dkms build -m lirc -v 0.8.3~pre1
|
||||
|
||||
4) Make the deb and/or dsc for the package:
|
||||
dkms mkdeb -m lirc -v 0.8.3~pre1
|
||||
dkms mkdsc -m lirc -v 0.8.3~pre1
|
||||
|
||||
The end result will be a deb and/or dsc in /var/lib/dkms/lirc/0.8.3~pre1/deb or /var/lib/dkms/lirc/0.8.3~pre1/dsc
|
||||
|
||||
------------
|
||||
If you would prefer not to contaminate your system with the changes from building these debs, you should
|
||||
create a framework.conf that contains these variables (adjust for your use case):
|
||||
|
||||
source_tree="/path/to/source/tree"
|
||||
dkms_tree="/path/to/dkms/tree"
|
||||
|
||||
You will then call DKMS with an extra variable, '--dkmsframework'. Here is an example of how this would work
|
||||
using the same lirc example above:
|
||||
|
||||
dkms add -m lirc -v 0.8.3~pre1 --dkmsframework framework.conf
|
||||
dkms build -m lirc -v 0.8.3~pre1 --dkmsframework framework.conf
|
||||
dkms mkdeb -m lirc -v 0.8.3~pre1 --dkmsframework framework.conf
|
||||
dkms mkdsc -m lirc -v 0.8.3~pre1 --dkmsframework framework.conf
|
||||
|
||||
The end result will be both a debian binary package and a debian source package that you can use.
|
|
@ -0,0 +1,8 @@
|
|||
dkms for Debian
|
||||
|
||||
Please edit this to provide information specific to
|
||||
this dkms Debian package.
|
||||
|
||||
(Automatically generated by debmake Version 4.3.1)
|
||||
|
||||
-- Luoyaoming <luoyaoming@kylinos.cn> Sun, 09 Oct 2022 14:40:34 +0800
|
|
@ -0,0 +1,5 @@
|
|||
dkms (3.0.7-ok1) yangtze; urgency=low
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- Luoyaoming <luoyaoming@kylinos.cn> Sun, 09 Oct 2022 14:40:34 +0800
|
|
@ -0,0 +1 @@
|
|||
debian/scripts/dh_dkms
|
|
@ -0,0 +1 @@
|
|||
11
|
|
@ -0,0 +1,53 @@
|
|||
Source: dkms
|
||||
Section: kernel
|
||||
Priority: optional
|
||||
Maintainer: Openkylin Developers <packaging@lists.openkylin.top>
|
||||
Uploaders: Luoyaoming <luoyaoming@kylinos.cn>
|
||||
Build-Depends: debhelper-compat (= 13)
|
||||
Standards-Version: 4.6.1
|
||||
Homepage: https://github.com/dell/dkms
|
||||
Vcs-Git: https://gitee.com/openkylin/dkms.git
|
||||
Vcs-Browser: https://gitee.com/openkylin/dkms
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: dkms
|
||||
Architecture: all
|
||||
Multi-Arch: foreign
|
||||
Pre-Depends: lsb-release
|
||||
Depends: ${misc:Depends},
|
||||
kmod | kldutils,
|
||||
gcc | c-compiler,
|
||||
dpkg-dev,
|
||||
make | build-essential,
|
||||
patch,
|
||||
dctrl-tools,
|
||||
dh-dkms (= ${binary:Version}),
|
||||
Recommends: fakeroot,
|
||||
sudo,
|
||||
linux-headers-686-pae | linux-headers-amd64 | linux-headers-generic | linux-headers,
|
||||
Suggests: menu, e2fsprogs
|
||||
Breaks: ${dkms:Breaks}
|
||||
Description: Dynamic Kernel Module System (DKMS)
|
||||
DKMS is a framework designed to allow individual kernel modules to be upgraded
|
||||
without changing the whole kernel. It is also very easy to rebuild modules as
|
||||
you upgrade kernels.
|
||||
|
||||
Package: dh-dkms
|
||||
Architecture: all
|
||||
Multi-Arch: foreign
|
||||
Depends:
|
||||
${perl:Depends},
|
||||
${misc:Depends},
|
||||
Breaks:
|
||||
dkms (<< 3.0.3-0),
|
||||
Replaces:
|
||||
dkms (<< 3.0.3-0),
|
||||
Provides:
|
||||
dh-sequence-dkms,
|
||||
Description: debhelper addon for the Dynamic Kernel Module System (DKMS)
|
||||
DKMS is a framework designed to allow individual kernel modules to be upgraded
|
||||
without changing the whole kernel. It is also very easy to rebuild modules as
|
||||
you upgrade kernels.
|
||||
.
|
||||
This package provides a debhelper add-on 'dkms' that simplifies packaging of
|
||||
dkms kernel module source packages.
|
|
@ -0,0 +1,429 @@
|
|||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: dkms
|
||||
Source: https://github.com/dell/dkms
|
||||
#
|
||||
# Please double check copyright with the licensecheck(1) command.
|
||||
|
||||
Files: .github/workflows/tests.yml
|
||||
.gitignore
|
||||
Makefile
|
||||
README.md
|
||||
dkms.8.in
|
||||
dkms.bash-completion
|
||||
dkms.service
|
||||
dkms_autoinstaller
|
||||
dkms_find-provides
|
||||
dkms_framework.conf
|
||||
kernel_install.d_dkms
|
||||
kernel_postinst.d_dkms
|
||||
kernel_prerm.d_dkms
|
||||
run_test.sh
|
||||
test/README
|
||||
test/dkms_test-1.0/Makefile
|
||||
test/dkms_test-1.0/dkms.conf
|
||||
test/dkms_test-1.0/dkms_test.c
|
||||
Copyright: __NO_COPYRIGHT_NOR_LICENSE__
|
||||
License: __NO_COPYRIGHT_NOR_LICENSE__
|
||||
|
||||
Files: dkms.in
|
||||
dkms_apport.py
|
||||
Copyright: 2003-2008 Dell, Inc. Gary Lerhaupt, Matt Domsch, & Mario Limonciello
|
||||
2009 Dell, Inc. Mario Limonciello
|
||||
2012 Darik Horn <dajhorn@vanadac.com>
|
||||
License: GPL-2.0+
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
.
|
||||
The FSF address in the above text is the old one.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General Public License
|
||||
Version 2 can be found in `/usr/share/common-licenses/GPL-2'.
|
||||
|
||||
Files: lsb_release
|
||||
Copyright: 2000-2004 Free Standards Group, Inc. Dominique MASSONIE <mdomi@users.sourceforge.net>
|
||||
License: GPL-2.0+
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
.
|
||||
* Changes in 2.0
|
||||
- Support LSB 2.0 module layout (Mats Wichmann)
|
||||
.
|
||||
The FSF address in the above text is the old one.
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General Public License
|
||||
Version 2 can be found in `/usr/share/common-licenses/GPL-2'.
|
||||
|
||||
Files: dkms_common.postinst
|
||||
Copyright: 2002-2005 Flavio Stanchina
|
||||
2005-2006 Aric Cyr
|
||||
2007 Mario Limonciello
|
||||
2009 Alberto Milone
|
||||
License: __NO_LICENSE__
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Files marked as NO_LICENSE_TEXT_FOUND may be covered by the following
|
||||
# license/copyright files.
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# License file: COPYING
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
.
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
.
|
||||
Preamble
|
||||
.
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
.
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
.
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
.
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
.
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
.
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
.
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
.
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
.
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
.
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
.
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
.
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
.
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
.
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
.
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
.
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
.
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
.
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
.
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
.
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
.
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
.
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
.
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
.
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
.
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
.
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
.
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
.
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
.
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
.
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
.
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
.
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
.
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
.
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
.
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
.
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
.
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
.
|
||||
NO WARRANTY
|
||||
.
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
.
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
.
|
||||
END OF TERMS AND CONDITIONS
|
||||
.
|
||||
How to Apply These Terms to Your New Programs
|
||||
.
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
.
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
.
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
.
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
.
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
.
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
.
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
.
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
.
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
.
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
.
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
.
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
|
@ -0,0 +1,4 @@
|
|||
debian/scripts/dh_dkms usr/bin
|
||||
debian/scripts/dh_dkms.1 usr/share/man/man1/
|
||||
debian/scripts/*-dkms usr/share/debhelper/autoscripts/
|
||||
debian/scripts/dkms.pm usr/share/perl5/Debian/Debhelper/Sequence/
|
|
@ -0,0 +1 @@
|
|||
debian/HOWTO.Debian
|
|
@ -0,0 +1 @@
|
|||
debian/scripts/dkms-autopkgtest usr/lib/dkms/
|
|
@ -0,0 +1,5 @@
|
|||
# dependency is provided by apport
|
||||
python3-script-but-no-python3-dep python3 (does not satisfy python3:any | python3-minimal:any) [usr/share/apport/package-hooks/dkms_packages.py]
|
||||
|
||||
# this location is used by multiple external scripts to find dkms bits
|
||||
executable-in-usr-lib
|
|
@ -0,0 +1,19 @@
|
|||
rm_conffile /etc/bash_completion.d/dkms 3.0.3-2~
|
||||
rm_conffile /etc/dkms/kernel_install.d_dkms 3.0.3-2~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/rules 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/prerm 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/postinst 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/dirs 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/copyright 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/control 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/compat 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/changelog 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/debian/README.Debian 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkdeb/Makefile 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkbmdeb/debian/rules 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkbmdeb/debian/copyright 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkbmdeb/debian/control 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkbmdeb/debian/compat 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkbmdeb/debian/changelog 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkbmdeb/debian/README.Debian 3.0.3-3~
|
||||
rm_conffile /etc/dkms/template-dkms-mkbmdeb/Makefile 3.0.3-3~
|
|
@ -0,0 +1,4 @@
|
|||
# modprobe information used for DKMS modules
|
||||
#
|
||||
# This is a stub file, should be edited when needed,
|
||||
# used by default by DKMS.
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
if dpkg --compare-versions "$2" lt-nl "3.0.3-3~" ; then
|
||||
for d in /etc/dkms/template-dkms-mkdeb/debian /etc/dkms/template-dkms-mkdeb /etc/dkms/template-dkms-mkbmdeb/debian /etc/dkms/template-dkms-mkbmdeb
|
||||
do
|
||||
test ! -d $d || rmdir --ignore-fail-on-non-empty $d
|
||||
done
|
||||
fi
|
|
@ -0,0 +1 @@
|
|||
dkms_3.0.7-ok1_source.buildinfo kernel optional
|
|
@ -0,0 +1,2 @@
|
|||
[DEFAULT]
|
||||
pristine-tar = True
|
|
@ -0,0 +1,3 @@
|
|||
include:
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
|
|
@ -0,0 +1,41 @@
|
|||
Author: Andreas Beckmann <anbe@debian.org>
|
||||
Description: add BUILD_EXCLUSIVE_CONFIG
|
||||
support build exclusion depending on kernel features being present/absent,
|
||||
e.g. BUILD_EXCLUSIVE_CONFIG="CONFIG_FOO !CONFIG_BAR"
|
||||
Forwarded: https://github.com/dell/dkms/issues/219
|
||||
|
||||
--- a/dkms.in
|
||||
+++ b/dkms.in
|
||||
@@ -28,6 +28,7 @@ shopt -s extglob
|
||||
readonly dkms_conf_variables="CLEAN PACKAGE_NAME
|
||||
PACKAGE_VERSION POST_ADD POST_BUILD POST_INSTALL POST_REMOVE PRE_BUILD
|
||||
PRE_INSTALL BUILD_DEPENDS BUILD_EXCLUSIVE_KERNEL BUILD_EXCLUSIVE_ARCH
|
||||
+ BUILD_EXCLUSIVE_CONFIG
|
||||
build_exclude OBSOLETE_BY MAKE MAKE_MATCH
|
||||
PATCH PATCH_MATCH patch_array BUILT_MODULE_NAME
|
||||
built_module_name BUILT_MODULE_LOCATION built_module_location
|
||||
@@ -605,6 +606,15 @@ read_conf()
|
||||
# Set build_exclude
|
||||
[[ $BUILD_EXCLUSIVE_KERNEL && ! $1 =~ $BUILD_EXCLUSIVE_KERNEL ]] && build_exclude="yes"
|
||||
[[ $BUILD_EXCLUSIVE_ARCH && ! $2 =~ $BUILD_EXCLUSIVE_ARCH ]] && build_exclude="yes"
|
||||
+ if [[ $BUILD_EXCLUSIVE_CONFIG && -e $kernel_source_dir/.config ]]; then
|
||||
+ local kconf
|
||||
+ for kconf in $BUILD_EXCLUSIVE_CONFIG ; do
|
||||
+ case "$kconf" in
|
||||
+ !*) grep -q -E "^${kconf#!}=[ym]" $kernel_source_dir/.config && build_exclude="yes" ;;
|
||||
+ *) grep -q -E "^${kconf}=[ym]" $kernel_source_dir/.config || build_exclude="yes" ;;
|
||||
+ esac
|
||||
+ done
|
||||
+ fi
|
||||
|
||||
# Fail if absolutely no DEST_MODULE_LOCATION
|
||||
if ((${#dest_module_location[@]} == 0)); then
|
||||
@@ -949,7 +959,7 @@ prepare_build()
|
||||
|
||||
# Error out if build_exclude is set
|
||||
[[ $build_exclude ]] && die 9 \
|
||||
- $"The $base_dir/dkms.conf for module $module includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch."\
|
||||
+ $"The $base_dir/dkms.conf for module $module includes a BUILD_EXCLUSIVE directive which does not match this kernel/arch/config."\
|
||||
$"This indicates that it should not be built."
|
||||
|
||||
# Error out if source_tree is basically empty (binary-only dkms tarball w/ --force check)
|
|
@ -0,0 +1,64 @@
|
|||
Author: Andreas Beckmann <anbe@debian.org>
|
||||
Description: make deprecation warnings less noisy and more informative
|
||||
print the dkms.conf file name containing the deprecated setting
|
||||
silence duplicate deprecation warnings emitted from
|
||||
module_status_built_extra() which reads the dkms.conf file again
|
||||
Bug-Debian: https://bugs.debian.org/1012043
|
||||
|
||||
--- a/dkms.in
|
||||
+++ b/dkms.in
|
||||
@@ -411,6 +411,12 @@ safe_source() {
|
||||
)
|
||||
. "$tmpfile"
|
||||
rm "$tmpfile"
|
||||
+
|
||||
+ (( ${#REMAKE_INITRD[@]} )) && deprecated "REMAKE_INITRD ($to_source_file)"
|
||||
+ (( ${#MODULES_CONF[@]} )) && deprecated "MODULES_CONF ($to_source_file)"
|
||||
+ (( ${#MODULES_CONF_OBSOLETES[@]} )) && deprecated "MODULES_CONF_OBSOLETES ($to_source_file)"
|
||||
+ (( ${#MODULES_CONF_ALIAS_TYPE[@]} )) && deprecated "MODULES_CONF_ALIAS_TYPE ($to_source_file)"
|
||||
+ (( ${#MODULES_CONF_OBSOLETE_ONLY[@]} )) && deprecated "MODULES_CONF_OBSOLETE_ONLY ($to_source_file)"
|
||||
}
|
||||
|
||||
# Source a dkms.conf file and perform appropriate postprocessing on it.
|
||||
@@ -456,12 +462,6 @@ read_conf()
|
||||
[ -e "$_conf_file" ] && safe_source "$_conf_file" $dkms_conf_variables
|
||||
done
|
||||
|
||||
- (( ${#REMAKE_INITRD[@]} )) && deprecated $"REMAKE_INITRD"
|
||||
- (( ${#MODULES_CONF[@]} )) && deprecated $"MODULES_CONF"
|
||||
- (( ${#MODULES_CONF_OBSOLETES[@]} )) && deprecated $"MODULES_CONF_OBSOLETES"
|
||||
- (( ${#MODULES_CONF_ALIAS_TYPE[@]} )) && deprecated $"MODULES_CONF_ALIAS_TYPE"
|
||||
- (( ${#MODULES_CONF_OBSOLETE_ONLY[@]} )) && deprecated $"MODULES_CONF_OBSOLETE_ONLY"
|
||||
-
|
||||
# Source in the directive_array
|
||||
for directive in "${directive_array[@]}"; do
|
||||
directive_name=${directive%%=*}
|
||||
@@ -1633,7 +1633,7 @@ do_status_weak()
|
||||
# interested in, but that the DKMS internals do not usually care about.
|
||||
module_status_built_extra() (
|
||||
set_module_suffix "$3"
|
||||
- read_conf "$3" "$4" "$dkms_tree/$1/$2/source/dkms.conf"
|
||||
+ read_conf "$3" "$4" "$dkms_tree/$1/$2/source/dkms.conf" 2>/dev/null
|
||||
[[ -d $dkms_tree/$1/original_module/$3/$4 ]] && echo -n " (original_module exists)"
|
||||
for ((count=0; count < ${#dest_module_name[@]}; count++)); do
|
||||
tree_mod=$(compressed_or_uncompressed "$dkms_tree/$1/$2/$3/$4/module" "${dest_module_name[$count]}")
|
||||
@@ -1692,6 +1692,9 @@ module_status() {
|
||||
# is easier to parse.
|
||||
do_status() {
|
||||
local status mvka m v k a
|
||||
+ # separate deprecation warnings from status output
|
||||
+ local tmpfile=$(mktemp_or_die)
|
||||
+ (module_status "$@") >"$tmpfile"
|
||||
while read status mvka; do
|
||||
IFS=/ read m v k a <<< "$mvka"
|
||||
case $status in
|
||||
@@ -1704,7 +1707,8 @@ do_status() {
|
||||
echo
|
||||
;;
|
||||
esac
|
||||
- done < <(module_status "$@")
|
||||
+ done < "$tmpfile"
|
||||
+ rm "$tmpfile"
|
||||
}
|
||||
|
||||
# Show all our status in the format that external callers expect, even
|
|
@ -0,0 +1,23 @@
|
|||
Description: Use exact compiler for dkms as used to build the kernel
|
||||
Ubuntu kernel builds do not export .kernelvariables file, thus extend
|
||||
CC detection to read compiler binary from the .config file
|
||||
|
||||
|
||||
Index: dkms-3.0.7/dkms.in
|
||||
===================================================================
|
||||
--- dkms-3.0.7.orig/dkms.in
|
||||
+++ dkms-3.0.7/dkms.in
|
||||
@@ -1006,6 +1006,13 @@ actual_build()
|
||||
unset CC
|
||||
fi
|
||||
|
||||
+ if [[ -e $kernel_source_dir/.config ]]; then
|
||||
+ cc=$(sed -n 's|^CONFIG_CC_VERSION_TEXT="\([^ ]*\) .*"|\1|p' $kernel_source_dir/.config)
|
||||
+ if command -v "$cc" >/dev/null; then
|
||||
+ export CC="$cc"
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
invoke_command "$clean" "Cleaning build area" background
|
||||
echo $"DKMS make.log for $module-$module_version for kernel $kernelver ($arch)" >> "$build_log"
|
||||
date >> "$build_log"
|
|
@ -0,0 +1,23 @@
|
|||
Description: Use exact compiler for dkms as used to build the kernel
|
||||
Ubuntu kernel builds do not export .kernelvariables file, thus extend
|
||||
CC detection to read compiler binary from the .config file
|
||||
|
||||
|
||||
Index: dkms-3.0.3/dkms.in
|
||||
===================================================================
|
||||
--- dkms-3.0.3.orig/dkms.in
|
||||
+++ dkms-3.0.3/dkms.in
|
||||
@@ -1007,6 +1007,13 @@ actual_build()
|
||||
unset CC
|
||||
fi
|
||||
|
||||
+ if [[ -e $kernel_source_dir/.config ]]; then
|
||||
+ cc=$(sed -n 's|^CONFIG_CC_VERSION_TEXT="\([^ ]*\) .*"|\1|p' $kernel_source_dir/.config)
|
||||
+ if command -v "$cc" >/dev/null; then
|
||||
+ export CC="$cc"
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
invoke_command "$clean" "Cleaning build area" background
|
||||
echo $"DKMS make.log for $module-$module_version for kernel $kernelver ($arch)" >> "$build_log"
|
||||
date >> "$build_log"
|
|
@ -0,0 +1,22 @@
|
|||
Description: export CC pointing to the kernel's compiler
|
||||
export the CC variable from .kernelvariables in the kernel source to allow
|
||||
module build systems use the kernel's compiler also outside of Kbuild
|
||||
Author: Andreas Beckmann <anbe@debian.org>
|
||||
|
||||
Index: dkms/dkms.in
|
||||
===================================================================
|
||||
--- dkms.orig/dkms.in
|
||||
+++ dkms/dkms.in
|
||||
@@ -991,6 +991,12 @@
|
||||
echo $""
|
||||
echo $"Building module:"
|
||||
|
||||
+ if [ -f "$kernel_source_dir/.kernelvariables" ]; then
|
||||
+ export CC=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $kernel_source_dir/.kernelvariables" | make -f - show-CC)
|
||||
+ else
|
||||
+ unset CC
|
||||
+ fi
|
||||
+
|
||||
invoke_command "$clean" "Cleaning build area" background
|
||||
echo $"DKMS make.log for $module-$module_version for kernel $kernelver ($arch)" >> "$build_log"
|
||||
date >> "$build_log"
|
|
@ -0,0 +1,11 @@
|
|||
--- a/dkms_autoinstaller
|
||||
+++ b/dkms_autoinstaller
|
||||
@@ -47,7 +47,7 @@ case "$1" in
|
||||
kernel=`uname -r`
|
||||
fi
|
||||
if [ -f /etc/dkms/no-autoinstall ]; then
|
||||
- log_daemon_msg "$prog: autoinstall for dkms modules has been disabled"
|
||||
+ log_action_msg "$prog: autoinstall for dkms modules has been disabled"
|
||||
else
|
||||
log_daemon_msg "$prog: running auto installation service for kernel $kernel"
|
||||
dkms autoinstall --kernelver $kernel
|
|
@ -0,0 +1,6 @@
|
|||
export-CC.patch
|
||||
messaging.patch
|
||||
deprecations.patch
|
||||
BUILD_EXCLUSIVE_CONFIG.patch
|
||||
spelling.patch
|
||||
exact-cc.patch
|
|
@ -0,0 +1,14 @@
|
|||
Author: Andreas Beckmann <anbe@debian.org>
|
||||
Description: spelling corrections
|
||||
|
||||
--- a/dkms_common.postinst
|
||||
+++ b/dkms_common.postinst
|
||||
@@ -254,7 +254,7 @@ for KERNEL in $KERNELS; do
|
||||
dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH`
|
||||
else
|
||||
echo "Module build for kernel $KERNEL was skipped since the"
|
||||
- echo "kernel headers for this kernel does not seem to be installed."
|
||||
+ echo "kernel headers for this kernel do not seem to be installed."
|
||||
fi
|
||||
fi
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/make -f
|
||||
# -*- makefile -*-
|
||||
|
||||
include /usr/share/dpkg/pkg-info.mk
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
debian/scripts/dh_dkms: debian/scripts/dh_dkms.in
|
||||
sed -r "s,^#VERSION#,our \$$VERSION = \"$(DEB_VERSION)\";," $< > $@
|
||||
|
||||
dh_dkms.1: debian/scripts/dh_dkms
|
||||
pod2man \
|
||||
--center "DKMS Debhelper" \
|
||||
--release $(DEB_VERSION_UPSTREAM) \
|
||||
$< > debian/scripts/$@
|
||||
|
||||
override_dh_auto_build:
|
||||
|
||||
override_dh_auto_install:
|
||||
|
||||
override_dh_install: debian/scripts/dh_dkms
|
||||
override_dh_install:
|
||||
$(MAKE) install-debian DESTDIR=$(CURDIR)/debian/dkms
|
||||
dh_install
|
||||
|
||||
override_dh_gencontrol:
|
||||
ifeq ($(shell dpkg-vendor --derives-from Ubuntu && echo yes),yes)
|
||||
dh_gencontrol -- \
|
||||
-Vdkms:Breaks="shim-signed (<< 1.34~)"
|
||||
else
|
||||
dh_gencontrol
|
||||
endif
|
|
@ -0,0 +1,196 @@
|
|||
.\" Automatically generated by Pod::Man 4.10 (Pod::Simple 3.35)
|
||||
.\"
|
||||
.\" Standard preamble:
|
||||
.\" ========================================================================
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.de Vb \" Begin verbatim text
|
||||
.ft CW
|
||||
.nf
|
||||
.ne \\$1
|
||||
..
|
||||
.de Ve \" End verbatim text
|
||||
.ft R
|
||||
.fi
|
||||
..
|
||||
.\" Set up some character translations and predefined strings. \*(-- will
|
||||
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
||||
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
|
||||
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
|
||||
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
|
||||
.\" nothing in troff, for use with C<>.
|
||||
.tr \(*W-
|
||||
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
||||
.ie n \{\
|
||||
. ds -- \(*W-
|
||||
. ds PI pi
|
||||
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
||||
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
||||
. ds L" ""
|
||||
. ds R" ""
|
||||
. ds C` ""
|
||||
. ds C' ""
|
||||
'br\}
|
||||
.el\{\
|
||||
. ds -- \|\(em\|
|
||||
. ds PI \(*p
|
||||
. ds L" ``
|
||||
. ds R" ''
|
||||
. ds C`
|
||||
. ds C'
|
||||
'br\}
|
||||
.\"
|
||||
.\" Escape single quotes in literal strings from groff's Unicode transform.
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.\"
|
||||
.\" If the F register is >0, we'll generate index entries on stderr for
|
||||
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
|
||||
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
||||
.\" output yourself in some meaningful fashion.
|
||||
.\"
|
||||
.\" Avoid warning from groff about undefined register 'F'.
|
||||
.de IX
|
||||
..
|
||||
.nr rF 0
|
||||
.if \n(.g .if rF .nr rF 1
|
||||
.if (\n(rF:(\n(.g==0)) \{\
|
||||
. if \nF \{\
|
||||
. de IX
|
||||
. tm Index:\\$1\t\\n%\t"\\$2"
|
||||
..
|
||||
. if !\nF==2 \{\
|
||||
. nr % 0
|
||||
. nr F 2
|
||||
. \}
|
||||
. \}
|
||||
.\}
|
||||
.rr rF
|
||||
.\"
|
||||
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
|
||||
.\" Fear. Run. Save yourself. No user-serviceable parts.
|
||||
. \" fudge factors for nroff and troff
|
||||
.if n \{\
|
||||
. ds #H 0
|
||||
. ds #V .8m
|
||||
. ds #F .3m
|
||||
. ds #[ \f1
|
||||
. ds #] \fP
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
|
||||
. ds #V .6m
|
||||
. ds #F 0
|
||||
. ds #[ \&
|
||||
. ds #] \&
|
||||
.\}
|
||||
. \" simple accents for nroff and troff
|
||||
.if n \{\
|
||||
. ds ' \&
|
||||
. ds ` \&
|
||||
. ds ^ \&
|
||||
. ds , \&
|
||||
. ds ~ ~
|
||||
. ds /
|
||||
.\}
|
||||
.if t \{\
|
||||
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
|
||||
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
|
||||
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
|
||||
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
|
||||
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
|
||||
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
|
||||
.\}
|
||||
. \" troff and (daisy-wheel) nroff accents
|
||||
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
|
||||
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
|
||||
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
|
||||
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
|
||||
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
|
||||
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
|
||||
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
|
||||
.ds ae a\h'-(\w'a'u*4/10)'e
|
||||
.ds Ae A\h'-(\w'A'u*4/10)'E
|
||||
. \" corrections for vroff
|
||||
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
|
||||
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
|
||||
. \" for low resolution devices (crt and lpr)
|
||||
.if \n(.H>23 .if \n(.V>19 \
|
||||
\{\
|
||||
. ds : e
|
||||
. ds 8 ss
|
||||
. ds o a
|
||||
. ds d- d\h'-1'\(ga
|
||||
. ds D- D\h'-1'\(hy
|
||||
. ds th \o'bp'
|
||||
. ds Th \o'LP'
|
||||
. ds ae ae
|
||||
. ds Ae AE
|
||||
.\}
|
||||
.rm #[ #] #H #V #F C
|
||||
.\" ========================================================================
|
||||
.\"
|
||||
.IX Title "DH_DKMS 1"
|
||||
.TH DH_DKMS 1 "2022-06-02" "3.0.3" "DKMS Debhelper"
|
||||
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
||||
.\" way too many mistakes in technical documents.
|
||||
.if n .ad l
|
||||
.nh
|
||||
.SH "NAME"
|
||||
dh_dkms \- correctly handle DKMS usage by a kernel module package
|
||||
.SH "SYNOPSIS"
|
||||
.IX Header "SYNOPSIS"
|
||||
\&\fBdh_dkms\fR [\fIdebhelper\ options\fR] [\fB\-l\fR] [\fB\-V\fR[\fIversion\fR]] [\fB\-\-\fR\ \fIfile\fR]
|
||||
.SH "DESCRIPTION"
|
||||
.IX Header "DESCRIPTION"
|
||||
dh_dkms is a debhelper program that is responsible for correctly setting
|
||||
postinst, postrm and dependencies in kernel module packages using \s-1DKMS.\s0
|
||||
.PP
|
||||
If a file named debian/package.dkms exists, then different actions are
|
||||
performed, depending on its contents.
|
||||
.SH "FILES"
|
||||
.IX Header "FILES"
|
||||
.IP "debian/\fIpackage\fR.dkms" 4
|
||||
.IX Item "debian/package.dkms"
|
||||
.PD 0
|
||||
.IP "debian/dkms" 4
|
||||
.IX Item "debian/dkms"
|
||||
.PD
|
||||
It can be a proper configuration file, and in this case it would be installed
|
||||
in the proper directory as dkms.conf.
|
||||
.Sp
|
||||
It can also point to another file (this should be used when the configuration
|
||||
is provided by upstream), and in this case that file will be installed as dkms.conf
|
||||
in the proper directory.
|
||||
.Sp
|
||||
This file can only miss if a filename is provided when calling dh_dkms.
|
||||
.SH "OPTIONS"
|
||||
.IX Header "OPTIONS"
|
||||
.IP "\fB\-l\fR, \fB\-\-legacy\fR" 4
|
||||
.IX Item "-l, --legacy"
|
||||
Add code to also support \s-1DKMS\s0 versions < 2.1.0.0.
|
||||
.IP "\fB\-V\fR, \fB\-V\fR \fIversion\fR" 4
|
||||
.IX Item "-V, -V version"
|
||||
If \f(CW\*(C`PACKAGE_VERSION\*(C'\fR in \fIdkms.conf\fR is set to \f(CW\*(C`#MODULE_VERSION#\*(C'\fR, set it to
|
||||
the given \fIversion\fR or, if none is given, default to the upstream version of
|
||||
the current package. Otherwise, leave the value specified in \fIdkms.conf\fR.
|
||||
.IP "\fB\-\-\fR \fIfile\fR" 4
|
||||
.IX Item "-- file"
|
||||
Don't look for debian/\fIpackage\fR.dkms or debian/dkms, but install \fIfile\fR as dkms.conf.
|
||||
.SH "NOTES"
|
||||
.IX Header "NOTES"
|
||||
Note that this command is not idempotent. \fBdh_prep\fR\|(1) should be called
|
||||
between invocations of this command. Otherwise, it may cause multiple
|
||||
instances of the same text to be added to maintainer scripts.
|
||||
.SH "SEE ALSO"
|
||||
.IX Header "SEE ALSO"
|
||||
\&\fBdebhelper\fR\|(1)
|
||||
.PP
|
||||
This program is part of the Debian \s-1DKMS\s0 package.
|
||||
.PP
|
||||
\&\fBdkms\fR\|(8)
|
||||
.SH "AUTHOR"
|
||||
.IX Header "AUTHOR"
|
||||
David Paleino <dapal@debian.org>
|
|
@ -0,0 +1,184 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
=head1 NAME
|
||||
|
||||
dh_dkms - correctly handle DKMS usage by a kernel module package
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use Debian::Debhelper::Dh_Lib;
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
B<dh_dkms> [S<I<debhelper options>>] [S<B<-l>>] [S<B<-V>[I<version>]>] [S<B<--> I<file>>]
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
dh_dkms is a debhelper program that is responsible for correctly setting
|
||||
postinst, postrm and dependencies in kernel module packages using DKMS.
|
||||
|
||||
If a file named debian/package.dkms exists, then different actions are
|
||||
performed, depending on its contents.
|
||||
|
||||
=head1 FILES
|
||||
|
||||
=over 4
|
||||
|
||||
=item debian/I<package>.dkms
|
||||
|
||||
=item debian/dkms
|
||||
|
||||
It can be a proper configuration file, and in this case it would be installed
|
||||
in the proper directory as dkms.conf.
|
||||
|
||||
It can also point to another file (this should be used when the configuration
|
||||
is provided by upstream), and in this case that file will be installed as dkms.conf
|
||||
in the proper directory.
|
||||
|
||||
This file can only miss if a filename is provided when calling dh_dkms.
|
||||
|
||||
=back
|
||||
|
||||
=head1 OPTIONS
|
||||
|
||||
=over 4
|
||||
|
||||
=item B<-l>, B<--legacy>
|
||||
|
||||
Add code to also support DKMS versions < 2.1.0.0.
|
||||
|
||||
=item B<-V>, B<-V> I<version>
|
||||
|
||||
If C<PACKAGE_VERSION> in F<dkms.conf> is set to C<#MODULE_VERSION#>, set it to
|
||||
the given I<version> or, if none is given, default to the upstream version of
|
||||
the current package. Otherwise, leave the value specified in F<dkms.conf>.
|
||||
|
||||
=item B<--> I<file>
|
||||
|
||||
Don't look for debian/I<package>.dkms or debian/dkms, but install I<file> as dkms.conf.
|
||||
|
||||
=back
|
||||
|
||||
=head1 NOTES
|
||||
|
||||
Note that this command is not idempotent. L<dh_prep(1)> should be called
|
||||
between invocations of this command. Otherwise, it may cause multiple
|
||||
instances of the same text to be added to maintainer scripts.
|
||||
|
||||
=cut
|
||||
|
||||
# placeholder substituted at build time
|
||||
# is shown along generated autoscripts
|
||||
#VERSION#
|
||||
|
||||
init(options => {
|
||||
"l|legacy" => \$dh{LEGACY_DKMS},
|
||||
});
|
||||
|
||||
foreach my $package (@{$dh{DOPACKAGES}}) {
|
||||
#next if is_udeb($package);
|
||||
|
||||
my $tmp = tmpdir($package);
|
||||
my $dkms_dir = "/usr/lib/dkms/";
|
||||
my $dkms_conf = pkgfile($package, "dkms");
|
||||
my $is_snippet = 0;
|
||||
my @other_conf;
|
||||
my $name;
|
||||
my $package_name;
|
||||
my $package_version;
|
||||
my $build_exclusive_config;
|
||||
|
||||
if ($dkms_conf) {
|
||||
# let's see if it's a proper snippet
|
||||
open(IN, "< $dkms_conf");
|
||||
while (my $l = <IN>) {
|
||||
$l =~ /PACKAGE_NAME=(["'])(.*)\1/ && ($is_snippet = 1);
|
||||
}
|
||||
close(IN);
|
||||
|
||||
if ($is_snippet) {
|
||||
$name = $dkms_conf;
|
||||
}
|
||||
else {
|
||||
@other_conf = filearray($dkms_conf);
|
||||
if ($#other_conf > 1) {
|
||||
error "cannot list more than one file in $dkms_conf!";
|
||||
}
|
||||
else {
|
||||
$name = $other_conf[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ($#ARGV == 0) {
|
||||
$name = $ARGV[0];
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
verbose_print "installing $name as dkms.conf";
|
||||
|
||||
# now, parse our configuration file
|
||||
open(IN, "< $name");
|
||||
while (my $l = <IN>) {
|
||||
$l =~ /PACKAGE_NAME=(["']?)(.*)\1/ && ($is_snippet = 1 && $package_name = $2);
|
||||
$l =~ /PACKAGE_VERSION=(["']?)(.*)\1/ && ($package_version = $2);
|
||||
$l =~ /BUILD_EXCLUSIVE_CONFIG=(["']?)(.*)\1/ && ($build_exclusive_config = $2);
|
||||
}
|
||||
close(IN);
|
||||
|
||||
#$ENV{DH_AUTOSCRIPTDIR} = "debian/scripts/";
|
||||
if ($build_exclusive_config) {
|
||||
addsubstvar($package, "misc:Depends", "dkms", ">= 3.0.3-4~");
|
||||
}
|
||||
elsif ($dh{LEGACY_DKMS}) {
|
||||
doit("install", "-p", "-D", "-m755", "$dkms_dir/common.postinst", "$tmp/usr/share/$package/postinst");
|
||||
addsubstvar($package, "misc:Depends", "dkms");
|
||||
}
|
||||
else {
|
||||
addsubstvar($package, "misc:Depends", "dkms", ">= 2.1.0.0");
|
||||
}
|
||||
|
||||
if ($dh{V_FLAG_SET}) {
|
||||
$package_version = $dh{V_FLAG};
|
||||
if ($package_version eq "") {
|
||||
# Call isnative because it sets $dh{VERSION}
|
||||
# as a side effect.
|
||||
isnative($package);
|
||||
$package_version = $dh{VERSION};
|
||||
# Remove the Debian revision
|
||||
$package_version =~ s/-[^-]+$//;
|
||||
}
|
||||
|
||||
my $old_name = $name;
|
||||
$name = "debian/".pkgext($package)."dkms.debhelper";
|
||||
doit("cp", "-a", $old_name, $name);
|
||||
doit("sed", "-i", "s/#MODULE_VERSION#/$package_version/g", $name);
|
||||
}
|
||||
|
||||
error "could not determine package name"
|
||||
unless defined($package_name);
|
||||
|
||||
error "could not determine package version"
|
||||
unless defined($package_version);
|
||||
|
||||
autoscript($package, "prerm", "prerm-dkms",
|
||||
"s/#MODULE_NAME#/$package_name/;s/#MODULE_VERSION#/$package_version/");
|
||||
autoscript($package, "postinst", "postinst-dkms",
|
||||
"s/#MODULE_NAME#/$package_name/;s/#MODULE_VERSION#/$package_version/");
|
||||
doit("install", "-p", "-D", "-m644", "$name", "$tmp/usr/src/$package_name-$package_version/dkms.conf");
|
||||
}
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
L<debhelper(1)>
|
||||
|
||||
This program is part of the Debian DKMS package.
|
||||
|
||||
L<dkms(8)>
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
David Paleino <dapal@debian.org>
|
||||
|
||||
=cut
|
|
@ -0,0 +1,208 @@
|
|||
#!/bin/sh
|
||||
# Common autopkgtest script for testing a dkms source package.
|
||||
# Author: Martin Pitt <martin.pitt@ubuntu.com>
|
||||
# Copyright: (C) 2014 Canonical Ltd.
|
||||
set -eu
|
||||
|
||||
result=0
|
||||
summary=
|
||||
crlf="
|
||||
"
|
||||
|
||||
header_packages=
|
||||
check_for_linux_headers() {
|
||||
# Act only on the first run.
|
||||
if [ -n "$header_packages" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
# What Linux header packages are installed?
|
||||
header_packages=$(dpkg-query -f '${Status} ${Package}\n' -W 'linux-headers-*' | sed -r -n 's/^install ok installed //p')
|
||||
if [ -n "$header_packages" ]; then
|
||||
echo "I: Using the following Linux header packages that were already installed:"
|
||||
for p in $header_packages ; do
|
||||
echo "I: $p"
|
||||
done
|
||||
return
|
||||
fi
|
||||
|
||||
# What Linux header packages could be installed?
|
||||
# linux-doc is a dependency generated by autodep8 for autopkgtest-pkg-dkms
|
||||
# install only linux-headers-* matching the source version of linux-doc
|
||||
wanted_source_version=$(dpkg-query -f '${source:Version}' -W linux-doc 2>/dev/null || true)
|
||||
candidates=$(apt-cache search --names-only '^linux-headers-' | awk '{print $1}' | grep -v -E -e '-common(-rt)?$')
|
||||
echo "I: No Linux header packages are installed."
|
||||
echo "I: Installing all available ones from src:linux $wanted_source_version:"
|
||||
for p in $candidates ; do
|
||||
if [ -z "$wanted_source_version" ]; then
|
||||
echo "I: $p"
|
||||
header_packages="$header_packages $p"
|
||||
continue
|
||||
fi
|
||||
source_versions=$(apt-cache show $p | perl -ne 'if (/^$/) { print $s || $v, "\n"; $s=$v=""; } $s=$1 if /^Source: .* \((.*)\)$/; $v=$1 if /^Version: (.*)$/;')
|
||||
for sv in $source_versions ; do
|
||||
if [ "$sv" = "$wanted_source_version" ]; then
|
||||
echo "I: install $p"
|
||||
header_packages="$header_packages $p"
|
||||
continue 2
|
||||
fi
|
||||
done
|
||||
echo "I: skip $p"
|
||||
done
|
||||
apt-get install --no-install-recommends -yq $header_packages </dev/null 2>&1 || RC=$?
|
||||
if [ "$RC" -ne 0 ]; then
|
||||
echo "E: Linux headers failed to install" >&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_pkg() {
|
||||
pkg="$1"
|
||||
|
||||
echo "I: Removing binary package $pkg, to get clean state"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get purge -yq $pkg </dev/null 2>&1 >/dev/null || true
|
||||
|
||||
echo "I: Installing binary package $pkg"
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
RC=0
|
||||
apt-get install --no-install-recommends -yq $pkg </dev/null 2>&1 || RC=$?
|
||||
if [ "$RC" -ne 0 ]; then
|
||||
echo "E: Package $pkg failed to install" >&2
|
||||
result=1
|
||||
return
|
||||
fi
|
||||
|
||||
# Try and remove dkms to spot packages which miss a dkms dependency
|
||||
echo "I: Checking for missing dkms dependency by trying to deinstall dkms"
|
||||
dpkg --remove dkms || true
|
||||
|
||||
if ! dkms_conf=$(dpkg -L $pkg | grep '/usr/src' | grep '/dkms.conf$'); then
|
||||
echo "I: Package $pkg has no dkms.conf, skipping"
|
||||
return
|
||||
fi
|
||||
|
||||
check_for_linux_headers
|
||||
|
||||
echo "I: Testing binary package $pkg"
|
||||
|
||||
dkms_pkg=$(bash -c ". $dkms_conf > /dev/null; echo \$PACKAGE_NAME" 2>/dev/null)
|
||||
dkms_ver=$(bash -c ". $dkms_conf > /dev/null; echo \$PACKAGE_VERSION" 2>/dev/null)
|
||||
|
||||
for k in /lib/modules/*/build
|
||||
do
|
||||
test -d "$k" || continue
|
||||
kver="${k%/build}"
|
||||
kver="${kver#/lib/modules/}"
|
||||
|
||||
# If any linux-meta is in triggers, only test abistems that
|
||||
# match triggers otherwise continue. This helps integration
|
||||
# with adt-matrix which specifically requests test results
|
||||
# against each individual linux-meta and tracks unique results
|
||||
# per kernel abi.
|
||||
abistem=$(echo $kver | sed 's/-[a-z]*$//')
|
||||
case "${ADT_TEST_TRIGGERS-}" in
|
||||
*linux-meta*)
|
||||
case "$ADT_TEST_TRIGGERS" in
|
||||
*"$abistem"*)
|
||||
;;
|
||||
*)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
esac
|
||||
|
||||
echo "I: Trying to build $dkms_pkg/$dkms_ver for $kver"
|
||||
res=0
|
||||
dkms build -m "$dkms_pkg" -v "$dkms_ver" -k "$kver" || res=$?
|
||||
|
||||
if [ "$res" = 9 ]; then
|
||||
echo "I: $dkms_pkg/$dkms_ver is not supported on $kver (BUILD_EXCLUSIVE directive), skipping"
|
||||
summary="${summary}I: SKIP $kver${crlf}"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "$res" != 0 ]; then
|
||||
echo "E: $dkms_pkg/$dkms_ver failed to build for $kver" >&2
|
||||
makelog="/var/lib/dkms/$dkms_pkg/$dkms_ver/build/make.log"
|
||||
echo "========== $makelog ==========" >&2
|
||||
cat "$makelog" >&2 || true
|
||||
echo "====================" >&2
|
||||
summary="${summary}I: FAIL $kver${crlf}"
|
||||
result=1
|
||||
continue
|
||||
fi
|
||||
|
||||
if ! dkms install -m "$dkms_pkg" -v "$dkms_ver" -k "$kver" ; then
|
||||
echo "E: $dkms_pkg/$dkms_ver failed to install for $kver" >&2
|
||||
summary="${summary}I: FAIL $kver${crlf}"
|
||||
result=1
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "I: Testing if $dkms_pkg modules are correctly installed"
|
||||
dkmsstatus="$(dkms status $dkms_pkg -k $kver)"
|
||||
echo "$dkmsstatus"
|
||||
if [ -z "$dkmsstatus" ]; then
|
||||
echo "E: dkms status output is empty!" >&2
|
||||
summary="${summary}I: FAIL $kver${crlf}"
|
||||
result=1
|
||||
continue
|
||||
fi
|
||||
|
||||
# This should check for exact zfs module against exact kernel
|
||||
# abi to allow testing multiple kernels simultaniously. Some
|
||||
# dkms modules are pre-built inside the kernel (i.e. zfs on
|
||||
# Ubuntu) thus we should accept such result.
|
||||
if ! echo "$dkmsstatus" | sed 's/ (WARNING! Diff between built and installed module!)//g' | grep -q "installed$"; then
|
||||
echo "E: not installed" >&2
|
||||
summary="${summary}I: FAIL $kver${crlf}"
|
||||
result=1
|
||||
continue
|
||||
fi
|
||||
|
||||
summary="${summary}I: PASS $kver${crlf}"
|
||||
|
||||
done
|
||||
|
||||
# collect build logs as artifacts
|
||||
if [ -d /var/lib/dkms ]; then
|
||||
(cd /var/lib/dkms; find -name "make.log" -print0 | xargs -r -0 tar cv) > "$AUTOPKGTEST_ARTIFACTS/$pkg-make-logs.tar"
|
||||
fi
|
||||
|
||||
# skip modprobing for now; this fails too often (needs particular
|
||||
# hardware/firmware/etc)
|
||||
# for mod in $(awk -F '"' '/^BUILT_MODULE_NAME/ {print $2}' $dkms_conf); do
|
||||
# echo "I: modprobe $mod"
|
||||
# if ! modprobe $mod; then
|
||||
# echo "E: Failed to modprobe module $mod" >&2
|
||||
# exit 1
|
||||
# else
|
||||
# echo "I: $modname loaded"
|
||||
# fi
|
||||
# done
|
||||
}
|
||||
|
||||
# Do not (fail to) build the modules upon linux-header-* and *-dkms package
|
||||
# installation, which can cause apt-get to fail. We will do this later with
|
||||
# improved error reporting.
|
||||
# (This only works if the *-dkms package is not yet installed.)
|
||||
touch /etc/dkms/no-autoinstall
|
||||
|
||||
for pkg in $(grep-dctrl -FDepends -e '(^| )dkms' -o -FPackage -e '\-dkms' debian/control -sPackage -n); do
|
||||
# package might be arch: restriction or udeb etc.
|
||||
if ! apt-cache show $pkg >/dev/null 2>&1; then
|
||||
echo "I: Skipping unavailable package $pkg"
|
||||
continue
|
||||
fi
|
||||
run_pkg $pkg
|
||||
done
|
||||
|
||||
if [ -n "$summary" ]; then
|
||||
echo "I: Summary:"
|
||||
echo -n "$summary"
|
||||
fi
|
||||
|
||||
exit $result
|
||||
|
||||
# vim: sw=4:ts=4:et
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/perl
|
||||
use warnings;
|
||||
use strict;
|
||||
use Debian::Debhelper::Dh_Lib;
|
||||
|
||||
insert_before("dh_installinit", "dh_dkms");
|
||||
|
||||
1;
|
|
@ -0,0 +1,27 @@
|
|||
# The original file can be found in template-dkms-mkdeb/debian/postinst
|
||||
# in the DKMS tarball, check it for copyright notices.
|
||||
|
||||
DKMS_NAME=#MODULE_NAME#
|
||||
DKMS_PACKAGE_NAME=$DKMS_NAME-dkms
|
||||
DKMS_VERSION=#MODULE_VERSION#
|
||||
|
||||
postinst_found=0
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
for DKMS_POSTINST in /usr/lib/dkms/common.postinst /usr/share/$DKMS_PACKAGE_NAME/postinst; do
|
||||
if [ -f $DKMS_POSTINST ]; then
|
||||
$DKMS_POSTINST $DKMS_NAME $DKMS_VERSION /usr/share/$DKMS_PACKAGE_NAME "" $2
|
||||
postinst_found=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ "$postinst_found" -eq 0 ]; then
|
||||
echo "ERROR: DKMS version is too old and $DKMS_PACKAGE_NAME was not"
|
||||
echo "built with legacy DKMS support."
|
||||
echo "You must either rebuild $DKMS_PACKAGE_NAME with legacy postinst"
|
||||
echo "support or upgrade DKMS to a more current version."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,10 @@
|
|||
DKMS_NAME=#MODULE_NAME#
|
||||
DKMS_VERSION=#MODULE_VERSION#
|
||||
|
||||
case "$1" in
|
||||
remove|upgrade|deconfigure)
|
||||
if [ "$(dkms status -m $DKMS_NAME -v $DKMS_VERSION)" ]; then
|
||||
dkms remove -m $DKMS_NAME -v $DKMS_VERSION --all
|
||||
fi
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1 @@
|
|||
3.0 (quilt)
|
|
@ -0,0 +1,2 @@
|
|||
# for debian/scripts/dh_dkms.in
|
||||
maintainer-manual-page [debian/scripts/dh_dkms.1]
|
|
@ -0,0 +1,2 @@
|
|||
#abort-on-upstream-changes
|
||||
#unapply-patches
|
|
@ -0,0 +1,4 @@
|
|||
Bug-Database: https://github.com/dell/dkms/issues
|
||||
Bug-Submit: https://github.com/dell/dkms/issues/new
|
||||
Repository: https://github.com/dell/dkms.git
|
||||
Repository-Browse: https://github.com/dell/dkms
|
|
@ -0,0 +1,7 @@
|
|||
version=4
|
||||
|
||||
#we no longer are hosted on linux.dell.com
|
||||
#http://linux.dell.com/dkms/permalink/dkms-(.*)\.tar\.gz
|
||||
|
||||
https://github.com/dell/dkms/releases \
|
||||
.*[^n]/(?:|v|version-|r|REL_|rel-|dkms(?:_|-))(\d[^\s/]*)\.(?:tar\.xz|txz|tar\.bz2|tbz2|tar\.gz|tgz)
|
|
@ -0,0 +1,768 @@
|
|||
.\" -*- nroff -*-
|
||||
.\"
|
||||
.\" .SY, .YS, .OP macros from /usr/share/groff/1.21/tmac/an-ext.tmac
|
||||
.\"
|
||||
.\" Declare start of command synopsis. Sets up hanging indentation.
|
||||
.de SY
|
||||
. ie !\\n(mS \{\
|
||||
. nh
|
||||
. nr mS 1
|
||||
. nr mA \\n(.j
|
||||
. ad l
|
||||
. nr mI \\n(.i
|
||||
. \}
|
||||
. el \{\
|
||||
. br
|
||||
. ns
|
||||
. \}
|
||||
.
|
||||
. HP \w'\fB\\$1\fP\ 'u
|
||||
. B "\\$1"
|
||||
..
|
||||
.
|
||||
.
|
||||
.\" End of command synopsis. Restores adjustment.
|
||||
.de YS
|
||||
. in \\n(mIu
|
||||
. ad \\n(mA
|
||||
. hy \\n(HY
|
||||
. nr mS 0
|
||||
..
|
||||
.
|
||||
.
|
||||
.\" Declare optional option.
|
||||
.de OP
|
||||
. ie \\n(.$-1 \
|
||||
. RI "[\fB\\$1\fP" "\ \\$2" "]"
|
||||
. el \
|
||||
. RB "[" "\\$1" "]"
|
||||
..
|
||||
.TH DKMS 8 #RELEASE_DATE# #RELEASE_STRING#
|
||||
.SH NAME
|
||||
dkms \- Dynamic Kernel Module Support
|
||||
.SH SYNOPSIS
|
||||
.SY dkms
|
||||
.OP action
|
||||
.OP options
|
||||
.OP module/module-version
|
||||
.OP /path/to/source-tree
|
||||
.OP /path/to/tarball.tar
|
||||
.OP /path/to/driver.rpm
|
||||
.YS
|
||||
.SH DESCRIPTION
|
||||
.B dkms
|
||||
is a framework which allows kernel modules to be dynamically built
|
||||
for each kernel on your system in a simplified and organized fashion.
|
||||
.SH ACTIONS
|
||||
.SY add
|
||||
.OP module/module\-version
|
||||
.OP /path/to/source\-tree
|
||||
.OP /path/to/tarball.tar
|
||||
.YS
|
||||
.IP "" 4
|
||||
Adds a module/module\-version combination to the tree for builds and installs.
|
||||
If module/module\-version, \-m module/module\-version, or \-m module\ \-v version are passed as options, this command
|
||||
requires source in
|
||||
.I /usr/src/<module>\-<module\-version>/
|
||||
as well as a properly
|
||||
formatted
|
||||
.I dkms.conf
|
||||
file. If
|
||||
.I /path/to/source\-tree
|
||||
is passed as an option, and source-tree contains a
|
||||
.I dkms.conf
|
||||
file, it will copy
|
||||
.I /path/to/source\-tree
|
||||
to
|
||||
.I /usr/src/module\-module\-version.
|
||||
If
|
||||
.I /path/to/tarball.tar
|
||||
is passed, this command behaves like the
|
||||
.B ldtarball
|
||||
command.
|
||||
.SY remove
|
||||
.OP module/module\-version
|
||||
.OP -k kernel/arch
|
||||
.OP \-\-all
|
||||
.YS
|
||||
.IP "" 4
|
||||
Removes a module/version or module/version/kernel/arch combination from the
|
||||
tree. If the module is currently installed, it first uninstalls it
|
||||
and if applicable, will replace it with its original_module. Use the
|
||||
.B \-\-all
|
||||
option in order to remove all instances for every kernel at once.
|
||||
.SY build
|
||||
.OP module/module\-version
|
||||
.OP -k kernel/arch
|
||||
.OP --force
|
||||
.YS
|
||||
.IP "" 4
|
||||
Builds the specified module/version combo for the specified kernel/arch. If
|
||||
the
|
||||
.I \-k
|
||||
option is not specified it builds for the currently running kernel and arch. All builds
|
||||
occur in the directory
|
||||
.I /var/lib/dkms/<module>/<module\-version>/build/.
|
||||
If the module/module\-version combo has not been added, dkms will try to add it, and in that
|
||||
case
|
||||
.B build
|
||||
can take the same arguments that
|
||||
.B add
|
||||
can.
|
||||
If the module is already built, it will not be rebuilt again by default, and the
|
||||
.B --force
|
||||
option should be used to override this.
|
||||
.SY unbuild
|
||||
.OP module/module\-version
|
||||
.OP -k kernel/arch
|
||||
.OP \-\-all
|
||||
.YS
|
||||
.IP "" 4
|
||||
Undoes the build for a module/version or module/version/kernel/arch combination from the
|
||||
tree. If the module is currently installed, it first uninstalls it
|
||||
and if applicable, will replace it with its original_module. Finally all binary
|
||||
kernel modules are removed. Use the
|
||||
.B \-\-all
|
||||
option in order to remove all instances for every kernel at once.
|
||||
.SY install
|
||||
.OP module/module\-version
|
||||
.OP -k kernel/arch
|
||||
.OP --force
|
||||
.OP /path/to/driver.rpm
|
||||
.YS
|
||||
.IP "" 4
|
||||
Installs a built module/version combo onto the kernel it was built for. If
|
||||
the kernel option is not specified it assumes the currently running kernel.
|
||||
If the module has not been built, dkms will try to build it.
|
||||
If the module has not been added, dkms will try to add it. In both cases, the
|
||||
.B install
|
||||
command can then take the same arguments as the
|
||||
.B build
|
||||
or
|
||||
.B add
|
||||
commands.
|
||||
If the module is already installed, it will not be reinstalled again
|
||||
by default, and the
|
||||
.B --force
|
||||
option should be used to override this.
|
||||
If you pass a .rpm file, dkms will try to install that file with
|
||||
.B rpm -Uvh
|
||||
, and it will perform an
|
||||
.B autoinstall
|
||||
action to be sure that everything is built for your kernel if the RPM installed successfully.
|
||||
.SY uninstall
|
||||
.OP module/module\-version
|
||||
.OP -k kernel/arch
|
||||
.OP \-\-all
|
||||
.YS
|
||||
.IP "" 4
|
||||
Uninstalls an installed module/module\-version combo from the kernel/arch passed in the -k option, or the
|
||||
current kernel if the -k option was not passed. Use the
|
||||
.B \-\-all
|
||||
option in order to uninstall all instances for every kernel at once.
|
||||
After uninstall completion, the driver will be left in the built state.
|
||||
To completely remove a driver, the remove action should be utilized.
|
||||
.SY match
|
||||
.OP --templatekernel kernel/arch
|
||||
.OP -k kernel/arch
|
||||
.YS
|
||||
.IP "" 4
|
||||
Match installs modules onto the specified kernel by looking at the
|
||||
configuration of the specified
|
||||
.B templatekernel.
|
||||
Every module that is installed on the
|
||||
.B templatekernel
|
||||
within
|
||||
.B dkms
|
||||
is then installed on that specified kernel.
|
||||
.SY mktarball
|
||||
.OP module/module\-version
|
||||
.OP -k kernel/arch
|
||||
.OP --archive /path/to/tarball.tar
|
||||
.OP --source-only
|
||||
.OP --binaries-only
|
||||
.YS
|
||||
.IP "" 4
|
||||
Creates a tarball archive for the specified module/version of all files
|
||||
in the DKMS tree for that module/version combination. This includes
|
||||
the source and any built modules for kernels in the tree (as specified).
|
||||
Otherwise, you can specify
|
||||
a singular kernel to archive only, or multiple kernels to archive
|
||||
(\-k kernel1/arch1 \-k kernel2/arch2). Optionally, you can use
|
||||
.B \-\-archive
|
||||
to specify the file that you would like to save this
|
||||
tarball to. You can also specify
|
||||
.B \-\-binaries\-only
|
||||
if you want the resultant tarball not to include the module source. Likewise,
|
||||
.B \-\-source-only
|
||||
can be used to specify that no prebuilt binaries should be included in the tarball.
|
||||
In general,
|
||||
.B mktarball
|
||||
is great for systems management purposes as you can build your driver
|
||||
on just one system and then use
|
||||
.B ldtarball
|
||||
on all of your other systems to get the same built modules loaded
|
||||
without having to wait for anything to compile.
|
||||
.SY ldtarball
|
||||
.OP /path/to/tarball.tar
|
||||
.OP --force
|
||||
.YS
|
||||
.IP "" 4
|
||||
This takes a tarball made from the
|
||||
.B mktarball
|
||||
command and loads it into your DKMS tree. This will leave any
|
||||
newly added modules in the built state and
|
||||
.B dkms install
|
||||
should then be called to install any of them. If files already
|
||||
exist where
|
||||
.B ldtarball
|
||||
is attempting to place them, it will warn and not copy over them. The
|
||||
.B \-\-force
|
||||
option should be used to override this.
|
||||
.SY status
|
||||
.OP module/module\-version
|
||||
.OP -k kernel/arch
|
||||
.YS
|
||||
.IP "" 4
|
||||
Returns the current status of modules, versions and kernels within
|
||||
the tree as well as whether they have been added, built or installed.
|
||||
Status can be shown for just a certain module, a certain kernel,
|
||||
a module/version combination or a module/version/kernel combination.
|
||||
.SY autoinstall
|
||||
.YS
|
||||
.IP "" 4
|
||||
Attempt to install the latest revision of all modules that have been installed for other kernel revisions.
|
||||
dkms_autoinstaller is a stub that uses this action to perform its work.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \-m <module>/<module\-version>
|
||||
The name of the module and module version you want to operate on. The
|
||||
.B \-m
|
||||
part of this option is optional, and can be omitted in virtually all circumstances.
|
||||
.TP
|
||||
.B \-v <module\-version>
|
||||
The version of the module to execute the specified action upon. This option only has to be specified
|
||||
if you pass a
|
||||
.B \-m
|
||||
option without a <module\-version> component of its own.
|
||||
.TP
|
||||
.B \-k <kernel\-version>/<arch>
|
||||
The kernel and arch to perform the action upon. You can specify multiple kernel version/arch pairs
|
||||
on the command line by repeating the \-k argument with a different kernel version and arch.
|
||||
However, not all actions support multiple kernel versions (it will error out
|
||||
in this case).
|
||||
The arch part can be omitted, and DKMS will assume you want it to be the arch of the currently running
|
||||
system.
|
||||
.TP
|
||||
.B \-a, \-\-arch
|
||||
The system architecture to perform the action upon. It is optional if you pass it as part of the
|
||||
.B \-k
|
||||
option. If not specified, it assumes
|
||||
the arch of the currently running system (`uname \-m`). You can specify multiple
|
||||
arch parameters on the same command line by repeating the \-a argument with a
|
||||
different arch name. When multiple architectures are specified, there must
|
||||
be a 1:1 relationship between \-k arguments to \-a arguments. DKMS will then
|
||||
assume the first \-a argument aligns with the first \-k kernel and so on for the
|
||||
second, third, etc.
|
||||
|
||||
For example, if you were to specify: \-k kernel1 \-k kernel2 \-a i386 \-k kernel3 \-a i686 \-a x86_64,
|
||||
DKMS would process this as: kernel1-i386, kernel2-i686, kernel3-x86_64.
|
||||
.TP
|
||||
.B \-q, \-\-quiet
|
||||
Quiet.
|
||||
.TP
|
||||
.B \-V, \-\-version
|
||||
Prints the currently installed version of dkms and exits.
|
||||
.TP
|
||||
.B \-c <dkms.conf\-location>
|
||||
The location of the
|
||||
.I dkms.conf
|
||||
file. This is needed for the add action and if not specified,
|
||||
it is assumed to be located in
|
||||
.I /usr/src/<module>\-<module\-version>/.
|
||||
See below for more information on the format of
|
||||
.I dkms.conf.
|
||||
.TP
|
||||
.B \-\-config <kernel\-.config\-location>
|
||||
During a
|
||||
.B build
|
||||
this option is used to specify an alternate location for the kernel .config
|
||||
file which was used to compile that kernel. Normally,
|
||||
.B dkms
|
||||
uses the Red Hat standard location and config filenames located in
|
||||
.I /usr/src/linux\-<kernel>/configs/.
|
||||
If the config for the kernel that you
|
||||
are building a module for is not located here or does not have the expected
|
||||
name in this location, you will need to tell
|
||||
.B dkms
|
||||
where the necessary .config can be found so that your kernel can be properly
|
||||
prepared for the module build.
|
||||
.TP
|
||||
.B \-\-archive <tarball\-location>
|
||||
This option is used during a
|
||||
.B ldtarball
|
||||
action to specify the location of the tarball you wish to load into
|
||||
your DKMS tree. You only have to specify the
|
||||
.B --archive
|
||||
part of this option if <tarball\-location> does not already exist as a file.
|
||||
.TP
|
||||
.B \-\-templatekernel <kernel\-version>
|
||||
This option is required for the action:
|
||||
.B match.
|
||||
Match will look at the
|
||||
templatekernel specified and install all of the same module/version
|
||||
combinations on the other kernel.
|
||||
.TP
|
||||
.B \-\-force
|
||||
This option can be used in conjunction with
|
||||
.B ldtarball
|
||||
to force copying over of extant files.
|
||||
.TP
|
||||
.B \-\-binaries\-only
|
||||
This option can be used in conjunction with
|
||||
.B mktarball
|
||||
in order to create a DKMS tarball which does not contain the source for the
|
||||
module within it. This can be helpful in reducing the size of the tarball
|
||||
if you know that the system which this tarball will be loaded upon already
|
||||
has the source installed. In order to load a tarball made as binaries-only
|
||||
.B you must
|
||||
have the module source in that systems DKMS tree. If you do not, DKMS
|
||||
.B will refuse
|
||||
to load a binaries-only tarball.
|
||||
.TP
|
||||
.B \-\-source\-only
|
||||
This option can be used in conjunction with
|
||||
.B mktarball
|
||||
but do not want the tarball you create to have any prebuilt modules within it,
|
||||
passing this option will keep its internal DKMS tarball from containing any
|
||||
prebuilt modules.
|
||||
.TP
|
||||
.B \-\-all
|
||||
This option can be used to automatically specify all relevant kernels/arches
|
||||
for a module/module-version. This can be used for things like remove, unbuild
|
||||
and uninstall. This saves the trouble of having to actually specify \-k kernel1 \-a
|
||||
arch1 \-k kernel2 \-a arch2 for every kernel you have built your module for.
|
||||
.TP
|
||||
.B \-\-no\-depmod
|
||||
This option prevents DKMS from running the depmod command during
|
||||
.B install
|
||||
and
|
||||
.B uninstall
|
||||
which will avoid (re)calculating module dependencies and thereby save time.
|
||||
.TP
|
||||
.B \-\-modprobe\-on\-install
|
||||
This option executes modprobe on the modules upon successful installation.
|
||||
.TP
|
||||
.B \-\-kernelsourcedir <kernel\-source\-directory\-location>
|
||||
Using this option you can specify the location of your kernel source
|
||||
directory. Most likely you will not need to set this if your kernel
|
||||
source is accessible via
|
||||
.I /lib/modules/$kernel_version/build.
|
||||
.TP
|
||||
.B \-\-directive <"cli\-directive=cli\-value">
|
||||
Using this option, you can specify additional directives from the command
|
||||
line. The
|
||||
.B \-\-directive
|
||||
option can be used multiple times on the same command-line to specify
|
||||
multiple additional command line directives.
|
||||
.TP
|
||||
.B \-\-rpm_safe_upgrade
|
||||
This flag should be used when packaging DKMS enabled modules in RPMs. It should
|
||||
be specified during both the
|
||||
.B add
|
||||
and
|
||||
.B remove
|
||||
actions in the RPM spec to ensure that DKMS and RPM behave correctly in all
|
||||
scenarios when upgrading between various versions of a dkms enabled module
|
||||
RPM package.
|
||||
.TP
|
||||
.B \-\-dkmstree path/to/place
|
||||
Provides a destination tree for building and installing modules to. Useful in
|
||||
cases that you don't want to contaminate a system when using solely for building.
|
||||
.TP
|
||||
.B \-\-sourcetree path/to/place
|
||||
Provides a location to build a DKMS package from. Useful for systems that you may
|
||||
not have root access, but would still like to be able to build DKMS packages.
|
||||
.TP
|
||||
.B \-\-installtree path/to/place
|
||||
Provides a location to place modules when a
|
||||
.I dkms install
|
||||
command is issued.
|
||||
.TP
|
||||
.B \-j number
|
||||
Run no more than
|
||||
.I number
|
||||
jobs in parallel; see the -j option of
|
||||
.I make(1).
|
||||
Defaults to the number of CPUs in the system, detected by
|
||||
.I nproc(1).
|
||||
Specify 0 to impose no limit on the number of parallel jobs.
|
||||
.SH ORIGINAL MODULES
|
||||
During the first install of a module for a <kernelversion>,
|
||||
.B dkms
|
||||
will search
|
||||
.I /lib/modules/<kernelversion>
|
||||
for a pre-existing module of the same name. If one is found, it will automatically
|
||||
be saved as an "original_module" so that if the newer module is later removed,
|
||||
.B dkms
|
||||
will put the original module back in its place. Currently, DKMS searches
|
||||
for these original modules with first preference going to modules located in
|
||||
.I /lib/modules/<kernelversion>/updates/
|
||||
followed by
|
||||
.B $DEST_MODULE_LOCATION
|
||||
(as specified in
|
||||
.I dkms.conf
|
||||
). If one cannot be found in either location, a find will be used to locate one for
|
||||
that kernel.
|
||||
If none are found, then during a later uninstall, your kernel will not have that module
|
||||
replaced.
|
||||
|
||||
If more than one is found, then the first one located (by preference indicated
|
||||
above) will be considered the "original_module". As well, all copies of the same-named
|
||||
module will be removed from your kernel tree and placed into
|
||||
.I /var/lib/dkms/<module>/original_module/$kernelver/collisions
|
||||
so that they can be *manually* accessible later. DKMS will never actually do anything
|
||||
with the modules found underneath the /collisions directory, and they will be stored there
|
||||
until you manually delete them.
|
||||
.SH DKMS.CONF
|
||||
When performing an
|
||||
.B add
|
||||
, a proper
|
||||
.I dkms.conf
|
||||
file must be found. A properly formatted conf file is essential
|
||||
for communicating to
|
||||
.B dkms
|
||||
how and where the module should be installed. While not all the directives
|
||||
are required, providing as many as possible helps to limit any ambiguity. Note
|
||||
that the
|
||||
.I dkms.conf
|
||||
is really only a shell\-script of variable definitions which are then sourced in
|
||||
by the
|
||||
.B dkms
|
||||
executable (of the format, DIRECTIVE="directive text goes here"). As well, the
|
||||
directives are case\-sensitive and should be given in
|
||||
.B ALL CAPS.
|
||||
|
||||
It is important to understand that many of the DKMS directives are arrays whose index
|
||||
values are tied together. These array associations can be considered families, and there
|
||||
are currently three such families of directive arrays. MAKE[#] and MAKE_MATCH[#] make up
|
||||
one family. PATCH[#] and PATCH_MATCH[#] make up the second family. The third and
|
||||
largest family consists of BUILT_MODULE_NAME[#], BUILT_MODULE_LOCATION[#], DEST_MODULE_NAME[#],
|
||||
DEST_MODULE_LOCATION[#] and STRIP[#]. When indexing these arrays when creating your
|
||||
dkms.conf, each family should start at index value 0.
|
||||
.TP
|
||||
.B MAKE[#]=
|
||||
The MAKE directive array tells DKMS which make command should be used for building your module. The default make command
|
||||
should be put into
|
||||
.B MAKE[0].
|
||||
Other entries in the MAKE array will only be used if their corresponding entry in
|
||||
.B MAKE_MATCH[#]
|
||||
matches, as a regular expression (using grep -E), the kernel that the module is being built for.
|
||||
Note that if no value is placed in
|
||||
.B MAKE_MATCH[#]
|
||||
for any
|
||||
.B MAKE[#]
|
||||
where # > 0, then that
|
||||
.B MAKE
|
||||
directive is ignored.
|
||||
.B MAKE_MATCH[0]
|
||||
is optional and if it is populated, it will be used to determine
|
||||
if MAKE[0] should be used to build the module for that kernel. If multiple
|
||||
.B MAKE_MATCH
|
||||
directives match against the kernel being built for, the last matching
|
||||
.B MAKE[#]
|
||||
will be used to build your module. If no MAKE directive is specified or if no
|
||||
MAKE_MATCH matches the kernel being built for, DKMS
|
||||
will attempt to use a generic MAKE command to build your module.
|
||||
|
||||
KERNELRELEASE will be automatically appended to MAKE[#]. If you want to
|
||||
suppress this behavior, you can quote the make command: 'make'.
|
||||
.TP
|
||||
.B MAKE_MATCH[#]=
|
||||
See the above entry on
|
||||
.B MAKE[#]
|
||||
directives. This array should be populated with regular expressions which, when matched
|
||||
against the kernel being built for, will tell
|
||||
.B DKMS
|
||||
to use the corresponding make command in the
|
||||
.B MAKE[#]
|
||||
directive array to build your module.
|
||||
.TP
|
||||
.B BUILT_MODULE_NAME[#]=
|
||||
This directive gives the name of the module just after it is built. If your DKMS module
|
||||
package contains more than one module to install, this is a
|
||||
.B required
|
||||
directive for all of the modules. This directive should explicitly not contain any
|
||||
trailing ".o" or ".ko".
|
||||
Note that for each module within a dkms package, the numeric value of
|
||||
.B #
|
||||
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
|
||||
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. BUILT_MODULE_NAME[0]="qla2200"
|
||||
BUILT_MODULE_NAME[1]="qla2300").
|
||||
.TP
|
||||
.B BUILT_MODULE_LOCATION[#]=
|
||||
This directive tells DKMS where to find your built module after it has been built. This
|
||||
pathname should be given relative to the root directory of your source files (where your
|
||||
dkms.conf file can be found). If unset, DKMS expects to find your
|
||||
.B BUILT_MODULE_NAME[#]
|
||||
in the root directory of your source files.
|
||||
Note that for each module within a dkms package, the numeric value of
|
||||
.B #
|
||||
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
|
||||
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. BUILT_MODULE_LOCATION[0]="some/dir/"
|
||||
BUILT_MODULE_LOCATION[1]="other/dir/").
|
||||
.TP
|
||||
.B DEST_MODULE_NAME[#]=
|
||||
This directive can be used to specify the name of the module as it should be installed. This
|
||||
will rename the module from
|
||||
.B BUILT_MODULE_NAME[#]
|
||||
to
|
||||
.B DEST_MODULE_NAME[#].
|
||||
This directive should explicitly not contain any trailing ".o" or ".ko". If unset, it is
|
||||
assumed to be the same value as
|
||||
.B BUILT_MODULE_NAME[#].
|
||||
Note that for each module within a dkms package, the numeric value of
|
||||
.B #
|
||||
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
|
||||
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. DEST_MODULE_NAME[0]="qla2200_6x"
|
||||
DEST_MODULE_NAME[1]="qla2300_6x").
|
||||
.TP
|
||||
.B DEST_MODULE_LOCATION[#]=
|
||||
This directive specifies the destination where a module should be installed to, once compiled. It also
|
||||
is used for finding original_modules. This is a
|
||||
.B required
|
||||
directive, except as noted below. This directive must start with the text "/kernel" which is in reference to
|
||||
/lib/modules/<kernelversion>/kernel.
|
||||
Note that for each module within a dkms package, the numeric value of
|
||||
.B #
|
||||
must be the same for each of BUILT_MODULE_NAME, BUILT_MODULE_LOCATION, DEST_MODULE_NAME and
|
||||
DEST_MODULE_LOCATION and that the numbering should start at 0 (eg. DEST_MODULE_LOCATION[0]="/kernel/drivers/something/"
|
||||
DEST_MODULE_LOCATION[1]="/kernel/drivers/other/").
|
||||
|
||||
DEST_MODULE_LOCATION is ignored on Fedora and Red Hat Enterprise Linux, Novell SuSE Linux Enterprise Server 10
|
||||
and higher, Novell SuSE Linux 10.0 and higher, and Ubuntu. Instead, the proper distribution-specific directory is used.
|
||||
.TP
|
||||
.B STRIP[#]=
|
||||
By default strip is considered to be "yes". If set to "no", DKMS will not
|
||||
run strip \-g against your built module to remove debug symbols from it.
|
||||
STRIP[0] is used as the default for any unset entries in the STRIP array.
|
||||
.TP
|
||||
.B PACKAGE_NAME=
|
||||
This directive is used to give the name associated with the entire package of modules. This is the same
|
||||
name that is used with the
|
||||
.B \-m
|
||||
option when building, adding, etc. and may not necessarily be the same as the MODULE_NAME. This
|
||||
directive must be present in every dkms.conf.
|
||||
.TP
|
||||
.B PACKAGE_VERSION=
|
||||
This directive is used to give the version associated with the entire package of modules being installed within that dkms
|
||||
package. This directive must be present in every dkms.conf.
|
||||
.TP
|
||||
.B CLEAN=
|
||||
CLEAN specifies the make clean command to be used to clean up both before and after building the
|
||||
module. If unset, it is assumed to be "make clean".
|
||||
.TP
|
||||
.B OBSOLETE_BY=
|
||||
This directive allows you to specify a kernel version that obsoletes the necessity for this
|
||||
particular DKMS module. This can be specified as a particular upstream kernel or an ABI
|
||||
bump of a kernel. For example, "2.6.24" would be an upstream kernel and "2.6.24\-16" would
|
||||
represent an ABI bump for a kernel. Both are valid in this area.
|
||||
|
||||
Please avoid the use of
|
||||
.B OBSOLETE_BY
|
||||
wherever possible. It's use indicates a lack of proper module
|
||||
versioning using
|
||||
.B MODULE_VERSION()
|
||||
tags in the module source itself. It is better to fix the
|
||||
.B MODULE_VERSION()
|
||||
tags than use
|
||||
.B OBSOLETE_BY.
|
||||
This also introduces a implicit distribution/version dependency on the
|
||||
package, as the value of
|
||||
.B OBSOLETE_BY
|
||||
is meaningful only in the context of a single distribution/version.
|
||||
|
||||
If you feel you must use it, please use as such in dkms.conf:
|
||||
|
||||
ubuntu_804="Ubuntu
|
||||
8.04"
|
||||
if [ \-x /usr/bin/lsb_release ]; then
|
||||
if [ "$(/usr/bin/lsb_release \-sir)" == "${ubuntu_804}" ]; then
|
||||
OBSOLETE_BY="2.6.25"
|
||||
fi
|
||||
fi
|
||||
|
||||
.TP
|
||||
.B PATCH[#]=
|
||||
Use the PATCH directive array to specify patches which should be applied to your source before a build occurs.
|
||||
All patches are expected to be in \-p1 format and are applied with the patch \-p1 command.
|
||||
Each directive should specify the filename of the patch to apply, and all patches must
|
||||
be located in the patches subdirectory of your source directory (
|
||||
.I /usr/src/<module>\-<module\-version>/patches/
|
||||
). If any patch fails to apply, the build will be halted and the rejections can be
|
||||
inspected in
|
||||
.I /var/lib/dkms/<module>/<module\-version>/build/.
|
||||
If a PATCH should only be applied conditionally, the
|
||||
.B PATCH_MATCH[#]
|
||||
array should be used, and a corresponding regular expression should be placed in
|
||||
.B PATCH_MATCH[#]
|
||||
which will alert dkms to only use that
|
||||
.B PATCH[#]
|
||||
if the regular expression matches the kernel which the module is currently being built for.
|
||||
.TP
|
||||
.B PATCH_MATCH[#]=
|
||||
See the above description for
|
||||
.B PATCH[#]
|
||||
directives. If you only want a patch applied in certain scenarios, the
|
||||
.B PATCH_MATCH
|
||||
array should be utilized by giving a regular expression which matches
|
||||
the kernels you intend the corresponding
|
||||
.B PATCH[#]
|
||||
to be applied to before building that module.
|
||||
.TP
|
||||
.B AUTOINSTALL=
|
||||
If this directive is set to
|
||||
.B yes
|
||||
then the service
|
||||
.I /etc/rc.d/init.d/dkms_autoinstaller
|
||||
will automatically try to install this module on any kernel you boot into. See the section
|
||||
on
|
||||
.B dkms_autoinstaller
|
||||
for more information.
|
||||
.TP
|
||||
.B BUILD_DEPENDS[#]=
|
||||
This optional directive is an array that allows you to specify other modules as
|
||||
dependencies for your module. Each array element should be the
|
||||
.B PACKAGE_NAME
|
||||
of another module that is managed by dkms. Do not specify a version or
|
||||
architecture in the dependency. Note that this directive is only advisory;
|
||||
missing or broken dependencies cause non-fatal warnings.
|
||||
.TP
|
||||
.B BUILD_EXCLUSIVE_KERNEL=
|
||||
This optional directive allows you to specify a regular expression which defines
|
||||
the subset of kernels which DKMS is allowed to build your module for. If the kernel
|
||||
being built for does not match against this regular expression, the dkms build
|
||||
will error out. For example, if you set it as ="^2\.4.*", your module would not be
|
||||
built for 2.6 kernels.
|
||||
.TP
|
||||
.B BUILD_EXCLUSIVE_ARCH=
|
||||
This optional directive functions very similarly to
|
||||
.B BUILD_EXCLUSIVE_KERNEL
|
||||
except that it matches against the kernel architecture. For example, if you set
|
||||
it to ="i.86", your module would not be built for ia32e, x86_64, amd64, s390, etc.
|
||||
.TP
|
||||
.B POST_ADD=
|
||||
The name of the script to be run after an
|
||||
.B add
|
||||
is performed. The path should be given relative to the root directory of your source.
|
||||
.TP
|
||||
.B POST_BUILD=
|
||||
The name of the script to be run after a
|
||||
.B build
|
||||
is performed. The path should be given relative to the root directory of your source.
|
||||
.TP
|
||||
.B POST_INSTALL=
|
||||
The name of the script to be run after an
|
||||
.B install
|
||||
is performed. The path should be given relative to the root directory of your source.
|
||||
.TP
|
||||
.B POST_REMOVE=
|
||||
The name of the script to be run after a
|
||||
.B remove
|
||||
is performed. The path should be given relative to the root directory of your source.
|
||||
.TP
|
||||
.B PRE_BUILD=
|
||||
The name of the script to be run before a
|
||||
.B build
|
||||
is performed. The path should be given relative to the root directory of your source.
|
||||
.TP
|
||||
.B PRE_INSTALL=
|
||||
The name of the script to be run before an
|
||||
.B install
|
||||
is performed. The path should be given relative to the root directory
|
||||
of your source. If the script exits with a non\-zero value, the
|
||||
install will be aborted. This is typically used to perform a custom
|
||||
version comparison.
|
||||
.TP
|
||||
.SH DKMS.CONF VARIABLES
|
||||
Within your
|
||||
.I dkms.conf
|
||||
file, you can use certain variables which will be replaced at run\-time with their
|
||||
values.
|
||||
.TP
|
||||
.B $kernelver
|
||||
This variable can be used within a directive definition and during use, the actual kernel
|
||||
version in question will be substituted in its place. This is especially useful in MAKE
|
||||
commands when specifying which INCLUDE statements should be used when compiling your
|
||||
module (eg. MAKE="make all INCLUDEDIR=/lib/modules/${kernelver}/build/include").
|
||||
.TP
|
||||
.B $dkms_tree
|
||||
See the section on /etc/dkms/framework.conf for more information. This variable represents
|
||||
the location of the DKMS tree on the local system. By default this is
|
||||
.I /var/lib/dkms
|
||||
, but this value should not be hard\-coded into a dkms.conf in the event that the local user
|
||||
has changed it on their system.
|
||||
.TP
|
||||
.B $source_tree
|
||||
See the section on /etc/dkms/framework.conf for more information. This variable represents
|
||||
the location where DKMS keeps source on the local system. By default this is
|
||||
.I /usr/src
|
||||
, but this value should not be hard\-coded into a dkms.conf in the event that the local user
|
||||
has changed it on their system.
|
||||
.TP
|
||||
.B $kernel_source_dir
|
||||
This variable holds the value of the location of your kernel source directory. Usually, this
|
||||
will be
|
||||
.I /lib/modules/$kernelver/build
|
||||
, unless otherwise specified with the
|
||||
.B \-\-kernelsourcedir
|
||||
option.
|
||||
.SH DKMS.CONF OVERRIDES
|
||||
You can override the module-provided
|
||||
.I dkms.conf
|
||||
files. Every time after a dkms.conf file is read, dkms will look for and read the following files in order:
|
||||
.PP
|
||||
.I /etc/dkms/<module>.conf
|
||||
.br
|
||||
.I /etc/dkms/<module>\-<module\-version>.conf
|
||||
.br
|
||||
.I /etc/dkms/<module>\-<module\-version>\-<kernel>.conf
|
||||
.br
|
||||
.I /etc/dkms/<module>\-<module\-version>\-<kernel>\-<arch>.conf
|
||||
.PP
|
||||
You can use these files to override settings in the module-provided dkms.conf files.
|
||||
.SH /etc/dkms/framework.conf
|
||||
This configuration file controls how the overall DKMS framework handles. It is sourced
|
||||
in every time the dkms command is run. Mainly it can currently be used to set different
|
||||
default values for the variables.
|
||||
|
||||
Additionally to /etc/dkms/framework.conf,
|
||||
.B any file matching the glob
|
||||
/etc/dkms/framework.conf.d/*.conf will be loaded as well.
|
||||
.TP
|
||||
.B $dkms_tree, $source_tree, $install_tree
|
||||
control where DKMS looks for its framework.
|
||||
.TP
|
||||
.B $symlink_modules
|
||||
controls whether binary modules are copied to /lib/modules or if only symlinks are created there. Note that these variables can also
|
||||
be manipulated on the command line with \-\-dkmstree, \-\-sourcetree, \-\-installtree
|
||||
and \-\-symlink-modules options.
|
||||
.TP
|
||||
.B $autoinstall_all_kernels
|
||||
used by the common postinst for DKMS modules. It controls if the build should be done for all installed kernels or only for the current and latest installed kernel. It has no command
|
||||
line equivalent.
|
||||
.SH dkms_autoinstaller
|
||||
This boot\-time service automatically installs any module which has
|
||||
.B AUTOINSTALL="yes"
|
||||
set in its
|
||||
.B dkms.conf
|
||||
file. The service works quite simply and if multiple versions of a module are in
|
||||
your system's DKMS tree, it will not do anything and instead explain that manual
|
||||
intervention is required.
|
||||
.SH AUTHOR
|
||||
Gary Lerhaupt
|
||||
.SH WEBPAGE
|
||||
.I https://github.com/dell/dkms
|
||||
.SH MAILING\-LIST
|
||||
dkms\-devel@dell.com
|
||||
.I http://lists.us.dell.com/mailman/listinfo/dkms\-devel
|
|
@ -0,0 +1,112 @@
|
|||
# bash completion for dkms
|
||||
# Copied from the Mandriva dkms package
|
||||
|
||||
# This function complete on available kernels
|
||||
#
|
||||
_kernels()
|
||||
{
|
||||
COMPREPLY=( $( cd /lib/modules && compgen -d -- "$cur" ) )
|
||||
}
|
||||
|
||||
# complete on full directory names under $1
|
||||
_subdirectories()
|
||||
{
|
||||
COMPREPLY=( $( cd $1 && compgen -d -- "$cur" ) )
|
||||
}
|
||||
|
||||
# complete on $2 part of filenames matching pattern $1 under /usr/src
|
||||
_filename_parts()
|
||||
{
|
||||
COMPREPLY=( $( command ls -F /usr/src/ 2>/dev/null | grep -E '^'$1'/$' \
|
||||
| sed -r -e 's/^([^-]+)-(.+)\/$/\'$2'/' | grep "^$cur" ) )
|
||||
}
|
||||
|
||||
_dkms()
|
||||
{
|
||||
local cur prev command module i
|
||||
|
||||
COMPREPLY=()
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
|
||||
if [[ $COMP_CWORD -eq 1 ]] ; then
|
||||
COMPREPLY=( $( compgen -W "add autoinstall remove build unbuild install uninstall \
|
||||
match mktarball ldtarball \
|
||||
status" -- $cur ) )
|
||||
else
|
||||
|
||||
prev=${COMP_WORDS[COMP_CWORD-1]}
|
||||
command=${COMP_WORDS[1]}
|
||||
case $prev in
|
||||
-m)
|
||||
if [ "$command" = 'add' ]; then
|
||||
_filename_parts '.*-.*' 1
|
||||
else
|
||||
_subdirectories /var/lib/dkms
|
||||
fi
|
||||
return 0
|
||||
;;
|
||||
-v)
|
||||
for (( i=1; i < COMP_CWORD; i++ )); do
|
||||
if [[ "${COMP_WORDS[i]}" == -m ]]; then
|
||||
module=${COMP_WORDS[i+1]}
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "$module" ]; then
|
||||
if [ "$command" = 'add' ]; then
|
||||
_filename_parts "$module-.*" 2
|
||||
else
|
||||
_subdirectories /var/lib/dkms/$module
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
;;
|
||||
-k)
|
||||
_kernels
|
||||
return 0
|
||||
;;
|
||||
-@\(c|-spec|-archive|-config\))
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
--kernelsourcedir)
|
||||
_filedir -d
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
case $command in
|
||||
add)
|
||||
options='-c --rpm_safe_upgrade'
|
||||
;;
|
||||
remove)
|
||||
options='--rpm_safe_upgrade'
|
||||
;;
|
||||
build)
|
||||
options='--config --force'
|
||||
;;
|
||||
install)
|
||||
options='--force'
|
||||
;;
|
||||
ldtarball)
|
||||
options='--archive --force'
|
||||
;;
|
||||
mktarball)
|
||||
options='--source-only --binaries-only'
|
||||
;;
|
||||
match)
|
||||
options='--templatekernel'
|
||||
;;
|
||||
esac
|
||||
|
||||
options="$options -m -v -k -a --arch -q --quiet -V \
|
||||
--version --all --kernelsourcedir \
|
||||
--directive"
|
||||
|
||||
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
|
||||
fi
|
||||
fi
|
||||
}
|
||||
complete -F _dkms dkms
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Builds and install new kernel modules through DKMS
|
||||
Documentation=man:dkms(8)
|
||||
Before=network-pre.target graphical.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
RemainAfterExit=true
|
||||
ExecStart=/usr/sbin/dkms autoinstall --verbose --kernelver %v
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,101 @@
|
|||
#!/usr/bin/env python3
|
||||
#
|
||||
# Dynamic Kernel Module Support (DKMS) <dkms-devel@dell.com>
|
||||
# Copyright (C) 2009 Dell, Inc.
|
||||
# by Mario Limonciello
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import apport
|
||||
from apport.hookutils import *
|
||||
import sys
|
||||
import subprocess, optparse
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
optparser = optparse.OptionParser('%prog [options]')
|
||||
optparser.add_option('-m', help="Specify the DKMS module to find the package for",
|
||||
action='store', type='string', dest='module')
|
||||
optparser.add_option('-v', help="Specify the DKMS version to find the package for",
|
||||
action='store', type='string', dest='version')
|
||||
optparser.add_option('-k', help="Specify the kernel version",
|
||||
action='store', type='string', dest='kernel')
|
||||
options=optparser.parse_args()[0]
|
||||
|
||||
if not options.module or not options.version:
|
||||
sys.stderr.write('ERROR (dkms apport): both -m and -v are required\n')
|
||||
sys.exit(2)
|
||||
|
||||
package=packaging.get_file_package('/usr/src/' + options.module + '-' + options.version)
|
||||
if package is None:
|
||||
sys.stderr.write('ERROR (dkms apport): binary package for %s: %s not found\n' % (options.module,options.version))
|
||||
sys.exit(1)
|
||||
|
||||
if options.kernel:
|
||||
# TODO: Ubuntu specific
|
||||
kernel_package = "linux-headers-" + options.kernel
|
||||
|
||||
supported_kernel = True
|
||||
try:
|
||||
supported_kernel = apport.packaging.is_distro_package(kernel_package)
|
||||
except ValueError as e:
|
||||
if str(e) == 'package %s does not exist' % kernel_package:
|
||||
supported_kernel = False
|
||||
|
||||
if not supported_kernel:
|
||||
sys.stderr.write('ERROR (dkms apport): kernel package %s is not supported\n' % (kernel_package))
|
||||
sys.exit(1)
|
||||
|
||||
make_log=os.path.join('/var','lib','dkms',options.module,options.version,'build','make.log')
|
||||
|
||||
report = apport.Report('Package')
|
||||
try:
|
||||
version = packaging.get_version(package)
|
||||
except ValueError:
|
||||
version = '(not installed)'
|
||||
if version is None:
|
||||
version = '(not installed)'
|
||||
report['Package'] = '%s %s' % (package, version)
|
||||
try:
|
||||
report['SourcePackage'] = apport.packaging.get_source(package)
|
||||
except ValueError:
|
||||
sys.stderr.write('ERROR (dkms apport): unable to determine source package for %s\n' % package)
|
||||
sys.exit(3)
|
||||
|
||||
if report['SourcePackage'] == 'fglrx-installer':
|
||||
fglrx_make_log = os.path.join('/var','lib','dkms',options.module,options.version,'build','make.sh.log')
|
||||
attach_file_if_exists(report, fglrx_make_log, 'FglrxBuildLog')
|
||||
|
||||
report['PackageVersion'] = version
|
||||
report['Title'] = "%s %s: %s kernel module failed to build" % (package, version, options.module)
|
||||
attach_file_if_exists(report, make_log, 'DKMSBuildLog')
|
||||
if 'DKMSBuildLog' in report:
|
||||
this_year = str(datetime.today().year)
|
||||
if 'Segmentation fault' in report['DKMSBuildLog']:
|
||||
sys.stderr.write('ERROR (dkms apport): There was a segmentation fault when trying to build the module\n')
|
||||
sys.exit(1)
|
||||
for line in report['DKMSBuildLog'].split('\n'):
|
||||
if ': error:' in line:
|
||||
report['DuplicateSignature'] = 'dkms:%s:%s:%s' % (package, version, line.strip())
|
||||
break
|
||||
|
||||
if options.kernel:
|
||||
report['DKMSKernelVersion'] = options.kernel
|
||||
try:
|
||||
with apport.fileutils.make_report_file(report) as f:
|
||||
report.write(f)
|
||||
except (IOError, OSError) as e:
|
||||
apport.fatal('Cannot create report: ' + str(e))
|
|
@ -0,0 +1,65 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# dkms_autoinstaller - A service to automatically install DKMS modules for new kernels.
|
||||
#
|
||||
# chkconfig: 345 04 04
|
||||
# description: Compiles and install kernel modules automatically for new \
|
||||
# kernels at boot.
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: dkms_autoinstaller dkms
|
||||
# Default-Start: 3 4 5
|
||||
# Default-Stop: 0 1 2 6
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Short-Description: DKMS kernel modules installer service
|
||||
# Description: A service to automatically install DKMS modules for new kernels.
|
||||
### END INIT INFO
|
||||
|
||||
|
||||
if [ -f /lib/lsb/init-functions ]; then
|
||||
. /lib/lsb/init-functions
|
||||
elif [ -f /etc/rc.d/init.d/functions ]; then
|
||||
. /etc/rc.d/init.d/functions
|
||||
fi
|
||||
|
||||
# We only have these functions on debian/ubuntu
|
||||
# so on other distros just stub them out
|
||||
if [ ! -f /etc/debian_version ]; then
|
||||
alias log_daemon_msg=/bin/echo
|
||||
log_end_msg() { if [ "$1" = "0" ]; then echo " Done. "; else echo " Failed. "; fi; }
|
||||
alias log_action_begin_msg=log_daemon_msg
|
||||
alias log_action_end_msg=log_end_msg
|
||||
fi
|
||||
|
||||
exec="/usr/sbin/dkms"
|
||||
prog=${exec##*/}
|
||||
|
||||
test -f $exec || exit 0
|
||||
|
||||
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -n "$2" ]; then
|
||||
kernel="$2"
|
||||
else
|
||||
kernel=`uname -r`
|
||||
fi
|
||||
if [ -f /etc/dkms/no-autoinstall ]; then
|
||||
log_daemon_msg "$prog: autoinstall for dkms modules has been disabled"
|
||||
else
|
||||
log_daemon_msg "$prog: running auto installation service for kernel $kernel"
|
||||
dkms autoinstall --kernelver $kernel
|
||||
log_end_msg $?
|
||||
fi
|
||||
;;
|
||||
stop|restart|force-reload|status|reload)
|
||||
# There is no stop action, this and the 04 priority during stop is
|
||||
# added to make RHEL chkconfig happy.
|
||||
# Ignore others on debian/ubuntu too
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start}"
|
||||
exit 2
|
||||
esac
|
|
@ -0,0 +1,266 @@
|
|||
#!/bin/sh
|
||||
# Copyright (C) 2002-2005 Flavio Stanchina
|
||||
# Copyright (C) 2005-2006 Aric Cyr
|
||||
# Copyright (C) 2007 Mario Limonciello
|
||||
# Copyright (C) 2009 Alberto Milone
|
||||
|
||||
set -e
|
||||
|
||||
[ -f /usr/share/debconf/confmodule ] && . /usr/share/debconf/confmodule
|
||||
|
||||
uname_s=$(uname -s)
|
||||
|
||||
_get_kernel_dir() {
|
||||
KVER=$1
|
||||
case ${uname_s} in
|
||||
Linux) DIR="/lib/modules/$KVER/build" ;;
|
||||
GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;;
|
||||
esac
|
||||
echo $DIR
|
||||
}
|
||||
|
||||
_check_kernel_dir() {
|
||||
DIR=$(_get_kernel_dir $1)
|
||||
case ${uname_s} in
|
||||
Linux) test -e $DIR/include ;;
|
||||
GNU/kFreeBSD) test -e $DIR/kern && test -e $DIR/conf/kmod.mk ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
return $?
|
||||
}
|
||||
|
||||
# Check the existence of a kernel named as $1
|
||||
_is_kernel_name_correct() {
|
||||
if [ -e "/lib/modules/$1" ]; then
|
||||
echo yes
|
||||
else
|
||||
echo no
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# Get the most recent kernel on Debian based systems. This keeps
|
||||
# into account both the version and the ABI. If the current kernel
|
||||
# is the most recent kernel then the function will print a null string.
|
||||
_get_newest_kernel_debian() {
|
||||
NEWEST_KERNEL=
|
||||
NEWEST_VERSION=
|
||||
NEWEST_ABI=
|
||||
|
||||
for kernel in /boot/config-*; do
|
||||
[ -f "$kernel" ] || continue
|
||||
KERNEL=${kernel#*-}
|
||||
KERNEL_VERSION=${KERNEL%%-*}
|
||||
ABI=${KERNEL#*-}
|
||||
ABI=${ABI%%-*}
|
||||
|
||||
if [ -z "$NEWEST_KERNEL" ]; then
|
||||
# The 1st time get a version which is bigger than $1
|
||||
COMPARE_TO=$1
|
||||
else
|
||||
# Get the biggest version
|
||||
COMPARE_TO="$NEWEST_VERSION-$NEWEST_ABI"
|
||||
fi
|
||||
|
||||
# if $kernel is greater than $COMPARE_TO
|
||||
if [ `dpkg --compare-versions "$KERNEL_VERSION-$ABI" ge "$COMPARE_TO" && echo "yes" || \
|
||||
echo "no"` = "yes" ]; then
|
||||
NEWEST_KERNEL=$KERNEL
|
||||
NEWEST_VERSION=$KERNEL_VERSION
|
||||
NEWEST_ABI=$ABI
|
||||
fi
|
||||
done
|
||||
|
||||
echo "$NEWEST_KERNEL"
|
||||
}
|
||||
|
||||
# Get the most recent kernel in Rhel based systems.
|
||||
_get_newest_kernel_rhel() {
|
||||
rpm -q --qf="%{VERSION}-%{RELEASE}.%{ARCH}\n" --whatprovides kernel | tail -n 1
|
||||
}
|
||||
|
||||
# Get the newest kernel on Debian and Rhel based systems.
|
||||
get_newest_kernel() {
|
||||
NEWEST_KERNEL=
|
||||
# Try Debian first as rpm can be installed in Debian based distros
|
||||
if [ -e /usr/bin/dpkg ]; then
|
||||
# If DEB based
|
||||
CURRENT_VERSION=${CURRENT_KERNEL%%-*}
|
||||
CURRENT_ABI=${CURRENT_KERNEL#*-}
|
||||
CURRENT_FLAVOUR=${CURRENT_ABI#*-}
|
||||
CURRENT_ABI=${CURRENT_ABI%%-*}
|
||||
NEWEST_KERNEL=$(_get_newest_kernel_debian "$CURRENT_VERSION-$CURRENT_ABI")
|
||||
|
||||
elif [ `which rpm >/dev/null` ]; then
|
||||
# If RPM based
|
||||
NEWEST_KERNEL=$(_get_newest_kernel_rhel)
|
||||
fi
|
||||
|
||||
# Make sure that kernel name that we extracted corresponds to an installed
|
||||
# kernel
|
||||
if [ -n "$NEWEST_KERNEL" ] && [ `_is_kernel_name_correct $NEWEST_KERNEL` = "no" ]; then
|
||||
NEWEST_KERNEL=
|
||||
fi
|
||||
|
||||
echo $NEWEST_KERNEL
|
||||
}
|
||||
|
||||
NAME=$1
|
||||
VERSION=$2
|
||||
TARBALL_ROOT=$3
|
||||
ARCH=$4
|
||||
UPGRADE=$5
|
||||
|
||||
if [ -z "$NAME" ] || [ -z "$VERSION" ]; then
|
||||
echo "Need NAME, and VERSION defined"
|
||||
echo "ARCH is optional"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f /etc/dkms/no-autoinstall ]; then
|
||||
echo "autoinstall for dkms modules has been disabled."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# read framework configuration options
|
||||
if [ -r /etc/dkms/framework.conf ]; then
|
||||
. /etc/dkms/framework.conf
|
||||
fi
|
||||
|
||||
KERNELS=$(ls /lib/modules/ 2>/dev/null || true)
|
||||
CURRENT_KERNEL=$(uname -r)
|
||||
|
||||
#We never want to keep an older version side by side to prevent conflicts
|
||||
if [ -e "/var/lib/dkms/$NAME/$VERSION" ]; then
|
||||
echo "Removing old $NAME-$VERSION DKMS files..."
|
||||
dkms remove -m $NAME -v $VERSION --all
|
||||
fi
|
||||
|
||||
#Load new files, by source package and by tarball
|
||||
if [ -f "$TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz" ]; then
|
||||
if ! dkms ldtarball --archive "$TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz"; then
|
||||
echo ""
|
||||
echo ""
|
||||
echo "Unable to load DKMS tarball $TARBALL_ROOT/$NAME-$VERSION.dkms.tar.gz."
|
||||
echo "Common causes include: "
|
||||
echo " - You must be using DKMS 2.1.0.0 or later to support binaries only"
|
||||
echo " distribution specific archives."
|
||||
echo " - Corrupt distribution specific archive"
|
||||
echo ""
|
||||
echo ""
|
||||
exit 2
|
||||
fi
|
||||
elif [ -d "/usr/src/$NAME-$VERSION" ]; then
|
||||
echo "Loading new $NAME-$VERSION DKMS files..."
|
||||
dkms add -m $NAME -v $VERSION > /dev/null
|
||||
fi
|
||||
|
||||
# On 1st installation, let us look for a directory
|
||||
# in /lib/modules which matches `uname -r`. If none
|
||||
# is found it is possible that buildd is being used
|
||||
# and that uname -r is giving us the name of the
|
||||
# kernel used by the buildd machine.
|
||||
#
|
||||
# If this is the case we try to build the kernel
|
||||
# module for each kernel which has a directory in
|
||||
# /lib/modules. Furthermore we will have to tell
|
||||
# DKMS which architecture it should build the module
|
||||
# for (e.g. if the buildd machine is using a
|
||||
# 2.6.24-23-xen 64bit kernel).
|
||||
#
|
||||
# NOTE: if the headers are not installed then the
|
||||
# module won't be built, as usual
|
||||
|
||||
# Here we look for the most recent kernel so that we can
|
||||
# build the module for it (in addition to doing it for the
|
||||
# current kernel.
|
||||
NEWEST_KERNEL=$(get_newest_kernel)
|
||||
|
||||
if [ -z "$autoinstall_all_kernels" ]; then
|
||||
# If the current kernel is installed on the system or chroot
|
||||
if [ `_is_kernel_name_correct $CURRENT_KERNEL` = "yes" ]; then
|
||||
if [ -n "$NEWEST_KERNEL" ] && [ ${CURRENT_KERNEL} != ${NEWEST_KERNEL} ]; then
|
||||
KERNELS="$CURRENT_KERNEL $NEWEST_KERNEL"
|
||||
else
|
||||
KERNELS=$CURRENT_KERNEL
|
||||
fi
|
||||
# The current kernel is not useful as it's not installed
|
||||
else
|
||||
echo "It is likely that $CURRENT_KERNEL belongs to a chroot's host"
|
||||
|
||||
# Let's use only the newest kernel if this is not a first installation
|
||||
# otherwise build for all kernels
|
||||
if [ -n "$NEWEST_KERNEL" -a -n "$UPGRADE" ]; then
|
||||
KERNELS="$NEWEST_KERNEL"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Take care of displaying newline separated list
|
||||
echo "Building for $KERNELS" | tr '\n' ',' \
|
||||
| sed -e 's/,/, /g; s/, $/\n/; s/, \([^,]\+\)$/ and \1/'
|
||||
|
||||
if [ -n "$ARCH" ]; then
|
||||
if which lsb_release >/dev/null && [ $(lsb_release -s -i) = "Ubuntu" ]; then
|
||||
case $ARCH in
|
||||
amd64)
|
||||
ARCH="x86_64"
|
||||
;;
|
||||
lpia|i?86)
|
||||
ARCH="i686"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
echo "Building for architecture $ARCH"
|
||||
ARCH="-a $ARCH"
|
||||
fi
|
||||
|
||||
for KERNEL in $KERNELS; do
|
||||
dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH`
|
||||
if [ `echo $KERNEL | grep -c "BOOT"` -gt 0 ]; then
|
||||
echo ""
|
||||
echo "Module build and install for $KERNEL was skipped as "
|
||||
echo "it is a BOOT variant"
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
#if the module isn't yet built, try to build it
|
||||
if [ `echo $dkms_status | grep -c ": built"` -eq 0 ]; then
|
||||
if [ ! -L /var/lib/dkms/$NAME/$VERSION/source ]; then
|
||||
echo "This package appears to be a binaries-only package"
|
||||
echo " you will not be able to build against kernel $KERNEL"
|
||||
echo " since the package source was not provided"
|
||||
continue
|
||||
fi
|
||||
if _check_kernel_dir $KERNEL; then
|
||||
echo "Building initial module for $KERNEL"
|
||||
set +e
|
||||
dkms build -m $NAME -v $VERSION -k $KERNEL $ARCH > /dev/null
|
||||
case $? in
|
||||
9)
|
||||
set -e
|
||||
echo "Skipped."
|
||||
continue
|
||||
;;
|
||||
0)
|
||||
set -e
|
||||
echo "Done."
|
||||
;;
|
||||
*)
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
dkms_status=`dkms status -m $NAME -v $VERSION -k $KERNEL $ARCH`
|
||||
else
|
||||
echo "Module build for kernel $KERNEL was skipped since the"
|
||||
echo "kernel headers for this kernel does not seem to be installed."
|
||||
fi
|
||||
fi
|
||||
|
||||
#if the module is built (either pre-built or just now), install it
|
||||
if [ `echo $dkms_status | grep -c ": built"` -eq 1 ] &&
|
||||
[ `echo $dkms_status | grep -c ": installed"` -eq 0 ]; then
|
||||
dkms install -m $NAME -v $VERSION -k $KERNEL $ARCH
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,93 @@
|
|||
#! /bin/sh
|
||||
|
||||
# heavily based upon find-suggests.ksyms by Andreas Gruenbacher <agruen@suse.de>.
|
||||
# with modifications by Michael Brown <Michael_E_Brown@dell.com>
|
||||
#
|
||||
# -- added module versioning info to modalias() symbols
|
||||
# -- removed code which inspects spec files.
|
||||
|
||||
IFS=$'\n'
|
||||
|
||||
print_modaliases() {
|
||||
declare class=$1 variants=$2 pos=$3
|
||||
if [ -n "$variants" ]; then
|
||||
echo "${class:0:pos}[$variants]${class:pos+1}"
|
||||
else
|
||||
[ -z "$class" ] || echo "$class"
|
||||
fi
|
||||
}
|
||||
|
||||
combine_modaliases() {
|
||||
declare tag class variants pos n
|
||||
read class
|
||||
while read tag; do
|
||||
for ((n=0; n<${#class}; n++)); do
|
||||
if [ "*" != "${class:n:1}" -a \
|
||||
"${class:0:n}" = "${tag:0:n}" -a \
|
||||
"${class:n+1}" = "${tag:n+1}" ] &&
|
||||
( [ -z "$pos" ] || [ $n = $pos ] ); then
|
||||
variants="${variants:-${class:n:1}}${tag:n:1}"
|
||||
pos=$n
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ $n -eq ${#class} ]; then
|
||||
print_modaliases "$class" "$variants" "$pos"
|
||||
variants=
|
||||
pos=
|
||||
class=$tag
|
||||
fi
|
||||
done
|
||||
print_modaliases "$class" "$variants" "$pos"
|
||||
}
|
||||
|
||||
get_modinfo() {
|
||||
module=$1
|
||||
|
||||
# | head -n1 because some modules have *two* version tags. *cough*b44*cough*
|
||||
modver=$(/sbin/modinfo -F version "$module"| head -n1)
|
||||
modver=${modver// /_}
|
||||
|
||||
# only add version tag if it has a version
|
||||
if [ -n "$modver" ]; then
|
||||
/sbin/modinfo -F alias "$module" \
|
||||
| sed -nre "s,(.+),modalias(\\1) = $modver,p"
|
||||
else
|
||||
/sbin/modinfo -F alias "$module" \
|
||||
| sed -nre "s,(.+),modalias(\\1),p"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
tmp=${TMPDIR:-/tmp}
|
||||
TMPDIR=$(mktemp -d ${tmp}/dkms-findprovides-$$-$RANDOM-XXXXXX)
|
||||
trap "rm -rf $TMPDIR >/dev/null 2>&1" QUIT EXIT HUP INT TERM
|
||||
|
||||
modlist=
|
||||
for cand in $(grep -E '(/lib/modules/.+\.ko$|tgz$|tbz$|tar\.(gz|bz2|xz)$)') $*; do
|
||||
if echo $cand | grep -q -E '/lib/modules/.+\.ko$' > /dev/null 2>&1; then
|
||||
modlist="$modlist $cand"
|
||||
fi
|
||||
|
||||
[ -f $cand ] || continue
|
||||
|
||||
opts=x
|
||||
if gzip -t $cand >/dev/null 2>&1; then
|
||||
opts=${opts}z
|
||||
elif bzip2 -t $cand >/dev/null 2>&1; then
|
||||
opts=${opts}j
|
||||
elif xz -t $cand >/dev/null 2>&1; then
|
||||
opts=${opts}J
|
||||
fi
|
||||
tar ${opts}f $cand -C $TMPDIR > /dev/null 2>&1
|
||||
done
|
||||
|
||||
for module in $(find $TMPDIR -name \*.ko) $modlist; do
|
||||
if echo $module | grep -q -E '.ko$' >/dev/null 2>&1; then
|
||||
# it is a straight module
|
||||
get_modinfo $module
|
||||
continue
|
||||
fi
|
||||
done \
|
||||
| sort -u \
|
||||
| combine_modaliases
|
|
@ -0,0 +1,36 @@
|
|||
# This configuration file modifies the behavior of DKMS (Dynamic Kernel Module
|
||||
# Support) and is sourced in by DKMS every time it is run.
|
||||
|
||||
# Source Tree Location (default: /usr/src):
|
||||
# source_tree="/usr/src"
|
||||
|
||||
# DKMS Tree Location (default: /var/lib/dkms):
|
||||
# dkms_tree="/var/lib/dkms"
|
||||
|
||||
# Install Tree Location (default: /lib/modules):
|
||||
# install_tree="/lib/modules"
|
||||
|
||||
# Temporary folder Location (default: /tmp):
|
||||
# tmp_location="/tmp"
|
||||
|
||||
# Verbosity setting, will be active if set to a non-null value:
|
||||
# verbose=""
|
||||
|
||||
# This creates symlinks from the install_tree into the dkms_tree instead of
|
||||
# copying the modules. This preserves some space on the costs of being less
|
||||
# safe. Symlinking will be active if set to a non-null value:
|
||||
# symlink_modules=""
|
||||
|
||||
# Automatic installation and upgrade for all installed kernels if set to a
|
||||
# non-null value:
|
||||
# autoinstall_all_kernels=""
|
||||
|
||||
# Location of the sign-file kernel binary (default: depends on distribution):
|
||||
# sign_file="/path/to/sign-file"
|
||||
|
||||
# Location of the key and certificate used for Secure boot (default: /var/lib/dkms):
|
||||
# mok_signing_key=/var/lib/dkms/mok.key
|
||||
# mok_certificate=/var/lib/dkms/mok.pub
|
||||
|
||||
# Automatically modprobe the built modules upon succesful installation:
|
||||
# modprobe_on_install="true"
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$1" = "add" ]; then
|
||||
/etc/kernel/postinst.d/dkms "$2"
|
||||
fi
|
||||
|
||||
if [ "$1" = "remove" ]; then
|
||||
/etc/kernel/prerm.d/dkms "$2"
|
||||
fi
|
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
|
||||
# We're passed the version of the kernel being installed
|
||||
inst_kern=$1
|
||||
|
||||
uname_s=$(uname -s)
|
||||
|
||||
_get_kernel_dir() {
|
||||
KVER=$1
|
||||
case ${uname_s} in
|
||||
Linux) DIR="/lib/modules/$KVER/build" ;;
|
||||
GNU/kFreeBSD) DIR="/usr/src/kfreebsd-headers-$KVER/sys" ;;
|
||||
esac
|
||||
echo "$DIR"
|
||||
}
|
||||
|
||||
_check_kernel_dir() {
|
||||
DIR=$(_get_kernel_dir "$1")
|
||||
case ${uname_s} in
|
||||
Linux) test -e "$DIR/include" ;;
|
||||
GNU/kFreeBSD) test -e "$DIR/kern" && test -e "$DIR/conf/kmod.mk" ;;
|
||||
*) false ;;
|
||||
esac
|
||||
}
|
||||
|
||||
case "${uname_s}" in
|
||||
Linux)
|
||||
header_pkg="linux-headers-$inst_kern"
|
||||
kernel="Linux"
|
||||
;;
|
||||
GNU/kFreeBSD)
|
||||
header_pkg="kfreebsd-headers-$inst_kern"
|
||||
kernel="kFreeBSD"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -x /usr/lib/dkms/dkms_autoinstaller ]; then
|
||||
exec /usr/lib/dkms/dkms_autoinstaller start "$inst_kern"
|
||||
fi
|
||||
|
||||
if ! _check_kernel_dir "$inst_kern" ; then
|
||||
echo "dkms: WARNING: $kernel headers are missing, which may explain the above failures." >&2
|
||||
echo " please install the $header_pkg package to fix this." >&2
|
||||
fi
|
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
# We're passed the version of the kernel being removed
|
||||
inst_kern=$1
|
||||
|
||||
if command -v dkms > /dev/null; then
|
||||
dkms status -k "$inst_kern" 2>/dev/null | while IFS=",:/ " read -r name vers _ arch status; do
|
||||
[ "$status" = "installed" ] || continue
|
||||
echo "dkms: removing: $name $vers ($inst_kern) ($arch)" >&2
|
||||
dkms remove -m "$name" -v "$vers" -k "$inst_kern" -a "$arch"
|
||||
done
|
||||
fi
|
||||
|
||||
rmdir --ignore-fail-on-non-empty \
|
||||
"/lib/modules/$inst_kern/updates/dkms" \
|
||||
"/lib/modules/$inst_kern/updates" 2>/dev/null
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,415 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# lsb_release - collect LSB conformance status about a system
|
||||
#
|
||||
# Copyright (C) 2000, 2002, 2004 Free Standards Group, Inc.
|
||||
# Originally by Dominique MASSONIE <mdomi@users.sourceforge.net>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# * Changes in 2.0
|
||||
# - Support LSB 2.0 module layout (Mats Wichmann)
|
||||
# The LSB_VERSION is now a colon-separated field of supported module versions
|
||||
# An /etc/lsb-release.d is searched for modules beyond the core.
|
||||
# Only the filenames in this directory is looked at, those names are added
|
||||
# to LSB_VERSION. This allows module support to be handled easily by
|
||||
# package install/removal without a need to edit lsb-release on the fly.
|
||||
# - Correct license: FSG == Free Standards Group, Inc.
|
||||
#
|
||||
# * Changes in 1.4
|
||||
# - "awk" not needed anymore (Loic Lefort)
|
||||
# - fixed bug #121879 reported by Chris D. Faulhaber,
|
||||
# some shells doesn't support local variables
|
||||
# - fixed a bug when single parameter sets many args including -s
|
||||
# - function DisplayProgramVersion (undocumented) now exits script like Usage
|
||||
# - cosmetic changes in comments/outputs
|
||||
#
|
||||
# * Changes in 1.3
|
||||
# - No changes in script, only in build infrastructure
|
||||
#
|
||||
# * Changes in 1.2
|
||||
# - Fixed more bash'isms
|
||||
# - LSB_VERSION is no longer required in /etc/lsb-release file
|
||||
#
|
||||
# * Changes in 1.1
|
||||
# - removed some bash-ism and typos
|
||||
# Notice: script remains broken with ash because of awk issues
|
||||
# - changed licence to FSG - "Free Software Group, Inc"
|
||||
# - fixed problem with --short single arg call
|
||||
# - changed Debian specifics, codename anticipates release num
|
||||
#
|
||||
# Description:
|
||||
# Collect information from sourceable /etc/lsb-release file (present on
|
||||
# LSB-compliant systems) : LSB_VERSION, DISTRIB_ID, DISTRIB_RELEASE,
|
||||
# DISTRIB_CODENAME, DISTRIB_DESCRIPTION (all optional)
|
||||
# Then (if needed) find and add names from /etc/lsb-release.d
|
||||
# Then (if needed) find and parse the /etc/[distro]-release file
|
||||
|
||||
|
||||
###############################################################################
|
||||
# DECLARATIONS
|
||||
###############################################################################
|
||||
|
||||
# This script version
|
||||
SCRIPTVERSION="2.0"
|
||||
|
||||
# Defines the data files
|
||||
INFO_ROOT="/etc" # directory of config files
|
||||
INFO_LSB_FILE="lsb-release" # where to get LSB version
|
||||
INFO_LSB_DIR="lsb-release.d" # where to get LSB addon modules
|
||||
INFO_DISTRIB_SUFFIX="release" # <distrib>-<suffix>
|
||||
ALTERNATE_DISTRIB_FILE="/etc/debian_version" # for Debian [based distrib]
|
||||
ALTERNATE_DISTRIB_NAME="Debian" # "
|
||||
CHECKFIRST="/etc/redhat-release" # check it before file search
|
||||
|
||||
# Defines our exit codes
|
||||
EXIT_STATUS="0" # default = Ok :)
|
||||
ERROR_UNKNOWN="10" # unknown error
|
||||
ERROR_USER="1" # program misuse
|
||||
ERROR_PROGRAM="2" # internal error
|
||||
ERROR_NOANSWER="3" # all required info not available
|
||||
# typically non LSB compliant distro!
|
||||
|
||||
# Defines our messages
|
||||
MSG_LSBVER="LSB Version:\t"
|
||||
MSG_DISTID="Distributor ID:\t"
|
||||
MSG_DISTDESC="Description:\t"
|
||||
MSG_DISTREL="Release:\t"
|
||||
MSG_DISTCODE="Codename:\t"
|
||||
MSG_NA="n/a"
|
||||
MSG_NONE="(none)"
|
||||
MSG_RESULT="" # contains the result in case short output selected
|
||||
|
||||
# Description string delimiter
|
||||
DESCSTR_DELI="release"
|
||||
|
||||
|
||||
###############################################################################
|
||||
# FUNCTIONS
|
||||
###############################################################################
|
||||
|
||||
# Display Program Version for internal use (needed by help2man)
|
||||
DisplayProgramVersion() {
|
||||
echo "FSG `basename $0` v$SCRIPTVERSION"
|
||||
echo
|
||||
echo "Copyright (C) 2000, 2002, 2004 Free Standards Group, Inc."
|
||||
echo "This is free software; see the source for copying conditions. There\
|
||||
is NO"
|
||||
echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR\
|
||||
PURPOSE."
|
||||
echo
|
||||
echo "Originally written by Dominique MASSONIE."
|
||||
|
||||
exit $EXIT_STATUS
|
||||
}
|
||||
|
||||
# defines the Usage for lsb_release
|
||||
Usage() {
|
||||
echo "FSG `basename $0` v$SCRIPTVERSION prints certain LSB (Linux\
|
||||
Standard Base) and"
|
||||
echo "Distribution information."
|
||||
echo
|
||||
echo "Usage: `basename $0` [OPTION]..."
|
||||
echo "With no OPTION specified defaults to -v."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -v, --version"
|
||||
echo " Display the version of the LSB specification against which the distribution is compliant."
|
||||
echo " -i, --id"
|
||||
echo " Display the string id of the distributor."
|
||||
echo " -d, --description"
|
||||
echo " Display the single line text description of the distribution."
|
||||
echo " -r, --release"
|
||||
echo " Display the release number of the distribution."
|
||||
echo " -c, --codename"
|
||||
echo " Display the codename according to the distribution release."
|
||||
echo " -a, --all"
|
||||
echo " Display all of the above information."
|
||||
echo " -s, --short"
|
||||
echo " Use short output format for information requested by other options (or version if none)."
|
||||
echo " -h, --help"
|
||||
echo " Display this message."
|
||||
|
||||
exit $EXIT_STATUS
|
||||
}
|
||||
|
||||
# Handles the enhanced args (i.e. --something)
|
||||
EnhancedGetopt() {
|
||||
getopt -T >/dev/null 2>&1 # is getopt the enhanced one ?
|
||||
if [ $? = 4 ]
|
||||
then # Yes, advanced args ALLOWED
|
||||
OPT=$(getopt -o acdhirsvp \
|
||||
--long all,codename,description,help,id,release,short,version,program_version \
|
||||
-n 'lsb_release' \
|
||||
-- "$@")
|
||||
else # No, advanced args NOT allowed
|
||||
# convert (if needed) the enhanced options into basic ones
|
||||
MYARGS=$(echo "$@" | sed -e "/--/s/-\(-[[:alnum:]]\)[[:alnum:]]*/\1/g")
|
||||
OPT=$(getopt -o acdhirsvp \
|
||||
-n 'lsb_release' \
|
||||
-- "$MYARGS")
|
||||
fi
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
exit $ERROR_PROGRAM
|
||||
fi
|
||||
|
||||
NB_ARG="" # enabled if many args set in one parameter (i.e. -dris)
|
||||
eval set -- "$OPT"
|
||||
while true ; do
|
||||
case "$1" in
|
||||
-a|--all) ARG_A="y"; NB_ARG="y"; shift;;
|
||||
-c|--codename) ARG_C="y"; NB_ARG="y"; shift;;
|
||||
-d|--description) ARG_D="y"; NB_ARG="y"; shift;;
|
||||
-i|--id) ARG_I="y"; NB_ARG="y"; shift;;
|
||||
-r|--release) ARG_R="y"; NB_ARG="y"; shift;;
|
||||
-s|--short) ARG_S="y"; shift;;
|
||||
-v|--version) ARG_V="y"; NB_ARG="y"; shift;;
|
||||
-p|--program_version) DisplayProgramVersion;;
|
||||
-h|--help) Usage;;
|
||||
--) shift; break;;
|
||||
*) EXIT_STATUS=$ERROR_USER
|
||||
Usage;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Get/Init LSB infos (maybe Distrib infos too)
|
||||
GetLSBInfo() {
|
||||
# if we found LSB_VERSION, continue to look in directory
|
||||
if [ -d "$INFO_ROOT/$INFO_LSB_DIR" ]
|
||||
then
|
||||
for tag in "$INFO_ROOT/$INFO_LSB_DIR/"*
|
||||
do
|
||||
LSB_VERSION=$LSB_VERSION:`basename $tag`
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Get the whole distrib information string (from ARG $1 file)
|
||||
InitDistribInfo() {
|
||||
## Notice: Debian has a debian_version file
|
||||
## (at least) Mandrake has two files, a mandrake and a redhat one
|
||||
FILENAME=$1 # CHECKFIRST or finds' result in GetDistribInfo() or ""
|
||||
|
||||
if [ -z "$FILENAME" ]
|
||||
then
|
||||
if [ -f "$ALTERNATE_DISTRIB_FILE" ]
|
||||
then # For Debian only
|
||||
[ -z "$DISTRIB_ID" ] && DISTRIB_ID="$ALTERNATE_DISTRIB_NAME"
|
||||
[ -z "$DISTRIB_RELEASE" ] \
|
||||
&& DISTRIB_RELEASE=$(cat $ALTERNATE_DISTRIB_FILE)
|
||||
[ -z "$DISTRIB_CODENAME" ] && [ "$DISTRIB_RELEASE" = "2.1" ] \
|
||||
&& DISTRIB_CODENAME="Slink"
|
||||
[ -z "$DISTRIB_CODENAME" ] && [ "$DISTRIB_RELEASE" = "2.2" ] \
|
||||
&& DISTRIB_CODENAME="Potato"
|
||||
# [ -z "$DISTRIB_CODENAME" ] && [ "$DISTRIB_RELEASE" = "2.3" ] \
|
||||
# && DISTRIB_CODENAME="Woody"
|
||||
[ -z "$DISTRIB_CODENAME" ] && DISTRIB_CODENAME=$DISTRIB_RELEASE
|
||||
# build the DISTRIB_DESCRIPTION string (never need to be parsed)
|
||||
[ -z "$DISTRIB_DESCRIPTION" ] \
|
||||
&& DISTRIB_DESCRIPTION="$DISTRIB_ID $DESCSTR_DELI $DISTRIB_REL\
|
||||
EASE ($DISTRIB_CODENAME)"
|
||||
else # Only for nothing known compliant distrib :(
|
||||
[ -z "$DISTRIB_ID" ] && DISTRIB_ID=$MSG_NA
|
||||
[ -z "$DISTRIB_RELEASE" ] && DISTRIB_RELEASE=$MSG_NA
|
||||
[ -z "$DISTRIB_CODENAME" ] && DISTRIB_CODENAME=$MSG_NA
|
||||
[ -z "$DISTRIB_DESCRIPTION" ] && DISTRIB_DESCRIPTION=$MSG_NONE
|
||||
|
||||
EXIT_STATUS=$ERROR_NOANSWER
|
||||
fi
|
||||
else
|
||||
NO="" # is Description string syntax correct ?
|
||||
if [ -z "$DISTRIB_DESCRIPTION" ] \
|
||||
|| [ -n "$(echo $DISTRIB_DESCRIPTION | \
|
||||
sed -e "s/.*$DESCSTR_DELI.*//")" ]
|
||||
then
|
||||
TMP_DISTRIB_DESC=$(head -n 1 $FILENAME 2>/dev/null)
|
||||
[ -z "$DISTRIB_DESCRIPTION" ] \
|
||||
&& DISTRIB_DESCRIPTION=$TMP_DISTRIB_DESC
|
||||
else
|
||||
TMP_DISTRIB_DESC=$DISTRIB_DESCRIPTION
|
||||
fi
|
||||
|
||||
if [ -z "$TMP_DISTRIB_DESC" ] # head or lsb-release init
|
||||
then # file contains no data
|
||||
DISTRIB_DESCRIPTION=$MSG_NONE
|
||||
NO="y"
|
||||
else # Do simple check
|
||||
[ -n "$(echo $TMP_DISTRIB_DESC | \
|
||||
sed -e "s/.*$DESCSTR_DELI.*//")" ] \
|
||||
&& NO="y"
|
||||
fi
|
||||
|
||||
if [ -n "$NO" ]
|
||||
then # does not contain "release" delimiter
|
||||
[ -z "$DISTRIB_ID" ] && DISTRIB_ID=$MSG_NA
|
||||
[ -z "$DISTRIB_RELEASE" ] && DISTRIB_RELEASE=$MSG_NA
|
||||
[ -z "$DISTRIB_CODENAME" ] && DISTRIB_CODENAME=$MSG_NA
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Check missing and requested infos, then find the file and get infos
|
||||
GetDistribInfo() {
|
||||
NO="" # /etc/lsb-release data are enough to reply what is requested?
|
||||
[ -n "$ARG_D" ] && [ -z "$DISTRIB_DESCRIPTION" ] && NO="y"
|
||||
[ -z "$NO" ] && [ -n "$ARG_I" ] && [ -z "$DISTRIB_ID" ] && NO="y"
|
||||
[ -z "$NO" ] && [ -n "$ARG_R" ] && [ -z "$DISTRIB_RELEASE" ] && NO="y"
|
||||
[ -z "$NO" ] && [ -n "$ARG_C" ] && [ -z "$DISTRIB_CODENAME" ] && NO="y"
|
||||
|
||||
if [ -n "$NO" ]
|
||||
then
|
||||
if [ ! -f "$CHECKFIRST" ]
|
||||
then
|
||||
CHECKFIRST=$(find $INFO_ROOT/ -maxdepth 1 \
|
||||
-name \*$INFO_DISTRIB_SUFFIX \
|
||||
-and ! -name $INFO_LSB_FILE \
|
||||
-and -type f \
|
||||
2>/dev/null \
|
||||
| head -n 1 ) # keep one of the files found (if many)
|
||||
fi
|
||||
InitDistribInfo $CHECKFIRST
|
||||
fi
|
||||
}
|
||||
|
||||
# Display version of LSB against which distribution is compliant
|
||||
DisplayVersion() {
|
||||
if [ -z "$ARG_S" ]
|
||||
then
|
||||
echo -e "$MSG_LSBVER$LSB_VERSION" # at least "n/a"
|
||||
else
|
||||
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$LSB_VERSION"
|
||||
fi
|
||||
}
|
||||
|
||||
# Display string id of distributor ( i.e. a single word! )
|
||||
DisplayID() {
|
||||
if [ -z "$DISTRIB_ID" ]
|
||||
then
|
||||
## Linux could be part of the distro name (i.e. Turbolinux) or a separate word
|
||||
## set before, after...
|
||||
## also expect a delimiter ( i.e. "release" )
|
||||
if [ -n "$(echo $TMP_DISTRIB_DESC | sed "s/.*$DESCSTR_DELI.*//")" ]
|
||||
then
|
||||
DISTRIB_ID=$MSG_NA
|
||||
else
|
||||
DISTRIB_ID=$(echo " $TMP_DISTRIB_DESC" \
|
||||
| sed -e "s/[[:blank:]][Ll][Ii][Nn][Uu][Xx][[:blank:]]/ /g" \
|
||||
-e "s/\(.*\)[[:blank:]]$DESCSTR_DELI.*/\1/" -e "s/[[:blank:]]//g")
|
||||
fi
|
||||
fi
|
||||
if [ -z "$ARG_S" ]
|
||||
then
|
||||
echo -e "$MSG_DISTID$DISTRIB_ID"
|
||||
else
|
||||
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$DISTRIB_ID"
|
||||
fi
|
||||
}
|
||||
|
||||
# Diplay single line text description of distribution
|
||||
DisplayDescription() {
|
||||
if [ -z "$DISTRIB_DESCRIPTION" ]
|
||||
then
|
||||
# should not be empty since GetDistribInfo called on Initialization !
|
||||
EXIT_STATUS=$ERROR_PROGRAM
|
||||
fi
|
||||
if [ -z "$ARG_S" ]
|
||||
then
|
||||
echo -e "$MSG_DISTDESC$DISTRIB_DESCRIPTION"
|
||||
else
|
||||
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }\"$DISTRIB_DESCRIPTION\""
|
||||
fi
|
||||
}
|
||||
|
||||
# Display release number of distribution.
|
||||
DisplayRelease() {
|
||||
if [ -z "$DISTRIB_RELEASE" ]
|
||||
then # parse the "$DISTRIB_DESCRIPTION" string
|
||||
DISTRIB_RELEASE=$(echo "$TMP_DISTRIB_DESC" | \
|
||||
sed -e "s/.*$DESCSTR_DELI[[:blank:]]*\([[:digit:]][[:graph:]]*\).*/\1/" )
|
||||
[ "$DISTRIB_RELEASE" = "$TMP_DISTRIB_DESC" ] \
|
||||
|| [ -z "$DISTRIB_RELEASE" ] \
|
||||
&& DISTRIB_RELEASE=$MSG_NA
|
||||
fi
|
||||
if [ -z "$ARG_S" ]
|
||||
then
|
||||
echo -e "$MSG_DISTREL$DISTRIB_RELEASE"
|
||||
else
|
||||
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$DISTRIB_RELEASE"
|
||||
fi
|
||||
}
|
||||
|
||||
# Display codename according to distribution version.
|
||||
DisplayCodename() {
|
||||
if [ -z "$DISTRIB_CODENAME" ]
|
||||
then # parse the "$DISTRIB_DESCRIPTION" string
|
||||
DISTRIB_CODENAME=$(echo "$TMP_DISTRIB_DESC" | \
|
||||
sed -e "s/.*$DESCSTR_DELI.*(\(.*\)).*/\1/")
|
||||
[ "$DISTRIB_CODENAME" = "$TMP_DISTRIB_DESC" ] \
|
||||
|| [ -z "$DISTRIB_CODENAME" ] \
|
||||
&& DISTRIB_CODENAME=$MSG_NA
|
||||
fi
|
||||
if [ -z "$ARG_S" ]
|
||||
then
|
||||
echo -e "$MSG_DISTCODE$(echo "$DISTRIB_CODENAME" | \
|
||||
tr -d "[:blank:]")" # Remove blanks
|
||||
else
|
||||
MSG_RESULT="$MSG_RESULT${MSG_RESULT:+ }$(echo "$DISTRIB_CODENAME" | \
|
||||
tr -d "[:blank:]")"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
###############################################################################
|
||||
# MAIN
|
||||
###############################################################################
|
||||
|
||||
# Check if any prog argument
|
||||
if [ -z "$1" ]
|
||||
then
|
||||
ARG_V="y" # default set to Display LSB Version (not Usage)
|
||||
else
|
||||
EnhancedGetopt "$@" # Parse program args
|
||||
if [ -n "$ARG_S" ] && [ -z "$NB_ARG" ]
|
||||
then
|
||||
ARG_V="y" # set also default for --short when single arg
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update args to All if requested
|
||||
if [ -n "$ARG_A" ]
|
||||
then
|
||||
[ -z "$ARG_C" ] && ARG_C="y"
|
||||
[ -z "$ARG_D" ] && ARG_D="y"
|
||||
[ -z "$ARG_I" ] && ARG_I="y"
|
||||
[ -z "$ARG_R" ] && ARG_R="y"
|
||||
[ -z "$ARG_V" ] && ARG_V="y"
|
||||
fi
|
||||
|
||||
# Initialization
|
||||
GetLSBInfo
|
||||
GetDistribInfo
|
||||
|
||||
# Display requested infos (order as follow)
|
||||
[ -n "$ARG_V" ] && DisplayVersion
|
||||
[ -n "$ARG_I" ] && DisplayID
|
||||
[ -n "$ARG_D" ] && DisplayDescription
|
||||
[ -n "$ARG_R" ] && DisplayRelease
|
||||
[ -n "$ARG_C" ] && DisplayCodename
|
||||
|
||||
[ -n "$ARG_S" ] && echo "$MSG_RESULT"
|
||||
|
||||
exit $EXIT_STATUS
|
|
@ -0,0 +1,424 @@
|
|||
#!/bin/bash -e
|
||||
# Test that dkms works properly
|
||||
set -eu
|
||||
|
||||
# Change the to base directory
|
||||
cd "$(dirname -- "$0")"
|
||||
|
||||
# To use a specific kernel version, use the environment variable KERNEL_VER
|
||||
KERNEL_VER="${KERNEL_VER:-$(uname -r)}"
|
||||
echo "Using kernel ${KERNEL_VER}"
|
||||
|
||||
# Override PATH to use the local dkms binary
|
||||
PATH="$(pwd):$PATH"
|
||||
export PATH
|
||||
|
||||
# Some helpers
|
||||
dkms_status_grep_dkms_test() {
|
||||
(dkms status | grep '^dkms_test/') || true
|
||||
}
|
||||
|
||||
check_no_dkms_test() {
|
||||
local found_moule
|
||||
|
||||
found_moule="$(dkms_status_grep_dkms_test)"
|
||||
if [[ -n "$found_moule" ]] ; then
|
||||
echo >&2 'Warning: module dkms_test is already in DKMS tree, removing...'
|
||||
dkms remove dkms_test/1.0 >/dev/null
|
||||
fi
|
||||
if [[ -d /usr/src/dkms_test-1.0 ]] ; then
|
||||
echo >&2 'Warning: directory /usr/src/dkms_test-1.0 already exists, removing'
|
||||
rm -rf /usr/src/dkms_test-1.0
|
||||
fi
|
||||
}
|
||||
|
||||
run_with_expected_output() {
|
||||
cat > test_cmd_expected_output.log
|
||||
if "$@" > test_cmd_output.log 2>&1 ; then
|
||||
# "depmod..." lines can have multiple points. Replace them, to be able to compare
|
||||
sed 's/\([^.]\)\.\.\.\.*$/\1.../' -i test_cmd_output.log
|
||||
# On CentOS, weak-modules is executed. Drop it from the output, to be more generic
|
||||
sed '/^Adding any weak-modules$/d' -i test_cmd_output.log
|
||||
sed '/^Removing any linked weak-modules$/d' -i test_cmd_output.log
|
||||
# "depmod..." lines are missing when uninstalling modules on CentOS. Remove them to be more generic
|
||||
if [[ $# -ge 2 && "$2" =~ uninstall|unbuild|remove ]] ; then
|
||||
sed '/^depmod\.\.\.$/d' -i test_cmd_output.log
|
||||
fi
|
||||
# Signing related output. Drop it from the output, to be more generic
|
||||
sed '/^Sign command:/d' -i test_cmd_output.log
|
||||
sed '/^Signing key:/d' -i test_cmd_output.log
|
||||
sed '/^Public certificate (MOK):/d' -i test_cmd_output.log
|
||||
sed '/^Signing module \/var\/lib\/dkms\/dkms_test\/1.0\/build\/dkms_test.ko$/d' -i test_cmd_output.log
|
||||
sed '/^Certificate or key are missing, generating them using update-secureboot-policy...$/d' -i test_cmd_output.log
|
||||
sed '/^Certificate or key are missing, generating self signed certificate for MOK...$/d' -i test_cmd_output.log
|
||||
sed "/^Binary .* not found, modules won't be signed$/d" -i test_cmd_output.log
|
||||
# OpenSSL non-critical errors while signing. Remove them to be more generic
|
||||
sed '/^At main.c:/d' -i test_cmd_output.log
|
||||
sed '/^- SSL error:/d' -i test_cmd_output.log
|
||||
if ! diff -U3 test_cmd_expected_output.log test_cmd_output.log ; then
|
||||
echo >&2 "Error: unexpected output from: $*"
|
||||
return 1
|
||||
fi
|
||||
rm test_cmd_expected_output.log test_cmd_output.log
|
||||
else
|
||||
echo "Error: command '$*' returned status $?"
|
||||
cat test_cmd_output.log
|
||||
rm test_cmd_expected_output.log test_cmd_output.log
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
run_with_expected_error() {
|
||||
local expected_error_code="$1"
|
||||
local error_code
|
||||
|
||||
shift
|
||||
cat > test_cmd_expected_output.log
|
||||
if "$@" > test_cmd_output.log 2>&1 ; then
|
||||
echo "Error: command '$*' was successful"
|
||||
cat test_cmd_output.log
|
||||
rm test_cmd_expected_output.log test_cmd_output.log
|
||||
return 1
|
||||
else
|
||||
error_code=$?
|
||||
fi
|
||||
if [[ "${error_code}" != "${expected_error_code}" ]] ; then
|
||||
echo "Error: command '$*' returned status ${error_code} instead of expected ${expected_error_code}"
|
||||
cat test_cmd_output.log
|
||||
rm test_cmd_expected_output.log test_cmd_output.log
|
||||
return 1
|
||||
fi
|
||||
if ! diff -U3 test_cmd_expected_output.log test_cmd_output.log ; then
|
||||
echo >&2 "Error: unexpected output from: $*"
|
||||
return 1
|
||||
fi
|
||||
rm test_cmd_expected_output.log test_cmd_output.log
|
||||
}
|
||||
|
||||
# Compute the expected destination module location
|
||||
os_id="$(sed -n 's/^ID\s*=\s*\(.*\)$/\1/p' /etc/os-release | tr -d '"')"
|
||||
mod_compression_ext=
|
||||
case "${os_id}" in
|
||||
centos | fedora | rhel | ovm | almalinux)
|
||||
expected_dest_loc=extra
|
||||
mod_compression_ext=.xz
|
||||
;;
|
||||
sles | suse | opensuse)
|
||||
expected_dest_loc=updates
|
||||
;;
|
||||
arch | debian | ubuntu)
|
||||
expected_dest_loc=updates/dkms
|
||||
;;
|
||||
alpine)
|
||||
expected_dest_loc=kernel/extra
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Error: unknown Linux distribution ID ${os_id}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
echo 'Checking that the environment is clean'
|
||||
check_no_dkms_test
|
||||
|
||||
echo 'Adding the test module by version (expected error)'
|
||||
run_with_expected_error 2 dkms add -m dkms_test -v 1.0 << EOF
|
||||
Error! Could not find module source directory.
|
||||
Directory: /usr/src/dkms_test-1.0 does not exist.
|
||||
EOF
|
||||
|
||||
echo 'Adding the test module by directory'
|
||||
run_with_expected_output dkms add test/dkms_test-1.0 << EOF
|
||||
Creating symlink /var/lib/dkms/dkms_test/1.0/source -> /usr/src/dkms_test-1.0
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0: added
|
||||
EOF
|
||||
if ! [[ -d /usr/src/dkms_test-1.0 ]] ; then
|
||||
echo >&2 'Error: directory /usr/src/dkms_test-1.0 was not created'
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo 'Adding the test module again (expected error)'
|
||||
run_with_expected_error 3 dkms add test/dkms_test-1.0 << EOF
|
||||
Error! DKMS tree already contains: dkms_test-1.0
|
||||
You cannot add the same module/version combo more than once.
|
||||
EOF
|
||||
|
||||
echo 'Adding the test module by version (expected error)'
|
||||
run_with_expected_error 3 dkms add -m dkms_test -v 1.0 << EOF
|
||||
Error! DKMS tree already contains: dkms_test-1.0
|
||||
You cannot add the same module/version combo more than once.
|
||||
EOF
|
||||
|
||||
echo 'Building the test module'
|
||||
run_with_expected_output dkms build -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
|
||||
Building module:
|
||||
Cleaning build area...
|
||||
make -j$(nproc) KERNELRELEASE=${KERNEL_VER} -C /lib/modules/${KERNEL_VER}/build M=/var/lib/dkms/dkms_test/1.0/build...
|
||||
Cleaning build area...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): built
|
||||
EOF
|
||||
|
||||
echo 'Building the test module again'
|
||||
run_with_expected_output dkms build -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test/1.0 already built for kernel ${KERNEL_VER} ($(uname -m)), skip. You may override by specifying --force.
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): built
|
||||
EOF
|
||||
|
||||
echo 'Building the test module again by force'
|
||||
run_with_expected_output dkms build -k "${KERNEL_VER}" -m dkms_test -v 1.0 --force << EOF
|
||||
|
||||
Building module:
|
||||
Cleaning build area...
|
||||
make -j$(nproc) KERNELRELEASE=${KERNEL_VER} -C /lib/modules/${KERNEL_VER}/build M=/var/lib/dkms/dkms_test/1.0/build...
|
||||
Cleaning build area...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): built
|
||||
EOF
|
||||
|
||||
|
||||
echo 'Installing the test module'
|
||||
run_with_expected_output dkms install -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
Running module version sanity check.
|
||||
- Original module
|
||||
- No original module exists within this kernel
|
||||
- Installation
|
||||
- Installing to /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
depmod...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): installed
|
||||
EOF
|
||||
|
||||
echo 'Installing the test module again'
|
||||
run_with_expected_output dkms install -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test/1.0 already installed on kernel ${KERNEL_VER} ($(uname -m)), skip. You may override by specifying --force.
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): installed
|
||||
EOF
|
||||
if ! [[ -f "/lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}" ]] ; then
|
||||
echo >&2 "Error: module not found in /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Installing the test module again by force'
|
||||
run_with_expected_output dkms install -k "${KERNEL_VER}" -m dkms_test -v 1.0 --force << EOF
|
||||
Module dkms_test-1.0 for kernel ${KERNEL_VER} ($(uname -m)).
|
||||
Before uninstall, this module version was ACTIVE on this kernel.
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
- Uninstallation
|
||||
- Deleting from: /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
- Original module
|
||||
- No original module was found for this module on this kernel.
|
||||
- Use the dkms install command to reinstall any previous module version.
|
||||
depmod...
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
Running module version sanity check.
|
||||
- Original module
|
||||
- No original module exists within this kernel
|
||||
- Installation
|
||||
- Installing to /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
depmod...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): installed
|
||||
EOF
|
||||
|
||||
echo 'Checking modinfo'
|
||||
run_with_expected_output sh -c "modinfo /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext} | head -n 4" << EOF
|
||||
filename: /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}
|
||||
version: 1.0
|
||||
description: A Simple dkms test module
|
||||
license: GPL
|
||||
EOF
|
||||
|
||||
echo 'Uninstalling the test module'
|
||||
run_with_expected_output dkms uninstall -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test-1.0 for kernel ${KERNEL_VER} ($(uname -m)).
|
||||
Before uninstall, this module version was ACTIVE on this kernel.
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
- Uninstallation
|
||||
- Deleting from: /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
- Original module
|
||||
- No original module was found for this module on this kernel.
|
||||
- Use the dkms install command to reinstall any previous module version.
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): built
|
||||
EOF
|
||||
if [[ -e "/lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}" ]] ; then
|
||||
echo >&2 "Error: module not removed in /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Uninstalling the test module again'
|
||||
run_with_expected_output dkms uninstall -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test 1.0 is not installed for kernel ${KERNEL_VER} ($(uname -m)). Skipping...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): built
|
||||
EOF
|
||||
|
||||
echo 'Unbuilding the test module'
|
||||
run_with_expected_output dkms unbuild -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test 1.0 is not installed for kernel ${KERNEL_VER} ($(uname -m)). Skipping...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0: added
|
||||
EOF
|
||||
|
||||
echo 'Unbuilding the test module again'
|
||||
run_with_expected_output dkms unbuild -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test 1.0 is not installed for kernel ${KERNEL_VER} ($(uname -m)). Skipping...
|
||||
Module dkms_test 1.0 is not built for kernel ${KERNEL_VER} ($(uname -m)). Skipping...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0: added
|
||||
EOF
|
||||
|
||||
echo 'Removing the test module'
|
||||
run_with_expected_output dkms remove -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test 1.0 is not installed for kernel ${KERNEL_VER} ($(uname -m)). Skipping...
|
||||
Module dkms_test 1.0 is not built for kernel ${KERNEL_VER} ($(uname -m)). Skipping...
|
||||
Deleting module dkms_test-1.0 completely from the DKMS tree.
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
EOF
|
||||
if ! [[ -d /usr/src/dkms_test-1.0 ]] ; then
|
||||
echo >&2 'Error: directory /usr/src/dkms_test-1.0 was removed'
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo 'Adding the test module by version'
|
||||
run_with_expected_output dkms add -m dkms_test -v 1.0 << EOF
|
||||
Creating symlink /var/lib/dkms/dkms_test/1.0/source -> /usr/src/dkms_test-1.0
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0: added
|
||||
EOF
|
||||
|
||||
echo 'Removing the test module'
|
||||
run_with_expected_output dkms remove --all -m dkms_test -v 1.0 << EOF
|
||||
Deleting module dkms_test-1.0 completely from the DKMS tree.
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
EOF
|
||||
|
||||
echo 'Installing the test module by version (combining add, build, install)'
|
||||
run_with_expected_output dkms install -k "${KERNEL_VER}" -m dkms_test -v 1.0 << EOF
|
||||
Creating symlink /var/lib/dkms/dkms_test/1.0/source -> /usr/src/dkms_test-1.0
|
||||
|
||||
Building module:
|
||||
Cleaning build area...
|
||||
make -j$(nproc) KERNELRELEASE=${KERNEL_VER} -C /lib/modules/${KERNEL_VER}/build M=/var/lib/dkms/dkms_test/1.0/build...
|
||||
Cleaning build area...
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
Running module version sanity check.
|
||||
- Original module
|
||||
- No original module exists within this kernel
|
||||
- Installation
|
||||
- Installing to /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
depmod...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): installed
|
||||
EOF
|
||||
if ! [[ -f "/lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}" ]] ; then
|
||||
echo >&2 "Error: module not found in /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Checking modinfo'
|
||||
run_with_expected_output sh -c "modinfo /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext} | head -n 4" << EOF
|
||||
filename: /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}
|
||||
version: 1.0
|
||||
description: A Simple dkms test module
|
||||
license: GPL
|
||||
EOF
|
||||
|
||||
echo 'Removing the test module with --all'
|
||||
run_with_expected_output dkms remove --all -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test-1.0 for kernel ${KERNEL_VER} ($(uname -m)).
|
||||
Before uninstall, this module version was ACTIVE on this kernel.
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
- Uninstallation
|
||||
- Deleting from: /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
- Original module
|
||||
- No original module was found for this module on this kernel.
|
||||
- Use the dkms install command to reinstall any previous module version.
|
||||
Deleting module dkms_test-1.0 completely from the DKMS tree.
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
EOF
|
||||
if [[ -e "/lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}" ]] ; then
|
||||
echo >&2 "Error: module not removed in /lib/modules/${KERNEL_VER}/${expected_dest_loc}/dkms_test.ko${mod_compression_ext}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'Removing /usr/src/dkms_test-1.0'
|
||||
rm -r /usr/src/dkms_test-1.0
|
||||
|
||||
echo 'Building the test module by config file (combining add, build)'
|
||||
run_with_expected_output dkms build -k "${KERNEL_VER}" test/dkms_test-1.0/dkms.conf << EOF
|
||||
Creating symlink /var/lib/dkms/dkms_test/1.0/source -> /usr/src/dkms_test-1.0
|
||||
|
||||
Building module:
|
||||
Cleaning build area...
|
||||
make -j$(nproc) KERNELRELEASE=${KERNEL_VER} -C /lib/modules/${KERNEL_VER}/build M=/var/lib/dkms/dkms_test/1.0/build...
|
||||
Cleaning build area...
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
dkms_test/1.0, ${KERNEL_VER}, $(uname -m): built
|
||||
EOF
|
||||
|
||||
echo "Running dkms autoinstall"
|
||||
run_with_expected_output dkms autoinstall -k "${KERNEL_VER}" << EOF
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
Running module version sanity check.
|
||||
- Original module
|
||||
- No original module exists within this kernel
|
||||
- Installation
|
||||
- Installing to /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
depmod...
|
||||
EOF
|
||||
|
||||
echo 'Removing the test module with --all'
|
||||
run_with_expected_output dkms remove --all -m dkms_test -v 1.0 << EOF
|
||||
Module dkms_test-1.0 for kernel ${KERNEL_VER} ($(uname -m)).
|
||||
Before uninstall, this module version was ACTIVE on this kernel.
|
||||
|
||||
dkms_test.ko${mod_compression_ext}:
|
||||
- Uninstallation
|
||||
- Deleting from: /lib/modules/${KERNEL_VER}/${expected_dest_loc}/
|
||||
- Original module
|
||||
- No original module was found for this module on this kernel.
|
||||
- Use the dkms install command to reinstall any previous module version.
|
||||
Deleting module dkms_test-1.0 completely from the DKMS tree.
|
||||
EOF
|
||||
run_with_expected_output dkms_status_grep_dkms_test << EOF
|
||||
EOF
|
||||
|
||||
echo 'Removing /usr/src/dkms_test-1.0'
|
||||
rm -r /usr/src/dkms_test-1.0
|
||||
|
||||
echo 'Checking that the environment is clean again'
|
||||
check_no_dkms_test
|
||||
|
||||
echo 'All tests successful :)'
|
|
@ -0,0 +1 @@
|
|||
A sample module to test dkms.
|
|
@ -0,0 +1,7 @@
|
|||
obj-m += dkms_test.o
|
||||
|
||||
all:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||
|
||||
clean:
|
||||
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
PACKAGE_NAME="dkms_test"
|
||||
PACKAGE_VERSION="1.0"
|
||||
BUILT_MODULE_NAME="dkms_test"
|
||||
|
||||
# MAKE="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build modules"
|
||||
# CLEAN="make -C /lib/modules/${kernelver}/build SUBDIRS=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build M=$PWD clean"
|
||||
|
||||
AUTOINSTALL="yes"
|
||||
|
||||
DEST_MODULE_LOCATION="/kernel/extra"
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
#define DKMS_TEST_VER "1.0"
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("A Simple dkms test module");
|
||||
|
||||
static int __init dkms_test_init(void)
|
||||
{
|
||||
printk(KERN_INFO "DKMS Test Module -%s Loaded\n",DKMS_TEST_VER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit dkms_test_cleanup(void)
|
||||
{
|
||||
printk(KERN_INFO "Cleaning up after dkms test module.\n");
|
||||
}
|
||||
|
||||
module_init(dkms_test_init);
|
||||
module_exit(dkms_test_cleanup);
|
||||
MODULE_VERSION(DKMS_TEST_VER);
|
Loading…
Reference in New Issue