blob: e20e179607d67e88325e9f8f8887fc428c807010 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#!/bin/sh -e
# POSIX install functions, similar to 'install -Dm'
# and 'install -Dm* -t'
kinstall() {
# usage: kinstall 644 file /usr/bin/prog
mkdir -p "${3%/*}"; rmdir "$3" 2>/dev/null ||:
cp "$2" "$3"
[ -d "$3" ] && set -- "$1" "$3/${2##*/}"
chmod "$1" "${3:-$2}"
}
kinstall_t() {
# usage: kinstall_t 644 /usr/bin prog1 prog2
mod=$1 dir=$2; mkdir -p "$dir"
shift 2
for file; do
cp "$file" "$dir"
chmod "$mod" "$dir/${file##*/}"
done
}
# Use an out function similar to KISS' log.
out() { printf '\033[1;33m-> \033[1;36mlinux \033[m%s\n' "$@" >&2 ;}
ROOT=$PWD
ver=$(make -C linux -s kernelversion)
# Prepare the kernel sources first.
(
out "Preparing the kernel"
cd linux
patch -p1 < kernel-no-perl.patch
cp .config oldconfig
./scripts/config -e modules
make olddefconfig
make prepare
)
(
out "Preparing zfs modules"
cd zfs
sed -i 's|CDDL|GPL|g' META
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--sbindir=/usr/bin \
--disable-systemd \
--disable-sysvinit \
--disable-nls \
--enable-linux-builtin \
--with-linux="$ROOT/linux"
sed -i "/^KERNEL_DIR/s|^.*|KERNEL_DIR=$ROOT/linux|" copy-builtin
./copy-builtin "$ROOT/linux"
)
(
cd linux
# Enable zfs
./scripts/config -e zfs -d modules
out "Compiling the kernel"
make
out "Installing the kernel"
install -Dm644 "$(make -s image_name)" "$1/boot/vmlinuz-$ver"
install -Dm644 System.map "$1/boot/System.map-$ver"
install -Dm644 oldconfig "$1/boot/Config-$ver"
)
|