2019-07-07 14:50:17 +02:00
|
|
|
VERSION="4.19.57"
|
2017-12-09 21:51:48 +01:00
|
|
|
SRCDIR="linux-$VERSION"
|
|
|
|
TARBALL="linux-$VERSION.tar.xz"
|
2019-07-07 14:50:17 +02:00
|
|
|
URL="https://www.kernel.org/pub/linux/kernel/v4.x"
|
|
|
|
SHA256SUM="327c5759d5888361d6c9d6adb0c8ad7e3c624eb05bb9e5869d9f3078dd0d3f87"
|
2018-01-24 12:52:41 +01:00
|
|
|
DEPENDS="initrd"
|
2019-03-31 15:13:18 +02:00
|
|
|
SUBPKG="linux linux-modules"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2018-10-19 19:04:00 +02:00
|
|
|
get_linux_cpu() {
|
|
|
|
case "$TARGET" in
|
|
|
|
i*86-*)
|
|
|
|
echo "x86"
|
|
|
|
;;
|
|
|
|
x86_64-*)
|
|
|
|
echo "x86_64"
|
|
|
|
;;
|
|
|
|
arm-*)
|
|
|
|
echo "arm"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "don't know how to map $TARGET to Linux arch" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2017-12-09 21:51:48 +01:00
|
|
|
prepare() {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
build() {
|
2019-03-06 10:03:12 +01:00
|
|
|
local INITRDDIR="$PKGDEPLOYDIR/initrd"
|
2019-02-04 18:32:29 +01:00
|
|
|
local INITRDLIST="$INITRDDIR/initrd.list"
|
2018-10-19 19:04:00 +02:00
|
|
|
local LINUX_CPU=$(get_linux_cpu)
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2019-06-10 15:16:41 +02:00
|
|
|
pkg install -omLD -r "$INITRDDIR" initrd
|
|
|
|
pkg install -r "$INITRDDIR" -l initrd initrd > "$INITRDLIST"
|
2019-02-04 18:32:29 +01:00
|
|
|
|
2018-02-16 23:22:04 +01:00
|
|
|
export KBUILD_OUTPUT="$PKGBUILDDIR"
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2018-02-16 23:22:04 +01:00
|
|
|
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" mrproper
|
2018-02-20 21:30:34 +01:00
|
|
|
cat_file_override "linux.config" > "$PKGBUILDDIR/.config"
|
2018-02-16 23:22:04 +01:00
|
|
|
sed -i "$PKGBUILDDIR/.config" -e 's,^CONFIG_CROSS_COMPILE=.*,CONFIG_CROSS_COMPILE="'$TARGET'-",'
|
|
|
|
sed -i "$PKGBUILDDIR/.config" -e 's,^CONFIG_INITRAMFS_SOURCE=.*,CONFIG_INITRAMFS_SOURCE="'$INITRDLIST'",'
|
|
|
|
sed -i "$PKGBUILDDIR/.config" -e 's,^CONFIG_LOCALVERSION=.*,CONFIG_LOCALVERSION="-'${OS_NAME}-${OS_RELEASE}'",'
|
2018-09-28 17:09:57 +02:00
|
|
|
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" oldconfig
|
2018-02-16 23:22:04 +01:00
|
|
|
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" -j $NUMJOBS $LINUX_TGT
|
2019-02-04 18:32:29 +01:00
|
|
|
|
|
|
|
rm -rf "$INITRDDIR"
|
2017-12-09 21:51:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
deploy() {
|
|
|
|
local SOURCE="$1"
|
2018-10-19 19:04:00 +02:00
|
|
|
local LINUX_CPU=$(get_linux_cpu)
|
2018-10-19 20:42:09 +02:00
|
|
|
local target
|
2017-12-09 21:51:48 +01:00
|
|
|
|
2019-03-06 10:03:12 +01:00
|
|
|
mkdir -p "$PKGDEPLOYDIR/boot" "$PKGDEPLOYDIR/lib/modules"
|
2019-03-31 15:13:18 +02:00
|
|
|
touch "$PKGDEPLOYDIR/linux.desc" "$PKGDEPLOYDIR/linux.files"
|
|
|
|
touch "$PKGDEPLOYDIR/linux-modules.desc"
|
|
|
|
touch "$PKGDEPLOYDIR/linux-modules.files"
|
2018-07-15 17:17:01 +02:00
|
|
|
|
2018-10-19 20:42:09 +02:00
|
|
|
for target in $LINUX_TGT; do
|
|
|
|
case $target in
|
|
|
|
*Image)
|
2019-03-31 15:13:18 +02:00
|
|
|
cp "arch/$LINUX_CPU/boot/$target" "$PKGDEPLOYDIR/vmlinuz"
|
|
|
|
echo "file vmlinuz 0755 0 0" > "$PKGDEPLOYDIR/linux.files"
|
2018-10-19 20:42:09 +02:00
|
|
|
;;
|
|
|
|
modules)
|
|
|
|
export KBUILD_OUTPUT="$PKGBUILDDIR"
|
2019-03-06 10:03:12 +01:00
|
|
|
make -C "$SOURCE" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" INSTALL_MOD_PATH="$PKGDEPLOYDIR" modules_install
|
2018-09-28 17:09:57 +02:00
|
|
|
|
2019-03-31 15:13:18 +02:00
|
|
|
echo "dir lib 0755 0 0" > "$PKGDEPLOYDIR/linux-modules.files"
|
2019-02-27 14:22:03 +01:00
|
|
|
|
2019-03-31 15:13:18 +02:00
|
|
|
pkg_scan_dir "$PKGDEPLOYDIR/lib" | \
|
|
|
|
sed "s#$PKGDEPLOYDIR/##g" \
|
|
|
|
>> "$PKGDEPLOYDIR/linux-modules.files"
|
2018-10-19 20:42:09 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2017-12-09 21:51:48 +01:00
|
|
|
}
|
2018-05-06 17:23:31 +02:00
|
|
|
|
|
|
|
check_update() {
|
2018-05-14 18:31:24 +02:00
|
|
|
curl --silent -L https://www.kernel.org/feeds/kdist.xml | \
|
|
|
|
grep -o "[0-9.]*: longterm" | grep -o "[0-9.]*" | \
|
|
|
|
verson_find_greatest "$VERSION"
|
2018-07-15 16:19:44 +02:00
|
|
|
}
|