Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 149 lines (125 sloc) 6 KB
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
UPLOADER := $(shell dpkg-parsechangelog | sed -ne 's,^Maintainer: .[^<]*<\([^>]*\)>,\1,p')
DEB_VERSION := $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
DEB_NOEPOCH_VERSION := $(shell echo $(DEB_VERSION) | cut -d: -f2-)
DEB_UPSTREAM_VERSION := $(shell echo $(DEB_NOEPOCH_VERSION) | sed 's/-[^-]*$$//')
DEB_REVISION := $(shell echo $(DEB_NOEPOCH_VERSION) | cut -d- -f2-)
ABINAME=$(DEB_NOEPOCH_VERSION)
UPSTREAMVERSION=2.6.39
DEB_BUILD_ARCH := $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_HOST_ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_HOST_ARCH_CPU := $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
KERNEL_ARCH := $(shell dpkg-architecture -qDEB_HOST_GNU_CPU)
BUILD_DIR=debian/build
export DEB_HOST_ARCH DEB_HOST_GNU_TYPE DEB_BUILD_ARCH
setup_env := env -u ABINAME -u ARCH -u FEATURESET -u FLAVOUR -u VERSION -u LOCALVERSION
setup_env += DISTRIBUTION_OFFICIAL_BUILD=1 DISTRIBUTION_UPLOADER=$(UPLOADER) DISTRIBUTION_VERSION="$(DEB_VERSION)"
MAKE_CLEAN = $(setup_env) $(MAKE)
ifeq ($(DEB_HOST_ARCH),armel)
PACKAGE=bubba3-kernel
HEADER_PACKAGE=bubba3-kernel-headers-armel
CONFIG=bubba3_defconfig
else ifeq ($(DEB_HOST_ARCH),powerpc)
PACKAGE=bubba3-kernel
HEADER_PACKAGE=bubba3-kernel-headers-powerpc
CONFIG=bubbatwo_defconfig
endif
PACKAGE_DIR=debian/$(PACKAGE)
%:
+dh $@ --parallel
define REAL_VERSION
$(shell cat $(SOURCE_DIR)/include/config/kernel.release)
endef
define device_tree_compile
dtc -b 0 -V 17 -R 4 -S 0x3000 -I dts -O dtb -f $(strip $(1)) > $(addsuffix .dtb,$(basename $(strip $(1))))
endef
override_dh_auto_configure: SOURCE_FILES = $(filter-out debian .git .pc, $(wildcard * .[^.]*))
override_dh_auto_configure: SOURCE_DIR=$(BUILD_DIR)/source
override_dh_auto_configure:
rm -rf '$(SOURCE_DIR)'
mkdir -p '$(SOURCE_DIR)'
cp -al $(SOURCE_FILES) '$(SOURCE_DIR)'
chmod -R u+rw,go=rX '$(SOURCE_DIR)'
touch '$(SOURCE_DIR)/.scmversion'
echo '-$(DEB_REVISION)' > '$(SOURCE_DIR)/localversion'
echo 'override ARCH = $(DEB_HOST_ARCH_CPU)' >> '$(SOURCE_DIR)/.kernelvariables'
echo 'override KERNELRELEASE = $(ABINAME)' >> '$(SOURCE_DIR)/.kernelvariables'
ifneq (,$(findstring ccache,$(DEB_BUILD_OPTIONS)))
echo 'CCACHE = ccache' >> '$(SOURCE_DIR)/.kernelvariables'
echo 'CC =ccache $$(CROSS_COMPILE)gcc' >> '$(SOURCE_DIR)/.kernelvariables'
endif
ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH))
echo 'override CROSS_COMPILE = $(DEB_HOST_GNU_TYPE)-' >> '$(SOURCE_DIR)/.kernelvariables'
endif
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' $(CONFIG)
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' prepare
override_dh_auto_install: SOURCE_DIR=$(BUILD_DIR)/source
override_dh_auto_install: install_headers
override_dh_auto_install:
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' INSTALL_MOD_PATH='$(CURDIR)/$(PACKAGE_DIR)' INSTALL_MOD_STRIP=1 modules_install
mkdir -p debian/$(PACKAGE)/boot
cp '$(SOURCE_DIR)'/arch/$(DEB_HOST_ARCH_CPU)/boot/uImage debian/$(PACKAGE)/boot
cp '$(SOURCE_DIR)'/.config $(PACKAGE_DIR)/boot/config-$(call REAL_VERSION)
cp '$(SOURCE_DIR)'/System.map $(PACKAGE_DIR)/boot/System.map-$(call REAL_VERSION)
find $(PACKAGE_DIR)/lib/modules/$(call REAL_VERSION)/ -mindepth 1 -maxdepth 1 \! -name kernel \! -name modules.order -exec rm {} \+
rm $(PACKAGE_DIR)/lib/firmware -rf
ifeq ($(DEB_HOST_ARCH),powerpc)
cp debian/dts/*.dtb debian/$(PACKAGE)/boot
endif
install_headers: PACKAGE_NAME = $(HEADER_PACKAGE)
install_headers: BASE_DIR = /usr/src/$(PACKAGE_NAME)
install_headers: PACKAGE_DIR = debian/$(PACKAGE_NAME)
install_headers: INSTALL_DIR = $(PACKAGE_DIR)/$(BASE_DIR)
install_headers: DH_OPTIONS = -p$(PACKAGE_NAME) -a$(DEB_HOST_ARCH)
install_headers: SOURCE_DIR=$(BUILD_DIR)/source
install_headers:
cd $(SOURCE_DIR); \
( \
echo Makefile; \
find . -path './scripts/*' -prune -o -path './Documentation/*' -prune -o -type f \( -name Makefile -o -name 'Kconfig*' \) -print; \
find arch/$(KERNEL_ARCH) -name 'module.lds' -print; \
find $$(find arch/$(KERNEL_ARCH) \( -name include -o -name scripts \) -type d -print) -print; \
find include -name 'asm*' -prune -o -print; \
find include/asm-generic -print; \
) \
| \
cpio -pd --preserve-modification-time '$(CURDIR)/$(INSTALL_DIR)'
cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/include $(INSTALL_DIR)/arch/$(KERNEL_ARCH)
cp -a $(wildcard $(addprefix $(SOURCE_DIR)/,.config .kernel* Module.symvers include scripts)) $(INSTALL_DIR)
cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/kernel/asm-offsets.s $(INSTALL_DIR)/arch/$(KERNEL_ARCH)/kernel
ifeq ($(DEB_HOST_ARCH),powerpc)
if [ -f $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o ]; then \
mkdir $(INSTALL_DIR)/arch/$(KERNEL_ARCH)/lib; \
cp -a $(SOURCE_DIR)/arch/$(KERNEL_ARCH)/lib/crtsavres.o $(INSTALL_DIR)/arch/$(KERNEL_ARCH)/lib; \
fi
endif
mkdir -p $(PACKAGE_DIR)/lib/modules/$(call REAL_VERSION)
ln -s /usr/src/$(PACKAGE_NAME) $(PACKAGE_DIR)/lib/modules/$(call REAL_VERSION)/build
override_dh_auto_build: SOURCE_DIR=$(BUILD_DIR)/source
override_dh_auto_build:
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)'
+$(MAKE_CLEAN) -C '$(SOURCE_DIR)' uImage
ifeq ($(DEB_HOST_ARCH),powerpc)
$(call device_tree_compile, debian/dts/bubba.dts)
$(call device_tree_compile, debian/dts/8313E21.dts)
endif
override_dh_clean: SOURCE_DIR=$(BUILD_DIR)/source
override_dh_clean:
rm -f debian/dts/*.dtb
rm -rf $(SOURCE_DIR)
make clean
rm -rf include/config/ include/generated/
rm -f scripts/basic/docproc scripts/basic/fixdep scripts/kconfig/conf scripts/kconfig/lex.zconf.c scripts/kconfig/zconf.hash.c scripts/kconfig/zconf.tab.c
dh_clean $@
override_dh_auto_clean: SOURCE_DIR=$(BUILD_DIR)/source
override_dh_auto_clean:
+test ! -e $(SOURCE_DIR) || $(MAKE_CLEAN) -C '$(SOURCE_DIR)' clean