From 17679d28c9883180c5b02b0178595cdfc8bb640e Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Sun, 25 Sep 2016 01:50:57 +0100 Subject: eclass/linux-build: Handle multiple bootloaders --- eclass/linux-build.eclass | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'eclass') diff --git a/eclass/linux-build.eclass b/eclass/linux-build.eclass index 11e595fb..38188702 100644 --- a/eclass/linux-build.eclass +++ b/eclass/linux-build.eclass @@ -157,26 +157,23 @@ _linux-build_src_prepare_build() { sys-boot/syslinux:0 /boot/extlinux/extlinux.conf ) - for (( i = 0 ; i < ${#BOOTLOADERS[@]} ; i+=2 )) ; do - if has_version "${BOOTLOADERS[i]}" && [[ -e "${EPREFIX}/${BOOTLOADERS[i+1]}" ]] ; then - BOOTLOADER=Yes - BOOTLOADER_DIR="${BOOTLOADERS[i+1]%/*}" - BOOTLOADER_FILE="${BOOTLOADERS[i+1]##*/}" + KV_INSTALLED="$(best_version ${CATEGORY}/${PN}:${SLOT})" + KV_INSTALLED="${KV_INSTALLED/#${CATEGORY}\/${PN}-}" - break - fi - done + if [[ -n "${KV_INSTALLED}" ]] ; then + for (( i = 0 ; i < ${#BOOTLOADERS[@]} ; i+=2 )) ; do + if ! has_version "${BOOTLOADERS[i]}" || [[ ! -e "${EPREFIX}/${BOOTLOADERS[i+1]}" ]] ; then + continue + fi - if [[ "${BOOTLOADER}" == "Yes" ]] ; then - KV_INSTALLED="$(best_version ${CATEGORY}/${PN}:${SLOT})" - KV_INSTALLED="${KV_INSTALLED/#${CATEGORY}\/${PN}-}" + BOOTLOADER_DIR="${BOOTLOADERS[i+1]%/*}" + BOOTLOADER_FILE="${BOOTLOADERS[i+1]##*/}" - if [[ -n "${KV_INSTALLED}" ]] ; then mkdir -p "${WORKDIR}/bootloader/${BOOTLOADER_DIR}" # Handle collision protect - for (( i = 0 ; i < 9999 ; i++ )) ; do - printf -v BOOTLOADER_PROTECTED_FILE "._cfg%04d_${BOOTLOADER_FILE}" "${i}" + for (( j = 0 ; j < 9999 ; j++ )) ; do + printf -v BOOTLOADER_PROTECTED_FILE "._cfg%04d_${BOOTLOADER_FILE}" "${j}" if [[ ! -e "${EPREFIX}/${BOOTLOADER_DIR}/${BOOTLOADER_PROTECTED_FILE}" ]] ; then break fi @@ -194,8 +191,10 @@ _linux-build_src_prepare_build() { rm "${WORKDIR}/bootloader/${BOOTLOADER_DIR}/${BOOTLOADER_PROTECTED_FILE}" fi - echo "CONFIG_PROTECT=${BOOTLOADER_DIR}/${BOOTLOADER_FILE}" > "${WORKDIR}/env.d_42-${PN}" - fi + _CONFIG_PROTECT+=( "${BOOTLOADER_DIR}/${BOOTLOADER_FILE}" ) + done + + echo "CONFIG_PROTECT='${_CONFIG_PROTECT[@]}'" > "${WORKDIR}/env.d_42-${P}" fi _linux-build_configval MODULES || ewarn "CONFIG_MODULES is not set" @@ -388,7 +387,7 @@ _linux-build_src_install_build() { doins -r "${WORKDIR}"/bootloader/boot/* insinto /etc/env.d - newins "${WORKDIR}/env.d_42-${PN}" "42-${PN}" + newins "${WORKDIR}/env.d_42-${P}" "42-${P}" fi use savedconfig && save_config "${BUILDDIR}/.config" -- cgit v1.2.3