Lines 610-660
Link Here
|
610 |
linux-mod_src_compile() { |
610 |
linux-mod_src_compile() { |
611 |
debug-print-function ${FUNCNAME} $* |
611 |
debug-print-function ${FUNCNAME} $* |
612 |
|
612 |
|
613 |
local modulename libdir srcdir objdir i n myABI="${ABI}" |
613 |
if has modules-rebuild ${FEATURES}; |
614 |
set_arch_to_kernel |
614 |
then |
615 |
ABI="${KERNEL_ABI}" |
615 |
find /lib/modules/ -iname build | xargs -n 1 dirname | while read k; |
616 |
|
|
|
617 |
BUILD_TARGETS=${BUILD_TARGETS:-clean module} |
618 |
strip_modulenames; |
619 |
cd "${S}" |
620 |
for i in ${MODULE_NAMES} |
621 |
do |
622 |
unset libdir srcdir objdir |
623 |
for n in $(find_module_params ${i}) |
624 |
do |
616 |
do |
625 |
eval ${n/:*}=${n/*:/} |
617 |
if [ ! -e "$k/build/Makefile" ]; then |
626 |
done |
618 |
ewarn "Skipping ${k:13} because of missing it\`s sourcedir(Makefile)" |
627 |
libdir=${libdir:-misc} |
619 |
continue |
628 |
srcdir=${srcdir:-${S}} |
|
|
629 |
objdir=${objdir:-${srcdir}} |
630 |
|
631 |
if [ ! -f "${srcdir}/.built" ]; |
632 |
then |
633 |
cd ${srcdir} |
634 |
einfo "Preparing ${modulename} module" |
635 |
if [[ -n ${ECONF_PARAMS} ]] |
636 |
then |
637 |
econf ${ECONF_PARAMS} || \ |
638 |
die "Unable to run econf ${ECONF_PARAMS}" |
639 |
fi |
620 |
fi |
|
|
621 |
local modulename libdir srcdir objdir i n myABI="${ABI}" |
622 |
set_arch_to_kernel |
623 |
ABI="${KERNEL_ABI}" |
624 |
|
625 |
BUILD_TARGETS=${BUILD_TARGETS:-module} |
626 |
strip_modulenames; |
627 |
for i in ${MODULE_NAMES} |
628 |
do |
629 |
cd "${S}" |
630 |
unset libdir srcdir objdir |
631 |
for n in $(find_module_params ${i}) |
632 |
do |
633 |
eval ${n/:*}=${n/*:/} |
634 |
done |
635 |
libdir=${libdir:-misc} |
636 |
srcdir=${srcdir:-${S}} |
637 |
objdir=${objdir:-${srcdir}} |
638 |
|
639 |
cd ${srcdir} |
640 |
einfo "Preparing ${modulename} module for ${k:13}" |
641 |
if [[ -n ${ECONF_PARAMS} ]]; |
642 |
then |
643 |
if ! econf ${ECONF_PARAMS}; |
644 |
then |
645 |
eerror "Unable to run econf ${ECONF_PARAMS}" |
646 |
break |
647 |
fi |
648 |
fi |
640 |
|
649 |
|
641 |
# This looks messy, but it is needed to handle multiple variables |
650 |
# This looks messy, but it is needed to handle multiple variables |
642 |
# being passed in the BUILD_* stuff where the variables also have |
651 |
# being passed in the BUILD_* stuff where the variables also have |
643 |
# spaces that must be preserved. If don't do this, then the stuff |
652 |
# spaces that must be preserved. If don't do this, then the stuff |
644 |
# inside the variables gets used as targets for Make, which then |
653 |
# inside the variables gets used as targets for Make, which then |
645 |
# fails. |
654 |
# fails. |
646 |
eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \ |
655 |
einfo `pwd` |
|
|
656 |
if ! eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \ |
657 |
CROSS_COMPILE=${CHOST}- \ |
658 |
LDFLAGS=\"$(get_abi_LDFLAGS)\" \ |
659 |
${BUILD_FIXES} \ |
660 |
${BUILD_PARAMS} \ |
661 |
${BUILD_TARGETS} SYSOUT=\"${k}/build\" |
662 |
SYSSRC=\"${k}/build\""; |
663 |
then |
664 |
eerror "Unable to emake HOSTCC="$(tc-getBUILD_CC)" |
665 |
CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" |
666 |
${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}" |
667 |
break |
668 |
fi |
669 |
einfo "Installing ${modulename} module for ${k:13}" |
670 |
cd ${objdir} |
671 |
insinto ${k}/${libdir} |
672 |
if doins ${modulename}.${KV_OBJ} |
673 |
then |
674 |
touch ${T}/.built_one |
675 |
else |
676 |
eerror "doins ${modulename}.${KV_OBJ} failed" |
677 |
break |
678 |
fi |
679 |
done |
680 |
done |
681 |
#Check if we built at least one module: |
682 |
if [ ! -f ${T}/.built_one ]; |
683 |
then |
684 |
die "Fail to build any kernel module! :-(" |
685 |
fi |
686 |
mv ${D}/lib/modules ${T}/kernel-modules |
687 |
else |
688 |
local modulename libdir srcdir objdir i n myABI="${ABI}" |
689 |
set_arch_to_kernel |
690 |
ABI="${KERNEL_ABI}" |
691 |
|
692 |
BUILD_TARGETS=${BUILD_TARGETS:-clean module} |
693 |
strip_modulenames; |
694 |
cd "${S}" |
695 |
for i in ${MODULE_NAMES} |
696 |
do |
697 |
unset libdir srcdir objdir |
698 |
for n in $(find_module_params ${i}) |
699 |
do |
700 |
eval ${n/:*}=${n/*:/} |
701 |
done |
702 |
libdir=${libdir:-misc} |
703 |
srcdir=${srcdir:-${S}} |
704 |
objdir=${objdir:-${srcdir}} |
705 |
|
706 |
if [ ! -f "${srcdir}/.built" ]; |
707 |
then |
708 |
cd ${srcdir} |
709 |
einfo "Preparing ${modulename} module" |
710 |
if [[ -n ${ECONF_PARAMS} ]] |
711 |
then |
712 |
econf ${ECONF_PARAMS} || \ |
713 |
die "Unable to run econf ${ECONF_PARAMS}" |
714 |
fi |
715 |
|
716 |
# This looks messy, but it is needed to handle multiple variables |
717 |
# being passed in the BUILD_* stuff where the variables also have |
718 |
# spaces that must be preserved. If don't do this, then the stuff |
719 |
# inside the variables gets used as targets for Make, which then |
720 |
# fails. |
721 |
eval "emake HOSTCC=\"$(tc-getBUILD_CC)\" \ |
647 |
CROSS_COMPILE=${CHOST}- \ |
722 |
CROSS_COMPILE=${CHOST}- \ |
648 |
LDFLAGS=\"$(get_abi_LDFLAGS)\" \ |
723 |
LDFLAGS=\"$(get_abi_LDFLAGS)\" \ |
649 |
${BUILD_FIXES} \ |
724 |
${BUILD_FIXES} \ |
650 |
${BUILD_PARAMS} \ |
725 |
${BUILD_PARAMS} \ |
651 |
${BUILD_TARGETS} " \ |
726 |
${BUILD_TARGETS} " \ |
652 |
|| die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} ${BUILD_PARAMS} ${BUILD_TARGETS}" |
727 |
|| die "Unable to emake HOSTCC="$(tc-getBUILD_CC)" |
653 |
cd ${OLDPWD} |
728 |
CROSS_COMPILE=${CHOST}- LDFLAGS="$(get_abi_LDFLAGS)" ${BUILD_FIXES} |
654 |
touch ${srcdir}/.built |
729 |
${BUILD_PARAMS} ${BUILD_TARGETS}" |
655 |
fi |
730 |
cd ${OLDPWD} |
656 |
done |
731 |
touch ${srcdir}/.built |
657 |
|
732 |
fi |
|
|
733 |
done |
734 |
fi |
735 |
cd ${OLDPWD} |
658 |
set_arch_to_portage |
736 |
set_arch_to_portage |
659 |
ABI="${myABI}" |
737 |
ABI="${myABI}" |
660 |
} |
738 |
} |
Lines 676-700
Link Here
|
676 |
local modulename libdir srcdir objdir i n |
754 |
local modulename libdir srcdir objdir i n |
677 |
|
755 |
|
678 |
strip_modulenames; |
756 |
strip_modulenames; |
679 |
for i in ${MODULE_NAMES} |
757 |
if has modules-rebuild ${FEATURES}; |
680 |
do |
758 |
then |
681 |
unset libdir srcdir objdir |
759 |
mkdir -p ${D}/lib |
682 |
for n in $(find_module_params ${i}) |
760 |
cp -a ${T}/kernel-modules ${D}/lib/modules || die "Kernel module installation failed" |
|
|
761 |
else |
762 |
for i in ${MODULE_NAMES} |
683 |
do |
763 |
do |
684 |
eval ${n/:*}=${n/*:/} |
764 |
unset libdir srcdir objdir |
685 |
done |
765 |
for n in $(find_module_params ${i}) |
686 |
libdir=${libdir:-misc} |
766 |
do |
687 |
srcdir=${srcdir:-${S}} |
767 |
eval ${n/:*}=${n/*:/} |
688 |
objdir=${objdir:-${srcdir}} |
768 |
done |
689 |
|
769 |
libdir=${libdir:-misc} |
690 |
einfo "Installing ${modulename} module" |
770 |
srcdir=${srcdir:-${S}} |
691 |
cd ${objdir} || die "${objdir} does not exist" |
771 |
objdir=${objdir:-${srcdir}} |
692 |
insinto /lib/modules/${KV_FULL}/${libdir} |
772 |
|
693 |
doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" |
773 |
einfo "Installing ${modulename} module" |
694 |
cd ${OLDPWD} |
774 |
cd ${objdir} || die "${objdir} does not exist" |
|
|
775 |
insinto /lib/modules/${KV_FULL}/${libdir} |
776 |
doins ${modulename}.${KV_OBJ} || die "doins ${modulename}.${KV_OBJ} failed" |
777 |
cd ${OLDPWD} |
695 |
|
778 |
|
696 |
generate_modulesd ${objdir}/${modulename} |
779 |
generate_modulesd ${objdir}/${modulename} |
697 |
done |
780 |
done |
|
|
781 |
fi |
698 |
} |
782 |
} |
699 |
|
783 |
|
700 |
# @FUNCTION: linux-mod_pkg_preinst |
784 |
# @FUNCTION: linux-mod_pkg_preinst |