From: Henning Schild <henning.schild@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: isar-users <isar-users@googlegroups.com>
Subject: Re: [PATCH v2 5/8] Provide include file for easy custom kernel builds
Date: Fri, 9 Feb 2018 20:04:15 +0100 [thread overview]
Message-ID: <20180209200415.19dd80a4@mmd1pvb1c.ad001.siemens.net> (raw)
In-Reply-To: <f733626e-c7d7-31cb-9ea1-27ec37f635af@siemens.com>
Am Fri, 9 Feb 2018 18:54:12 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> On 2018-02-09 18:30, Henning Schild wrote:
> > Am Thu, 8 Feb 2018 18:22:56 +0100
> > schrieb "[ext] Jan Kiszka" <jan.kiszka@siemens.com>:
> >
> >> From: Jan Kiszka <jan.kiszka@siemens.com>
> >>
> >> With this include file, it becomes almost trivial to replace the
> >> distro kernel with a custom build. You just need to include
> >> linux-custom.inc, specify the source URI, define via S where the
> >> source is unpacked to and provide a defconfig. To switch to a
> >> custom kernel recipe, PREFERRED_PROVIDER_virtual/kernel has to be
> >> adjusted in local.conf or the distro conf.
> >>
> >> The approach works internally by first running "make deb-pkg" on
> >> the kernel and the repackages the output to make the binary
> >> linux-image and linux-header debs act as replacement of their
> >> distro packages. This results in a suboptimal technical
> >> implementation which may eventually be replaced by an
> >> isar-implemented deb-pkg build process. However, this is not
> >> expected to affect the user-visible interface of this include file.
> >>
> >> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> >> ---
> >> meta/recipes-kernel/linux/linux-custom.inc | 98
> >> ++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+)
> >> create mode 100644 meta/recipes-kernel/linux/linux-custom.inc
> >>
> >> diff --git a/meta/recipes-kernel/linux/linux-custom.inc
> >> b/meta/recipes-kernel/linux/linux-custom.inc new file mode 100644
> >> index 0000000..feb96a1
> >> --- /dev/null
> >> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> >> @@ -0,0 +1,98 @@
> >> +# Custom kernel recipe include
> >> +#
> >> +# This software is a part of ISAR.
> >> +# Copyright (c) Siemens AG, 2018
> >> +#
> >> +# SPDX-License-Identifier: MIT
> >> +
> >> +DESCRIPTION ?= "Custom kernel"
> >> +PROVIDES = "virtual/kernel"
> >> +
> >> +inherit dpkg-base
> >> +
> >> +KERNEL_DEBIAN_DEPENDS = "initramfs-tools | linux-initramfs-tool,
> >> kmod, linux-base (>= 4.3~)" +KERNEL_HEADERS_DEBIAN_DEPENDS =
> >> "libc6, libssl1.1, gcc" +KBUILD_DEPENDS = "libssl-dev libelf-dev
> >> bc"
> >
> > These guys and the repacking are here because someone wrote a
> > build-script that does not allow customization, how about not
> > repeating that mistake and using "?=".
>
> As this is an include, you can already easily adjust after including.
> Granted, defining those as default assignment would permit
> project-wide overrides in local.conf & Co. OK, will send v3.
Maybe i missed that so far, but could you explain why this is an
include and not a bbclass. Not that i prefer one over the other but so
far we do not seem to use .incs in Isar.
Henning
> Jan
>
> >> +REPACK_DIR = "${PP}/repack"
> >> +REPACK_LINUX_IMAGE_DIR = "${REPACK_DIR}/linux-image"
> >> +REPACK_LINUX_HEADERS_DIR = "${REPACK_DIR}/linux-headers"
> >> +
> >> +dpkg_runbuild() {
> >> + E="${@ bb.utils.export_proxies(d)}"
> >> + sudo -E chroot ${BUILDCHROOT_DIR} sh -c '
> >> + set -e
> >> +
> >> + apt-get install -y -o
> >> Debug::pkgProblemResolver=yes \
> >> + --no-install-recommends ${KBUILD_DEPENDS}
> >> +
> >> + cd ${PP}/${S}
> >> + cp ../defconfig .config
> >> + make olddefconfig
> >> +
> >> + make -j ${@bb.utils.cpu_count() * 2} deb-pkg
> >> +
> >> + rm -rf ${REPACK_DIR}
> >> + mkdir -p ${REPACK_DIR}
> >> + mkdir -p ${REPACK_LINUX_IMAGE_DIR}
> >> + mkdir -p ${REPACK_LINUX_HEADERS_DIR}
> >> +
> >> + cd ${PP}
> >> + tar xzf linux-${PV}_${PV}-1.debian.tar.gz -C
> >> ${REPACK_DIR}
> >> + dpkg-deb -R
> >> linux-image-${PV}_${PV}-1_${KERNEL_ARCH}.deb \
> >> + ${REPACK_LINUX_IMAGE_DIR}
> >> + dpkg-deb -R
> >> linux-headers-${PV}_${PV}-1_${KERNEL_ARCH}.deb \
> >> + ${REPACK_LINUX_HEADERS_DIR}
> >> +
> >> + dpkg-gencontrol -crepack/debian/control \
> >> + -lrepack/debian/changelog \
> >> + -frepack/debian/files \
> >> + -plinux-image-${PV} \
> >> + -P${REPACK_LINUX_IMAGE_DIR} \
> >> + -DPackage="linux-image-${KERNEL_ARCH}" \
> >> + -DSection=kernel \
> >> + -DPriority=required \
> >> + -DProvides="${PN}" \
> >> + -DDepends="${KERNEL_DEBIAN_DEPENDS}"
> >> +
> >> + # Add Debian-like link installation to postinst
> >> + touch
> >> ${REPACK_LINUX_IMAGE_DIR}/lib/modules/${PV}/.fresh-install
> >> + sed -i ${REPACK_LINUX_IMAGE_DIR}/DEBIAN/postinst \
> >> + -e "/^set -e$/a\\
> >> +\\
> >> +if [ -f /lib/modules/${PV}/.fresh-install ]; then\\
> >> + change=install\\
> >> +else\\
> >> + change=upgrade\\
> >> +fi\\
> >> +linux-update-symlinks \$change ${PV} /boot/vmlinuz-${PV}\\
> >> +rm -f /lib/modules/${PV}/.fresh-install"
> >> +
> >> + # Add Debian-like link removal to postrm
> >> + sed -i ${REPACK_LINUX_IMAGE_DIR}/DEBIAN/postrm \
> >> + -e "/^set -e$/a\\
> >> +\\
> >> +rm -f /lib/modules/${PV}/.fresh-install\\
> >> +\\
> >> +if [ \"\$1\" != upgrade ] && command -v linux-update-symlinks
> >>> /dev/null; then\\
> >> + linux-update-symlinks remove ${PV} /boot/vmlinuz-${PV}\\
> >> +fi"
> >> +
> >> + dpkg-gencontrol -crepack/debian/control \
> >> + -lrepack/debian/changelog \
> >> + -frepack/debian/files \
> >> + -plinux-headers-${PV} \
> >> + -P${REPACK_LINUX_HEADERS_DIR} \
> >> + -Vkernel:debarch="${KERNEL_ARCH}" \
> >> + -DPackage="linux-headers-${KERNEL_ARCH}" \
> >> + -DSection=kernel \
> >> + -DDepends="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
> >> +
> >> + dpkg-deb -b ${REPACK_LINUX_IMAGE_DIR} \
> >> +
> >> linux-image-${KERNEL_ARCH}_${PV}-1_${KERNEL_ARCH}.deb
> >> + rm -f linux-image-${PV}_${PV}-1_${KERNEL_ARCH}.deb
> >> + dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \
> >> +
> >> linux-headers-${KERNEL_ARCH}_${PV}-1_${KERNEL_ARCH}.deb
> >> + rm -f
> >> linux-headers-${PV}_${PV}-1_${KERNEL_ARCH}.deb
> >> + '
> >> +}
> >
>
>
next prev parent reply other threads:[~2018-02-09 19:04 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 17:22 [PATCH v2 0/8] Provide infrastructure and examples for custom kernels and modules Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 1/8] Forward proxy settings to dpkg build Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 2/8] Prioritize isar-apt repo over all others Jan Kiszka
2018-02-09 16:46 ` Henning Schild
2018-02-09 16:52 ` Jan Kiszka
2018-02-09 17:15 ` Henning Schild
2018-02-08 17:22 ` [PATCH v2 3/8] Replace SRC_DIR with S Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 4/8] Install kernel via replaceable recipe Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 5/8] Provide include file for easy custom kernel builds Jan Kiszka
2018-02-09 16:59 ` Henning Schild
2018-02-09 17:24 ` Jan Kiszka
2018-02-09 17:31 ` Henning Schild
2018-02-09 17:30 ` Henning Schild
2018-02-09 17:54 ` Jan Kiszka
2018-02-09 19:04 ` Henning Schild [this message]
2018-02-11 15:16 ` Jan Kiszka
2018-02-09 17:57 ` [PATCH v3 " Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 6/8] Add custom kernel examples Jan Kiszka
2018-02-09 17:01 ` Henning Schild
2018-02-08 17:22 ` [PATCH v2 7/8] Provide include file for easy custom module builds Jan Kiszka
2018-02-08 17:22 ` [PATCH v2 8/8] Add exemplary kernel module Jan Kiszka
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=20180209200415.19dd80a4@mmd1pvb1c.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
/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