get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/87852/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 87852,
    "url": "http://patches.dpdk.org/api/patches/87852/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1613048386-655-1-git-send-email-juraj.linkes@pantheon.tech/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<1613048386-655-1-git-send-email-juraj.linkes@pantheon.tech>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1613048386-655-1-git-send-email-juraj.linkes@pantheon.tech",
    "date": "2021-02-11T12:59:46",
    "name": "[v6] build: kni cross-compilation support",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "221e63e9ac006c5c0332ace0f96948afaf830e0f",
    "submitter": {
        "id": 1626,
        "url": "http://patches.dpdk.org/api/people/1626/?format=api",
        "name": "Juraj Linkeš",
        "email": "juraj.linkes@pantheon.tech"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1613048386-655-1-git-send-email-juraj.linkes@pantheon.tech/mbox/",
    "series": [
        {
            "id": 15236,
            "url": "http://patches.dpdk.org/api/series/15236/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15236",
            "date": "2021-02-11T12:59:46",
            "name": "[v6] build: kni cross-compilation support",
            "version": 6,
            "mbox": "http://patches.dpdk.org/series/15236/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/87852/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/87852/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id BBB0CA054A;\n\tThu, 11 Feb 2021 13:59:52 +0100 (CET)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 37FE91CC38A;\n\tThu, 11 Feb 2021 13:59:52 +0100 (CET)",
            "from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20])\n by mails.dpdk.org (Postfix) with ESMTP id 7EB861CC344\n for <dev@dpdk.org>; Thu, 11 Feb 2021 13:59:50 +0100 (CET)",
            "from localhost (localhost [127.0.0.1])\n by lb.pantheon.sk (Postfix) with ESMTP id 51761C05B6;\n Thu, 11 Feb 2021 13:59:49 +0100 (CET)",
            "from lb.pantheon.sk ([127.0.0.1])\n by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id E40yj9VzSra4; Thu, 11 Feb 2021 13:59:47 +0100 (CET)",
            "from service-node1.lab.pantheon.local (unknown [46.229.239.141])\n by lb.pantheon.sk (Postfix) with ESMTP id 95F68BF47F;\n Thu, 11 Feb 2021 13:59:46 +0100 (CET)"
        ],
        "X-Virus-Scanned": "amavisd-new at siecit.sk",
        "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "To": "bruce.richardson@intel.com, thomas@monjalon.net, Ruifeng.Wang@arm.com,\n Honnappa.Nagarahalli@arm.com, jerinjacobk@gmail.com,\n hemant.agrawal@nxp.com, ferruh.yigit@intel.com, aboyer@pensando.io",
        "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "Date": "Thu, 11 Feb 2021 13:59:46 +0100",
        "Message-Id": "<1613048386-655-1-git-send-email-juraj.linkes@pantheon.tech>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1612860425-27646-1-git-send-email-juraj.linkes@pantheon.tech>",
        "References": "<1612860425-27646-1-git-send-email-juraj.linkes@pantheon.tech>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=UTF-8",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v6] build: kni cross-compilation support",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "The kni linux module is using a custom target for building, which\ndoesn't take into account any cross compilation arguments. The arguments\nin question are ARCH, CROSS_COMPILE (for gcc, clang) and CC, LD (for\nclang). Get those from the cross file and pass them to the custom\ntarget.\n\nThe user supplied path may not contain the 'build' directory, such as\nwhen using cross-compiled headers, so only append that in the default\ncase (when no path is supplied in native builds) and use the unmodified\npath from the user otherwise. Also modify the install path accordingly.\n\nSigned-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>\nReviewed-by: Bruce Richardson <bruce.richardson@intel.com>\n---\n kernel/linux/kni/meson.build |  8 ++--\n kernel/linux/meson.build     | 90 ++++++++++++++++++++++++++++++------\n meson_options.txt            |  2 +-\n 3 files changed, 82 insertions(+), 18 deletions(-)",
    "diff": "diff --git a/kernel/linux/kni/meson.build b/kernel/linux/kni/meson.build\nindex 07e0c9dae7..46b71c7418 100644\n--- a/kernel/linux/kni/meson.build\n+++ b/kernel/linux/kni/meson.build\n@@ -13,7 +13,7 @@ kni_sources = files(\n custom_target('rte_kni',\n \tinput: kni_sources,\n \toutput: 'rte_kni.ko',\n-\tcommand: ['make', '-j4', '-C', kernel_dir + '/build',\n+\tcommand: ['make', '-j4', '-C', kernel_build_dir,\n \t\t'M=' + meson.current_build_dir(),\n \t\t'src=' + meson.current_source_dir(),\n \t\t'MODULE_CFLAGS=-include ' + meson.source_root() + '/config/rte_config.h' +\n@@ -21,8 +21,8 @@ custom_target('rte_kni',\n \t\t' -I' + meson.source_root() + '/lib/librte_kni' +\n \t\t' -I' + meson.build_root() +\n \t\t' -I' + meson.current_source_dir(),\n-\t\t'modules'],\n+\t\t'modules'] + cross_args,\n \tdepends: kni_mkfile,\n-\tinstall: true,\n-\tinstall_dir: kernel_dir + '/extra/dpdk',\n+\tinstall: install,\n+\tinstall_dir: kernel_install_dir,\n \tbuild_by_default: get_option('enable_kmods'))\ndiff --git a/kernel/linux/meson.build b/kernel/linux/meson.build\nindex 5c864a4653..7b15e0fd44 100644\n--- a/kernel/linux/meson.build\n+++ b/kernel/linux/meson.build\n@@ -3,25 +3,89 @@\n \n subdirs = ['kni']\n \n-# if we are cross-compiling we need kernel_dir specified\n-if get_option('kernel_dir') == '' and meson.is_cross_build()\n-\terror('Need \"kernel_dir\" option for kmod compilation when cross-compiling')\n-endif\n+kernel_build_dir = get_option('kernel_dir')\n+kernel_install_dir = ''\n+install = not meson.is_cross_build()\n+cross_args = []\n \n-kernel_dir = get_option('kernel_dir')\n-if kernel_dir == ''\n-\t# use default path for native builds\n+if not meson.is_cross_build()\n+\t# native build\n \tkernel_version = run_command('uname', '-r').stdout().strip()\n-\tkernel_dir = '/lib/modules/' + kernel_version\n+\tkernel_install_dir = '/lib/modules/' + kernel_version + '/extra/dpdk'\n+\tif kernel_build_dir == ''\n+\t\t# use default path for native builds\n+\t\tkernel_build_dir = '/lib/modules/' + kernel_version + '/build'\n+\tendif\n+\n+\t# test running make in kernel directory, using \"make kernelversion\"\n+\tmake_returncode = run_command('make', '-sC', kernel_build_dir,\n+\t\t\t'kernelversion').returncode()\n+\tif make_returncode != 0\n+\t\t# backwards compatibility:\n+\t\t# the headers could still be in the 'build' subdir\n+\t\tif not kernel_build_dir.endswith('build') and not kernel_build_dir.endswith('build/')\n+\t\t\tkernel_build_dir = join_paths(kernel_build_dir, 'build')\n+\t\t\tmake_returncode = run_command('make', '-sC', kernel_build_dir,\n+\t\t\t\t\t'kernelversion').returncode()\n+\t\tendif\n+\tendif\n+\n+\tif make_returncode != 0\n+\t\terror('Cannot compile kernel modules as requested - are kernel headers installed?')\n+\tendif\n+\n+\t# DO ACTUAL MODULE BUILDING\n+\tforeach d:subdirs\n+\t\tsubdir(d)\n+\tendforeach\n+\n+\tsubdir_done()\n endif\n \n-# test running make in kernel directory, using \"make kernelversion\"\n-make_returncode = run_command('make', '-sC', kernel_dir + '/build',\n-\t\t'kernelversion').returncode()\n-if make_returncode != 0\n-\terror('Cannot compile kernel modules as requested - are kernel headers installed?')\n+# cross build\n+# if we are cross-compiling we need kernel_build_dir specified\n+if kernel_build_dir == ''\n+\terror('Need \"kernel_dir\" option for kmod compilation when cross-compiling')\n+endif\n+cross_compiler = find_program('c').path()\n+if cross_compiler.endswith('gcc')\n+\tcross_prefix = run_command([py3, '-c', 'print(\"' + cross_compiler + '\"[:-3])']).stdout().strip()\n+elif cross_compiler.endswith('clang')\n+\tcross_prefix = ''\n+\tfound_target = false\n+\t# search for '-target' and use the arg that follows\n+\t# (i.e. the value of '-target') as cross_prefix\n+\tforeach cross_c_arg : meson.get_cross_property('c_args')\n+\t\tif found_target and cross_prefix == ''\n+\t\t\tcross_prefix = cross_c_arg\n+\t\tendif\n+\t\tif cross_c_arg == '-target'\n+\t\t\tfound_target = true\n+\t\tendif\n+\tendforeach\n+\tif cross_prefix == ''\n+\t\terror('Didn\\'t find -target and its value in' +\n+\t\t      ' c_args in input cross-file.')\n+\tendif\n+\tlinker = 'lld'\n+\tforeach cross_c_link_arg : meson.get_cross_property('c_link_args')\n+\t\tif cross_c_link_arg.startswith('-fuse-ld')\n+\t\t\tlinker = cross_c_link_arg.split('=')[1]\n+\t\tendif\n+\tendforeach\n+\tcross_args += ['CC=@0@'.format(cross_compiler), 'LD=ld.@0@'.format(linker)]\n+else\n+\terror('Unsupported cross compiler: @0@'.format(cross_compiler))\n endif\n \n+cross_arch = host_machine.cpu_family()\n+if host_machine.cpu_family() == 'aarch64'\n+\tcross_arch = 'arm64'\n+endif\n+\n+cross_args += ['ARCH=@0@'.format(cross_arch),\n+\t'CROSS_COMPILE=@0@'.format(cross_prefix)]\n+\n # DO ACTUAL MODULE BUILDING\n foreach d:subdirs\n \tsubdir(d)\ndiff --git a/meson_options.txt b/meson_options.txt\nindex 6eff62e47d..3b8c5d316d 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -19,7 +19,7 @@ option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'],\n option('include_subdir_arch', type: 'string', value: '',\n \tdescription: 'subdirectory where to install arch-dependent headers')\n option('kernel_dir', type: 'string', value: '',\n-\tdescription: 'Path to the kernel for building kernel modules. Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.')\n+\tdescription: 'Path to the kernel for building kernel modules. Headers must be in $kernel_dir or $kernel_dir/build. Modules will be installed in /lib/modules.')\n option('machine', type: 'string', value: 'native',\n \tdescription: 'set the target machine type')\n option('max_ethports', type: 'integer', value: 32,\n",
    "prefixes": [
        "v6"
    ]
}