summaryrefslogtreecommitdiff
path: root/eclass/kernel-install.eclass
diff options
context:
space:
mode:
Diffstat (limited to 'eclass/kernel-install.eclass')
-rw-r--r--eclass/kernel-install.eclass29
1 files changed, 22 insertions, 7 deletions
diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass
index 78a498000790..f512d815fe09 100644
--- a/eclass/kernel-install.eclass
+++ b/eclass/kernel-install.eclass
@@ -572,6 +572,7 @@ kernel-install_pkg_preinst() {
local dir_ver=${PV}${KV_LOCALVERSION}
local kernel_dir=${ED}/usr/src/linux-${dir_ver}
local relfile=${kernel_dir}/include/config/kernel.release
+ local image_path=$(dist-kernel_get_image_path)
[[ ! -d ${kernel_dir} ]] &&
die "Kernel directory ${kernel_dir} not installed!"
[[ ! -f ${relfile} ]] &&
@@ -598,6 +599,12 @@ kernel-install_pkg_preinst() {
rm "${ED}/lib/modules/${release}"/{build,source} || die
dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/build"
dosym "../../../src/linux-${dir_ver}" "/usr/lib/modules/${release}/source"
+ for file in vmlinux vmlinuz; do
+ if [[ -L "${ED}/lib/modules/${release}/${file}" ]]; then
+ rm "${ED}/lib/modules/${release}/${file}" || die
+ dosym "../../../src/linux-${dir_ver}/${image_path}" "/usr/lib/modules/${release}/${file}"
+ fi
+ done
fi
}
@@ -614,6 +621,7 @@ kernel-install_extract_from_uki() {
$(tc-getOBJCOPY) -O binary "-j.${extract_type}" "${uki}" "${out}" ||
die "Failed to extract ${extract_type}"
+ chmod 644 "${out}" || die
}
# @FUNCTION: kernel-install_install_all
@@ -629,7 +637,7 @@ kernel-install_install_all() {
local dir_ver=${1}
local kernel_dir=${EROOT}/usr/src/linux-${dir_ver}
local relfile=${kernel_dir}/include/config/kernel.release
- local image_path=${kernel_dir}/$(dist-kernel_get_image_path)
+ local image_path=$(dist-kernel_get_image_path)
local image_dir=${image_path%/*}
local module_ver
module_ver=$(<"${relfile}") || die
@@ -638,15 +646,22 @@ kernel-install_install_all() {
if use generic-uki; then
# Populate placeholders
kernel-install_extract_from_uki linux \
- "${image_dir}"/uki.efi \
- "${image_path}"
+ "${kernel_dir}/${image_dir}"/uki.efi \
+ "${kernel_dir}/${image_path}"
kernel-install_extract_from_uki initrd \
- "${image_dir}"/uki.efi \
- "${image_dir}"/initrd
+ "${kernel_dir}/${image_dir}"/uki.efi \
+ "${kernel_dir}/${image_dir}"/initrd
+ if [[ -L ${EROOT}/lib && ${EROOT}/lib -ef ${EROOT}/usr/lib ]]; then
+ ln -sf "../../../src/linux-${dir_ver}/${image_dir}/initrd" "${EROOT}/usr/lib/modules/${module_ver}/initrd" || die
+ ln -sf "../../../src/linux-${dir_ver}/${image_dir}/uki.efi" "${EROOT}/usr/lib/modules/${module_ver}/uki.efi" || die
+ else
+ ln -sf "../../../usr/src/linux-${dir_ver}/${image_dir}/initrd" "${EROOT}/lib/modules/${module_ver}/initrd" || die
+ ln -sf "../../../usr/src/linux-${dir_ver}/${image_dir}/uki.efi" "${EROOT}/lib/modules/${module_ver}/uki.efi" || die
+ fi
else
# Remove placeholders, -f because these have already been removed
# when doing emerge --config.
- rm -f "${image_dir}"/{initrd,uki.efi} || die
+ rm -f "${kernel_dir}/${image_dir}"/{initrd,uki.efi} || die
fi
fi
@@ -656,7 +671,7 @@ kernel-install_install_all() {
nonfatal mount-boot_check_status || break
nonfatal dist-kernel_install_kernel "${module_ver}" \
- "${image_path}" "${kernel_dir}/System.map" || break
+ "${kernel_dir}/${image_path}" "${kernel_dir}/System.map" || break
success=1
break