the kernel has been upgraded to the version 4.14.7
[dragora.git] / recipes / kernel / generic / recipe
blob3912205b5b641515b3b590839f86c32112fd39f8
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.
17 program=linux
18 version=4.14.7
19 release=1
21 pkgname=kernel-generic
23 tarname=${program}-libre-${version}-gnu.tar.lz
25 # Remote source(s)
26 fetch=http://linux-libre.fsfla.org/pub/linux-libre/releases/${version}-gnu/$tarname
28 homepage=http://www.gnu.org/software/linux-libre
30 description="
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.
37 license="GPLv2 only"
39 build()
41     set -e
43     unpack "${tardir}/$tarname"
45     cd "$srcdir"
47     # Support LZIP
49     patch -p1 < "${worktree}/patches/kernel/linux-4.14.7_lzip-1.diff"
51     # Support AUFS
53     cp -R -p "${worktree}/patches/kernel/aufs/Documentation"  \
54              "${worktree}/patches/kernel/aufs/fs"             \
55              .
56     mkdir -p include/uapi/linux
57     cp -p "${worktree}/patches/kernel/aufs/include/uapi/linux/aufs_type.h" \
58           include/uapi/linux/
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"
66     make mrproper
68     case $arch in
69     x86_64)
70         cp -p "${worktree}/archive/kernel/config-x86_64_generic" .config
71         kernel_arch=x86_64
72         ;;
73     i?86)
74         cp -p "${worktree}/archive/kernel/config-x86_generic" .config
75         kernel_arch=x86
76         ;;
77     *)
78         echo "No custom configuration file detected for your architecture." 1>&2
79         exit 1;
80         ;;
81     esac
83     make -j${jobs} bzImage
85     # Firmware
86     mkdir -p "${destdir}/lib/firmware"
87     make INSTALL_FW_PATH="${destdir}/lib/firmware"
89     # Modules
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##*/}"
97     # Image
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"
111 # Kernel version
112 strver=$strver
114 # Make generic symlinks for this kernel version (if needed)
116 srcdir="${srcdir##*/}"
119     cd lib/modules/${strver} || exit 1
120     rm -f build source
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