You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
170 lines
4.8 KiB
170 lines
4.8 KiB
#!/bin/sh |
|
# --- T2-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# T2 SDE: package/.../linux24/linux24.conf |
|
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|
# Copyright (C) 1998 - 2003 Clifford Wolf |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This program is free software; you can redistribute it and/or modify |
|
# it under the terms of the GNU General Public License as published by |
|
# the Free Software Foundation; version 2 of the License. A copy of the |
|
# GNU General Public License can be found in the file COPYING. |
|
# --- T2-COPYRIGHT-NOTE-END --- |
|
|
|
. $base/package/*/linux*/linux-conf.in |
|
|
|
main_lx() { |
|
lx_patch |
|
lx_config |
|
|
|
hook_eval premake |
|
|
|
# we need to rerun the oldconfig since the used .config |
|
# might not match the one used in the last oldconfig run |
|
# (e.g. the nomods is run last - and normally the module |
|
# one is used) |
|
yes '' | eval $MAKE $makeopt oldconfig > /dev/null |
|
|
|
if [[ $treever = 24* ]] ; then |
|
echo "Creating dependencies ..." |
|
eval $MAKE $makeopt dep |
|
fi |
|
|
|
kerneldir="$PWD" |
|
moduledir="$root/lib/modules/${lx_kernelrelease}" |
|
|
|
echo "Cleanup kernel ..." |
|
eval $MAKE $makeopt clean > /dev/null |
|
|
|
cp -vf .config $root/boot/kconfig_${lx_kernelrelease} |
|
|
|
if [ -z "$SDEDEBUG_LINUX_SUBMODULES_ONLY" ] ; then |
|
|
|
var_append makeopt ' ' vmlinux |
|
if grep -q "CONFIG_MODULES=y" .config ; then |
|
var_append makeopt ' ' modules |
|
var_append makeinstopt ' ' "INSTALL_MOD_PATH=$root DEPMOD=/bin/true modules_install" |
|
else |
|
makeinstopt= |
|
fi |
|
|
|
case "$lx_cpu" in |
|
i386|x86_64) |
|
var_append makeopt ' ' bzImage ;; |
|
mips) |
|
var_append makeopt ' ' vmlinux.ecoff ;; |
|
ppc|sh) |
|
var_append makeopt ' ' zImage ;; |
|
sparc*) |
|
var_append makeopt ' ' image ;; |
|
esac |
|
|
|
echo "Building the kernel ..." |
|
eval $MAKE $makeopt |
|
cp -vf System.map $root/boot/System.map_${lx_kernelrelease} |
|
|
|
hook_eval inmake |
|
|
|
[ "$makeinstopt" ] && eval $MAKE $makeinstopt |
|
|
|
echo "Installing the kernel ..." |
|
# for debugging with oprofile, also used to boot on some arches |
|
cp -vf vmlinux $root/boot/vmlinux_${lx_kernelrelease} |
|
case "$lx_cpu" in |
|
i386|x86_64) |
|
cp -vf arch/${lx_cpu}/boot/bzImage $root/boot/vmlinuz_${lx_kernelrelease} |
|
;; |
|
alpha) |
|
gzip < vmlinux > $root/boot/vmlinux_${lx_kernelrelease}.gz |
|
;; |
|
mips) |
|
cp -vf vmlinux.ecoff $root/boot/vmlinux_${lx_kernelrelease}.ecoff |
|
;; |
|
ppc) |
|
for x in arch/ppc/boot/images/zImage.* ; do |
|
cp -v $x $root/boot/${x/*\//}-${lx_kernelrelease} |
|
done |
|
;; |
|
sh) |
|
cp -vf arch/sh/boot/zImage $root/boot/vmlinux_${lx_kernelrelease} |
|
;; |
|
sparc*) |
|
cp -vf arch/$lx_cpu/boot/image $root/boot/vmlinux_${lx_kernelrelease} |
|
;; |
|
esac |
|
else |
|
eval $MAKE $makeopt scripts |
|
touch $root/boot/System.map_${lx_kernelrelease} |
|
mkdir -p $moduledir |
|
ln -sf $PWD $moduledir/build |
|
fi |
|
|
|
hook_eval postmake |
|
|
|
# iterate over the packages that provide 3rd party linux kernel modules |
|
if grep -q "CONFIG_MODULES=y" .config ; then |
|
module_error=0 |
|
echo_status "Registered 3rd party kernel modules:" |
|
for x in $lx_3rd_party_modules ; do |
|
echo "Sub-building 3rd party module package $x ..." |
|
pushd $builddir |
|
# ugly, bash does not abort properly when we have this in a if |
|
# and without it the return 1 aborts immediatly ... :-( |
|
set +e |
|
build_package $x postlinux.conf |
|
error=$? |
|
set -e |
|
if [ $error -ne 0 ]; then |
|
echo_warning "Failed building $x." |
|
module_error=1 |
|
fi |
|
echo "Done building $x" |
|
popd |
|
done |
|
|
|
# maybe fail hard |
|
if ! atstage rebuild && [ $module_error = 1 ]; then |
|
abort "At least one of the 3rd party kernel modules failed!" |
|
fi |
|
|
|
if atstage native; then |
|
echo "Running 'depmod -a -q -F /boot/System.map ${lx_kernelrelease}' ..." |
|
depmod -a -q -F $root/boot/System.map_${lx_kernelrelease} ${lx_kernelrelease} |
|
|
|
# due static depmod :-( |
|
for x in $moduledir/modules.* |
|
do [ -f $x ] && add_flist $x; done |
|
|
|
[ -z "`type -p mkinitrd`" ] || mkinitrd ${lx_kernelrelease} |
|
else |
|
# In theory depmod here as well ... |
|
[ ! -e $root/sbin/mkinitrd ] || sh $root/sbin/mkinitrd -R $root ${lx_kernelrelease} |
|
fi |
|
|
|
echo "Fixing /lib/modules/${ver}/build symlink ..." |
|
rm -f $root/lib/modules/${lx_kernelrelease}/build |
|
ln -sf ../../../usr/src/linux-${lx_kernelrelease} \ |
|
$root/lib/modules/${lx_kernelrelease}/build |
|
fi |
|
|
|
echo "Copying kernel patches ..." |
|
( |
|
cd $root/usr/src/ |
|
rm -rf linux$treever-patches ; mkdir -p linux$treever-patches |
|
echo -e "This directory contains all the applied patches, used\n\ |
|
to build the kernel (in addition to the official kernel sources)." > \ |
|
linux$treever-patches/README |
|
for x in $patchfiles ; do |
|
# if the patch does not exist it was downloaded or so |
|
# and we just do not copy it ... |
|
[ -f $x ] && cp -v $x linux$treever-patches/ || true |
|
done |
|
) |
|
} |
|
|
|
custmain="main_lx" |
|
autopatch=0 |
|
|
|
|