{"id":11484,"url":"https://patchwork.libcamera.org/api/1.1/patches/11484/?format=json","web_url":"https://patchwork.libcamera.org/patch/11484/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20210303173921.8801-1-laurent.pinchart@ideasonboard.com>","date":"2021-03-03T17:39:21","name":"[libcamera-devel] utils: Add kernel headers update script","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"7349650c026245d81b6dd1e18e93e0fe02901cda","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/1.1/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11484/mbox/","series":[{"id":1755,"url":"https://patchwork.libcamera.org/api/1.1/series/1755/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1755","date":"2021-03-03T17:39:21","name":"[libcamera-devel] utils: Add kernel headers update script","version":1,"mbox":"https://patchwork.libcamera.org/series/1755/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11484/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11484/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 77E35BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Mar 2021 17:39:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E788A68A9A;\n\tWed,  3 Mar 2021 18:39:54 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 3748E68A7E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Mar 2021 18:39:54 +0100 (CET)","from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A6A668CA\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Mar 2021 18:39:53 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"f+9tKAet\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1614793193;\n\tbh=7L4ueILntRsZUp7yQatBrs9qf1oovjtDXGgvpWSHRHM=;\n\th=From:To:Subject:Date:From;\n\tb=f+9tKAet4wdFtBMKa/N/ovkNnnRTOvnKRMIQOPdGgKLY8rRjqLJp9ps5OTIkgTerQ\n\tja6H2JfY0sonwXoWqmHdgSxsI6Cn12uZQ1i3+fTIh9t6POh1WS3fAUJDpjPoc/FiiA\n\t6kOQA2Ntt11UaEkvO++1MsNxNon7CLTOyFSfKUVo=","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Date":"Wed,  3 Mar 2021 19:39:21 +0200","Message-Id":"<20210303173921.8801-1-laurent.pinchart@ideasonboard.com>","X-Mailer":"git-send-email 2.28.0","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH] utils: Add kernel headers update script","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add a script to update the local copy of kernel headers (in\ninclude/linux/) from a Linux kernel git tree. The script handles header\ninstallation, manual processing of the IPU3 header that is still in\nstaging, and update of the README file.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n utils/update-kernel-headers.sh | 78 ++++++++++++++++++++++++++++++++++\n 1 file changed, 78 insertions(+)\n create mode 100755 utils/update-kernel-headers.sh","diff":"diff --git a/utils/update-kernel-headers.sh b/utils/update-kernel-headers.sh\nnew file mode 100755\nindex 000000000000..f5d91c8a8c08\n--- /dev/null\n+++ b/utils/update-kernel-headers.sh\n@@ -0,0 +1,78 @@\n+#!/bin/sh\n+\n+# SPDX-License-Identifier: GPL-2.0-or-later\n+# Update the kernel headers copy from a kernel source tree\n+\n+if [ $# != 1 ] ; then\n+\techo \"Usage: $0 <kernel dir>\"\n+\texit 1\n+fi\n+\n+header_dir=\"$(dirname \"$(realpath \"$0\")\")/../include/linux\"\n+kernel_dir=\"$1\"\n+\n+# Bail out if the directory doesn't contain kernel sources\n+line=$(head -3 \"${kernel_dir}/Kbuild\" 2>/dev/null | tail -1)\n+if [ \"$line\" != \"# Kbuild for top-level directory of the kernel\" ] ; then\n+\techo \"Directory ${kernel_dir} doesn't contain a kernel source tree\"\n+\texit 1\n+fi\n+\n+if [ ! -d \"${kernel_dir}/.git\" ] ; then\n+\techo \"Directory ${kernel_dir} doesn't contain a git tree\"\n+\texit 1\n+fi\n+\n+# Install the headers to a temporary directory\n+install_dir=$(mktemp -d)\n+if [ ! -d \"${install_dir}\" ] ; then\n+\techo \"Failed to create temporary directory\"\n+\texit 1\n+fi\n+\n+trap \"rm -rf ${install_dir}\" EXIT\n+\n+set -e\n+make -C \"${kernel_dir}\" O=\"${install_dir}\" headers_install\n+set +e\n+\n+# Copy the headers\n+headers=\"\n+\tdrm/drm_fourcc.h\n+\tlinux/dma-buf.h\n+\tlinux/dma-heap.h\n+\tlinux/media-bus-format.h\n+\tlinux/media.h\n+\tlinux/rkisp1-config.h\n+\tlinux/v4l2-common.h\n+\tlinux/v4l2-controls.h\n+\tlinux/v4l2-mediabus.h\n+\tlinux/v4l2-subdev.h\n+\tlinux/videodev2.h\n+\"\n+\n+for header in $headers ; do\n+\tname=$(basename \"${header}\")\n+\tcp \"${install_dir}/usr/include/${header}\" \"${header_dir}/${name}\"\n+done\n+\n+# The IPU3 header is a special case, as it's stored in staging. Handle it\n+# manually.\n+(cd \"${install_dir}\" ; \"${kernel_dir}scripts/headers_install.sh\" \\\n+\t\"${kernel_dir}/drivers/staging/media/ipu3/include/intel-ipu3.h\" \\\n+\t\"${header_dir}/intel-ipu3.h\")\n+\n+# Update the README file\n+version=$(git --git-dir=\"${kernel_dir}/.git\" describe)\n+\n+cat <<EOF > \"${header_dir}/README\"\n+# SPDX-License-Identifier: CC0-1.0\n+\n+Files in this directory are imported from ${version} of the Linux kernel. Do not\n+modify them manually.\n+EOF\n+\n+# Cleanup\n+rm -rf \"${install_dir}\"\n+\n+echo \"Kernel headers updated\"\n","prefixes":["libcamera-devel"]}