blob: 96c7a01c6515931186a69169b5ade22fea708095 [file] [log] [blame]
#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
export DH_VERBOSE = 1
VERSION := 4.4.22-mtk
ARCH := arm64
CROSS_COMPILE := aarch64-linux-gnu-
KERNEL_OPTIONS := \
ARCH=${ARCH} \
CROSS_COMPILE=${CROSS_COMPILE} \
LOCALVERSION=-mtk
LDFLAGS :=
BUILD_DIR := $(CURDIR)/debian/build
DESTDIR := $(CURDIR)/debian/linux-image-$(VERSION)
DESTDIR_HEADERS := $(CURDIR)/debian/linux-headers-$(VERSION)
DESTDIR_KBUILD := $(CURDIR)/debian/linux-kbuild-$(VERSION)
%:
dh $@ --with=systemd
override_dh_auto_clean:
true
override_dh_auto_build:
+make $(KERNEL_OPTIONS) mt8167s_excelsior_defconfig
+make $(KERNEL_OPTIONS) olddefconfig
+make $(KERNEL_OPTIONS) -j$(shell nproc) Image modules dtbs
$(CROSS_COMPILE)objcopy -O binary -R .note -R .comment -S vmlinux linux.bin
/boot/compress_lz4.sh linux.bin
cp /boot/kernel-fit-image.its .
mtk-mkimage -D "-I dts -O dtb -p 1024" -k /boot/keys -f kernel-fit-image.its boot.img
override_dh_auto_install:
+make $(KERNEL_OPTIONS) INSTALL_MOD_PATH=$(DESTDIR) modules_install
rm $(DESTDIR)/lib/modules/$(VERSION)/build
rm $(DESTDIR)/lib/modules/$(VERSION)/source
install -d $(DESTDIR)/boot
install -p -m 655 boot.img $(DESTDIR)/boot
install -d $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)
install -d $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)/arch/arm
install -d $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)/arch/$(ARCH)/kernel
cp -a .config $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)
cp -a Module.symvers $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)
cp -a include $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)
cp -a arch/$(ARCH)/include $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)/arch/$(ARCH)
cp -a arch/arm/include $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)/arch/arm
cp -a Makefile $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)
( \
find arch/$(ARCH) -maxdepth 1 -name 'Makefile*' -print; \
find arch/$(ARCH) \( -name 'module.lds' -o -name 'Kbuild.platforms' -o -name 'Platform' \) -print; \
find $$(find arch/$(ARCH) \( -name include -o -name scripts \) -type d -print) -print; \
) | cpio -pdm $(DESTDIR_HEADERS)/usr/src/linux-headers-$(VERSION)
install -d $(DESTDIR_HEADERS)/lib/modules/$(VERSION)
ln -s /usr/src/linux-headers-$(VERSION) $(DESTDIR_HEADERS)/lib/modules/$(VERSION)/build
override_dh_systemd_enable:
dh_systemd_enable --name=linux-mtk
override_dh_sytemd_start:
dh_systemd_start --restart-after-upgrade linux-mtk