123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- # Build recipe for linux-libre (generic).
- #
- # Copyright (c) 2017-2020 Matias Fonzo, <selk@dragora.org>.
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- program=linux
- version=5.4.25
- release=1
- # Set 'outdir' for a nice and well-organized output directory
- outdir="${outdir}/${arch}/kernel"
- pkgname=kernel-generic
- tarname=${program}-libre-${version}-gnu.tar.lz
- # Remote source(s)
- fetch=http://linux-libre.fsfla.org/pub/linux-libre/releases/${version}-gnu/$tarname
- homepage=http://www.gnu.org/software/linux-libre
- description="
- The Linux kernel image and modules.
- This is a generic configuration for the Linux kernel
- which intends to run well in all environments.
- "
- license="GPLv2 only"
- build()
- {
- # Preserve 'srcdir' in order to produce "buildtree-generic", later
- keep_srcdir=keep_srcdir
- set -e
- unpack "${tardir}/$tarname"
- cd "$srcdir"
- # Set sane permissions
- chmod -R u+w,go-w,a+rX-s .
- # Support LZIP
- patch -p1 < "${worktree}/patches/kernel/linux-5.4.18_lzip-0.diff"
- make mrproper
- case $arch in
- x86_64)
- echo "Copying config-x86_64_generic ..."
- cp -p "${worktree}/archive/kernel/config-x86_64_generic" .config
- kernel_arch=x86_64
- ;;
- i?86)
- echo "Copying config-x86_generic ..."
- cp -p "${worktree}/archive/kernel/config-x86_generic" .config
- kernel_arch=i386
- ;;
- armv7a)
- echo "Copying config-armv7a ..."
- cp -p "${worktree}/archive/kernel/config-armv7a" .config
- kernel_arch=arm
- ;;
- *)
- echo "No custom configuration file detected for your architecture." 1>&2
- exit 1;
- ;;
- esac
- # An environment variable for config purposes
- if test ! -z "$PRESERVE"
- then
- echo "PRESERVE has been set."
- exit 99;
- fi
- make -j${jobs} ARCH=$kernel_arch bzImage
- make -j${jobs} ARCH=$kernel_arch modules
- make -j${jobs} ARCH=$kernel_arch \
- INSTALL_MOD_PATH="$destdir" modules_install
- # To extract the kernel string version
- strver="$(ls -d "${destdir}"/lib/modules/*)"
- strver="${strver##*/}"
- # Install kernel images
- mkdir -p "${destdir}/boot"
- cp -p .config "${destdir}/boot/config-generic-${strver}"
- cp -p System.map "${destdir}/boot/System.map-generic-${strver}"
- if test -e "arch/${kernel_arch}/boot/bzImage"
- then
- cp -p "arch/${kernel_arch}/boot/bzImage" \
- "${destdir}/boot/vmlinuz-generic-${strver}"
- elif test -e "arch/${kernel_arch}/boot/zImage"
- then
- cp -p "arch/${kernel_arch}/boot/zImage" \
- "${destdir}/boot/vmlinuz-generic-${strver}"
- else
- echo "${0}: No kernel image found: bzImage or zImage" 1>&2
- exit 1;
- fi
- # Exclude files from the Graft installation,
- # this will be copied via post-intall, since
- # /boot could be a separated partition
- touch "${destdir}/boot/.nograft"
- # Insert post-install script manually
- # This must be recreated on post-installation
- rm -f "${destdir}"/lib/modules/${strver}/build \
- "${destdir}"/lib/modules/${strver}/source
- mkdir -p "${destdir}/var/lib/qi"
- cat << EOF > "${destdir}/var/lib/qi/${full_pkgname}.sh"
- # Kernel string version
- strver=$strver
- # Copy kernel image from 'packagedir' to 'rootdir/boot'
- mkdir -p -- "\${rootdir}/boot"
- cp -pf -- "\$rootdir${packagedir}/${full_pkgname}/boot/System.map-generic-${strver}" \\
- "\${rootdir}/boot/"
- cp -pf -- "\$rootdir${packagedir}/${full_pkgname}/boot/config-generic-${strver}" \\
- "\${rootdir}/boot/"
- cp -pf -- "\$rootdir${packagedir}/${full_pkgname}/boot/vmlinuz-generic-${strver}" \\
- "\${rootdir}/boot/"
- # Make generic symlinks for this kernel version
- srcdir="${srcdir##*/}"
- (
- cd lib/modules/${strver} || exit 1
- rm -f build source
- ln -sf /usr/src/${srcdir} build
- ln -sf /usr/src/${srcdir} source
- )
- # Generate or update the module dependency list
- chroot . /sbin/depmod -a $strver
- EOF
- }
|