2009-08-16 08:35:34 +03:00
#
2007-03-24 15:42:54 +02:00
# Copyright (C) 2006-2007 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
KERNELNAME =
i f n e q ( , $( findstring x 86,$ ( BOARD ) ) )
KERNELNAME = "bzImage"
e n d i f
i f n e q ( , $( findstring rdc ,$ ( BOARD ) ) )
KERNELNAME = "bzImage"
e n d i f
2007-06-08 13:44:01 +03:00
i f n e q ( , $( findstring avr 32,$ ( BOARD ) ) )
KERNELNAME = "uImage"
e n d i f
2007-03-24 15:42:54 +02:00
KERNEL_MAKEOPTS := -C $( LINUX_DIR) \
CROSS_COMPILE = " $( KERNEL_CROSS) " \
ARCH = " $( LINUX_KARCH) " \
2007-12-27 00:21:56 +02:00
KBUILD_HAVE_NLS = no \
2007-03-24 15:42:54 +02:00
CONFIG_SHELL = " $( BASH) "
2009-08-08 17:22:04 +03:00
i f d e f C O N F I G _ S T R I P _ K E R N E L _ E X P O R T S
KERNEL_MAKEOPTS += \
EXTRA_LDSFLAGS = " -I $( KERNEL_BUILD_DIR) -include symtab.h "
e n d i f
2007-10-23 09:23:29 +03:00
INITRAMFS_EXTRA_FILES ?= $( GENERIC_PLATFORM_DIR) /image/initramfs-base-files.txt
2007-10-23 09:23:23 +03:00
i f n e q ( , $( KERNEL_CC ) )
KERNEL_MAKEOPTS += CC = " $( KERNEL_CC) "
e n d i f
2007-06-03 11:28:05 +03:00
# defined in quilt.mk
Kernel/Patch : =$( Kernel /Patch /Default )
2007-11-20 15:21:01 +02:00
i f e q ( $( strip $ ( CONFIG_EXTERNAL_KERNEL_TREE ) ) , "" )
2008-10-10 13:07:45 +03:00
ifeq ( $( strip $( CONFIG_KERNEL_GIT_CLONE_URI) ) ,"" )
define Kernel/Prepare/Default
2007-06-21 18:50:01 +03:00
bzcat $( DL_DIR) /$( LINUX_SOURCE) | $( TAR) -C $( KERNEL_BUILD_DIR) $( TAR_OPTIONS)
2007-06-03 11:28:05 +03:00
$( Kernel/Patch)
2008-08-27 17:14:00 +03:00
touch $( LINUX_DIR) /.quilt_used
2008-10-10 13:07:45 +03:00
endef
else
ifeq ( $( strip $( CONFIG_KERNEL_GIT_LOCAL_REPOSITORY) ) ,"" )
2007-11-20 15:21:01 +02:00
d e f i n e K e r n e l / P r e p a r e / D e f a u l t
2008-10-10 13:07:45 +03:00
git clone $( CONFIG_KERNEL_GIT_CLONE_URI) $( LINUX_DIR)
endef
else
define Kernel/Prepare/Default
2009-08-16 08:35:34 +03:00
git clone --reference $( CONFIG_KERNEL_GIT_LOCAL_REPOSITORY) $( CONFIG_KERNEL_GIT_CLONE_URI) $( LINUX_DIR)
2008-10-10 13:07:45 +03:00
endef
endif
e n d i f
e l s e
define Kernel/Prepare/Default
2007-11-20 15:21:01 +02:00
mkdir -p $( KERNEL_BUILD_DIR)
if [ -d $( LINUX_DIR) ] ; then \
rmdir $( LINUX_DIR) ; \
fi
ln -s $( CONFIG_EXTERNAL_KERNEL_TREE) $( LINUX_DIR)
2008-10-10 13:07:45 +03:00
endef
2007-11-20 15:21:01 +02:00
e n d i f
2007-03-24 15:42:54 +02:00
2008-07-06 01:11:22 +03:00
i f e q ( $( KERNEL ) , 2 . 6 )
ifeq ( $( CONFIG_TARGET_ROOTFS_INITRAMFS) ,y)
define Kernel/SetInitramfs
mv $( LINUX_DIR) /.config $( LINUX_DIR) /.config.old
2009-11-11 03:25:02 +02:00
grep -v -e INITRAMFS -e CONFIG_RD_ -e CONFIG_BLK_DEV_INITRD $( LINUX_DIR) /.config.old > $( LINUX_DIR) /.config
echo 'CONFIG_BLK_DEV_INITRD=y' >> $( LINUX_DIR) /.config
2008-07-06 01:11:22 +03:00
echo 'CONFIG_INITRAMFS_SOURCE="$(strip $(TARGET_DIR) $(INITRAMFS_EXTRA_FILES))"' >> $( LINUX_DIR) /.config
echo 'CONFIG_INITRAMFS_ROOT_UID=$(shell id -u)' >> $( LINUX_DIR) /.config
echo 'CONFIG_INITRAMFS_ROOT_GID=$(shell id -g)' >> $( LINUX_DIR) /.config
2009-08-16 08:35:34 +03:00
echo " $( if $( CONFIG_TARGET_INITRAMFS_COMPRESSION_NONE) ,CONFIG_INITRAMFS_COMPRESSION_NONE= y,# CONFIG_INITRAMFS_COMPRESSION_NONE is not set ) " >> $( LINUX_DIR) /.config
echo -e " $( if $( CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP) ,CONFIG_INITRAMFS_COMPRESSION_GZIP= y\n CONFIG_RD_GZIP= y,# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set\n # CONFIG_RD_GZIP is not set)" >> $(LINUX_DIR)/.config
echo -e " $( if $( CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2) ,CONFIG_INITRAMFS_COMPRESSION_BZIP2= y\n CONFIG_RD_BZIP2= y,# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set\n # CONFIG_RD_BZIP2 is not set)" >> $(LINUX_DIR)/.config
echo -e " $( if $( CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA) ,CONFIG_INITRAMFS_COMPRESSION_LZMA= y\n CONFIG_RD_LZMA= y,# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set\n # CONFIG_RD_LZMA is not set)" >> $(LINUX_DIR)/.config
2009-11-21 17:20:11 +02:00
echo -e " $( if $( CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO) ,CONFIG_INITRAMFS_COMPRESSION_LZO= y\n CONFIG_RD_LZO= y,# CONFIG_INITRAMFS_COMPRESSION_LZO is not set\n # CONFIG_RD_LZO is not set)" >> $(LINUX_DIR)/.config
2008-07-06 01:11:22 +03:00
endef
else
define Kernel/SetInitramfs
mv $( LINUX_DIR) /.config $( LINUX_DIR) /.config.old
grep -v INITRAMFS $( LINUX_DIR) /.config.old > $( LINUX_DIR) /.config
echo 'CONFIG_INITRAMFS_SOURCE=""' >> $( LINUX_DIR) /.config
endef
endif
e n d i f
2007-03-24 15:42:54 +02:00
d e f i n e K e r n e l / C o n f i g u r e / 2 . 4
$( SED) "s,\-mcpu=,\-mtune=,g;" $( LINUX_DIR) /arch/mips/Makefile
2008-08-16 19:59:47 +03:00
$( _SINGLE) $( MAKE) $( KERNEL_MAKEOPTS) oldconfig include/linux/compile.h include/linux/version.h
$( _SINGLE) $( MAKE) $( KERNEL_MAKEOPTS) dep
2007-03-24 15:42:54 +02:00
e n d e f
d e f i n e K e r n e l / C o n f i g u r e / 2 . 6
2008-08-16 19:59:47 +03:00
-$( _SINGLE) $( MAKE) $( KERNEL_MAKEOPTS) oldconfig prepare scripts
2007-03-24 15:42:54 +02:00
e n d e f
d e f i n e K e r n e l / C o n f i g u r e / D e f a u l t
2007-09-08 22:55:42 +03:00
$( LINUX_CONFCMD) > $( LINUX_DIR) /.config.target
2009-01-20 23:09:04 +02:00
echo " $( if $( CONFIG_KERNEL_KALLSYMS) ,CONFIG_KALLSYMS= y,# CONFIG_KALLSYMS is not set ) " >> $( LINUX_DIR) /.config.target
2009-01-30 01:52:35 +02:00
echo " $( if $( CONFIG_KERNEL_PROFILING) ,CONFIG_PROFILING= y,# CONFIG_PROFILING is not set ) " >> $( LINUX_DIR) /.config.target
2009-09-08 10:25:20 +03:00
echo " $( if $( CONFIG_KERNEL_DEBUG_FS) ,CONFIG_DEBUG_FS= y,# CONFIG_DEBUG_FS is not set ) " >> $( LINUX_DIR) /.config.target
2009-01-20 23:09:04 +02:00
echo "# CONFIG_KALLSYMS_EXTRA_PASS is not set" >> $( LINUX_DIR) /.config.target
2009-02-14 16:10:44 +02:00
echo "# CONFIG_KALLSYMS_ALL is not set" >> $( LINUX_DIR) /.config.target
2009-01-20 23:09:04 +02:00
echo "# CONFIG_KPROBES is not set" >> $( LINUX_DIR) /.config.target
2009-02-21 18:26:27 +02:00
$( SED) 's,.*CONFIG_AEABI.*,$(if $(CONFIG_EABI_SUPPORT),CONFIG_AEABI=y,# CONFIG_AEABI is not set),' $( LINUX_DIR) /.config.target
$( if $( CONFIG_EABI_SUPPORT) ,echo '# CONFIG_OABI_COMPAT is not set' >> $( LINUX_DIR) /.config.target)
2007-07-18 14:31:01 +03:00
$( SCRIPT_DIR) /metadata.pl kconfig $( TMP_DIR) /.packageinfo $( TOPDIR) /.config > $( LINUX_DIR) /.config.override
2009-11-11 03:25:06 +02:00
$( SCRIPT_DIR) /kconfig.pl 'm+' '+' $( LINUX_DIR) /.config.target /dev/null $( LINUX_DIR) /.config.override > $( LINUX_DIR) /.config
2008-07-06 01:11:22 +03:00
$( call Kernel/SetInitramfs)
2007-03-24 15:42:54 +02:00
$( call Kernel/Configure/$( KERNEL) )
2007-03-24 19:05:26 +02:00
rm -rf $( KERNEL_BUILD_DIR) /modules
2007-03-24 15:42:54 +02:00
e n d e f
d e f i n e K e r n e l / C o m p i l e M o d u l e s / D e f a u l t
2007-04-26 01:26:40 +03:00
rm -f $( LINUX_DIR) /vmlinux $( LINUX_DIR) /System.map
2008-08-16 19:59:47 +03:00
+$( MAKE) $( KERNEL_MAKEOPTS) modules
2007-03-24 15:42:54 +02:00
e n d e f
2009-04-27 18:37:58 +03:00
OBJCOPY_STRIP = -R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
2009-02-02 18:39:28 +02:00
2007-03-24 15:42:54 +02:00
d e f i n e K e r n e l / C o m p i l e I m a g e / D e f a u l t
2008-07-06 01:11:22 +03:00
$( if $( CONFIG_TARGET_ROOTFS_INITRAMFS) ,,rm -f $( TARGET_DIR) /init)
2008-08-16 19:59:47 +03:00
+$( MAKE) $( KERNEL_MAKEOPTS) $( KERNELNAME)
2009-02-02 18:39:28 +02:00
$( KERNEL_CROSS) objcopy -O binary $( OBJCOPY_STRIP) -S $( LINUX_DIR) /vmlinux $( LINUX_KERNEL)
$( KERNEL_CROSS) objcopy $( OBJCOPY_STRIP) -S $( LINUX_DIR) /vmlinux $( KERNEL_BUILD_DIR) /vmlinux.elf
2007-03-24 15:42:54 +02:00
e n d e f
d e f i n e K e r n e l / C l e a n / D e f a u l t
rm -f $( KERNEL_BUILD_DIR) /linux-$( LINUX_VERSION) /.configured
rm -f $( LINUX_KERNEL)
2008-08-16 19:59:47 +03:00
$( _SINGLE) $( MAKE) -C $( KERNEL_BUILD_DIR) /linux-$( LINUX_VERSION) clean
2007-03-24 15:42:54 +02:00
e n d e f