scripts/package/mkdebian

Source file repositories/reference/linux-study-clean/scripts/package/mkdebian

File Facts

System
Linux kernel
Corpus path
scripts/package/mkdebian
Extension
[no extension]
Size
6774 bytes
Lines
274
Domain
Support Tooling And Documentation
Bucket
scripts
Inferred role
Support Tooling And Documentation: scripts
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/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)

Annotation

Implementation Notes