summaryrefslogtreecommitdiffstats
path: root/scripts/package/mkdebian
diff options
context:
space:
mode:
authorNiklas Cassel <cassel@kernel.org>2026-09-16 15:00:32 +0200
committerNiklas Cassel <cassel@kernel.org>2026-09-16 16:18:00 +0200
commit8d836581f9b1f57ceaa2b47654754ef1260b410b (patch)
tree1dbd4d0dfb99c2e238356cbe947e5b0be3e3a571 /scripts/package/mkdebian
downloadlinux-stable-8d836581f9b1f57ceaa2b47654754ef1260b410b.tar.gz
linux-stable-8d836581f9b1f57ceaa2b47654754ef1260b410b.zip
ata: libata-scsi: fix ata_dsm_trim_pages() kernel-docgrafted
make htmldocs fails with: Documentation/driver-api/libata:604: ./drivers/ata/libata-scsi.c:2301: ERROR: Unexpected indentation. [docutils] The Return: section of ata_dsm_trim_pages() ends its first sentence with a colon and continues with an indented bullet list. reStructuredText requires a blank line before an indented block, so docutils chokes on the list. Simply adding the missing blank line does not work either: Return: is a kernel-doc "special section", which is terminated by the first blank line, so the bullet list would end up in the Description section, detached from the sentence introducing it. Spell the two bounds out as prose instead, so that the Return: section stays self-contained. Documentation-only change. Fixes: e64e6b5dc867 ("ata: libata-scsi: scale DSM TRIM payload by MAX PAGES PER DSM COMMAND") Reported-by: Thomas Huth <thuth@redhat.com> Closes: https://lore.kernel.org/linux-ide/b0a0b8e8-cc4f-4c7b-8bc5-fee0712d405a@redhat.com/ Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Thomas Huth <thuth@redhat.com> Link: https://lore.kernel.org/r/20260916130031.29990-2-cassel@kernel.org Signed-off-by: Niklas Cassel <cassel@kernel.org>
Diffstat (limited to 'scripts/package/mkdebian')
-rwxr-xr-xscripts/package/mkdebian273
1 files changed, 273 insertions, 0 deletions
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
new file mode 100755
index 000000000..d4b007b38
--- /dev/null
+++ b/scripts/package/mkdebian
@@ -0,0 +1,273 @@
+#!/bin/sh
+#
+# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
+#
+# Simple script to generate a debian/ directory for a Linux kernel.
+
+set -eu
+
+is_enabled() {
+ grep -q "^$1=y" include/config/auto.conf
+}
+
+if_enabled_echo() {
+ if is_enabled "$1"; then
+ echo -n "$2"
+ elif [ $# -ge 3 ]; then
+ echo -n "$3"
+ fi
+}
+
+set_debarch() {
+ if [ "${KBUILD_DEBARCH:+set}" ]; then
+ debarch="$KBUILD_DEBARCH"
+ return
+ fi
+
+ # Attempt to find the correct Debian architecture
+ case "$UTS_MACHINE" in
+ i386|alpha|m68k|riscv*)
+ debarch="$UTS_MACHINE" ;;
+ x86_64)
+ debarch=amd64 ;;
+ sparc*)
+ debarch=sparc$(if_enabled_echo CONFIG_64BIT 64) ;;
+ s390*)
+ debarch=s390x ;;
+ ppc*)
+ if is_enabled CONFIG_64BIT; then
+ debarch=ppc64$(if_enabled_echo CONFIG_CPU_LITTLE_ENDIAN el)
+ else
+ debarch=powerpc$(if_enabled_echo CONFIG_SPE spe)
+ fi
+ ;;
+ parisc*)
+ debarch=hppa ;;
+ mips*)
+ if is_enabled CONFIG_CPU_LITTLE_ENDIAN; then
+ debarch=mips$(if_enabled_echo CONFIG_64BIT 64)$(if_enabled_echo CONFIG_CPU_MIPSR6 r6)el
+ elif is_enabled CONFIG_CPU_MIPSR6; then
+ debarch=mips$(if_enabled_echo CONFIG_64BIT 64)r6
+ else
+ debarch=mips
+ fi
+ ;;
+ aarch64|arm64)
+ debarch=arm64 ;;
+ arm*)
+ if is_enabled CONFIG_AEABI; then
+ debarch=arm$(if_enabled_echo CONFIG_VFP hf el)
+ else
+ debarch=arm
+ fi
+ ;;
+ openrisc)
+ debarch=or1k ;;
+ sh)
+ if is_enabled CONFIG_CPU_SH3; then
+ debarch=sh3$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
+ elif is_enabled CONFIG_CPU_SH4; then
+ debarch=sh4$(if_enabled_echo CONFIG_CPU_BIG_ENDIAN eb)
+ fi
+ ;;
+ um)
+ if is_enabled CONFIG_64BIT; then
+ debarch=amd64
+ else
+ debarch=i386
+ fi
+ ;;
+ loongarch64)
+ debarch=loong64 ;;
+ esac
+ if [ -z "$debarch" ]; then
+ debarch=$(dpkg-architecture -qDEB_HOST_ARCH)
+ echo "" >&2
+ echo "** ** ** WARNING ** ** **" >&2
+ echo "" >&2
+ echo "Your architecture doesn't have its equivalent" >&2
+ echo "Debian userspace architecture defined!" >&2
+ echo "Falling back to the current host architecture ($debarch)." >&2
+ echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
+ echo "" >&2
+ fi
+}
+
+# Create debian/source/ if it is a source package build
+gen_source ()
+{
+ mkdir -p debian/source
+
+ echo "3.0 (quilt)" > debian/source/format
+
+ {
+ echo "diff-ignore"
+ echo "extend-diff-ignore = .*"
+ } > debian/source/local-options
+
+ # Add .config as a patch
+ mkdir -p debian/patches
+ {
+ echo "Subject: Add .config"
+ echo "Author: ${maintainer}"
+ echo
+ echo "--- /dev/null"
+ echo "+++ linux/.config"
+ diff -u /dev/null "${KCONFIG_CONFIG}" | tail -n +3
+ } > debian/patches/config.patch
+ echo config.patch > debian/patches/series
+
+ "${srctree}/scripts/package/gen-diff-patch" debian/patches/diff.patch
+ if [ -s debian/patches/diff.patch ]; then
+ sed -i "
+ 1iSubject: Add local diff
+ 1iAuthor: ${maintainer}
+ 1i
+ " debian/patches/diff.patch
+
+ echo diff.patch >> debian/patches/series
+ else
+ rm -f debian/patches/diff.patch
+ fi
+}
+
+rm -rf debian
+mkdir debian
+
+user=${KBUILD_BUILD_USER:-$(id -nu)}
+name=${DEBFULLNAME:-${user}}
+if [ "${DEBEMAIL:+set}" ]; then
+ email=${DEBEMAIL}
+else
+ buildhost=${KBUILD_BUILD_HOST:-$(hostname -f 2>/dev/null || hostname)}
+ email="${user}@${buildhost}"
+fi
+maintainer="${name} <${email}>"
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --need-source)
+ gen_source
+ shift
+ ;;
+ *)
+ break
+ ;;
+ esac
+done
+
+# Some variables and settings used throughout the script
+if [ "${KDEB_PKGVERSION:+set}" ]; then
+ packageversion=$KDEB_PKGVERSION
+else
+ upstream_version=$("${srctree}/scripts/setlocalversion" --no-local "${srctree}" | sed 's/-\(rc[1-9]\)/~\1/')
+ debian_revision=$("${srctree}/scripts/build-version")
+ packageversion=${upstream_version}-${debian_revision}
+fi
+sourcename=${KDEB_SOURCENAME:-linux-upstream}
+
+if [ "$ARCH" = "um" ] ; then
+ packagename=user-mode-linux
+else
+ packagename=linux-image
+fi
+
+debarch=
+set_debarch
+
+# Try to determine distribution
+if [ "${KDEB_CHANGELOG_DIST:+set}" ]; then
+ distribution=$KDEB_CHANGELOG_DIST
+# In some cases lsb_release returns the codename as n/a, which breaks dpkg-parsechangelog
+elif distribution=$(lsb_release -cs 2>/dev/null) && [ -n "$distribution" ] && [ "$distribution" != "n/a" ]; then
+ : # nothing to do in this case
+else
+ distribution="unstable"
+ echo >&2 "Using default distribution of 'unstable' in the changelog"
+ echo >&2 "Install lsb-release or set \$KDEB_CHANGELOG_DIST explicitly"
+fi
+
+echo $debarch > debian/arch
+
+host_gnu=$(dpkg-architecture -a "${debarch}" -q DEB_HOST_GNU_TYPE | sed 's/_/-/g')
+
+# Generate a simple changelog template
+cat <<EOF > debian/changelog
+$sourcename ($packageversion) $distribution; urgency=low
+
+ * Custom built Linux kernel.
+
+ -- $maintainer $(date -R)
+EOF
+
+# Generate a control file
+cat <<EOF > debian/control
+Source: $sourcename
+Section: kernel
+Priority: optional
+Maintainer: $maintainer
+Rules-Requires-Root: no
+Build-Depends: debhelper-compat (= 12)
+Build-Depends-Arch: bc, bison, flex,
+ gcc-${host_gnu} <!pkg.${sourcename}.nokernelheaders>,
+ kmod, libdw-dev:native, libelf-dev:native,
+ libssl-dev:native, libssl-dev <!pkg.${sourcename}.nokernelheaders>,
+ python3:native, rsync
+Homepage: https://www.kernel.org/
+
+Package: $packagename-${KERNELRELEASE}
+Architecture: $debarch
+Description: Linux kernel, version ${KERNELRELEASE}
+ This package contains the Linux kernel, modules and corresponding other
+ files, version: ${KERNELRELEASE}.
+EOF
+
+if [ "${SRCARCH}" != um ]; then
+cat <<EOF >> debian/control
+
+Package: linux-libc-dev
+Section: devel
+Provides: linux-kernel-headers
+Architecture: $debarch
+Description: Linux support headers for userspace development
+ This package provides userspaces headers from the Linux kernel. These headers
+ are used by the installed headers for GNU glibc and other system libraries.
+Multi-Arch: same
+EOF
+
+if is_enabled CONFIG_MODULES; then
+cat <<EOF >> debian/control
+
+Package: linux-headers-${KERNELRELEASE}
+Architecture: $debarch
+Build-Profiles: <!pkg.${sourcename}.nokernelheaders>
+Description: Linux kernel headers for ${KERNELRELEASE} on $debarch
+ This package provides kernel header files for ${KERNELRELEASE} on $debarch
+ .
+ This is useful for people who need to build external modules
+EOF
+fi
+fi
+
+if is_enabled CONFIG_DEBUG_INFO; then
+cat <<EOF >> debian/control
+
+Package: linux-image-${KERNELRELEASE}-dbg
+Section: debug
+Architecture: $debarch
+Build-Profiles: <!pkg.${sourcename}.nokerneldbg>
+Description: Linux kernel debugging symbols for ${KERNELRELEASE}
+ This package will come in handy if you need to debug the kernel. It provides
+ all the necessary debug symbols for the kernel and its modules.
+EOF
+fi
+
+cat <<EOF > debian/rules.vars
+ARCH := ${ARCH}
+KERNELRELEASE := ${KERNELRELEASE}
+EOF
+
+cp "${srctree}/scripts/package/debian/copyright" debian/
+cp "${srctree}/scripts/package/debian/rules" debian/
+
+exit 0