From patchwork Mon Feb 19 08:32:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1900805 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TdbQV2R7qz23cn for ; Mon, 19 Feb 2024 19:33:06 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rbz57-0003qX-L8; Mon, 19 Feb 2024 08:32:57 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rbz54-0003pc-SU for kernel-team@lists.ubuntu.com; Mon, 19 Feb 2024 08:32:54 +0000 Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id AFFB940DB1 for ; Mon, 19 Feb 2024 08:32:54 +0000 (UTC) Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6e2e6992dc4so2544148a34.0 for ; Mon, 19 Feb 2024 00:32:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708331573; x=1708936373; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=//wCh4bcdB7SRbcew06QZzFnTJwwdkiYwX1o41EmyAo=; b=IknDVFcu1Lhg2om3mPjOU8DrKMxk1WHLBBk1Nr+shPgqdNXQFHIqIpAxH4niu7U80x DVKcwSzPQmyUXYrz9cXQ36Wk51CmvZI0+zd5RroDemGmeuqMSgJE3TtI7xTxq7IvmkuM WEPW/4rIcr3h+tfu1BzO5FENTPvmzlNEy0rPXBHmMw+qCv/DBdi5nGbYtRSPFykl7dwC Lbt6BFr7ZbH2602FYHGrkBTqGelTxLh82Klqh/ciB5nMjDS3CNrN70vkhNYchWTjQu39 i4HStfSLPS/3zXHhKzbAVEruSWgaQj1Y5yXGT2s2luRfnBRJYXx7p3NvFS/VnBuaRgM5 nfaw== X-Gm-Message-State: AOJu0YyrwSU+P4D5YlohPA4Q4wHEX+kF3w46UYIroBowfBm0ZbCIzJp+ vYZyXZPWCbfkwj/TQi/Pex44b2lcj763TQqiqd533kuCHz6Xig2dVCW0xu4ZKVolkb8/DeKbj0m zaLPMa4m5qZWFQcdGvV/LkLxW142MYlshII5FwrkjGaSRwVhhJzUK7yJx+JNXuBQjIG4JUkNeEy kQOEr/8Rj0BBaD X-Received: by 2002:a05:6358:d5a8:b0:176:ac69:87db with SMTP id ms40-20020a056358d5a800b00176ac6987dbmr11548337rwb.32.1708331573438; Mon, 19 Feb 2024 00:32:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IEFEipfL+aQdIo227fsCrpn93LiL6TrsrJyW843mBVRl3nfRciG3DSq5yIurCz8dp0SRY5Syg== X-Received: by 2002:a05:6358:d5a8:b0:176:ac69:87db with SMTP id ms40-20020a056358d5a800b00176ac6987dbmr11548325rwb.32.1708331572995; Mon, 19 Feb 2024 00:32:52 -0800 (PST) Received: from zoe.. ([240b:c020:442:78d4:a0b8:d193:69e4:b210]) by smtp.gmail.com with ESMTPSA id e25-20020aa78259000000b006e0d44e1bd0sm4210766pfn.55.2024.02.19.00.32.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 00:32:52 -0800 (PST) From: Masahiro Yamada To: kernel-team@lists.ubuntu.com Subject: [SRU j/linux-raspi PATCH v2 1/2] UBUNTU: [Packaging] Remove old snapcraft.yaml Date: Mon, 19 Feb 2024 17:32:42 +0900 Message-Id: <20240219083243.2291012-2-masahiro.yamada@canonical.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240219083243.2291012-1-masahiro.yamada@canonical.com> References: <20240219083243.2291012-1-masahiro.yamada@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" This file was added more than a decade ago, and is no longer working. BugLink: https://bugs.launchpad.net/bugs/2051468 Signed-off-by: Masahiro Yamada --- snapcraft.yaml | 36 ------------------------------------ 1 file changed, 36 deletions(-) delete mode 100644 snapcraft.yaml diff --git a/snapcraft.yaml b/snapcraft.yaml deleted file mode 100644 index 2452c4031066..000000000000 --- a/snapcraft.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: pc-kernel -version: null -version-script: | - . debian/debian.env - dpkg-parsechangelog -l $DEBIAN/changelog -S version -summary: The Ubuntu generic Linux kernel -description: This Ubuntu generic Linux kernel -grade: stable -confinement: strict -type: kernel - -parts: - kernel: - plugin: kernel - source: . - source-type: git - kconfigflavour: generic - kconfigs: - - CONFIG_DEBUG_INFO=n - override-build: | - cp debian/scripts/retpoline-extract-one \ - $SNAPCRAFT_PART_BUILD/scripts/ubuntu-retpoline-extract-one - snapcraftctl build - kernel-with-firmware: false - firmware: - plugin: nil - stage-packages: - - linux-firmware - organize: - lib/firmware: firmware - prime: - - -usr - - -lib - build-packages: - - cpio - - libssl-dev From patchwork Mon Feb 19 08:32:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 1900806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TdbQW50L2z23cl for ; Mon, 19 Feb 2024 19:33:07 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rbz5A-0003rq-3Z; Mon, 19 Feb 2024 08:33:00 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rbz56-0003q5-Br for kernel-team@lists.ubuntu.com; Mon, 19 Feb 2024 08:32:56 +0000 Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 218F940CBD for ; Mon, 19 Feb 2024 08:32:56 +0000 (UTC) Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-6e2f2e25c1eso3290583a34.2 for ; Mon, 19 Feb 2024 00:32:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708331575; x=1708936375; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yqWJb28JxPPfeWYTiCiEq8knAinneNbOVHEU7g59zvs=; b=CxE8K8zld6JG3mo1AXJsTUSkxmJgPvt7wpTaTwgFu/lo96JWocWUleo4mm1kC2P1kD wC4sbGwt4u6f3McIkBYNA+vFfrziBMzrZMKBz8fFr+3WDD8hTM+PVXXM3SmTAaRWpPWB 4z8gL0fzCCglIP012YXufLf79L0/u48uhIvn18gWJC2Wg66Vwkx4eqD9adza8ENT6Lq4 B0f43jGsJN6wgVFaUB7iOu+1oKblqpiL/ZfY9ZTzMD/5X7KanRNE6cBF6u0EQmR5pCL4 1LEtQWaVdLSKv3T5fcxHoqgV4uXH+f6qQkui+fZMy70wdBu19vNcBM0sXvjdMjeakd05 b4PA== X-Gm-Message-State: AOJu0YwdhfjDHQrPg01x6gOZqKEjyp3MPzzqvMsWa0JP7lh8bI8hLOMO VQ66zxucMxRgkoP2WI2X7uVpXwvKFmuzSrh9UBjLiqS+81bq+xBWJhdpaDoAcDSLeqIofiX1IRj u0WZFFFWb0vsJsCXsdbyv/RW+CNaoFBfK3TDDsLERvxbn1w2D2FA51jy//Y4eUTmsbA3I7GzcC4 CFx/QPFq7tqm4W X-Received: by 2002:a05:6358:7405:b0:178:ff94:f9a2 with SMTP id s5-20020a056358740500b00178ff94f9a2mr14433478rwg.27.1708331574831; Mon, 19 Feb 2024 00:32:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5vKoWwHuTY6iqUYuISVN4eoBW+nDV7XArYYcLdjCb7fCbxlcPD+0TUvKIXjauWDubvXfj1w== X-Received: by 2002:a05:6358:7405:b0:178:ff94:f9a2 with SMTP id s5-20020a056358740500b00178ff94f9a2mr14433462rwg.27.1708331574392; Mon, 19 Feb 2024 00:32:54 -0800 (PST) Received: from zoe.. ([240b:c020:442:78d4:a0b8:d193:69e4:b210]) by smtp.gmail.com with ESMTPSA id e25-20020aa78259000000b006e0d44e1bd0sm4210766pfn.55.2024.02.19.00.32.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 00:32:54 -0800 (PST) From: Masahiro Yamada To: kernel-team@lists.ubuntu.com Subject: [SRU j/linux-raspi PATCH v2 2/2] UBUNTU: [Packaging] Add snapcraft.yaml for building uc22 pi-kernel snap Date: Mon, 19 Feb 2024 17:32:43 +0900 Message-Id: <20240219083243.2291012-3-masahiro.yamada@canonical.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240219083243.2291012-1-masahiro.yamada@canonical.com> References: <20240219083243.2291012-1-masahiro.yamada@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Add snapcraft.yaml to support the local building for the pi-kernel snap. This supports cross-building, making it possible to build the snap on your x86 machine, and useful for development purposes. Build for arm64: $ snapcraft --use-lxd --build-for=arm64 Build for armhf: $ snapcraft --use-lxd --build-for=armhf Both arm64 and armhf snaps were tested on Raspberry Pi 4. BugLink: https://bugs.launchpad.net/bugs/2051468 Signed-off-by: Masahiro Yamada Commit-notes: Changes since the previos posts - Add BugLink - Fix BugLink style - Add 'PATCH' in the subject prefix Changes in v2: - Remove unneeded CONFIG_MODULE_SIG_FORCE orverride - Split the last treak to 'finalize' END Series-prefix: j/linux-raspi v2 RESEND4 Cover-letter: Make snapcraft.yaml work linux-raspi added snapcraft.yaml more than a decade ago, which is not functional at all. Remove the old one, and re-implement working snapcraft.yaml. BugLink: https://bugs.launchpad.net/bugs/2051468 END --- snapcraft.yaml | 151 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 snapcraft.yaml diff --git a/snapcraft.yaml b/snapcraft.yaml new file mode 100644 index 000000000000..9274305e156b --- /dev/null +++ b/snapcraft.yaml @@ -0,0 +1,151 @@ +# SPDX-License-Identifier: GPL-2.0-only +# Copyright (C) 2023 Canonical Ltd +# +# Build for arm64: +# +# $ snapcraft --use-lxd --build-for=arm64 +# +# Build for armhf: +# +# $ snapcraft --use-lxd --build-for=armhf + +name: pi-kernel +summary: The Canonical Raspberry Pi kernel +description: The Canonical Raspberry Pi kernel +type: kernel +confinement: strict +build-base: core22 +# Take the version from debian/changelog +adopt-info: kernel + +architectures: + - build-on: [amd64, arm64] + build-for: arm64 + - build-on: [amd64, armhf] + build-for: armhf + +package-repositories: + - type: apt + architectures: [arm64, armhf] + components: [main] + suites: [jammy] + key-id: 78E1918602959B9C59103100F1831DDAFC42E99D + url: https://ppa.launchpadcontent.net/snappy-dev/image/ubuntu + - type: apt + architectures: [arm64, armhf] + components: [main, restricted] + suites: [jammy, jammy-updates] + key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C + url: http://ports.ubuntu.com/ubuntu-ports + +parts: + kernel: + build-packages: + - bc + - bison + - debhelper + - fakeroot + - flex + - gawk + - kmod + - libssl-dev + - pahole + - rsync + - on amd64 to arm64: + - gcc-aarch64-linux-gnu + - libc6-dev-arm64-cross + - on amd64 to armhf: + - gcc-arm-linux-gnueabihf + - libc6-dev-armhf-cross + plugin: nil + source-type: local + source: . + override-build: | + FLAVOUR=raspi + deb_arch=${SNAPCRAFT_TARGET_ARCH} + + # Include 'DEBIAN' definition + . debian/debian.env + deb_ver=$(dpkg-parsechangelog -l "${DEBIAN}/changelog" -S version) + kernelrelease=$(echo "${deb_ver}" | cut -d. -f1-3)-${FLAVOUR} + craftctl set "version=local-${deb_ver}" + + dpkg-architecture -a "${deb_arch}" -c fakeroot debian/rules clean + dpkg-architecture -a "${deb_arch}" -c debian/rules "build-${FLAVOUR}" + dpkg-architecture -a "${deb_arch}" -c fakeroot debian/rules "binary-${FLAVOUR}" + + for pkg in linux-image linux-modules linux-buildinfo; do + dpkg-deb -x "../${pkg}-${kernelrelease}_${deb_ver}_${deb_arch}.deb" tmpdir + done + + depmod -b tmpdir "${kernelrelease}" + mv tmpdir/boot/vmlinuz-* "${SNAPCRAFT_PART_INSTALL}/kernel.img" + mv tmpdir/boot/config-* tmpdir/boot/System.map-* "${SNAPCRAFT_PART_INSTALL}/" + mv tmpdir/lib/modules "${SNAPCRAFT_PART_INSTALL}" + mv "tmpdir/lib/firmware/${kernelrelease}/device-tree" "${SNAPCRAFT_PART_INSTALL}/dtbs" + + firmware: + build-packages: + - bluez-firmware + - linux-firmware + plugin: nil + override-build: | + mkdir -p tmpdir/lib + cp -r /lib/firmware tmpdir/lib + + # linux-firmware and linux-firmware-raspi provides the same firmware + # files with different contents. Copy linux-firmware-raspi last. + apt-get download "linux-firmware-raspi:${SNAPCRAFT_TARGET_ARCH}" + dpkg-deb -x linux-firmware-raspi_*.deb tmpdir + mv tmpdir/lib/firmware "${SNAPCRAFT_PART_INSTALL}" + + # 'kernel-snap-uc22' runs 'trim-firmware' as the last step. Skip it here + # to simplify the build step. The resulting kernel snap will contain more + # firmware files than needed for raspberry pi, but it is not a big deal. + + initrd: + after: + - firmware + - kernel + build-packages: + - dracut + - zstd + plugin: nil + override-build: | + apt-get download "ubuntu-core-initramfs:${SNAPCRAFT_TARGET_ARCH}" + dpkg-deb -x ubuntu-core-initramfs_*.deb tmpdir + apt-get download "snapd:${SNAPCRAFT_TARGET_ARCH}" + dpkg-deb -x snapd_*.deb tmpdir + + mkdir tmpdir/lib/modules + + kernelrelease=$(ls "${SNAPCRAFT_STAGE}/modules") + + ln -s "${SNAPCRAFT_STAGE}/modules/${kernelrelease}" "tmpdir/lib/modules/${kernelrelease}" + ln -s "${SNAPCRAFT_STAGE}/firmware" tmpdir/lib/firmware + + # Run usr/bin/ubuntu-core-initramfs inside 'tmpdir'. + # Otherwise, tmpdir would be included in initrd.img. Odd... + ( cd tmpdir; usr/bin/ubuntu-core-initramfs create-initrd \ + --root . --output initrd.img --kernelver "${kernelrelease}" ) + cp "tmpdir/initrd.img-${kernelrelease}" "${SNAPCRAFT_PART_INSTALL}"/initrd.img + + finalize: + after: + - initrd + plugin: nil + override-build: | + # Mimic what 'kernel-snaps-uc22' does + cp /usr/share/common-licenses/GPL-2 "${SNAPCRAFT_PART_INSTALL}" + mkdir "${SNAPCRAFT_PART_INSTALL}/lib" + ln -s ../firmware "${SNAPCRAFT_PART_INSTALL}/lib" + ln -s ../modules "${SNAPCRAFT_PART_INSTALL}/lib" + + mkdir -p "${SNAPCRAFT_PART_INSTALL}/meta" + { + echo "assets:" + echo " dtbs:" + echo " update: true" + echo " content:" + echo " - dtbs/" + } > "${SNAPCRAFT_PART_INSTALL}/meta/kernel.yaml"