mirror of
https://github.com/pentoo/pentoo-overlay
synced 2026-04-22 06:41:01 +02:00
pentoo-livecd: improvements to binary-driver-handler
This commit is contained in:
parent
ae28f4117c
commit
f6a18d3057
4 changed files with 169 additions and 146 deletions
|
|
@ -1,4 +1,4 @@
|
|||
AUX binary-driver-handler.initd-2014.3-r2 4293 SHA256 6e5a741783298f0c1bc2e104318d6f8480ea55872fc0d9fdbe6195f7169b8c8d SHA512 8dd751e741e57269e1271ed1d7035e950058c9a8d8f1ffb8cf725e746b98abff12f2985b3c4e5f90d323c22a3cf8df7c437c772248ef9281de466d5f22146fa3 WHIRLPOOL f0ffcb0e6ee5ed13ecabdc0ba1f5ca26067a3973d186b73c237d79fdcbfb1e76f4ec034d43d4bf9677d2bb91ee889219b8878bae7720213d9e9098afce62e5b1
|
||||
AUX binary-driver-handler.initd-2014.3-r3 5677 SHA256 beedbb625a36ab081aa7b1a665ae66236a56f3ece393fbf661215581cae85dca SHA512 9831558b9f70e06efdc395c6fa19e2c5bacf68798cfbe488cb5e18b759e9faeaacd8cfbf22277dcf9a40778c5c075d62e36e7a9410a40803e66f58afb6dbeb8a WHIRLPOOL 5a785cb5a8405381e722f363fe56742d4bfc5628cfbdbe290f8c9d67906c374b05c146818d89ff9f1b7a3ea8b47b87ca92d02c34997623ffda070558f5f2ef90
|
||||
AUX flushchanges-2014.3-r2 1512 SHA256 81e9fe4d127a0cc1edfab5f342a4a565b7e68930cbeecbb210b91a8f5db1d772 SHA512 3b079d8c8436e14a159caa750afc422cdd062dba7659d8a8904f6a91eeda7f1d069fd2cfbc48e5e68477221237149f5d37e9ff8440adfae33dccae50fb4f0dc8 WHIRLPOOL 34c00f44948541dfc858fcf0b83f27ddd328690fcb90f78718a6cf4152d8574ab5cd5b4f025e7ce45e559b75eed2987ed37aa62da379f31ffd365b260c448911
|
||||
AUX makemo-2014.3-r2 1886 SHA256 1c564d939ed69626a9a4858f293de29c2d17cabb0a61e2f22bb2b38c96c5a325 SHA512 03ab306dd0db20570741cba33bec63e1f4fd7a8322970ee42338fccb3a8dced888b48d8fbed11e7f1824a0719ad645418c417b00a2b7d39648ea0d85812382b0 WHIRLPOOL fca805094c46432922022c758154392295c938aa03b8a47e025fe4546844298a8e4d6fd1dd9d24b5cc6f7c688ed4422b37fa363885774e07d46c232a5c409201
|
||||
EBUILD pentoo-livecd-2014.3-r2.ebuild 934 SHA256 806ab579a0eac3ee0e2ae1daa4c6314fdf01c9bd4598e5b4f25f442866a508ac SHA512 30e4693c3487cc1cef744e9957484d51a2718c39e9813cb286458b7c5adf7cfbadc0d1f9b544a4bfd1c420fdb47b14597ff712ca1c623bad40020e34a5fe807e WHIRLPOOL 09bc8ef275d87c8372b4c807cf8623b5e9a8a277a85f2394ac50d5b753c091503944c5eefc706f72ace83c5966a1661385983fefc16d08cdef8eb8a869befe82
|
||||
EBUILD pentoo-livecd-2014.3-r3.ebuild 938 SHA256 83608c4614d91d1934e8c5bbc5ae7ba3dc76bdf3c6bad4c4e286c557c4ce6b17 SHA512 910de521c127db93ce363f53282a532c9f58131e1c72c4363e288aa80cb11ac13bf8219fef10f222801cbd104ea846a5f81335dd5affa6649b82d3a007f670f0 WHIRLPOOL f416f7a207f87acfaa89a4a37661d3386f9a628ef64ad304f6456e0ae5e76e6673d19e5fcd4cbcc64d1956767bf94366540946ffe302ebe9702739906b04692e
|
||||
|
|
|
|||
|
|
@ -1,142 +0,0 @@
|
|||
#!/sbin/runscript
|
||||
#seriously, fuck you AMD and Nvidia. Write a sane license that permits redistribution, we just want your shitty hardware to work
|
||||
|
||||
#todo: better handling of if the drivers don't like the card
|
||||
|
||||
extra_commands="aufs_module"
|
||||
|
||||
depend() {
|
||||
before local xdm
|
||||
}
|
||||
|
||||
start() {
|
||||
BLACKLIST="/etc/modprobe.d/blacklist.conf"
|
||||
|
||||
handle_nvidia() {
|
||||
einfo "Detected: nvidia gpu, please stand by..."
|
||||
if [ "${NOBINDRIVERS}" = 1 ]; then
|
||||
einfo "Enabling open source nouveau driver..."
|
||||
|
||||
#blacklist the binary drivers just in case
|
||||
#check for nouveau in the blacklist and remove it
|
||||
sed -i '/nouveau/d' /etc/modprobe.d/blacklist.conf
|
||||
#check for nvidia in the blacklist and add it
|
||||
grep -q nvidia "${BLACKLIST}" || \
|
||||
echo "blacklist nvidia" >> "${BLACKLIST}"
|
||||
|
||||
#remove the binary driver and insert oss
|
||||
modprobe -r nvidia || eerror "Unable to unload nvidia driver."
|
||||
#do we want an intel check here or just don't care?
|
||||
modprobe nouveau
|
||||
else
|
||||
einfo "Enabling evil binary nvidia driver..."
|
||||
|
||||
#blacklist the open drivers just in case
|
||||
#check for nvidia in the blacklist and remove it
|
||||
sed -i '/nvidia/d' "${BLACKLIST}"
|
||||
#check for nouveau in the blacklist and add it
|
||||
grep -q nouveau "${BLACKLIST}" || \
|
||||
echo "blacklist nouveau" >> "${BLACKLIST}"
|
||||
|
||||
#remove oss
|
||||
modprobe -r nouveau || eerror "Unable to unload nouveau driver."
|
||||
|
||||
if [ ! -f /lib/modules/$(uname -r)/video/nvidia.ko ]; then
|
||||
eval ${run_merge} --nodeps nvidia-drivers
|
||||
fi
|
||||
#check for intel gpu
|
||||
#lspci | grep -iq "VGA.*Intel"
|
||||
if $(lspci -d8086: | grep VGA); then
|
||||
ewarn "nvidia and intel are both detected, using intel"
|
||||
else
|
||||
modprobe nvidia
|
||||
nvidia-xconfig
|
||||
#eselect opengl set nvidia
|
||||
eselect opencl set nvidia
|
||||
einfo "Enabled evil NVIDIA binary GPU driver"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
handle_amd() {
|
||||
einfo "Detected: amd gpu, please stand by..."
|
||||
if [ "${NOBINDRIVERS}" = 1 ]; then
|
||||
einfo "Enabling open source radeon driver..."
|
||||
|
||||
#blacklist the binary driver just in case
|
||||
#check for radeon in the blacklist and remove it
|
||||
sed -i '/radeon/d' "${BLACKLIST}"
|
||||
#check for fglrx in the blacklist and add it
|
||||
grep -q fglrx "${BLACKLIST}" || \
|
||||
echo "blacklist fglrx" >> "${BLACKLIST}"
|
||||
|
||||
#remove binary and insert oss
|
||||
modprobe -r fglrx || eerror "Unable to unload fglrx."
|
||||
modprobe radeon
|
||||
else
|
||||
einfo "Enabling evil binary ati driver..."
|
||||
|
||||
#blacklist the open drivers just in case
|
||||
#check for fglrx in the blacklist and remove it
|
||||
sed -i '/fglrx/d' "${BLACKLIST}"
|
||||
#check for radeon in the blacklist and add it
|
||||
grep -q radeon "${BLACKLIST}" || \
|
||||
echo "blacklist radeon" >> "${BLACKLIST}"
|
||||
|
||||
#remove oss
|
||||
modprobe -r radeon || eerror "Unable to unload radeon"
|
||||
|
||||
if [ ! -f /lib/modules/$(uname -r)/video/fglrx.ko ]; then
|
||||
eval ${run_merge} --nodeps ati-drivers
|
||||
fi
|
||||
modprobe fglrx
|
||||
aticonfig --initial
|
||||
#eselect opengl set ati
|
||||
eselect opencl set amd
|
||||
einfo "Successfully switched to AMD binary GPU driver"
|
||||
fi
|
||||
}
|
||||
|
||||
#parse kernel commandline to see what we are doing
|
||||
if grep -q nobindrivers /proc/cmdline; then
|
||||
NOBINDRIVERS=1
|
||||
else
|
||||
NOBINDRIVERS=0
|
||||
fi
|
||||
|
||||
#check environment to see if we want to make modules or not
|
||||
if [ -w /mnt/cdrom/modules ] && [ -x /usr/sbin/makemo ]; then
|
||||
run_merge="echo y | makemo"
|
||||
else
|
||||
run_merge="emerge"
|
||||
fi
|
||||
|
||||
ebegin "Setting up GPU drivers requested by user, this may take a few minutes"
|
||||
|
||||
#check for nvidia GPU
|
||||
#lspci | grep -iq "VGA.*NVIDIA"
|
||||
if $(lspci -d10de: | grep -q VGA); then
|
||||
handle_nvidia
|
||||
#check for AMD GPU
|
||||
#lspci | grep -iq "VGA.*Radeon"
|
||||
elif $(lspci -d1002: | grep -q VGA); then
|
||||
handle_amd
|
||||
fi
|
||||
|
||||
[ "$(eselect opengl show)" != "xorg-x11" ] && eselect opengl set xorg-x11
|
||||
eend 0
|
||||
}
|
||||
|
||||
aufs_module() {
|
||||
#temp dir
|
||||
T="/dev/shm"
|
||||
#target dir
|
||||
DEST=/usr/src/pentoo/livecd/trunk/isoroot/modules
|
||||
|
||||
mkdir -p "${T}"/distfiles/rootfs/usr/portage/distfiles/
|
||||
DISTDIR="${T}"/distfiles/ emerge -FO ati-drivers
|
||||
DISTDIR="${T}"/dev/shm/distfiles/ emerge -FO nvidia-drivers
|
||||
cp "${T}"/distfiles/{*[Ll]inux*,xvba*} "${T}"/distfiles/rootfs/usr/portage/distfiles
|
||||
chown portage.portage -R "${T}"/distfiles/rootfs/usr/portage
|
||||
mksquashfs "${T}"/distfiles/rootfs/ "${DEST}"/zdistfiles-`date "+%Y%m%d"`.lzm -comp xz -b 1048576 -Xdict-size 1048576 -no-recovery -noappend
|
||||
}
|
||||
165
pentoo/pentoo-livecd/files/binary-driver-handler.initd-2014.3-r3
Normal file
165
pentoo/pentoo-livecd/files/binary-driver-handler.initd-2014.3-r3
Normal file
|
|
@ -0,0 +1,165 @@
|
|||
#!/sbin/runscript
|
||||
#seriously, fuck you AMD and Nvidia. Write a sane license that permits redistribution, we just want your shitty hardware to work
|
||||
|
||||
#todo: detect if the drivers should work *BEFORE* building and switching to them.
|
||||
|
||||
extra_commands="aufs_module"
|
||||
|
||||
depend() {
|
||||
before xdm
|
||||
}
|
||||
|
||||
start() {
|
||||
BLACKLIST="/etc/modprobe.d/blacklist.conf"
|
||||
|
||||
handle_nvidia() {
|
||||
einfo "Detected: nvidia gpu, please stand by..."
|
||||
if [ "${NOBINDRIVERS}" = 1 ]; then
|
||||
|
||||
#remove the binary driver and insert oss
|
||||
#XXX: oh man, this is ugly, maybe, fix?
|
||||
lsmod | grep -iq nvidia && modprobe -r nvidia || eerror "Unable to unload nvidia driver."
|
||||
#we need an intel check here eventually
|
||||
modprobe nouveau || NOUVEAU_FAILURE=yes
|
||||
if [ "${NOUVEAU_FAILURE}" = "yes" ]; then
|
||||
eerror "Nouveau drivers failed to load, something went wrong. Please try the binary nvidia driver."
|
||||
else
|
||||
einfo "Enabling open source nouveau driver..."
|
||||
#blacklist the binary drivers
|
||||
#check for nouveau in the blacklist and remove it
|
||||
sed -i '/nouveau/d' /etc/modprobe.d/blacklist.conf
|
||||
#check for nvidia in the blacklist and add it
|
||||
grep -q nvidia "${BLACKLIST}" || \
|
||||
echo "blacklist nvidia" >> "${BLACKLIST}"
|
||||
fi
|
||||
else
|
||||
#remove oss
|
||||
#XXX: oh man, this is ugly, maybe, fix?
|
||||
lsmod | grep -iq nouveau && modprobe -r nouveau || eerror "Unable to unload nouveau driver."
|
||||
|
||||
if [ ! -f /lib/modules/$(uname -r)/video/nvidia.ko ]; then
|
||||
einfo "Building evil binary nvidia driver..."
|
||||
eval ${run_merge} --nodeps nvidia-drivers
|
||||
fi
|
||||
|
||||
modprobe nvidia || NVIDIA_FAILURE=yes
|
||||
if [ "${NVIDIA_FAILURE}" = "yes" ]; then
|
||||
eerror "Nvidia drivers failed to load, something went wrong. Please try open source drivers."
|
||||
else
|
||||
einfo "Enabling evil binary nvidia driver..."
|
||||
#blacklist the open drivers
|
||||
#check for nvidia in the blacklist and remove it
|
||||
sed -i '/nvidia/d' "${BLACKLIST}"
|
||||
#check for nouveau in the blacklist and add it
|
||||
grep -q nouveau "${BLACKLIST}" || \
|
||||
echo "blacklist nouveau" >> "${BLACKLIST}"
|
||||
fi
|
||||
|
||||
#check for intel gpu
|
||||
#lspci | grep -iq "VGA.*Intel"
|
||||
if $(lspci -d8086: | grep VGA); then
|
||||
ewarn "nvidia and intel are both detected, using intel for video"
|
||||
elif [ "${NVIDIA_FAILURE}" != "yes" ]; then
|
||||
/opt/bin/nvidia-xconfig
|
||||
#eselect opengl set nvidia
|
||||
eselect opencl set nvidia
|
||||
einfo "Enabled evil NVIDIA binary GPU driver"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
handle_amd() {
|
||||
einfo "Detected: amd gpu, please stand by..."
|
||||
if [ "${NOBINDRIVERS}" = 1 ]; then
|
||||
#remove binary and insert oss
|
||||
#XXX: oh man, this is ugly, maybe, fix?
|
||||
lsmod | grep -iq radeon && modprobe -r fglrx || eerror "Unable to unload fglrx."
|
||||
modprobe radeon || RADEON_FAILURE=yes
|
||||
if [ "${RADEON_FAILURE}" = "yes" ]; then
|
||||
eerror "Radeon drivers failed to load, something went wrong. Please try the binary drivers."
|
||||
else
|
||||
einfo "Enabling open source radeon driver..."
|
||||
#blacklist the binary driver
|
||||
#check for radeon in the blacklist and remove it
|
||||
sed -i '/radeon/d' "${BLACKLIST}"
|
||||
#check for fglrx in the blacklist and add it
|
||||
grep -q fglrx "${BLACKLIST}" || \
|
||||
echo "blacklist fglrx" >> "${BLACKLIST}"
|
||||
fi
|
||||
else
|
||||
#remove oss
|
||||
#XXX: oh man, this is ugly, maybe, fix?
|
||||
lsmod | grep -iq radeon && modprobe -r radeon || eerror "Unable to unload radeon"
|
||||
|
||||
if [ ! -f /lib/modules/$(uname -r)/video/fglrx.ko ]; then
|
||||
einfo "Building evil binary AMD driver..."
|
||||
eval ${run_merge} --nodeps ati-drivers
|
||||
fi
|
||||
modprobe fglrx || FGLRX_FAILURE=yes
|
||||
if [ "${FGLRX_FAILURE}" = "yes" ]; then
|
||||
eerror "FGLRX drivers failed to load, something went wrong. Please try open source drivers."
|
||||
else
|
||||
einfo "Enabling evil binary ati driver..."
|
||||
#blacklist the open drivers
|
||||
#check for fglrx in the blacklist and remove it
|
||||
sed -i '/fglrx/d' "${BLACKLIST}"
|
||||
#check for radeon in the blacklist and add it
|
||||
grep -q radeon "${BLACKLIST}" || \
|
||||
echo "blacklist radeon" >> "${BLACKLIST}"
|
||||
|
||||
/opt/bin/aticonfig --initial
|
||||
#eselect opengl set ati
|
||||
eselect opencl set amd
|
||||
einfo "Successfully switched to AMD binary GPU driver"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
#parse kernel commandline to see what we are doing
|
||||
if grep -q nobindrivers /proc/cmdline; then
|
||||
NOBINDRIVERS=1
|
||||
else
|
||||
NOBINDRIVERS=0
|
||||
fi
|
||||
|
||||
if [ ! -w /mnt/cdrom/modules ]; then
|
||||
#something is horribly wrong, even if it should be rw, /mnt/cdrom is remounted ro
|
||||
#the lazyiest hack way to handle this is to just try and remount it rw
|
||||
mount -o remount,rw /mnt/cdrom > /dev/zero 2>&1
|
||||
fi
|
||||
#check environment to see if we can make modules or not
|
||||
if [ -w /mnt/cdrom/modules ] && [ -x /usr/sbin/makemo ]; then
|
||||
run_merge="echo y | makemo"
|
||||
else
|
||||
run_merge="emerge"
|
||||
fi
|
||||
|
||||
ebegin "Setting up GPU drivers requested by user, this may take a few minutes"
|
||||
|
||||
#check for nvidia GPU
|
||||
#lspci | grep -iq "VGA.*NVIDIA"
|
||||
if $(lspci -d10de: | grep -q VGA); then
|
||||
handle_nvidia
|
||||
#check for AMD GPU
|
||||
#lspci | grep -iq "VGA.*Radeon"
|
||||
elif $(lspci -d1002: | grep -q VGA); then
|
||||
handle_amd
|
||||
fi
|
||||
|
||||
[ "$(eselect opengl show)" != "xorg-x11" ] && eselect opengl set xorg-x11
|
||||
eend 0
|
||||
}
|
||||
|
||||
aufs_module() {
|
||||
#temp dir
|
||||
T="/dev/shm"
|
||||
#target dir
|
||||
DEST=/usr/src/pentoo/livecd/trunk/isoroot/modules
|
||||
|
||||
mkdir -p "${T}"/distfiles/rootfs/usr/portage/distfiles/
|
||||
DISTDIR="${T}"/distfiles/ emerge -FO ati-drivers
|
||||
DISTDIR="${T}"/dev/shm/distfiles/ emerge -FO nvidia-drivers
|
||||
cp "${T}"/distfiles/{*[Ll]inux*,xvba*} "${T}"/distfiles/rootfs/usr/portage/distfiles
|
||||
chown portage.portage -R "${T}"/distfiles/rootfs/usr/portage
|
||||
mksquashfs "${T}"/distfiles/rootfs/ "${DEST}"/zdistfiles-`date "+%Y%m%d"`.lzm -comp xz -b 1048576 -Xdict-size 1048576 -no-recovery -noappend
|
||||
}
|
||||
|
|
@ -32,8 +32,8 @@ pkg_setup() {
|
|||
|
||||
src_install() {
|
||||
#/usr/sbin
|
||||
newsbin "${FILESDIR}"/flushchanges-${PVR} flushchanges
|
||||
newsbin "${FILESDIR}"/makemo-${PVR} makemo
|
||||
newsbin "${FILESDIR}"/flushchanges-${PV}-r2 flushchanges
|
||||
newsbin "${FILESDIR}"/makemo-${PV}-r2 makemo
|
||||
|
||||
newinitd "${FILESDIR}"/binary-driver-handler.initd-${PVR} binary-driver-handler
|
||||
}
|
||||
Loading…
Reference in a new issue