Hitchhiker Linux source tree
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.
 
 
 
 
 
 

77 lines
2.6 KiB

# Makefile - hhl - /usr/src/world/linux-mainline
# Copyright 2020 Nathan Fisher <nfisher.sr@gmail.com>
#
distname = linux
default_goal = installkernel
include world.mk
srcdir = $(basedir)/build/src-world-$(arch)/linux-$(linux_version)
objdir = $(basedir)/build/obj-world-$(arch)/linux-$(linux_version)
config ?= $(wkgdir)/config-$(arch)-$(linux_version).config
ifeq ($(filter x86_64 i486 i586 i686 i786, $(arch)), $(arch))
_arch = x86
image = bzImage
else ifeq ($(arch), armv7l)
_arch = arm
image = zImage
else
image = Image.gz
endif
ifeq ($(arch), aarch64)
_arch = arm64
else ifeq ($(arch), riscv64)
_arch = riscv
endif
installkernel: $(objdir)/.installed
buildkernel: $(objdir)/.built
$(objdir)/.mrproper: $(srcdir)/.dirstamp | $(objdir)
$(MAKE) -C ${srcdir} mrproper
touch $@
$(objdir)/.config: $(objdir)/.mrproper
$(info $(grn)=== Applying default kernel config ===$(reset))
cat ${config} > $(objdir)/.config
KBUILD_OUTPUT=$(objdir) $(MAKE) -C $(srcdir) ARCH=$(_arch) CROSS_COMPILE=$(tgt)- olddefconfig
menuconfig: $(objdir)/.mrproper
$(info $(grn)=== Applying default kernel config ===$(reset))
cat ${config} > $(objdir)/.config
KBUILD_OUTPUT=$(objdir) $(MAKE) -C $(srcdir) ARCH=$(_arch) CROSS_COMPILE=$(tgt)- olddefconfig
KBUILD_OUTPUT=$(objdir) $(MAKE) -C $(srcdir) ARCH=$(_arch) CROSS_COMPILE=$(tgt)- menuconfig
$(objdir)/.built: $(objdir)/.config
$(info $(grn)=== Building Linux kernel ===$(reset))
KBUILD_OUTPUT=$(objdir) $(MAKE) $(makeflags) ARCH=$(_arch) CROSS_COMPILE=$(tgt)- -C $(srcdir)
touch $@
$(objdir)/.modules_installed: $(objdir)/.built
$(info $(grn)=== Installing kernel modules ===$(reset))
KBUILD_OUTPUT=$(objdir) INSTALL_MOD_PATH=$(DESTDIR) $(MAKE) -C $(srcdir) modules_install
touch $@
$(objdir)/.docs_installed: $(objdir)/.built
$(info $(grn)=== Installing kernel documentation ===$(reset))
install -d $(docdir)/linux-$(linux_version)
cp -r $(srcdir)/Documentation/* $(docdir)/linux-$(linux_version)
touch $@
$(objdir)/.installed: $(objdir)/.modules_installed $(objdir)/.docs_installed
$(info $(grn)=== Installing kernel ===$(reset))
install -m644 $(objdir)/arch/$(_arch)/boot/$(image) $(DESTDIR)/boot/vmlinuz-$(linux_version)-$(os_abbrev)-$(os_version)
install -m644 $(objdir)/System.map $(DESTDIR)/boot/System.map-$(linux_version)
install -m644 $(objdir)/.config $(DESTDIR)/boot/config-$(linux_version)
touch $@
$(objdir):
install -d $(objdir)
$(srcdir)/.dirstamp:
$(info $(grn)=== Extracting $(distlocal) ===$(reset))
tar -xf $(distlocal) -C $(basedir)/build/src-world-$(arch)
touch $@
.PHONY: buildkernel installkernel