Skip to content

Commit

Permalink
Add bcm2711-kernel-bis-bin-4.19.97.20200204.ebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
sakaki- committed Feb 4, 2020
1 parent f8af2ac commit d313cbd
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
1 change: 1 addition & 0 deletions sys-kernel/bcm2711-kernel-bis-bin/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ DIST bcm2711-kernel-bis-bin-4.19.93.20200107.tar.xz 18503888 BLAKE2B bbe57c3a5ba
DIST bcm2711-kernel-bis-bin-4.19.93.20200114.tar.xz 18504932 BLAKE2B c6c3b4fdfce49b4c8256f19cdf66862de1ed979c61d0d6a2dceeb2476ba7369f9c15a3fac425b41c7bd1f535aa21ca9dfad247c0eae568703c4ce64b97e7ad71 SHA512 4bec2d5b5401cfd59811a48f559a0d2b8ac66d077aadc8983f05d708dea1fbb3d7ed700f7dc5def854cb3baa87bb701a9f5f0c1174faa7a4900e7034e2ee6465
DIST bcm2711-kernel-bis-bin-4.19.97.20200121.tar.xz 18503776 BLAKE2B e7a4b1135d03dc724e7228c79e692dcda463d8dd5f7a15261095bbfdee923ab15b5868b25c32731df1c07fdeb91e2f03fd56e9aa75213765c1e301e61d1a1dbe SHA512 1c3ada10bb8b9a365a76123f6601149d270b25df977fc771f58cfd6d056d41c7eb4bb265e8d13a3aaec84130b0f18f288eac5a08b248a5e932f46d65ca647cc5
DIST bcm2711-kernel-bis-bin-4.19.97.20200128.tar.xz 18505288 BLAKE2B 0dc9d2bd76c0e68684bda176404a4f55860608f85a5d2cdc93d9ea620da5e279204b44273a15e65c1f3514ba5d14b0c5c71211905cd13ab964261a5442f679d7 SHA512 e170195c798c646ab6ac6b378bd5076151308d121275bbbc194be9196b91e3b5ea03dce87620dad82422bb945ec8a3ce254a0038d297d495c700a415193899d1
DIST bcm2711-kernel-bis-bin-4.19.97.20200204.tar.xz 18508304 BLAKE2B 2a4d1fca39a90c020552850b474d16362f498a10f98ef7ebb237ed59c613c82054e6176a0bbb219f5050c38b256c4978dabde415061ab3489d500587187f08f1 SHA512 e25bc0c95b61c2bce661b0b695b7ef548239288f4d2966b4b3e2838b9a6d6c32d786997f32973d0106fbfe7c3633949492a13f4609440479befc309fb3a185f8
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
# Copyright (c) 2019 sakaki <[email protected]>
# Distributed under the terms of the GNU General Public License v2

EAPI="6"

inherit eutils autotools

DESCRIPTION="Binary RPi4 64-bit kernel package (bcm2711_defconfig + tweaks)"
HOMEPAGE="https://github.com/sakaki-/bcm2711-kernel-bis"

SRC_URI="${HOMEPAGE}/releases/download/${PV}/bcm2711-kernel-bis-${PV}.tar.xz -> ${P}.tar.xz"

LICENSE="GPL-2 freedist"
SLOT="0"
KEYWORDS="~arm64"
IUSE="+checkboot +with-matching-boot-fw pitop +pi3multiboot"

RESTRICT="mirror"

DEPEND="
!sys-kernel/bcm2711-kernel-bin"
# if pi3multiboot is specified, depend upon corresponding-date rpi3-specific
# kernel package too
RDEPEND="
with-matching-boot-fw? ( ~sys-boot/rpi3-64bit-firmware-1.20200114[pitop(-)?,-dtbo(+)] )
pi3multiboot? ( ~sys-kernel/bcmrpi3-kernel-bis-bin-${PV}[checkboot=,with-matching-boot-fw=,pitop=] )
!pi3multiboot? (
!sys-kernel/bcmrpi3-kernel-bin
!sys-kernel/bcmrpi3-kernel-bis-bin
)
${DEPEND}"

QA_PREBUILT="*"

S="${WORKDIR}"

# ebuild function overrides

pkg_pretend() {
# check /boot directory is mounted, provided $ROOT is /
if use checkboot && [[ "${ROOT%/}" == "" ]]; then
if ! grep -q "^/boot$" <(cut -d " " -f 2 "/proc/mounts") &>/dev/null; then
die "Your /boot directory does not appear to be mounted"
fi
else
ewarn 'Installing into non-default $ROOT'
ewarn "Not checking whether /boot is mounted"
fi
}

src_install() {
local RELEASE_NAME

# just copy tarball contents into temporary install root
insinto /boot
doins -r "${S%/}/boot"/*
# only copy overlays/ directory if not multibooting with a pi3 kernel
# (it owns them if this flag is set)
# also, don't duplicate COPYING.linux in this case
if use pi3multiboot; then
rm -rf "${D%/}/boot/overlays"
rm -f "${D%/}/boot/COPYING.linux"
fi
insinto /lib/modules
doins -r "${S%/}/lib/modules"/*
# note that we installed the libraries, for future cleanup
RELEASE_NAME=$(head -n1 <(ls -t1d "${S}/lib/modules"/*))
RELEASE_NAME="${RELEASE_NAME##*/}"
echo "${PF}" > "${D%/}/lib/modules/${RELEASE_NAME}/owning_binpkg"
}

pkg_postinst() {
elog "Your new kernel has been installed."
elog "Reboot your system to start using it."
}

pkg_postrm() {
# it is possible that if the kernel originally installed by this ebuild
# is currently running, then its /lib/modules/<release_name> directory
# will still be present, due to some of the module files therein having
# been marked as "in use", leading Portage deline to delete them during
# the default uninstall phase
# detect if this has happened and, if so, forcibly (and recursively)
# delete /lib/modules/<release_name>, and print a warning
local MDIR OWNING_BINPKG

shopt -s nullglob
for MDIR in "${ROOT%/}/lib/modules"/*; do
# was this kernel installed by a binary package?
if [[ -s "${MDIR}/owning_binpkg" ]]; then
OWNING_BINPKG="$(<"${MDIR}/owning_binpkg")"
# was it us? (also check this is not a pure re-install)
if [[ "${PF}" == "${OWNING_BINPKG}" && "${PVR}" != "${REPLACED_BY_VERSION}" ]]; then
# yes, we installed it, we need to remove it
ewarn "Forcibly deleting kernel module directory ${MDIR}"
rm -rf "${MDIR}"
# warn user if this is a 'pure' uninstall,
# rather than an upgrade
if [[ -z "${REPLACED_BY_VERSION}" ]]; then
ewarn "Please ensure you have a valid kernel and module set"
ewarn "in place, before rebooting."
fi
fi
fi
done
shopt -u nullglob
}

0 comments on commit d313cbd

Please sign in to comment.