comparison kernel/linux/linux.sh @ 1148:d7b018839eaa

kernel/linux: initial import, closes #1177
author David Demelier <markand@malikania.fr>
date Wed, 25 Sep 2019 21:05:00 +0200
parents
children 6710613b88b9
comparison
equal deleted inserted replaced
1147:ef803d8555ec 1148:d7b018839eaa
1 #!/bin/sh
2 #
3 # Copyright (c) 2019 David Demelier <markand@malikania.fr>
4 #
5 # Permission to use, copy, modify, and/or distribute this software for any
6 # purpose with or without fee is hereby granted, provided that the above
7 # copyright notice and this permission notice appear in all copies.
8 #
9 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 #
17
18 #
19 # User notes
20 # ----------
21 #
22 # The Linux kernel is built without modifications as if `make defconfig` was
23 # used.
24 #
25 # You can provide your own kernel configuration with the CONFIG option which
26 # should point to your custom file.
27 #
28
29 PKGNAME=linux
30 PKGVERSION=5.3.1
31 PKGREVISION=1
32 PKGLICENSE="GPLv20"
33 PKGSUMMARY="the Linux kernel"
34 PKGDOWNLOAD="https://cdn.kernel.org/pub/linux/kernel/v5.x/$PKGNAME-$PKGVERSION.tar.xz"
35 PKGDEPENDS="bison:build elfutils:build flex:build gcc:build"
36 PKGOPTIONS="CONFIG"
37
38 : ${CHOST:=$(uname -m)-linux-musl}
39 : ${CBUILD:=$(uname -m)-linux-musl}
40 : ${CC:=gcc}
41 : ${CFLAGS:=-O2}
42 : ${LDFLAGS:=}
43 : ${LIBS:=}
44 : ${CONFIG:=} # Note: path to kernel config file.
45
46 build()
47 {
48 rm -rf $PKGNAME-$PKGVERSION
49 tar xvf $PKGNAME-$PKGVERSION.tar.xz
50 cd $PKGNAME-$PKGVERSION
51
52 if [ -n "$CONFIG" ]; then
53 cp $CONFIG .config
54 else
55 # TODO: add architecture support.
56 cp ../config-amd64 .config
57 fi
58
59 mkdir -p $DESTDIR/boot
60 mkdir -p $DESTDIR/lib
61 make \
62 CC="$CC" \
63 HOSTCC="$CC" \
64 CFLAGS="$CFLAGS" \
65 INSTALL_PATH=$DESTDIR/boot \
66 INSTALL_MOD_PATH=$DESTDIR \
67 all install modules_install
68
69 cd ..
70 rm -rf $PKGNAME-$PKGVERSION
71 }