1 # Build recipe for linux-libre (generic).
3 # Copyright (c) 2017 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
21 pkgname=kernel-generic
23 tarname=${program}-libre-${version}-gnu.tar.lz
26 fetch=http://linux-libre.fsfla.org/pub/linux-libre/releases/${version}-gnu/$tarname
28 homepage=http://www.gnu.org/software/linux-libre
31 The Linux kernel image and modules.
33 This is a generic configuration for the Linux kernel
34 which intends to run well in all environments.
43 unpack "${tardir}/$tarname"
49 patch -p1 < "${worktree}/patches/kernel/linux-4.14.7_lzip-1.diff"
53 cp -R -p "${worktree}/patches/kernel/aufs/Documentation" \
54 "${worktree}/patches/kernel/aufs/fs" \
56 mkdir -p include/uapi/linux
57 cp -p "${worktree}/patches/kernel/aufs/include/uapi/linux/aufs_type.h" \
60 # http://github.com/sfjro/aufs4-standalone/tree/aufs4.9
61 patch -p1 < "${worktree}/patches/kernel/aufs/aufs4-kbuild.patch"
62 patch -p1 < "${worktree}/patches/kernel/aufs/aufs4-base.patch"
63 patch -p1 < "${worktree}/patches/kernel/aufs/aufs4-mmap.patch"
64 patch -p1 < "${worktree}/patches/kernel/aufs/aufs4-standalone.patch"
70 cp -p "${worktree}/archive/kernel/config-x86_64_generic" .config
74 cp -p "${worktree}/archive/kernel/config-x86_generic" .config
78 echo "No custom configuration file detected for your architecture." 1>&2
83 make -j${jobs} bzImage
86 mkdir -p "${destdir}/lib/firmware"
87 make INSTALL_FW_PATH="${destdir}/lib/firmware"
90 make -j${jobs} modules
91 make INSTALL_MOD_PATH="$destdir" modules_install
93 # Extract any additional kernel string
94 strver="$(ls -d "${destdir}"/lib/modules/*)"
95 strver="${strver##*/}"
98 mkdir -p "${destdir}/boot"
99 cp -p .config "${destdir}/boot/config"
100 cp -p System.map "${destdir}/boot/System.map"
101 cp -p "arch/${kernel_arch}/boot/bzImage" "${destdir}/boot/vmlinuz"
103 # Insert post-install script manually
105 rm -f "${destdir}"/lib/modules/${strver}/build \
106 "${destdir}"/lib/modules/${strver}/source
108 mkdir -p "${destdir}/var/lib/qi"
109 cat << EOF > "${destdir}/var/lib/qi/${full_pkgname}.sh"
114 # Make generic symlinks for this kernel version (if needed)
116 srcdir="${srcdir##*/}"
119 cd lib/modules/${strver} || exit 1
121 ln -s /usr/src/${srcdir} build
122 ln -s /usr/src/${srcdir} source
127 # Tell Qi to preserve 'srcdir' in order to produce "buildtree-generic"
128 keep_srcdir=keep_srcdir