#!/bin/sh -e

patch -p1 < kernel-no-perl.patch

cp .config oldconfig
make olddefconfig

# Store the build version in a file and a variable.
read -r ver <<EOF
$(make -s kernelrelease)
EOF

make
install -Dm644 "$(make -s image_name)" "$1/boot/vmlinuz-$ver"
install -Dm644 System.map              "$1/boot/System.map-$ver"
install -Dm644 .config                 "$1/boot/Config-$ver"