summaryrefslogtreecommitdiff
blob: aebf0d373c10df5fb9a12158313c1278e331b687 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Copyright 2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit linux-mod

GIT_COMMIT="c8313abffe083ac63bf76d2cc90d3edf5b2d1188"

DESCRIPTION="PCI-E RTS5209 card reader driver for Linux"
HOMEPAGE="https://github.com/gexplorer/RTS5209-linux-driver"
SRC_URI="https://github.com/gexplorer/RTS5209-linux-driver/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"

DEPEND="virtual/linux-sources"
S="${WORKDIR}/RTS5209-linux-driver-${GIT_COMMIT}"

MODULE_NAMES="rts_pstor(misc/drivers/scsi)"
MODULESD_RTS_PSTOR_ADDITIONS=(
	"# when rts_pstor is installed, blacklist in-kernel driver rtsx_pci"
	"blacklist rtsx_pci"
)
BUILD_TARGETS="default"
BUILD_PARAMS="KERNELDIR=${KERNEL_DIR}"
CONFIG_CHECK="~!MISC_RTSX_PCI !FORTIFY_SOURCE"
ERROR_MISC_RTSX_PCI="CONFIG_MISC_RTSX_PCI: The in-kernel driver rtsx_pci is configured, which may have the same functionality than this driver. To make sure that your kernel loads only rts_pstor, the rtsx_pci module will be blacklisted."
ERROR_FORTIFY_SOURCE="CONFIG_FORTIFY_SOURCE: this module is known to fail compiling when the hardening option CONFIG_FORTIFY_SOURCE is set"

src_prepare() {
	default

	eapply "${FILESDIR}/fix-compile-kernel-5.0.0.patch"
	kernel_is le 5 0 && eapply "${FILESDIR}/rts_pstor-makefile.patch" || eapply "${FILESDIR}/rts_pstor-makefile-kernel-5.1.patch"
}

pkg_postinst() {
	elog "This driver is based on code published by Realtek. There is a driver in the kernel named rtsx_pci which"
	elog "should be preferred over this driver - but on some hardware only this driver is functional and rtsx_pci is not."
}