-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_modules.sh
33 lines (24 loc) · 1.02 KB
/
build_modules.sh
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
#!/bin/bash
set -xe
EMERGE_FLAGS="--buildpkg --getbinpkg --update --jobs --deep --newuse"
MAKEOPTS="-j$(nproc)"
emerge $EMERGE_FLAGS --usepkg sys-kernel/gentoo-sources
latest_kernel=$(eselect kernel list | tail -n 1 | awk '{print $2}')
eselect kernel set "${latest_kernel}"
cp config.nosquash /usr/src/linux/.config
(cd /usr/src/linux; make olddefconfig prepare scripts)
# Copy ZFS source into kernel tree
env EXTRA_ECONF='--with-spl=/usr/src/linux --enable-linux-builtin --with-spl-obj=/usr/src/linux' ebuild /usr/portage/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild clean configure
(cd /var/tmp/portage/sys-fs/zfs-kmod-9999/work/zfs-kmod-9999/ && ./copy-builtin /usr/src/linux)
cp config.nosquash /usr/src/linux/.config
cd /usr/src/linux
KVER="$(make kernelversion)"
make olddefconfig
make kvmconfig
make $MAKEOPTS modules
make modules_install
depmod -av "${KVER}"
# Build a kernel release too (no initramfs)
make $MAKEOPTS tarxz-pkg
cp arch/x86/boot/bzImage /root/vmlinuz.nosquash
cp linux-"${KVER}"-x86.tar.xz /root/linux-image.tar.xz