From: Roland Hieber <rhi@pengutronix.de>
To: distrokit@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [DistroKit] [PATCH v2 6/8] mips, mipsel: kernel: re-fork from PTXdist 2021.10.0
Date: Sun, 24 Oct 2021 21:54:51 +0200 [thread overview]
Message-ID: <20211024195451.11141-1-rhi@pengutronix.de> (raw)
In-Reply-To: <20211024194534.6704-6-rhi@pengutronix.de>
The kernel recipe is currently only used for its config file, which
serves as a REF_CONFIG for the extra kernel packages. However the kernel
recipe has changed quite a bit upstream since it was last forked, and
especially the KERNEL_*_OPT variables form a public interface for other
recipes too (even though we currently don't have any in DistroKit). More
importantly, upstream has introduced options to keep the config diffs
clean when using newer GCC versions in combination with newer kernel
versions:
* commit d57abb42 ("kernel: fix disabling gcc plugins for >= v5.11")
* commit 114fecbd ("kernel: really fix disabling gcc plugins for >= v5.11")
* commit 533f7709 ("kernel/kernel-template: set PTXDIST_NO_GCC_PLUGINS=1 in _MAKE_ENV as well")
Furthermore, the upstream recipe also installs the perf and iio
userspace tools, which could be helpful for debugging.
To make porting upstream patches to the kernel recipe easier in the
future, re-fork it from the current PTXdist version, and then re-do our
changes cleanly in the next commit. Update the platformconfig with all
new selectable features disabled.
Link: https://git.pengutronix.de/cgit/ptxdist/commit/?id=d57abb428d360e0
Link: https://git.pengutronix.de/cgit/ptxdist/commit/?id=114fecbd4e97e97
Link: https://git.pengutronix.de/cgit/ptxdist/commit/?id=533f7709f61c54a
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
v1 -> v2:
* remove the sentence about symlinking the files, which turned out to
generate errors during the build. Rest of the series stays the same.
configs/platform-mips/platformconfig | 34 ++
configs/platform-mips/platforms/kernel.in | 330 +++++++++++++++++++-
configs/platform-mips/rules/kernel.make | 299 +++++++++++++++++-
configs/platform-mipsel/platformconfig | 39 +++
configs/platform-mipsel/platforms/kernel.in | 330 +++++++++++++++++++-
configs/platform-mipsel/rules/kernel.make | 299 +++++++++++++++++-
6 files changed, 1317 insertions(+), 14 deletions(-)
diff --git a/configs/platform-mips/platformconfig b/configs/platform-mips/platformconfig
index bae6671624c6..5ca070a4a0ab 100644
--- a/configs/platform-mips/platformconfig
+++ b/configs/platform-mips/platformconfig
@@ -109,9 +109,42 @@ PTXCONF_TARGET_EXTRA_LDFLAGS=""
# end of architecture
PTXCONF_KERNEL=y
+# PTXCONF_KERNEL_INSTALL is not set
+# PTXCONF_KERNEL_MODULES is not set
PTXCONF_KERNEL_VERSION="5.14"
PTXCONF_KERNEL_MD5="a082ef5748b813abca0649dab8be5f52"
+# PTXCONF_KERNEL_IMAGE_BZ is not set
+# PTXCONF_KERNEL_IMAGE_Z is not set
+# PTXCONF_KERNEL_IMAGE_XIP is not set
+# PTXCONF_KERNEL_IMAGE_U is not set
+# PTXCONF_KERNEL_IMAGE_VM is not set
+# PTXCONF_KERNEL_IMAGE_VMLINUX is not set
+PTXCONF_KERNEL_IMAGE_VMLINUZ=y
+# PTXCONF_KERNEL_IMAGE_RAW is not set
+# PTXCONF_KERNEL_IMAGE_SIMPLE is not set
+PTXCONF_KERNEL_IMAGE="vmlinuz"
+# PTXCONF_KERNEL_DTB is not set
+# PTXCONF_KERNEL_CODE_SIGNING is not set
+# PTXCONF_KERNEL_ZSTD is not set
+# PTXCONF_KERNEL_XZ is not set
PTXCONF_KERNEL_LZOP=y
+# PTXCONF_KERNEL_LZ4 is not set
+# PTXCONF_KERNEL_OPENSSL is not set
+# PTXCONF_KERNEL_LIBELF is not set
+# PTXCONF_KERNEL_GCC_PLUGINS is not set
+# PTXCONF_KERNEL_CONFIG_BASE_VERSION is not set
+
+#
+# patching & configuration
+#
+PTXCONF_KERNEL_SERIES="series"
+PTXCONF_KERNEL_CONFIG="kernelconfig"
+# end of patching & configuration
+
+#
+# Development features
+#
+PTXCONF_KERNEL_EXTRA_MAKEVARS=""
PTXCONF_HOST_DTC=y
PTXCONF_HOST_DTC_VERSION="1.6.0"
PTXCONF_HOST_DTC_MD5="cd36ac756290597f3cf1c5b6cfe12e77"
@@ -203,4 +236,5 @@ PTXCONF_HOST_LIBKMOD=y
PTXCONF_HOST_LIBLZO=y
PTXCONF_HOST_LZOP=y
PTXCONF_HOST_M4=y
+PTXCONF_HOST_SYSTEM_BC=y
PTXCONF_HOST_UTIL_LINUX_NG=y
diff --git a/configs/platform-mips/platforms/kernel.in b/configs/platform-mips/platforms/kernel.in
index 1889211a7ae2..06b6e24a6756 100644
--- a/configs/platform-mips/platforms/kernel.in
+++ b/configs/platform-mips/platforms/kernel.in
@@ -3,24 +3,352 @@
menuconfig KERNEL
bool
default y
+ select CODE_SIGNING if KERNEL_CODE_SIGNING
+ select HOST_U_BOOT_TOOLS if KERNEL_IMAGE_U || (KERNEL_IMAGE_SIMPLE && ARCH_MICROBLAZE)
+ select HOST_ZSTD if KERNEL_ZSTD
+ select HOST_XZ if KERNEL_XZ
+ select HOST_LZOP if KERNEL_LZOP
+ select HOST_LZ4 if KERNEL_LZ4
+ select HOST_LIBKMOD if KERNEL_MODULES
+ select HOST_SYSTEM_BC
+ select HOST_OPENSSL if KERNEL_OPENSSL
+ select HOST_LIBELF if KERNEL_LIBELF
prompt "Linux kernel "
if KERNEL
+config KERNEL_XPKG
+ bool
+ help
+ Select this symbol if kernel tools or other non kernel
+ modules are installed.
+
+config KERNEL_INSTALL
+ bool
+ prompt "install kernel into /boot"
+ select KERNEL_XPKG
+
+config KERNEL_MODULES
+ bool
+ default y
+ prompt "build kernel-modules"
+
+config KERNEL_MODULES_INSTALL
+ bool
+ default y
+ prompt "Install modules into /lib/modules"
+ depends on KERNEL_MODULES
+
+config KERNEL_MODULES_SIGN
+ bool
+ depends on KERNEL_MODULES
+ select KERNEL_CODE_SIGNING
+ select KERNEL_MODULES_INSTALL
+ prompt "sign modules"
+ help
+ If enabled, kernel modules are signed during the install stage with
+ the key specified by the code signing provider in the "kernel-modules"
+ role.
+
+ See the section "Kernel module signing" in the "Daily Work" chapter in
+ the PTXdist manual for use cases and more infos about what needs to be
+ enabled in the kernel config file.
+
config KERNEL_VERSION
prompt "kernel version"
string
default "4.15"
+ help
+ Fill in the kernel version that you want to use. Normally, you should
+ use the latest stable version, see <https://kernel.org>.
config KERNEL_MD5
prompt "kernel source md5sum"
string
+ help
+ To ensure integrity of the downloaded source tarball, fill in its
+ MD5 sum here.
-config KERNEL_INSTALL
+choice
+ prompt "Image Type "
+ default KERNEL_IMAGE_BZ
+
+ config KERNEL_IMAGE_BZ
+ bool
+ prompt "bzImage"
+ help
+ This usually is the target to be used on ia32 platforms. It
+ is not limited in size (to be more precise: Limited up to 4MiB).
+
+ config KERNEL_IMAGE_Z
+ bool
+ prompt "zImage "
+ help
+ This usually is a target to be used on ia32 platforms, it
+ is the older format and limited to about 500k in size due to
+ low memory size restrictions.
+
+ config KERNEL_IMAGE_XIP
+ bool
+ prompt "xipImage"
+ help
+ Create eXecute In Place Image.
+
+ config KERNEL_IMAGE_U
+ bool
+ prompt "uImage "
+ help
+ This is the target for most non ia32 platforms like PowerPC
+ and ARM architectures. Its a compressed image with additional
+ embedded information.
+
+ config KERNEL_IMAGE_VM
+ bool
+ prompt "vmImage"
+ help
+ This is the target for non ia32 platforms like blackfin
+ architectures.
+
+ config KERNEL_IMAGE_VMLINUX
+ bool
+ prompt "vmlinux"
+ help
+ This is the target to get the kernel image as an ELF. Mostly
+ used for debugging purposes.
+
+ config KERNEL_IMAGE_VMLINUZ
+ bool
+ prompt "vmlinuz"
+ help
+ This is the target to get the compressed kernel image as an ELF.
+ Mostly used for debugging purposes or for MIPS.
+
+ config KERNEL_IMAGE_RAW
+ bool
+ prompt "Image"
+ help
+ This is the target to get the kernel image as an raw uncompressed
+ binary file.
+ config KERNEL_IMAGE_SIMPLE
+ bool
+ prompt "simpleImage"
+ help
+ Create a simple Image with embedded DTB.
+endchoice
+
+if KERNEL_IMAGE_SIMPLE
+
+config KERNEL_IMAGE_SIMPLE_TARGET
+ prompt "name of simple image"
+ string
+ default "virtex405-xup"
+ help
+ Name of created simple kernel image e.g.
+ the "virtex405-xup" of "simpleImage.virtex405-xup.elf"
+
+config KERNEL_IMAGE_SIMPLE_DTS
+ prompt "path to DTS file"
+ string
+ default "${PTXDIST_PLATFORMCONFIGDIR}/simpleImage.dts"
+ help
+ This specifies the "dts" file used to create your simple
+ image.
+
+ The default is "${PTXDIST_PLATFORMCONFIGDIR}/simpleImage.dts".
+
+ The path "${PTXDIST_PLATFORMCONFIGDIR}" is the directory
+ where your platformconfig file is located.
+
+endif
+
+config KERNEL_IMAGE
+ string
+ default "bzImage" if KERNEL_IMAGE_BZ
+ default "Image.gz" if KERNEL_IMAGE_Z && ARCH_ARM64
+ default "zImage" if KERNEL_IMAGE_Z
+ default "xipImage" if KERNEL_IMAGE_XIP
+ default "uImage" if KERNEL_IMAGE_U
+ default "vmImage" if KERNEL_IMAGE_VM
+ default "vmlinux" if KERNEL_IMAGE_VMLINUX
+ default "vmlinuz" if KERNEL_IMAGE_VMLINUZ
+ default "Image" if KERNEL_IMAGE_RAW
+ default "simpleImage.${PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET}.elf" if KERNEL_IMAGE_SIMPLE
+
+menuconfig KERNEL_DTB
bool
+ prompt "Build device trees "
+
+if KERNEL_DTB
+
+config KERNEL_DTS_PATH
+ string "path to source dts file"
+ default "${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts"
+ help
+ Define path to the dts source file. Multiple directories can be
+ specified separated by ':'. A relative path will be expanded relative
+ to the workspace and all other layers. Only on of the specified paths
+ can be a relative path.
+
+config KERNEL_DTS
+ string "source dts file"
+ default "<yourboard>.dts"
+ help
+ Select the dts file to use for the device tree binary
+ blob generation. For relative file names KERNEL_DTS_PATH
+ is used as a search path for the device tree files specified
+ here. Multiple dts files can be specified, separated by spaces.
+
+endif
+
+config KERNEL_CODE_SIGNING
+ prompt "use code signing infrastructure"
+ select KERNEL_OPENSSL
+ bool
+ help
+ Enable this option if you want the kernel to make use of the code
+ signing infrastructure, e.g. to supply trust roots from the
+ 'kernel-trusted' code signing role.
+
+ See the section "Using the Code Signing Infrastructure with the Kernel
+ Recipe" in the "Daily Use" chapter in the PTXdist manual for use
+ cases and more information.
+
+config KERNEL_ZSTD
+ prompt "build zstd hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel compressed
+ with zstd and your host system is lacking the proper tools
+ (the "zstd" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_XZ
+ prompt "build xz-utils hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel compressed
+ with lzma and your host system is lacking the proper tools
+ ("xz-utils" or the deprecated "lzma" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
config KERNEL_LZOP
prompt "build lzop hosttool"
bool
+ help
+ Select this if you're going to build your kernel compressed
+ with lzo and your host system is lacking the proper tools
+ (the "lzop" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_LZ4
+ prompt "build lz4 hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel compressed
+ with lz4 and your host system is lacking the proper tools
+ (the "lz4" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_OPENSSL
+ prompt "build openssl hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel with support for
+ module signing, IMA etc. where openssl is need as hosttool.
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_LIBELF
+ prompt "build libelf host library"
+ bool
+ help
+ Select this if you're going to build your kernel with
+ STACK_VALIDATION enabled. Stack validation is used for the orc
+ unwinder for kernel version >= v4.14 on x86_64.
+
+config KERNEL_GCC_PLUGINS
+ prompt "allow gcc plugins"
+ bool
+ help
+ The kernel kconfig options to enable gcc plugins depend on a
+ sufficiently new host compiler. As a result, the kernel config
+ may change with a different host compiler version.
+ If this option is disabled then the environment is manipulated
+ to ensure that the compiler check always fails. This keeps the
+ kernel config stable.
+ Enable this option when the kernel gcc plugins are used.
+
+config KERNEL_CONFIG_BASE_VERSION
+ prompt "use base version in the kernelconfig"
+ bool
+ help
+ When the BSP contains a patch stack for the kernel, then it is
+ often useful to modify EXTRAVERSION with one of the patches. This
+ makes it easier to detect which version of the patch stack was
+ used to build the currently running kernel.
+ However, this means that the comment at the beginning of the
+ kernel config changes with each new revision of the patch stack.
+
+ When this option is enabled, then the version in the kernel
+ config is overwritten with the version from
+ PTXCONF_KERNEL_VERSION. The version built into the kernel remains
+ unchanged.
+
+menu "patching & configuration "
+
+config KERNEL_SERIES
+ prompt "patch series file"
+ string
+ default "series"
+ help
+ This entry specifies a patch series file which has to live in
+ the kernel patches directory.
+
+ The series file contains lines with names of patch files which
+ are then being applied to the kernel.
+
+config KERNEL_CONFIG
+ prompt "kernel config file"
+ string
+ default "kernelconfig"
+ help
+ This entry specifies the .config file used to compile your kernel.
+ Specify the path relative to the platformconfig directory.
+
+endmenu
+
+
+comment "Development features"
+
+config KERNEL_EXTRA_MAKEVARS
+ string
+ default ""
+ prompt "Additional kbuild options"
+ help
+ Specify extra parameters for the kernel build system here. Useful
+ options include:
+
+ * CONFIG_DEBUG_SECTION_MISMATCH=y
+ Enable this feature if you want the kernel's buildsystem to check for
+ section mismatches (__devinit/__devexit, __init/__exit). This
+ entry is valid for 2.6.25 kernels and above. Previous kernel versions
+ do this check automatically. Enabling this feature is recommended
+ for kernel development only because it changes how code is inlined.
+ Changing this entry will rebuild the whole kernel.
+
+ * C=1
+ Run sparse when compiling.
+
+ * V=1
+ Increase verbosity when compiling.
endif # KERNEL
diff --git a/configs/platform-mips/rules/kernel.make b/configs/platform-mips/rules/kernel.make
index 6d5ca4d4ea0e..9caff677918e 100644
--- a/configs/platform-mips/rules/kernel.make
+++ b/configs/platform-mips/rules/kernel.make
@@ -16,7 +16,7 @@ PACKAGES-$(PTXCONF_KERNEL) += kernel
# Paths and names
#
KERNEL := linux-$(KERNEL_VERSION)
-KERNEL_MD5 := $(call remove_quotes,$(PTXCONF_KERNEL_MD5))
+KERNEL_MD5 := $(call ptx/config-md5, PTXCONF_KERNEL)
ifneq ($(KERNEL_NEEDS_GIT_URL),y)
KERNEL_SUFFIX := tar.xz
KERNEL_URL := $(call kernel-url, KERNEL)
@@ -26,24 +26,105 @@ KERNEL_URL := https://git.kernel.org/torvalds/t/$(KERNEL).$(KERNEL_SUFFIX)
endif
KERNEL_DIR := $(BUILDDIR)/$(KERNEL)
KERNEL_BUILD_DIR := $(KERNEL_DIR)-build
-KERNEL_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig)
+KERNEL_CONFIG := $(call ptx/in-platformconfigdir, $(call remove_quotes, $(PTXCONF_KERNEL_CONFIG)))
+KERNEL_DTS_PATH := $(call remove_quotes,$(PTXCONF_KERNEL_DTS_PATH))
+KERNEL_DTS := $(call remove_quotes,$(PTXCONF_KERNEL_DTS))
+KERNEL_DTB_FILES := $(addsuffix .dtb,$(basename $(KERNEL_DTS)))
KERNEL_LICENSE := GPL-2.0-only
KERNEL_SOURCE := $(SRCDIR)/$(KERNEL).$(KERNEL_SUFFIX)
KERNEL_DEVPKG := NO
KERNEL_BUILD_OOT := KEEP
+# track changes to devices-trees in the BSP
+$(call world/dts-cfghash-file, KERNEL)
+
+# in case we migrate some old syntax
+ifneq ($(KERNEL_DTS),$(notdir $(KERNEL_DTS)))
+$(call ptx/error, the device trees in PTXCONF_KERNEL_DTS must be specified without)
+$(call ptx/error, directory. Use PTXCONF_KERNEL_DTS_PATH to provide a list of direcories)
+$(call ptx/error, that will be searched.)
+endif
+
# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------
-KERNEL_CONF_OPT := \
+# use CONFIG_CC_STACKPROTECTOR if available. The rest makes no sense for the kernel
+KERNEL_WRAPPER_BLACKLIST := \
+ $(PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST)
+
+# Note: for some reason, the error is not visible without the dummy '$(shell :)'
+# when running 'ptxdist -j -q go'.
+define kernel/deprecated
+$(if $(strip \
+$(filter $(STATEDIR)/%, \
+$(filter-out $(STATEDIR)/kernel.%,$@)) \
+),$(shell :)$(error $(notdir $@): \
+ use KERNEL_MODULE_OPT instead of $(1) for kernel module packages))
+endef
+
+# check for old kernel modules rules
+KERNEL_MAKEVARS = $(call kernel/deprecated, KERNEL_MAKEVARS)
+
+# like kernel-opts but with different CROSS_COMPILE=
+KERNEL_BASE_OPT = \
+ $(call kernel-opts, KERNEL,$(KERNEL_CROSS_COMPILE)) \
+ $(call remove_quotes,$(PTXCONF_KERNEL_EXTRA_MAKEVARS))
+
+ifdef PTXCONF_KERNEL_CODE_SIGNING
+KERNEL_BASE_OPT += \
+ $(if $(shell cs_get_ca kernel-trusted), \
+ CONFIG_SYSTEM_TRUSTED_KEYS=$(shell cs_get_ca kernel-trusted))
+endif
+ifdef PTXCONF_KERNEL_MODULES_SIGN
+KERNEL_BASE_OPT += \
+ CONFIG_MODULE_SIG_KEY='"$(shell cs_get_uri kernel-modules)"'
+endif
+
+# Intermediate option. This will be used by kernel module packages.
+KERNEL_MODULE_OPT = \
-C $(KERNEL_DIR) \
O=$(KERNEL_BUILD_DIR) \
- $(call kernel-opts, KERNEL)
+ $(KERNEL_BASE_OPT)
+
+KERNEL_SHARED_OPT = \
+ $(KERNEL_MODULE_OPT)
+ifndef PTXCONF_KERNEL_GCC_PLUGINS
# no gcc plugins; avoid config changes depending on the host compiler
-KERNEL_CONF_OPT += \
- HOSTCXX=false
+KERNEL_SHARED_OPT += \
+ HOSTCXX="$(HOSTCXX) -DGENERATOR_FILE" \
+ HOSTCC="$(HOSTCC) -DGENERATOR_FILE"
+KERNEL_CONF_ENV := \
+ PTXDIST_NO_GCC_PLUGINS=1
+KERNEL_MAKE_ENV := \
+ PTXDIST_NO_GCC_PLUGINS=1
+endif
+
+KERNEL_CONF_TOOL := kconfig
+KERNEL_CONF_OPT = \
+ $(KERNEL_SHARED_OPT)
+
+ifdef PTXCONF_KERNEL_CONFIG_BASE_VERSION
+# force using KERNEL_VERSION in the kernelconfig
+KERNEL_CONF_OPT += \
+ KERNELVERSION=$(KERNEL_VERSION)
+endif
+
+#
+# support the different kernel image formats
+#
+KERNEL_IMAGE := $(call remove_quotes, $(PTXCONF_KERNEL_IMAGE))
+
+# these are sane defaults
+KERNEL_IMAGE_PATH_y := $(KERNEL_BUILD_DIR)/arch/$(GENERIC_KERNEL_ARCH)/boot/$(KERNEL_IMAGE)
+
+# vmlinux and vmlinuz are special
+KERNEL_IMAGE_PATH_$(PTXCONF_KERNEL_IMAGE_VMLINUX) := $(KERNEL_BUILD_DIR)/vmlinux
+KERNEL_IMAGE_PATH_$(PTXCONF_KERNEL_IMAGE_VMLINUZ) := $(KERNEL_BUILD_DIR)/vmlinuz
+# avr32 is also special
+KERNEL_IMAGE_PATH_$(PTXCONF_ARCH_AVR32) := $(KERNEL_BUILD_DIR)/arch/$(GENERIC_KERNEL_ARCH)/boot/images/$(KERNEL_IMAGE)
+
ifdef PTXCONF_KERNEL
$(KERNEL_CONFIG):
@@ -56,22 +137,228 @@ $(KERNEL_CONFIG):
@exit 1
endif
+
+#
+# when compiling the rootfs into the kernel, we just include an empty
+# file for now. the rootfs isn't build yet.
+#
+KERNEL_INITRAMFS_SOURCE_$(PTXCONF_IMAGE_KERNEL_INITRAMFS) += $(STATEDIR)/empty.cpio
+
+$(STATEDIR)/kernel.prepare:
+ @$(call targetinfo)
+#
+# Make sure there is a non empty INITRAMFS_SOURCE in $(KERNEL_CONFIG), but
+# not the real expanded path because it contains local workdir path which
+# is not relevant to other developers.
+#
+ifdef KERNEL_INITRAMFS_SOURCE_y
+ @sed -i -e 's,^CONFIG_INITRAMFS_SOURCE.*$$,CONFIG_INITRAMFS_SOURCE=\"# Automatically set by PTXDist\",g' \
+ "$(KERNEL_CONFIG)"
+endif
+ifdef PTXCONF_KERNEL_IMAGE_SIMPLE
+ cp $(PTXCONF_KERNEL_IMAGE_SIMPLE_DTS) \
+ $(KERNEL_DIR)/arch/$(GENERIC_KERNEL_ARCH)/boot/dts/$(PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET).dts
+endif
+
+ @$(call world/prepare, KERNEL)
+
+#
+# Use an existing dummy INITRAMFS_SOURCE for the first 'make' call. The
+# kernel image will be rebuilt in the image-kernel package with the real
+# initramfs.
+#
+ifdef KERNEL_INITRAMFS_SOURCE_y
+ @touch "$(KERNEL_INITRAMFS_SOURCE_y)"
+ @sed -i -e 's,^CONFIG_INITRAMFS_SOURCE.*$$,CONFIG_INITRAMFS_SOURCE=\"$(KERNEL_INITRAMFS_SOURCE_y)\",g' \
+ "$(KERNEL_BUILD_DIR)/.config"
+endif
+ @$(call touch)
+
+
+# ----------------------------------------------------------------------------
+# tags
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/kernel.tags:
+ @$(call targetinfo)
+ @$(MAKE) -C $(KERNEL_DIR) $(KERNEL_MAKE_OPT) tags TAGS cscope
+
# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------
+KERNEL_MAKE_OPT = \
+ $(call kernel/deprecated, KERNEL_MAKE_OPT) \
+ $(KERNEL_SHARED_OPT) \
+ $(KERNEL_IMAGE) \
+ $(call ptx/ifdef, PTXCONF_KERNEL_MODULES,modules)
+
+KERNEL_TOOL_PERF_OPTS := \
+ -C $(KERNEL_DIR)/tools/perf \
+ O=$(KERNEL_BUILD_DIR)/tools/perf \
+ $(KERNEL_BASE_OPT) \
+ WERROR=0 \
+ NO_LIBPERL=1 \
+ NO_LIBPYTHON=1 \
+ NO_DWARF= \
+ NO_SLANG= \
+ NO_GTK2=1 \
+ NO_DEMANGLE= \
+ NO_LIBELF= \
+ NO_LIBUNWIND=1 \
+ NO_BACKTRACE= \
+ NO_LIBNUMA=1 \
+ NO_LIBAUDIT=1 \
+ NO_LIBBIONIC=1 \
+ NO_LIBCRYPTO=1 \
+ NO_LIBDW_DWARF_UNWIND= \
+ NO_PERF_READ_VDSO32=1 \
+ NO_PERF_READ_VDSOX32=1 \
+ NO_ZLIB= \
+ NO_LIBBABELTRACE=1 \
+ NO_LZMA=1 \
+ NO_LIBZSTD=1 \
+ NO_AUXTRACE= \
+ NO_LIBBPF=1 \
+ NO_SDT=1 \
+ NO_LIBCAP=1
+
+# manual make to handle CPPFLAGS and broken parallel building for some
+# kernel versions
+KERNEL_TOOL_IIO_OPTS := \
+ PTXDIST_ICECC=$(PTXDIST_ICERUN) \
+ CPPFLAGS="-D__EXPORTED_HEADERS__ -I$(KERNEL_DIR)/include/uapi -I$(KERNEL_DIR)/include" \
+ -C $(KERNEL_DIR)/tools/iio \
+ O=$(KERNEL_BUILD_DIR)/tools/iio \
+ $(KERNEL_BASE_OPT) \
+ $(PARALLELMFLAGS_BROKEN)
+
$(STATEDIR)/kernel.compile:
@$(call targetinfo)
+ @rm -f \
+ $(KERNEL_BUILD_DIR)/usr/initramfs_data.cpio.* \
+ $(KERNEL_BUILD_DIR)/usr/.initramfs_data.cpio.*
+ @$(call world/compile, KERNEL)
+ifdef PTXCONF_KERNEL_TOOL_PERF
+ @mkdir -p $(KERNEL_BUILD_DIR)/tools/perf
+ @$(call compile, KERNEL, $(KERNEL_TOOL_PERF_OPTS))
+endif
+ifdef PTXCONF_KERNEL_TOOL_IIO
+ @mkdir -p $(KERNEL_BUILD_DIR)/tools/iio
+ @$(call world/execute, KERNEL, \
+ $(MAKE) $(KERNEL_TOOL_IIO_OPTS))
+endif
@$(call touch)
# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------
+KERNEL_INSTALL_OPT = \
+ $(KERNEL_BASE_OPT) \
+ modules_install
+
$(STATEDIR)/kernel.install:
@$(call targetinfo)
+ifdef PTXCONF_KERNEL_MODULES_INSTALL
+ @$(call world/install, KERNEL)
+endif
+ @$(call world/dtb, KERNEL)
@$(call touch)
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/kernel.targetinstall:
+ @$(call targetinfo)
+
+ @$(foreach dtb, $(KERNEL_DTB_FILES), \
+ echo -e "Installing $(dtb) ...\n"$(ptx/nl) \
+ install -D -m0644 $(KERNEL_PKGDIR)/boot/$(dtb) \
+ $(IMAGEDIR)/$(dtb)$(ptx/nl))
+
+ifdef PTXCONF_KERNEL_XPKG
+ @$(call install_init, kernel)
+ @$(call install_fixup, kernel, PRIORITY,optional)
+ @$(call install_fixup, kernel, SECTION,base)
+ @$(call install_fixup, kernel, AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
+ @$(call install_fixup, kernel, DESCRIPTION,missing)
+
+ @$(call install_copy, kernel, 0, 0, 0755, /boot);
+
+ifdef PTXCONF_KERNEL_INSTALL
+ @$(call install_copy, kernel, 0, 0, 0644, $(KERNEL_IMAGE_PATH_y), /boot/$(KERNEL_IMAGE), n)
+
+ @$(foreach dtb, $(KERNEL_DTB_FILES), \
+ $(call install_copy, kernel, 0, 0, 0644, -, \
+ /boot/$(dtb), n)$(ptx/nl))
+endif
+
+# install the ELF kernel image for debugging purpose
+ifdef PTXCONF_KERNEL_VMLINUX
+ @$(call install_copy, kernel, 0, 0, 0644, $(KERNEL_BUILD_DIR)/vmlinux, /boot/vmlinux, n)
+endif
+
+ifdef PTXCONF_KERNEL_TOOL_PERF
+ @$(call install_copy, kernel, 0, 0, 0755, $(KERNEL_BUILD_DIR)/tools/perf/perf, \
+ /usr/bin/perf)
+endif
+
+ifdef PTXCONF_KERNEL_TOOL_IIO
+ @$(call install_copy, kernel, 0, 0, 0755, $(wildcard $(KERNEL_BUILD_DIR)/tools/iio/*generic_buffer), \
+ /usr/bin/iio_generic_buffer)
+ @$(call install_copy, kernel, 0, 0, 0755, $(KERNEL_BUILD_DIR)/tools/iio/lsiio, \
+ /usr/bin/lsiio)
+ @$(call install_copy, kernel, 0, 0, 0755, $(KERNEL_BUILD_DIR)/tools/iio/iio_event_monitor, \
+ /usr/bin/iio_event_monitor)
+endif
+
+ @$(call install_finish, kernel)
+endif
+
+ @$(call touch)
+
+
+# ----------------------------------------------------------------------------
+# Target-Install-post
+# ----------------------------------------------------------------------------
+
+ifdef PTXCONF_IMAGE_KERNEL_INSTALL_EARLY
+$(STATEDIR)/kernel.targetinstall.post: $(IMAGEDIR)/linuximage
+ifdef PTXCONF_IMAGE_KERNEL_LZOP
+$(STATEDIR)/kernel.targetinstall.post: $(IMAGEDIR)/linuximage.lzo
+endif
+endif
+
+$(STATEDIR)/kernel.targetinstall.post:
+ @$(call targetinfo)
+
+ifdef PTXCONF_KERNEL_MODULES_INSTALL
+ @$(call install_init, kernel-modules)
+ @$(call install_fixup, kernel-modules, PRIORITY,optional)
+ @$(call install_fixup, kernel-modules, SECTION,base)
+ @$(call install_fixup, kernel-modules, AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
+ @$(call install_fixup, kernel-modules, DESCRIPTION,missing)
+
+ @$(call install_glob, kernel-modules, 0, 0, -, /lib/modules, *.ko,, n)
+ @$(call install_glob, kernel-modules, 0, 0, -, /lib/modules,, *.ko */build */source, n)
+
+ @$(call install_finish, kernel-modules)
+endif
+
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/kernel.clean:
+ @$(call targetinfo)
+ @$(call clean_pkg, KERNEL)
+ @$(foreach dtb,$(KERNEL_DTB_FILES), \
+ rm -vf $(IMAGEDIR)/$(dtb)$(ptx/nl))
+
# ----------------------------------------------------------------------------
# oldconfig / menuconfig
# ----------------------------------------------------------------------------
diff --git a/configs/platform-mipsel/platformconfig b/configs/platform-mipsel/platformconfig
index dd697379137e..c84569e26d1c 100644
--- a/configs/platform-mipsel/platformconfig
+++ b/configs/platform-mipsel/platformconfig
@@ -109,9 +109,47 @@ PTXCONF_TARGET_EXTRA_LDFLAGS=""
# end of architecture
PTXCONF_KERNEL=y
+
+#
+# NOTE: this kernel only exists for the userspace kernel tools and a REF_CONFIG.
+#
+
+#
+# The actual kernels come from the extra kernel-* packages.
+#
PTXCONF_KERNEL_VERSION="5.14"
PTXCONF_KERNEL_MD5="a082ef5748b813abca0649dab8be5f52"
+# PTXCONF_KERNEL_IMAGE_BZ is not set
+# PTXCONF_KERNEL_IMAGE_Z is not set
+# PTXCONF_KERNEL_IMAGE_XIP is not set
+# PTXCONF_KERNEL_IMAGE_U is not set
+# PTXCONF_KERNEL_IMAGE_VM is not set
+# PTXCONF_KERNEL_IMAGE_VMLINUX is not set
+PTXCONF_KERNEL_IMAGE_VMLINUZ=y
+# PTXCONF_KERNEL_IMAGE_RAW is not set
+# PTXCONF_KERNEL_IMAGE_SIMPLE is not set
+PTXCONF_KERNEL_IMAGE="vmlinuz"
+# PTXCONF_KERNEL_CODE_SIGNING is not set
+# PTXCONF_KERNEL_ZSTD is not set
+# PTXCONF_KERNEL_XZ is not set
PTXCONF_KERNEL_LZOP=y
+# PTXCONF_KERNEL_LZ4 is not set
+# PTXCONF_KERNEL_OPENSSL is not set
+# PTXCONF_KERNEL_LIBELF is not set
+# PTXCONF_KERNEL_GCC_PLUGINS is not set
+# PTXCONF_KERNEL_CONFIG_BASE_VERSION is not set
+
+#
+# patching & configuration
+#
+PTXCONF_KERNEL_SERIES="series"
+PTXCONF_KERNEL_CONFIG="kernelconfig"
+# end of patching & configuration
+
+#
+# Development features
+#
+PTXCONF_KERNEL_EXTRA_MAKEVARS=""
PTXCONF_HOST_DTC=y
PTXCONF_HOST_DTC_VERSION="1.6.0"
PTXCONF_HOST_DTC_MD5="cd36ac756290597f3cf1c5b6cfe12e77"
@@ -199,4 +237,5 @@ PTXCONF_HOST_LIBKMOD=y
PTXCONF_HOST_LIBLZO=y
PTXCONF_HOST_LZOP=y
PTXCONF_HOST_M4=y
+PTXCONF_HOST_SYSTEM_BC=y
PTXCONF_HOST_UTIL_LINUX_NG=y
diff --git a/configs/platform-mipsel/platforms/kernel.in b/configs/platform-mipsel/platforms/kernel.in
index 1889211a7ae2..06b6e24a6756 100644
--- a/configs/platform-mipsel/platforms/kernel.in
+++ b/configs/platform-mipsel/platforms/kernel.in
@@ -3,24 +3,352 @@
menuconfig KERNEL
bool
default y
+ select CODE_SIGNING if KERNEL_CODE_SIGNING
+ select HOST_U_BOOT_TOOLS if KERNEL_IMAGE_U || (KERNEL_IMAGE_SIMPLE && ARCH_MICROBLAZE)
+ select HOST_ZSTD if KERNEL_ZSTD
+ select HOST_XZ if KERNEL_XZ
+ select HOST_LZOP if KERNEL_LZOP
+ select HOST_LZ4 if KERNEL_LZ4
+ select HOST_LIBKMOD if KERNEL_MODULES
+ select HOST_SYSTEM_BC
+ select HOST_OPENSSL if KERNEL_OPENSSL
+ select HOST_LIBELF if KERNEL_LIBELF
prompt "Linux kernel "
if KERNEL
+config KERNEL_XPKG
+ bool
+ help
+ Select this symbol if kernel tools or other non kernel
+ modules are installed.
+
+config KERNEL_INSTALL
+ bool
+ prompt "install kernel into /boot"
+ select KERNEL_XPKG
+
+config KERNEL_MODULES
+ bool
+ default y
+ prompt "build kernel-modules"
+
+config KERNEL_MODULES_INSTALL
+ bool
+ default y
+ prompt "Install modules into /lib/modules"
+ depends on KERNEL_MODULES
+
+config KERNEL_MODULES_SIGN
+ bool
+ depends on KERNEL_MODULES
+ select KERNEL_CODE_SIGNING
+ select KERNEL_MODULES_INSTALL
+ prompt "sign modules"
+ help
+ If enabled, kernel modules are signed during the install stage with
+ the key specified by the code signing provider in the "kernel-modules"
+ role.
+
+ See the section "Kernel module signing" in the "Daily Work" chapter in
+ the PTXdist manual for use cases and more infos about what needs to be
+ enabled in the kernel config file.
+
config KERNEL_VERSION
prompt "kernel version"
string
default "4.15"
+ help
+ Fill in the kernel version that you want to use. Normally, you should
+ use the latest stable version, see <https://kernel.org>.
config KERNEL_MD5
prompt "kernel source md5sum"
string
+ help
+ To ensure integrity of the downloaded source tarball, fill in its
+ MD5 sum here.
-config KERNEL_INSTALL
+choice
+ prompt "Image Type "
+ default KERNEL_IMAGE_BZ
+
+ config KERNEL_IMAGE_BZ
+ bool
+ prompt "bzImage"
+ help
+ This usually is the target to be used on ia32 platforms. It
+ is not limited in size (to be more precise: Limited up to 4MiB).
+
+ config KERNEL_IMAGE_Z
+ bool
+ prompt "zImage "
+ help
+ This usually is a target to be used on ia32 platforms, it
+ is the older format and limited to about 500k in size due to
+ low memory size restrictions.
+
+ config KERNEL_IMAGE_XIP
+ bool
+ prompt "xipImage"
+ help
+ Create eXecute In Place Image.
+
+ config KERNEL_IMAGE_U
+ bool
+ prompt "uImage "
+ help
+ This is the target for most non ia32 platforms like PowerPC
+ and ARM architectures. Its a compressed image with additional
+ embedded information.
+
+ config KERNEL_IMAGE_VM
+ bool
+ prompt "vmImage"
+ help
+ This is the target for non ia32 platforms like blackfin
+ architectures.
+
+ config KERNEL_IMAGE_VMLINUX
+ bool
+ prompt "vmlinux"
+ help
+ This is the target to get the kernel image as an ELF. Mostly
+ used for debugging purposes.
+
+ config KERNEL_IMAGE_VMLINUZ
+ bool
+ prompt "vmlinuz"
+ help
+ This is the target to get the compressed kernel image as an ELF.
+ Mostly used for debugging purposes or for MIPS.
+
+ config KERNEL_IMAGE_RAW
+ bool
+ prompt "Image"
+ help
+ This is the target to get the kernel image as an raw uncompressed
+ binary file.
+ config KERNEL_IMAGE_SIMPLE
+ bool
+ prompt "simpleImage"
+ help
+ Create a simple Image with embedded DTB.
+endchoice
+
+if KERNEL_IMAGE_SIMPLE
+
+config KERNEL_IMAGE_SIMPLE_TARGET
+ prompt "name of simple image"
+ string
+ default "virtex405-xup"
+ help
+ Name of created simple kernel image e.g.
+ the "virtex405-xup" of "simpleImage.virtex405-xup.elf"
+
+config KERNEL_IMAGE_SIMPLE_DTS
+ prompt "path to DTS file"
+ string
+ default "${PTXDIST_PLATFORMCONFIGDIR}/simpleImage.dts"
+ help
+ This specifies the "dts" file used to create your simple
+ image.
+
+ The default is "${PTXDIST_PLATFORMCONFIGDIR}/simpleImage.dts".
+
+ The path "${PTXDIST_PLATFORMCONFIGDIR}" is the directory
+ where your platformconfig file is located.
+
+endif
+
+config KERNEL_IMAGE
+ string
+ default "bzImage" if KERNEL_IMAGE_BZ
+ default "Image.gz" if KERNEL_IMAGE_Z && ARCH_ARM64
+ default "zImage" if KERNEL_IMAGE_Z
+ default "xipImage" if KERNEL_IMAGE_XIP
+ default "uImage" if KERNEL_IMAGE_U
+ default "vmImage" if KERNEL_IMAGE_VM
+ default "vmlinux" if KERNEL_IMAGE_VMLINUX
+ default "vmlinuz" if KERNEL_IMAGE_VMLINUZ
+ default "Image" if KERNEL_IMAGE_RAW
+ default "simpleImage.${PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET}.elf" if KERNEL_IMAGE_SIMPLE
+
+menuconfig KERNEL_DTB
bool
+ prompt "Build device trees "
+
+if KERNEL_DTB
+
+config KERNEL_DTS_PATH
+ string "path to source dts file"
+ default "${PTXDIST_PLATFORMCONFIG_SUBDIR}/dts:${KERNEL_DIR}/arch/${GENERIC_KERNEL_ARCH}/boot/dts"
+ help
+ Define path to the dts source file. Multiple directories can be
+ specified separated by ':'. A relative path will be expanded relative
+ to the workspace and all other layers. Only on of the specified paths
+ can be a relative path.
+
+config KERNEL_DTS
+ string "source dts file"
+ default "<yourboard>.dts"
+ help
+ Select the dts file to use for the device tree binary
+ blob generation. For relative file names KERNEL_DTS_PATH
+ is used as a search path for the device tree files specified
+ here. Multiple dts files can be specified, separated by spaces.
+
+endif
+
+config KERNEL_CODE_SIGNING
+ prompt "use code signing infrastructure"
+ select KERNEL_OPENSSL
+ bool
+ help
+ Enable this option if you want the kernel to make use of the code
+ signing infrastructure, e.g. to supply trust roots from the
+ 'kernel-trusted' code signing role.
+
+ See the section "Using the Code Signing Infrastructure with the Kernel
+ Recipe" in the "Daily Use" chapter in the PTXdist manual for use
+ cases and more information.
+
+config KERNEL_ZSTD
+ prompt "build zstd hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel compressed
+ with zstd and your host system is lacking the proper tools
+ (the "zstd" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_XZ
+ prompt "build xz-utils hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel compressed
+ with lzma and your host system is lacking the proper tools
+ ("xz-utils" or the deprecated "lzma" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
config KERNEL_LZOP
prompt "build lzop hosttool"
bool
+ help
+ Select this if you're going to build your kernel compressed
+ with lzo and your host system is lacking the proper tools
+ (the "lzop" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_LZ4
+ prompt "build lz4 hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel compressed
+ with lz4 and your host system is lacking the proper tools
+ (the "lz4" package).
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_OPENSSL
+ prompt "build openssl hosttool"
+ bool
+ help
+ Select this if you're going to build your kernel with support for
+ module signing, IMA etc. where openssl is need as hosttool.
+
+ Select this if you're unsure, as it won't hurt. It just
+ increases the build time.
+
+config KERNEL_LIBELF
+ prompt "build libelf host library"
+ bool
+ help
+ Select this if you're going to build your kernel with
+ STACK_VALIDATION enabled. Stack validation is used for the orc
+ unwinder for kernel version >= v4.14 on x86_64.
+
+config KERNEL_GCC_PLUGINS
+ prompt "allow gcc plugins"
+ bool
+ help
+ The kernel kconfig options to enable gcc plugins depend on a
+ sufficiently new host compiler. As a result, the kernel config
+ may change with a different host compiler version.
+ If this option is disabled then the environment is manipulated
+ to ensure that the compiler check always fails. This keeps the
+ kernel config stable.
+ Enable this option when the kernel gcc plugins are used.
+
+config KERNEL_CONFIG_BASE_VERSION
+ prompt "use base version in the kernelconfig"
+ bool
+ help
+ When the BSP contains a patch stack for the kernel, then it is
+ often useful to modify EXTRAVERSION with one of the patches. This
+ makes it easier to detect which version of the patch stack was
+ used to build the currently running kernel.
+ However, this means that the comment at the beginning of the
+ kernel config changes with each new revision of the patch stack.
+
+ When this option is enabled, then the version in the kernel
+ config is overwritten with the version from
+ PTXCONF_KERNEL_VERSION. The version built into the kernel remains
+ unchanged.
+
+menu "patching & configuration "
+
+config KERNEL_SERIES
+ prompt "patch series file"
+ string
+ default "series"
+ help
+ This entry specifies a patch series file which has to live in
+ the kernel patches directory.
+
+ The series file contains lines with names of patch files which
+ are then being applied to the kernel.
+
+config KERNEL_CONFIG
+ prompt "kernel config file"
+ string
+ default "kernelconfig"
+ help
+ This entry specifies the .config file used to compile your kernel.
+ Specify the path relative to the platformconfig directory.
+
+endmenu
+
+
+comment "Development features"
+
+config KERNEL_EXTRA_MAKEVARS
+ string
+ default ""
+ prompt "Additional kbuild options"
+ help
+ Specify extra parameters for the kernel build system here. Useful
+ options include:
+
+ * CONFIG_DEBUG_SECTION_MISMATCH=y
+ Enable this feature if you want the kernel's buildsystem to check for
+ section mismatches (__devinit/__devexit, __init/__exit). This
+ entry is valid for 2.6.25 kernels and above. Previous kernel versions
+ do this check automatically. Enabling this feature is recommended
+ for kernel development only because it changes how code is inlined.
+ Changing this entry will rebuild the whole kernel.
+
+ * C=1
+ Run sparse when compiling.
+
+ * V=1
+ Increase verbosity when compiling.
endif # KERNEL
diff --git a/configs/platform-mipsel/rules/kernel.make b/configs/platform-mipsel/rules/kernel.make
index 6d5ca4d4ea0e..9caff677918e 100644
--- a/configs/platform-mipsel/rules/kernel.make
+++ b/configs/platform-mipsel/rules/kernel.make
@@ -16,7 +16,7 @@ PACKAGES-$(PTXCONF_KERNEL) += kernel
# Paths and names
#
KERNEL := linux-$(KERNEL_VERSION)
-KERNEL_MD5 := $(call remove_quotes,$(PTXCONF_KERNEL_MD5))
+KERNEL_MD5 := $(call ptx/config-md5, PTXCONF_KERNEL)
ifneq ($(KERNEL_NEEDS_GIT_URL),y)
KERNEL_SUFFIX := tar.xz
KERNEL_URL := $(call kernel-url, KERNEL)
@@ -26,24 +26,105 @@ KERNEL_URL := https://git.kernel.org/torvalds/t/$(KERNEL).$(KERNEL_SUFFIX)
endif
KERNEL_DIR := $(BUILDDIR)/$(KERNEL)
KERNEL_BUILD_DIR := $(KERNEL_DIR)-build
-KERNEL_CONFIG := $(call ptx/in-platformconfigdir, kernelconfig)
+KERNEL_CONFIG := $(call ptx/in-platformconfigdir, $(call remove_quotes, $(PTXCONF_KERNEL_CONFIG)))
+KERNEL_DTS_PATH := $(call remove_quotes,$(PTXCONF_KERNEL_DTS_PATH))
+KERNEL_DTS := $(call remove_quotes,$(PTXCONF_KERNEL_DTS))
+KERNEL_DTB_FILES := $(addsuffix .dtb,$(basename $(KERNEL_DTS)))
KERNEL_LICENSE := GPL-2.0-only
KERNEL_SOURCE := $(SRCDIR)/$(KERNEL).$(KERNEL_SUFFIX)
KERNEL_DEVPKG := NO
KERNEL_BUILD_OOT := KEEP
+# track changes to devices-trees in the BSP
+$(call world/dts-cfghash-file, KERNEL)
+
+# in case we migrate some old syntax
+ifneq ($(KERNEL_DTS),$(notdir $(KERNEL_DTS)))
+$(call ptx/error, the device trees in PTXCONF_KERNEL_DTS must be specified without)
+$(call ptx/error, directory. Use PTXCONF_KERNEL_DTS_PATH to provide a list of direcories)
+$(call ptx/error, that will be searched.)
+endif
+
# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------
-KERNEL_CONF_OPT := \
+# use CONFIG_CC_STACKPROTECTOR if available. The rest makes no sense for the kernel
+KERNEL_WRAPPER_BLACKLIST := \
+ $(PTXDIST_LOWLEVEL_WRAPPER_BLACKLIST)
+
+# Note: for some reason, the error is not visible without the dummy '$(shell :)'
+# when running 'ptxdist -j -q go'.
+define kernel/deprecated
+$(if $(strip \
+$(filter $(STATEDIR)/%, \
+$(filter-out $(STATEDIR)/kernel.%,$@)) \
+),$(shell :)$(error $(notdir $@): \
+ use KERNEL_MODULE_OPT instead of $(1) for kernel module packages))
+endef
+
+# check for old kernel modules rules
+KERNEL_MAKEVARS = $(call kernel/deprecated, KERNEL_MAKEVARS)
+
+# like kernel-opts but with different CROSS_COMPILE=
+KERNEL_BASE_OPT = \
+ $(call kernel-opts, KERNEL,$(KERNEL_CROSS_COMPILE)) \
+ $(call remove_quotes,$(PTXCONF_KERNEL_EXTRA_MAKEVARS))
+
+ifdef PTXCONF_KERNEL_CODE_SIGNING
+KERNEL_BASE_OPT += \
+ $(if $(shell cs_get_ca kernel-trusted), \
+ CONFIG_SYSTEM_TRUSTED_KEYS=$(shell cs_get_ca kernel-trusted))
+endif
+ifdef PTXCONF_KERNEL_MODULES_SIGN
+KERNEL_BASE_OPT += \
+ CONFIG_MODULE_SIG_KEY='"$(shell cs_get_uri kernel-modules)"'
+endif
+
+# Intermediate option. This will be used by kernel module packages.
+KERNEL_MODULE_OPT = \
-C $(KERNEL_DIR) \
O=$(KERNEL_BUILD_DIR) \
- $(call kernel-opts, KERNEL)
+ $(KERNEL_BASE_OPT)
+
+KERNEL_SHARED_OPT = \
+ $(KERNEL_MODULE_OPT)
+ifndef PTXCONF_KERNEL_GCC_PLUGINS
# no gcc plugins; avoid config changes depending on the host compiler
-KERNEL_CONF_OPT += \
- HOSTCXX=false
+KERNEL_SHARED_OPT += \
+ HOSTCXX="$(HOSTCXX) -DGENERATOR_FILE" \
+ HOSTCC="$(HOSTCC) -DGENERATOR_FILE"
+KERNEL_CONF_ENV := \
+ PTXDIST_NO_GCC_PLUGINS=1
+KERNEL_MAKE_ENV := \
+ PTXDIST_NO_GCC_PLUGINS=1
+endif
+
+KERNEL_CONF_TOOL := kconfig
+KERNEL_CONF_OPT = \
+ $(KERNEL_SHARED_OPT)
+
+ifdef PTXCONF_KERNEL_CONFIG_BASE_VERSION
+# force using KERNEL_VERSION in the kernelconfig
+KERNEL_CONF_OPT += \
+ KERNELVERSION=$(KERNEL_VERSION)
+endif
+
+#
+# support the different kernel image formats
+#
+KERNEL_IMAGE := $(call remove_quotes, $(PTXCONF_KERNEL_IMAGE))
+
+# these are sane defaults
+KERNEL_IMAGE_PATH_y := $(KERNEL_BUILD_DIR)/arch/$(GENERIC_KERNEL_ARCH)/boot/$(KERNEL_IMAGE)
+
+# vmlinux and vmlinuz are special
+KERNEL_IMAGE_PATH_$(PTXCONF_KERNEL_IMAGE_VMLINUX) := $(KERNEL_BUILD_DIR)/vmlinux
+KERNEL_IMAGE_PATH_$(PTXCONF_KERNEL_IMAGE_VMLINUZ) := $(KERNEL_BUILD_DIR)/vmlinuz
+# avr32 is also special
+KERNEL_IMAGE_PATH_$(PTXCONF_ARCH_AVR32) := $(KERNEL_BUILD_DIR)/arch/$(GENERIC_KERNEL_ARCH)/boot/images/$(KERNEL_IMAGE)
+
ifdef PTXCONF_KERNEL
$(KERNEL_CONFIG):
@@ -56,22 +137,228 @@ $(KERNEL_CONFIG):
@exit 1
endif
+
+#
+# when compiling the rootfs into the kernel, we just include an empty
+# file for now. the rootfs isn't build yet.
+#
+KERNEL_INITRAMFS_SOURCE_$(PTXCONF_IMAGE_KERNEL_INITRAMFS) += $(STATEDIR)/empty.cpio
+
+$(STATEDIR)/kernel.prepare:
+ @$(call targetinfo)
+#
+# Make sure there is a non empty INITRAMFS_SOURCE in $(KERNEL_CONFIG), but
+# not the real expanded path because it contains local workdir path which
+# is not relevant to other developers.
+#
+ifdef KERNEL_INITRAMFS_SOURCE_y
+ @sed -i -e 's,^CONFIG_INITRAMFS_SOURCE.*$$,CONFIG_INITRAMFS_SOURCE=\"# Automatically set by PTXDist\",g' \
+ "$(KERNEL_CONFIG)"
+endif
+ifdef PTXCONF_KERNEL_IMAGE_SIMPLE
+ cp $(PTXCONF_KERNEL_IMAGE_SIMPLE_DTS) \
+ $(KERNEL_DIR)/arch/$(GENERIC_KERNEL_ARCH)/boot/dts/$(PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET).dts
+endif
+
+ @$(call world/prepare, KERNEL)
+
+#
+# Use an existing dummy INITRAMFS_SOURCE for the first 'make' call. The
+# kernel image will be rebuilt in the image-kernel package with the real
+# initramfs.
+#
+ifdef KERNEL_INITRAMFS_SOURCE_y
+ @touch "$(KERNEL_INITRAMFS_SOURCE_y)"
+ @sed -i -e 's,^CONFIG_INITRAMFS_SOURCE.*$$,CONFIG_INITRAMFS_SOURCE=\"$(KERNEL_INITRAMFS_SOURCE_y)\",g' \
+ "$(KERNEL_BUILD_DIR)/.config"
+endif
+ @$(call touch)
+
+
+# ----------------------------------------------------------------------------
+# tags
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/kernel.tags:
+ @$(call targetinfo)
+ @$(MAKE) -C $(KERNEL_DIR) $(KERNEL_MAKE_OPT) tags TAGS cscope
+
# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------
+KERNEL_MAKE_OPT = \
+ $(call kernel/deprecated, KERNEL_MAKE_OPT) \
+ $(KERNEL_SHARED_OPT) \
+ $(KERNEL_IMAGE) \
+ $(call ptx/ifdef, PTXCONF_KERNEL_MODULES,modules)
+
+KERNEL_TOOL_PERF_OPTS := \
+ -C $(KERNEL_DIR)/tools/perf \
+ O=$(KERNEL_BUILD_DIR)/tools/perf \
+ $(KERNEL_BASE_OPT) \
+ WERROR=0 \
+ NO_LIBPERL=1 \
+ NO_LIBPYTHON=1 \
+ NO_DWARF= \
+ NO_SLANG= \
+ NO_GTK2=1 \
+ NO_DEMANGLE= \
+ NO_LIBELF= \
+ NO_LIBUNWIND=1 \
+ NO_BACKTRACE= \
+ NO_LIBNUMA=1 \
+ NO_LIBAUDIT=1 \
+ NO_LIBBIONIC=1 \
+ NO_LIBCRYPTO=1 \
+ NO_LIBDW_DWARF_UNWIND= \
+ NO_PERF_READ_VDSO32=1 \
+ NO_PERF_READ_VDSOX32=1 \
+ NO_ZLIB= \
+ NO_LIBBABELTRACE=1 \
+ NO_LZMA=1 \
+ NO_LIBZSTD=1 \
+ NO_AUXTRACE= \
+ NO_LIBBPF=1 \
+ NO_SDT=1 \
+ NO_LIBCAP=1
+
+# manual make to handle CPPFLAGS and broken parallel building for some
+# kernel versions
+KERNEL_TOOL_IIO_OPTS := \
+ PTXDIST_ICECC=$(PTXDIST_ICERUN) \
+ CPPFLAGS="-D__EXPORTED_HEADERS__ -I$(KERNEL_DIR)/include/uapi -I$(KERNEL_DIR)/include" \
+ -C $(KERNEL_DIR)/tools/iio \
+ O=$(KERNEL_BUILD_DIR)/tools/iio \
+ $(KERNEL_BASE_OPT) \
+ $(PARALLELMFLAGS_BROKEN)
+
$(STATEDIR)/kernel.compile:
@$(call targetinfo)
+ @rm -f \
+ $(KERNEL_BUILD_DIR)/usr/initramfs_data.cpio.* \
+ $(KERNEL_BUILD_DIR)/usr/.initramfs_data.cpio.*
+ @$(call world/compile, KERNEL)
+ifdef PTXCONF_KERNEL_TOOL_PERF
+ @mkdir -p $(KERNEL_BUILD_DIR)/tools/perf
+ @$(call compile, KERNEL, $(KERNEL_TOOL_PERF_OPTS))
+endif
+ifdef PTXCONF_KERNEL_TOOL_IIO
+ @mkdir -p $(KERNEL_BUILD_DIR)/tools/iio
+ @$(call world/execute, KERNEL, \
+ $(MAKE) $(KERNEL_TOOL_IIO_OPTS))
+endif
@$(call touch)
# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------
+KERNEL_INSTALL_OPT = \
+ $(KERNEL_BASE_OPT) \
+ modules_install
+
$(STATEDIR)/kernel.install:
@$(call targetinfo)
+ifdef PTXCONF_KERNEL_MODULES_INSTALL
+ @$(call world/install, KERNEL)
+endif
+ @$(call world/dtb, KERNEL)
@$(call touch)
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/kernel.targetinstall:
+ @$(call targetinfo)
+
+ @$(foreach dtb, $(KERNEL_DTB_FILES), \
+ echo -e "Installing $(dtb) ...\n"$(ptx/nl) \
+ install -D -m0644 $(KERNEL_PKGDIR)/boot/$(dtb) \
+ $(IMAGEDIR)/$(dtb)$(ptx/nl))
+
+ifdef PTXCONF_KERNEL_XPKG
+ @$(call install_init, kernel)
+ @$(call install_fixup, kernel, PRIORITY,optional)
+ @$(call install_fixup, kernel, SECTION,base)
+ @$(call install_fixup, kernel, AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
+ @$(call install_fixup, kernel, DESCRIPTION,missing)
+
+ @$(call install_copy, kernel, 0, 0, 0755, /boot);
+
+ifdef PTXCONF_KERNEL_INSTALL
+ @$(call install_copy, kernel, 0, 0, 0644, $(KERNEL_IMAGE_PATH_y), /boot/$(KERNEL_IMAGE), n)
+
+ @$(foreach dtb, $(KERNEL_DTB_FILES), \
+ $(call install_copy, kernel, 0, 0, 0644, -, \
+ /boot/$(dtb), n)$(ptx/nl))
+endif
+
+# install the ELF kernel image for debugging purpose
+ifdef PTXCONF_KERNEL_VMLINUX
+ @$(call install_copy, kernel, 0, 0, 0644, $(KERNEL_BUILD_DIR)/vmlinux, /boot/vmlinux, n)
+endif
+
+ifdef PTXCONF_KERNEL_TOOL_PERF
+ @$(call install_copy, kernel, 0, 0, 0755, $(KERNEL_BUILD_DIR)/tools/perf/perf, \
+ /usr/bin/perf)
+endif
+
+ifdef PTXCONF_KERNEL_TOOL_IIO
+ @$(call install_copy, kernel, 0, 0, 0755, $(wildcard $(KERNEL_BUILD_DIR)/tools/iio/*generic_buffer), \
+ /usr/bin/iio_generic_buffer)
+ @$(call install_copy, kernel, 0, 0, 0755, $(KERNEL_BUILD_DIR)/tools/iio/lsiio, \
+ /usr/bin/lsiio)
+ @$(call install_copy, kernel, 0, 0, 0755, $(KERNEL_BUILD_DIR)/tools/iio/iio_event_monitor, \
+ /usr/bin/iio_event_monitor)
+endif
+
+ @$(call install_finish, kernel)
+endif
+
+ @$(call touch)
+
+
+# ----------------------------------------------------------------------------
+# Target-Install-post
+# ----------------------------------------------------------------------------
+
+ifdef PTXCONF_IMAGE_KERNEL_INSTALL_EARLY
+$(STATEDIR)/kernel.targetinstall.post: $(IMAGEDIR)/linuximage
+ifdef PTXCONF_IMAGE_KERNEL_LZOP
+$(STATEDIR)/kernel.targetinstall.post: $(IMAGEDIR)/linuximage.lzo
+endif
+endif
+
+$(STATEDIR)/kernel.targetinstall.post:
+ @$(call targetinfo)
+
+ifdef PTXCONF_KERNEL_MODULES_INSTALL
+ @$(call install_init, kernel-modules)
+ @$(call install_fixup, kernel-modules, PRIORITY,optional)
+ @$(call install_fixup, kernel-modules, SECTION,base)
+ @$(call install_fixup, kernel-modules, AUTHOR,"Robert Schwebel <r.schwebel@pengutronix.de>")
+ @$(call install_fixup, kernel-modules, DESCRIPTION,missing)
+
+ @$(call install_glob, kernel-modules, 0, 0, -, /lib/modules, *.ko,, n)
+ @$(call install_glob, kernel-modules, 0, 0, -, /lib/modules,, *.ko */build */source, n)
+
+ @$(call install_finish, kernel-modules)
+endif
+
+ @$(call touch)
+
+# ----------------------------------------------------------------------------
+# Clean
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/kernel.clean:
+ @$(call targetinfo)
+ @$(call clean_pkg, KERNEL)
+ @$(foreach dtb,$(KERNEL_DTB_FILES), \
+ rm -vf $(IMAGEDIR)/$(dtb)$(ptx/nl))
+
# ----------------------------------------------------------------------------
# oldconfig / menuconfig
# ----------------------------------------------------------------------------
--
2.30.2
_______________________________________________
DistroKit mailing list
DistroKit@pengutronix.de
next prev parent reply other threads:[~2021-10-24 19:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-24 19:45 [DistroKit] [PATCH 1/8] mips, mipsel: kernel-*: bring back KERNEL_*_PATH Roland Hieber
2021-10-24 19:45 ` [DistroKit] [PATCH 2/8] mips, mipsel: kernel-*: bring up-to-date with PTXdist 2021.07.0 template Roland Hieber
2021-10-24 19:45 ` [DistroKit] [PATCH 3/8] mips, mipsel: kernel-*: rework device-tree handling Roland Hieber
2021-10-24 19:45 ` [DistroKit] [PATCH 4/8] mips, mipsel: kernel-*: use ptx/config-version and ptx/config-md5 Roland Hieber
2021-10-24 19:45 ` [DistroKit] [PATCH 5/8] ptxdist: migrate 2021.06.0 -> 2021.10.0 Roland Hieber
2021-10-24 19:45 ` [DistroKit] [PATCH 6/8] mips, mipsel: kernel: re-fork from PTXdist 2021.10.0 Roland Hieber
2021-10-24 19:54 ` Roland Hieber [this message]
2021-10-24 19:45 ` [DistroKit] [PATCH 7/8] mips, mipsel: don't actually compile the kernel Roland Hieber
2021-10-25 7:37 ` Michael Olbrich
2021-11-24 14:53 ` Robert Schwebel
2021-11-25 11:42 ` Roland Hieber
2021-10-24 19:45 ` [DistroKit] [PATCH 8/8] mips, mipsel: update kernel configs Roland Hieber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211024195451.11141-1-rhi@pengutronix.de \
--to=rhi@pengutronix.de \
--cc=distrokit@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox