recipes: kernel/generic: fix url reference for the aufs patches
[dragora.git] / recipes / kernel / generic / recipe
blobfc9e9f757051b66ca677883ed04426e7064eb5e3
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.8
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.14
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
84     make -j${jobs} modules
85     make INSTALL_MOD_PATH="$destdir" modules_install
87     # Install kernel images
88     mkdir -p "${destdir}/boot"
89     cp -p .config "${destdir}/boot/config"
90     cp -p System.map "${destdir}/boot/System.map"
91     cp -p "arch/${kernel_arch}/boot/bzImage" "${destdir}/boot/vmlinuz"
93     # Insert post-install script manually
95     # This will be recreated on the post-install,
96     # we need to extract the kernel string for it
97     rm -f "${destdir}"/lib/modules/${strver}/build \
98           "${destdir}"/lib/modules/${strver}/source
100     strver="$(ls -d "${destdir}"/lib/modules/*)"
101     strver="${strver##*/}"
103     mkdir -p "${destdir}/var/lib/qi"
104     cat << EOF > "${destdir}/var/lib/qi/${full_pkgname}.sh"
106 # Kernel version
107 strver=$strver
109 # Make generic symlinks for this kernel version (if needed)
111 srcdir="${srcdir##*/}"
114     cd lib/modules/${strver} || exit 1
115     rm -f build source
116     ln -s /usr/src/${srcdir} build
117     ln -s /usr/src/${srcdir} source
122     # Tell Qi to preserve 'srcdir' in order to produce "buildtree-generic"
123     keep_srcdir=keep_srcdir