1
0
Fork 0
mirror of https://github.com/pygos/build.git synced 2024-11-22 11:09:46 +01:00
build/pkg/linux/build
David Oberhollenzer 82a00e5a1b Bump mainline LTS linux version
Signed-off-by: David Oberhollenzer <david.oberhollenzer@tele2.at>
2018-11-03 19:28:43 +01:00

79 lines
2.1 KiB
Text
Executable file

MAJOR="4"
MINOR="14"
RELEASE="78"
VERSION="$MAJOR.$MINOR.$RELEASE"
SRCDIR="linux-$VERSION"
TARBALL="linux-$VERSION.tar.xz"
URL="https://www.kernel.org/pub/linux/kernel/v$MAJOR.x"
SHA256SUM="f4da4dc0f079e420e1c1b8c71312eaa5415b08be847aa224a61d8af6a6e74c6c"
DEPENDS="initrd"
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
}
prepare() {
return
}
build() {
local INITRDLIST="$PKGDEPLOYDIR/initrd/initrd.list"
local LINUX_CPU=$(get_linux_cpu)
export KBUILD_OUTPUT="$PKGBUILDDIR"
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" mrproper
cat_file_override "linux.config" > "$PKGBUILDDIR/.config"
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}'",'
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" oldconfig
make -C "$1" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" -j $NUMJOBS $LINUX_TGT
}
deploy() {
local SOURCE="$1"
local DEPLOY="$2"
local LINUX_CPU=$(get_linux_cpu)
local target
mkdir -p "$DEPLOY/boot" "$DEPLOY/lib/modules"
for target in $LINUX_TGT; do
case $target in
*Image)
cp "arch/$LINUX_CPU/boot/$target" "$DEPLOY/boot/vmlinuz"
echo "boot/vmlinuz m 555 0 0" > "$DEPLOY/rootfs_files.txt"
;;
modules)
export KBUILD_OUTPUT="$PKGBUILDDIR"
make -C "$SOURCE" O="$PKGBUILDDIR" ARCH="$LINUX_CPU" CROSS_COMPILE="${TARGET}-" INSTALL_MOD_PATH="$DEPLOY" modules_install
find "$DEPLOY/lib" -exec stat {} --printf="%n m %a 0 0\\n" \; | \
sed "s#^$DEPLOY/##g" | sed "s/644/444/g" | \
sed "s/755/555/g" >> "$DEPLOY/rootfs_files.txt"
;;
esac
done
}
check_update() {
curl --silent -L https://www.kernel.org/feeds/kdist.xml | \
grep -o "[0-9.]*: longterm" | grep -o "[0-9.]*" | \
verson_find_greatest "$VERSION"
}