Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) #!/bin/sh
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) # SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5) # buildtar 0.0.5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) # (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) # This script is used to compile a tarball from the currently
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) # prepared kernel. Based upon the builddeb script from
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) # Wichert Akkerman <wichert@wiggy.net>.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) set -e
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) # Some variables and settings used throughout the script
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) tmpdir="${objtree}/tar-install"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) # Figure out how to compress, if requested at all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) case "${1}" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 	dir-pkg|tar-pkg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 		opts=
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 	targz-pkg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 		opts="-I ${KGZIP}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 		tarball=${tarball}.gz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	tarbz2-pkg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 		opts="-I ${KBZIP2}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 		tarball=${tarball}.bz2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	tarxz-pkg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 		opts="-I ${XZ}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		tarball=${tarball}.xz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 		exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) # Clean-up and re-create the temporary directory
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) rm -rf -- "${tmpdir}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) mkdir -p -- "${tmpdir}/boot"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) dirs=boot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) # Try to install dtbs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) if grep -q '^CONFIG_OF_EARLY_FLATTREE=y' include/config/auto.conf; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	# Only some architectures with OF support have this target
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	if [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 		$MAKE ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_DTBS_PATH="${tmpdir}/boot/dtbs/${KERNELRELEASE}" dtbs_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)     fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) # Try to install modules
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) if grep -q '^CONFIG_MODULES=y' include/config/auto.conf; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	make ARCH="${ARCH}" -f ${srctree}/Makefile INSTALL_MOD_PATH="${tmpdir}" modules_install
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	dirs="$dirs lib"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) # Install basic kernel files
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) cp -v -- "${KCONFIG_CONFIG}" "${tmpdir}/boot/config-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) # Install arch-specific kernel image(s)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) case "${ARCH}" in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 	x86|i386|x86_64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 		[ -f "${objtree}/arch/x86/boot/bzImage" ] && cp -v -- "${objtree}/arch/x86/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	alpha)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		[ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	parisc*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		[ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		[ -f "${objtree}/lifimage" ] && cp -v -- "${objtree}/lifimage" "${tmpdir}/boot/lifimage-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	mips)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		if [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.bin" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 			cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.bin" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 			cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.ecoff" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		elif [ -f "${objtree}/arch/mips/boot/compressed/vmlinux.srec" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 			cp -v -- "${objtree}/arch/mips/boot/compressed/vmlinux.srec" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		elif [ -f "${objtree}/vmlinux.32" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			cp -v -- "${objtree}/vmlinux.32" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		elif [ -f "${objtree}/vmlinux.64" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 			cp -v -- "${objtree}/vmlinux.64" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		elif [ -f "${objtree}/arch/mips/boot/vmlinux.bin" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 			cp -v -- "${objtree}/arch/mips/boot/vmlinux.bin" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		elif [ -f "${objtree}/arch/mips/boot/vmlinux.ecoff" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 			cp -v -- "${objtree}/arch/mips/boot/vmlinux.ecoff" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		elif [ -f "${objtree}/arch/mips/boot/vmlinux.srec" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			cp -v -- "${objtree}/arch/mips/boot/vmlinux.srec" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		elif [ -f "${objtree}/vmlinux" ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 			cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 		fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	arm64)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		for i in Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo ; do
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			if [ -f "${objtree}/arch/arm64/boot/${i}" ] ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 				cp -v -- "${objtree}/arch/arm64/boot/${i}" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 				break
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 			fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		done
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	*)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		[ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		echo "" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		echo '** ** **  WARNING  ** ** **' >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		echo "" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		echo "Your architecture did not define any architecture-dependent files" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		echo "to be placed into the tarball. Please add those to ${0} ..." >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		echo "" >&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 		sleep 5
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		;;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) esac
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) if [ "${1}" = dir-pkg ]; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	echo "Kernel tree successfully created in $tmpdir"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	exit 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) # Create the tarball
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) if tar --owner=root --group=root --help >/dev/null 2>&1; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	opts="$opts --owner=root --group=root"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) tar cf $tarball -C $tmpdir $opts $dirs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) echo "Tarball successfully created in $tarball"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) exit 0